: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(warehouse_sources): add Tally folders and form analytics metrics tables (#90857)
Tom Owers2d7f6c4246f1
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 9c06bdeabd5e..ecdac995f3df 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@@ -8333,6 +8333,21 @@ Diffed against: <https://api.tailscale.com/api/v2?outputOpenapiSchema=true>Note: Fetched the live OpenAPI 3.1 schema (58 paths). Static 4-endpoint config in sources/tailscale/settings.py, no dynamic discovery. Coverage of the tailnet-level list endpoints is reasonable; the notable miss is network flow logs, which sit on the same /logging prefix as the audit logs already synced and are by far the largest analytical dataset the API exposes. ACL, DNS, contacts, settings, webhooks and OAuth apps are all config and correctly out of scope.+## Tally — gaps++Today (7): `workspaces`, `forms`, `folders`, `questions`, `submissions`, `form_analytics_metrics`, `webhooks`++Diffed against: <https://developers.tally.so/api-reference/changelog>++- [x] `GET /workspaces/{workspaceId}/folders` — Folders that organize a workspace's forms; fanned out per workspace (added)+- [x] `GET /forms/{formId}/analytics/metrics` — Aggregate per-form metrics (visits, submissions, completion rate); fanned out per form with `period=all` (added)+- [ ] `GET /forms/{formId}/analytics/visits` — Form visits over time; a time series, not a table row per resource, so it needs a bucketed shape before it is worth syncing (low)+- [ ] `GET /forms/{formId}/analytics/submissions` — Completed and partial submissions over time; same time-series shape caveat as visits (low)+- [ ] `GET /forms/{formId}/analytics/dimensions` — Visitor breakdowns by source, browser, OS, device, and location (low)+- [ ] `GET /forms/{formId}/analytics/drop-off` — Per-question drop-off statistics (low)++Note: The folders and form-analytics endpoints were announced in the June 2026 releases (v0.8.0, v0.9.0) and are additive, so they are reachable with the source's pinned `tally-version: 2025-02-01`. Folders returns a bare JSON array; the metrics endpoint returns a single aggregate object per form. The remaining analytics endpoints are time series rather than one-row-per-resource tables, so they are deferred until a bucketed table shape is designed for them.+## Tavus — gapsToday (4): `conversations`, `personas`, `replicas`, `videos`diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/tally/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/tally/canonical_descriptions.pyindex 8b27aca1cd18..88ba6b4ae6bd 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/tally/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/tally/canonical_descriptions.py@@ -52,6 +52,38 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"updatedAt": "When the question was last updated.",},},+ "folders": {+ "description": "A folder used to organize a workspace's forms. Folders can nest under a parent folder.",+ "docs_url": "https://developers.tally.so/api-reference/endpoint/workspaces/folders/list",+ "columns": {+ "id": "Unique identifier for the folder within its workspace.",+ "name": "Name of the folder.",+ "workspaceId": "Identifier of the workspace the folder belongs to.",+ "parentId": "Identifier of the parent folder, or null for a top-level folder.",+ "createdByUserId": "Identifier of the user who created the folder.",+ "createdAt": "When the folder was created.",+ "updatedAt": "When the folder was last updated.",+ },+ },+ "form_analytics_metrics": {+ "description": (+ "Aggregate performance metrics for a form over its whole history. One row per form, "+ "recomputed on every sync."+ ),+ "docs_url": "https://developers.tally.so/api-reference/endpoint/forms/analytics/metrics",+ "columns": {+ "formId": "Identifier of the form the metrics are for.",+ "visits": "Number of visits to the form.",+ "visitDuration": "Average time spent on the form, in seconds.",+ "submissions": "Number of submissions the form received.",+ "uniqueRespondents": "Number of distinct respondents who submitted the form.",+ "totalViews": "Total number of times the form was viewed.",+ "starts": "Number of respondents who began filling in the form.",+ "completions": "Number of respondents who completed the form.",+ "completionDuration": "Average time to complete the form, in seconds.",+ "completionRate": "Share of starts that resulted in a completion.",+ },+ },"submissions": {"description": ("A single submission of a form, with every answer nested under `responses`. Answers are "diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/tally/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/tally/settings.pyindex 801f170d36bf..6c7659e6d956 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/tally/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/tally/settings.py@@ -28,6 +28,11 @@ WEBHOOKS_PAGE_SIZE = 100SUBMISSION_FILTER_COMPLETED: Literal["completed"] = "completed"SUBMISSION_FILTER_ALL: Literal["all"] = "all"+# /forms/{formId}/analytics/metrics requires a `period`. It returns one aggregate row per form, so+# the whole-lifetime window is the only one that makes the row self-contained rather than a moving+# slice — every sync recomputes it in full.+FORM_METRICS_PERIOD = "all"+@dataclassclass TallyEndpointConfig:@@ -55,7 +60,10 @@ class TallyEndpointConfig:capture_samples: bool = True-def _forms_fanout(parent_params: Optional[dict[str, object]] = None) -> DependentEndpointConfig:+def _forms_fanout(+ parent_params: Optional[dict[str, object]] = None,+ child_params: Optional[dict[str, object]] = None,+) -> DependentEndpointConfig:# Child rows already carry `formId`, but injecting the parent id guarantees the composite# primary key's column exists even if a future response shape drops it.return DependentEndpointConfig(@@ -65,6 +73,20 @@ def _forms_fanout(parent_params: Optional[dict[str, object]] = None) -> Dependeninclude_from_parent=["id"],parent_field_renames={"id": "formId"},parent_params=dict(parent_params or {}),+ child_params=dict(child_params or {}),+ )+++def _workspaces_fanout() -> DependentEndpointConfig:+ # Folders are listed per workspace, and a folder id is only documented as unique within its+ # workspace, so the parent workspace is part of the key. The row already carries `workspaceId`,+ # but injecting the parent id guarantees the key column exists even if the shape drops it.+ return DependentEndpointConfig(+ parent_name="workspaces",+ resolve_param="workspaceId",+ resolve_field="id",+ include_from_parent=["id"],+ parent_field_renames={"id": "workspaceId"},)@@ -131,6 +153,33 @@ TALLY_ENDPOINTS: dict[str, TallyEndpointConfig] = {redact_fields=("signingSecret", "httpHeaders"),capture_samples=False,),+ # One request per workspace. Folders organize a workspace's forms; the endpoint returns the+ # whole set as a bare JSON array with no wrapper key and no pagination.+ "folders": TallyEndpointConfig(+ name="folders",+ path="/workspaces/{workspaceId}/folders",+ data_selector="$",+ page_size_param=None,+ paginated=False,+ primary_keys=["workspaceId", "id"],+ partition_key="createdAt",+ fanout=_workspaces_fanout(),+ ),+ # One request per form. Returns a single aggregate object (visits, submissions, completion rate)+ # with no wrapper, no array, and no id of its own — one row per form, recomputed every sync.+ "form_analytics_metrics": TallyEndpointConfig(+ name="form_analytics_metrics",+ path="/forms/{formId}/analytics/metrics",+ data_selector="$",+ page_size_param=None,+ paginated=False,+ primary_keys=["formId"],+ # The aggregate carries no timestamp, so there is no stable field to partition it by.+ fanout=_forms_fanout(+ parent_params={"limit": FORMS_PAGE_SIZE},+ child_params={"period": FORM_METRICS_PERIOD},+ ),+ ),}ENDPOINTS = tuple(TALLY_ENDPOINTS)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/tally/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/tally/source.pyindex 553bf4af4127..8972e71cb7f8 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/tally/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/tally/source.py@@ -61,7 +61,7 @@ class TallySource(ResumableSource[TallySourceConfig, TallyResumeConfig]):keywords=["forms", "surveys", "tally.so"],iconPath="/static/services/tally.png",docsUrl="https://posthog.com/docs/cdp/sources/tally",- caption="""Enter a Tally API key to sync your workspaces, forms, questions, submissions, and webhooks.+ caption="""Enter a Tally API key to sync your workspaces, forms, folders, questions, submissions, form analytics, and webhooks.You can create an API key in your [Tally settings](https://tally.so/settings/api-keys). No extra scopes are needed.diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/tally/tests/test_tally.py b/products/warehouse_sources/backend/temporal/data_imports/sources/tally/tests/test_tally.pyindex d405e7b3f2b6..c88c795c2a60 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/tally/tests/test_tally.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/tally/tests/test_tally.py@@ -113,6 +113,7 @@ class TestSourceResponseShape:("questions", ["formId", "id"], "createdAt", "asc"),("submissions", ["formId", "id"], "submittedAt", "desc"),("webhooks", ["id"], "createdAt", "asc"),+ ("folders", ["workspaceId", "id"], "createdAt", "asc"),])@mock.patch(CLIENT_SESSION_PATCH)@@ -141,6 +142,22 @@ class TestSourceResponseShape:# ascending and the watermark must only advance once the whole sync finishes.assert response.sort_mode == expected_sort_mode+ @mock.patch(CLIENT_SESSION_PATCH)+ def test_metrics_has_no_partition_and_is_keyed_by_form(self, _MockSession: Any) -> None:+ # The metrics aggregate carries no timestamp, so it must not be partitioned; it is one row+ # per form, keyed by the injected parent form id (the object has no id of its own).+ response = tally_source(+ api_key="key",+ api_version=TALLY_API_VERSION,+ endpoint="form_analytics_metrics",+ team_id=1,+ job_id="job",+ resumable_source_manager=_make_manager(),+ )+ assert response.primary_keys == ["formId"]+ assert response.partition_mode is None+ assert response.partition_keys is None+class TestPagination:def test_follows_has_more_across_pages(self) -> None:@@ -257,6 +274,36 @@ class TestFanOut:_rows, params, _session = _run("submissions", responses, submission_filter=submission_filter)assert params[1]["filter"] == submission_filter+ def test_folders_fan_out_per_workspace_from_a_bare_array(self) -> None:+ # /workspaces/{id}/folders returns a bare JSON array with no wrapper key, and a folder id is+ # only unique within its workspace — so each row must be tagged with its parent workspace.+ responses = {+ f"{BASE}/workspaces?page=1": [_page([{"id": "W1"}, {"id": "W2"}], key="items")],+ f"{BASE}/workspaces/W1/folders": [_resp([{"id": "D1", "workspaceId": "W1", "name": "A"}])],+ f"{BASE}/workspaces/W2/folders": [_resp([{"id": "D2", "workspaceId": "W2", "name": "B"}])],+ }+ rows, _params, _session = _run("folders", responses)+ assert rows == [+ {"id": "D1", "workspaceId": "W1", "name": "A"},+ {"id": "D2", "workspaceId": "W2", "name": "B"},+ ]++ def test_form_metrics_wrap_a_single_object_and_tag_the_form(self) -> None:+ # The metrics endpoint returns one aggregate object per form (no wrapper, no array, no id of+ # its own), so each becomes a single row keyed by the parent form id, and `period` is+ # required on every child request.+ responses = {+ FORMS_PAGE_1: [_page([{"id": "F1"}, {"id": "F2"}])],+ f"{BASE}/forms/F1/analytics/metrics?period=all": [_resp({"visits": 10, "submissions": 3})],+ f"{BASE}/forms/F2/analytics/metrics?period=all": [_resp({"visits": 5, "submissions": 1})],+ }+ rows, params, _session = _run("form_analytics_metrics", responses)+ assert rows == [+ {"visits": 10, "submissions": 3, "formId": "F1"},+ {"visits": 5, "submissions": 1, "formId": "F2"},+ ]+ assert params[1]["period"] == "all"+def test_form_deleted_mid_sync_is_skipped(self) -> None:responses = {FORMS_PAGE_1: [_page([{"id": "F1"}, {"id": "GONE"}, {"id": "F2"}])],diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/tally/tests/test_tally_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/tally/tests/test_tally_source.pyindex b76e7ce6ddb4..a741ba898805 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/tally/tests/test_tally_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/tally/tests/test_tally_source.py@@ -62,7 +62,7 @@ class TestTallySource:assert [field["field"] for field in by_name["submissions"].incremental_fields] == ["submittedAt"]# `startDate` is inclusive, so append mode would re-write the watermark's own rows.assert by_name["submissions"].supports_append is False- for name in ("workspaces", "forms", "questions", "webhooks"):+ for name in ("workspaces", "forms", "questions", "webhooks", "folders", "form_analytics_metrics"):assert by_name[name].supports_incremental is Falseassert by_name[name].incremental_fields == []