:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(data-warehouse): add 1 missing table to the Coassemble source (#120850)
Tom Owersb19d32fbee18
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.mdindex 470173276c7a..a80e3be9c6ec 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md@@ -2876,7 +2876,7 @@ Diffed against: <https://developers.coassemble.com/api/tracking>- [x] `/screen/trackings` — Per-screen progress, the finest analytical grain; the only way to see where inside a course learners drop off (high)- [x] `/user/trackings` — Progress rows keyed by learner across all courses, the natural per-user completion table (medium)- [x] `/usage/clients (and /usage/client/{identifier})` — Per-client consumption (identified/anonymous recipients, narration tokens, image generations) - joins to the clients table already synced (medium)-- [ ] `/usage/allowances` — Workspace billing-period limits and current usage, giving usage rows a denominator (low)+- [x] `/usage/allowances` — Workspace billing-period limits and current usage, giving usage rows a denominator (low)Note: Headless API (https://api.coassemble.com/api/v1/headless). Docs sections are Courses, Generate, Collections, Identities, Tracking, Themes, Translations, Usage, Webhooks. The synced course_trackings maps to GET /trackings; its three sibling grains (collection, screen and user trackings) are synced alongside it. Themes/Translations are content config and excluded.diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/coassemble/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/coassemble/canonical_descriptions.pyindex ba9a7278cfe9..8056753c8c44 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/coassemble/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/coassemble/canonical_descriptions.py@@ -173,4 +173,20 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"periodEnd": "When the billing period ends (ISO 8601).",},},+ "workspace_allowances": {+ "description": "The workspace's allowance and usage total for the current billing period, one row per usage metric (identified recipients, anonymous recipients, narration, image generations).",+ "docs_url": "https://developers.coassemble.com/api/usage",+ "columns": {+ "metric": "The usage metric the allowance applies to, such as `ir` (identified recipients) or `ar` (anonymous recipients).",+ "unit": "The unit the metric is counted in.",+ "limit": "The cap for the metric in the billing period.",+ "setting": "Where the limit comes from, such as the plan default.",+ "currentUsage": "How much of the metric the workspace has consumed in the period.",+ "periodStart": "When the billing period started (ISO 8601).",+ "periodEnd": "When the billing period ends (ISO 8601).",+ "resetDate": "When the usage total next resets (ISO 8601).",+ "cadence": "How often the billing period repeats, such as `annual`.",+ "whenReached": "What happens when usage reaches the limit, such as `stops`.",+ },+ },}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/coassemble/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/coassemble/settings.pyindex 8829b1ff8e97..29f85c83f3ae 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/coassemble/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/coassemble/settings.py@@ -108,6 +108,14 @@ COASSEMBLE_ENDPOINTS: dict[str, CoassembleEndpointConfig] = {stamp_column="clientIdentifier",),),+ # Workspace-wide limits and current-period totals, one row per metric. Unpaged: the endpoint+ # documents no page/length params and returns a handful of rows.+ "workspace_allowances": CoassembleEndpointConfig(+ name="workspace_allowances",+ path="/usage/allowances",+ primary_keys=["metric", "periodStart"],+ page_size=None,+ ),}ENDPOINTS = tuple(COASSEMBLE_ENDPOINTS.keys())diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/coassemble/tests/test_coassemble.py b/products/warehouse_sources/backend/temporal/data_imports/sources/coassemble/tests/test_coassemble.pyindex 10c93e9a19ec..29ed09e0e8d2 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/coassemble/tests/test_coassemble.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/coassemble/tests/test_coassemble.py@@ -227,6 +227,19 @@ class TestClientUsagePagination:assert "Required data_selector" in str(result.raised)+class TestWorkspaceAllowances:+ def test_reads_one_unpaged_request(self) -> None:+ # The endpoint documents no page/length params, so the request must carry none.+ rows = [{"metric": "ir", "limit": 500, "currentUsage": 12}, {"metric": "imageUsage", "limit": None}]+ result = _driver().run("workspace_allowances", [ScriptedResponse(json=rows)])++ assert result.raised is None+ assert result.rows == rows+ assert result.paths == ["/api/v1/headless/usage/allowances"]+ assert result.params("page") == [None]+ assert result.params("length") == [None]++class TestValidateCredentials:@parameterized.expand([