: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 3 missing tables to the Vellum source (#117690)
Tom Owersdd4da8568db3
diff --git a/posthog/test/repo_invariants/dataclass_frozen_baseline.txt b/posthog/test/repo_invariants/dataclass_frozen_baseline.txtindex 73bd59bf0618..ee6b0e197157 100644--- a/posthog/test/repo_invariants/dataclass_frozen_baseline.txt+++ b/posthog/test/repo_invariants/dataclass_frozen_baseline.txt@@ -1198,7 +1198,6 @@1 products/warehouse_sources/backend/temporal/data_imports/sources/vapi/vapi.py1 products/warehouse_sources/backend/temporal/data_imports/sources/veeqo/settings.py1 products/warehouse_sources/backend/temporal/data_imports/sources/veeqo/veeqo.py-1 products/warehouse_sources/backend/temporal/data_imports/sources/vellum/settings.py1 products/warehouse_sources/backend/temporal/data_imports/sources/vellum/vellum.py1 products/warehouse_sources/backend/temporal/data_imports/sources/veracode/settings.py1 products/warehouse_sources/backend/temporal/data_imports/sources/veracode/veracode.pydiff --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 3b684b131e1d..ef96d84efbc8 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@@ -12906,9 +12906,9 @@ Today (5): `document_indexes`, `documents`, `prompt_deployments`, `workflow_deplDiffed against: <https://docs.vellum.ai/openapi.json>-- [ ] `GET /v1/workflow-deployments/{id}/releases` — release/version history per workflow deployment — the state-transition table for what shipped when (medium)-- [ ] `GET /v1/workflow-deployments/{id}/release-tags` — lookup mapping tags (LATEST, PRODUCTION) to workflow deployment releases (medium)-- [ ] `GET /v1/deployments/{id}/release-tags` — same lookup for the prompt deployments we already sync (medium)+- [x] `GET /v1/workflow-deployments/{id}/releases` — release/version history per workflow deployment — the state-transition table for what shipped when (medium)+- [x] `GET /v1/workflow-deployments/{id}/release-tags` — lookup mapping tags (LATEST, PRODUCTION) to workflow deployment releases (medium)+- [x] `GET /v1/deployments/{id}/release-tags` — same lookup for the prompt deployments we already sync (medium)- [ ] `GET /v1/folder-entities` — lookup mapping deployments, indexes and sandboxes to the folders that organize them (low)- [ ] `GET /v1/test-suite-runs/{id}/executions` — eval results per test suite run; only reachable if run tokens are known (low)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/vellum/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/vellum/canonical_descriptions.pyindex 79618f0d343b..8db2add942e6 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/vellum/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/vellum/canonical_descriptions.py@@ -80,4 +80,42 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"metric_results": "Metric evaluation results recorded for this execution.",},},+ "workflow_deployment_releases": {+ "description": "Release history of each workflow deployment in the environment the API key is scoped to. One row per release, keyed by the parent workflow deployment and the release id.",+ "docs_url": "https://docs.vellum.ai/developers/client-sdk/workflows/deployments/list-releases",+ "columns": {+ "workflow_deployment_id": "ID of the workflow deployment this release belongs to (injected by PostHog during the fan-out).",+ "id": "Vellum-generated ID that uniquely identifies this release.",+ "created": "Timestamp representing when this release was created.",+ "environment": "The environment this release was made to: its `id`, `name`, and `label`.",+ "created_by": "The user who created this release. Null when no user is recorded.",+ "workflow_version": "The workflow version this release shipped, with its input and output variables.",+ "deployment": "The workflow deployment this release belongs to: its `id` and `name`.",+ "description": "A human-readable description of the release.",+ "release_tags": "The release tags that point to this release.",+ "reviews": "The reviews recorded against this release.",+ },+ },+ "workflow_deployment_release_tags": {+ "description": "Release tags of each workflow deployment, and the release each tag points to. One row per tag, keyed by the parent workflow deployment and the tag name.",+ "docs_url": "https://docs.vellum.ai/developers/client-sdk/workflows/deployments/list-release-tags",+ "columns": {+ "workflow_deployment_id": "ID of the workflow deployment this release tag belongs to (injected by PostHog during the fan-out).",+ "name": "The name of the release tag, for example LATEST or PRODUCTION. Unique within its deployment.",+ "source": "How the release tag was originally created (SYSTEM or USER).",+ "release": "The release this tag points to: its `id` and `timestamp`.",+ "history_item": "Deprecated. Reference the `release` field instead.",+ },+ },+ "prompt_deployment_release_tags": {+ "description": "Release tags of each prompt deployment, and the release each tag points to. One row per tag, keyed by the parent prompt deployment and the tag name.",+ "docs_url": "https://docs.vellum.ai/developers/client-sdk/prompts/deployments/list-release-tags",+ "columns": {+ "prompt_deployment_id": "ID of the prompt deployment this release tag belongs to (injected by PostHog during the fan-out).",+ "name": "The name of the release tag, for example LATEST or PRODUCTION. Unique within its deployment.",+ "source": "How the release tag was originally created (SYSTEM or USER).",+ "release": "The release this tag points to: its `id` and `timestamp`.",+ "history_item": "Deprecated. Reference the `release` field instead.",+ },+ },}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/vellum/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/vellum/settings.pyindex 645e552dea12..a5fb2e74caaf 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/vellum/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/vellum/settings.py@@ -5,7 +5,7 @@ from dataclasses import dataclass, fieldVELLUM_BASE_URL = "https://api.vellum.ai/v1"-@dataclass+@dataclass(frozen=True)class VellumEndpointConfig:name: str# Path relative to VELLUM_BASE_URL. Fan-out endpoints carry a `{deployment_id}` placeholder.@@ -19,10 +19,10 @@ class VellumEndpointConfig:# ordering values, so we only send one we can reason about).ordering: str | None = Noneshould_sync_default: bool = True- # Fan out over every workflow deployment, hitting `path` (with `{deployment_id}`) per parent to- # pull its execution history. The parent id is injected into each child row under- # `parent_id_field` so the composite primary key stays unique table-wide.- fan_out_over_workflow_deployments: bool = False+ # Parent endpoint to fan out over, hitting `path` (with `{deployment_id}`) once per parent row. The+ # parent id is injected into each child row under `parent_id_field` so the composite primary key+ # stays unique table-wide.+ fan_out_parent: str | None = Noneparent_id_field: str | None = None@@ -64,9 +64,39 @@ VELLUM_ENDPOINTS: dict[str, VellumEndpointConfig] = {primary_keys=["workflow_deployment_id", "span_id"],partition_key="start",should_sync_default=False,- fan_out_over_workflow_deployments=True,+ fan_out_parent="workflow_deployments",parent_id_field="workflow_deployment_id",),+ # Release history per workflow deployment: one row per release, with the version and environment it+ # shipped to. Release ids are UUIDs, but the parent id stays in the key like the other fan-outs.+ # This and the release-tag tables below are fan-outs too, so they are also opt-in.+ "workflow_deployment_releases": VellumEndpointConfig(+ name="workflow_deployment_releases",+ path="/workflow-deployments/{deployment_id}/releases",+ primary_keys=["workflow_deployment_id", "id"],+ partition_key="created",+ should_sync_default=False,+ fan_out_parent="workflow_deployments",+ parent_id_field="workflow_deployment_id",+ ),+ # Release tags (e.g. LATEST, PRODUCTION) and the release each one points to. A tag name is unique only+ # within its deployment, and tags carry no immutable timestamp of their own, so no partition key.+ "workflow_deployment_release_tags": VellumEndpointConfig(+ name="workflow_deployment_release_tags",+ path="/workflow-deployments/{deployment_id}/release-tags",+ primary_keys=["workflow_deployment_id", "name"],+ should_sync_default=False,+ fan_out_parent="workflow_deployments",+ parent_id_field="workflow_deployment_id",+ ),+ "prompt_deployment_release_tags": VellumEndpointConfig(+ name="prompt_deployment_release_tags",+ path="/deployments/{deployment_id}/release-tags",+ primary_keys=["prompt_deployment_id", "name"],+ should_sync_default=False,+ fan_out_parent="prompt_deployments",+ parent_id_field="prompt_deployment_id",+ ),}ENDPOINTS = tuple(VELLUM_ENDPOINTS.keys())diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/vellum/tests/test_vellum.py b/products/warehouse_sources/backend/temporal/data_imports/sources/vellum/tests/test_vellum.pyindex bfe3f5c18bc9..315b6eb0f0aa 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/vellum/tests/test_vellum.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/vellum/tests/test_vellum.py@@ -85,27 +85,65 @@ class TestRetries:class TestExecutionEventsFanOut:- def test_injects_parent_id_into_every_row(self) -> None:+ @parameterized.expand(+ [+ (+ "workflow_execution_events",+ "workflow_deployment_id",+ "/v1/workflow-deployments",+ "/v1/workflow-deployments/{}/execution-events",+ [+ {"span_id": "s1", "start": "2026-01-01T00:00:00Z"},+ {"span_id": "s2", "start": "2026-01-02T00:00:00Z"},+ ],+ ),+ (+ "workflow_deployment_releases",+ "workflow_deployment_id",+ "/v1/workflow-deployments",+ "/v1/workflow-deployments/{}/releases",+ [{"id": "r1", "created": "2026-01-01T00:00:00Z"}, {"id": "r2", "created": "2026-01-02T00:00:00Z"}],+ ),+ (+ "workflow_deployment_release_tags",+ "workflow_deployment_id",+ "/v1/workflow-deployments",+ "/v1/workflow-deployments/{}/release-tags",+ [{"name": "LATEST", "release": {"id": "r1"}}, {"name": "LATEST", "release": {"id": "r2"}}],+ ),+ (+ "prompt_deployment_release_tags",+ "prompt_deployment_id",+ "/v1/deployments",+ "/v1/deployments/{}/release-tags",+ [{"name": "PRODUCTION", "release": {"id": "r1"}}, {"name": "PRODUCTION", "release": {"id": "r2"}}],+ ),+ ]+ )+ def test_injects_parent_id_into_every_row(+ self,+ endpoint: str,+ parent_id_field: str,+ parent_path: str,+ child_path: str,+ child_rows: list[dict[str, Any]],+ ) -> None:# The parent id completes the composite key; without it rows from different deployments that- # share a span id would collide and every merge would multi-match.+ # share a span id or tag name would collide and every merge would multi-match.result = _run(- "workflow_execution_events",+ endpoint,[_resp(results=[{"id": "A"}, {"id": "B"}], count=2),- _resp(results=[{"span_id": "s1", "start": "2026-01-01T00:00:00Z"}], count=1),- _resp(results=[{"span_id": "s2", "start": "2026-01-02T00:00:00Z"}], count=1),+ _resp(results=[child_rows[0]], count=1),+ _resp(results=[child_rows[1]], count=1),],)assert result.rows == [- {"workflow_deployment_id": "A", "span_id": "s1", "start": "2026-01-01T00:00:00Z"},- {"workflow_deployment_id": "B", "span_id": "s2", "start": "2026-01-02T00:00:00Z"},- ]- assert result.paths == [- "/v1/workflow-deployments",- "/v1/workflow-deployments/A/execution-events",- "/v1/workflow-deployments/B/execution-events",+ {parent_id_field: "A", **child_rows[0]},+ {parent_id_field: "B", **child_rows[1]},]+ assert result.paths == [parent_path, child_path.format("A"), child_path.format("B")]def test_non_404_error_propagates(self) -> None:# Any non-404 child error must fail the whole sync rather than be silently swallowed.@@ -148,6 +186,9 @@ class TestSourceResponse:("document_indexes", ["id"], "created"),("documents", ["id"], None),("workflow_execution_events", ["workflow_deployment_id", "span_id"], "start"),+ ("workflow_deployment_releases", ["workflow_deployment_id", "id"], "created"),+ ("workflow_deployment_release_tags", ["workflow_deployment_id", "name"], None),+ ("prompt_deployment_release_tags", ["prompt_deployment_id", "name"], None),])def test_primary_keys_and_partitioning(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/vellum/vellum.py b/products/warehouse_sources/backend/temporal/data_imports/sources/vellum/vellum.pyindex 443ad16e453d..65ae8c6a9f6a 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/vellum/vellum.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/vellum/vellum.py@@ -28,9 +28,6 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.vellum.setPAGE_SIZE = 100-# The workflow deployment that parents the execution-events fan-out.-_FANOUT_PARENT = "workflow_deployments"-@dataclasses.dataclassclass VellumResumeConfig:@@ -141,25 +138,27 @@ def _fanout_resource(job_id: str,resumable_source_manager: ResumableSourceManager[VellumResumeConfig],) -> Iterable[Any]:- """Fan out over every workflow deployment, pulling its execution events and stamping the parent id.+ """Fan out over every row of `config.fan_out_parent`, pulling the child list and stamping the parent id.The parent deployment id is injected into each child row under `parent_id_field` so the composite- primary key (`[workflow_deployment_id, span_id]`) stays unique table-wide. A deployment deleted+ primary key (e.g. `[workflow_deployment_id, span_id]`) stays unique table-wide. A deployment deletedbetween enumeration and its fetch 404s — `response_actions` treats that as an empty page and skipsit rather than failing the whole sync; any other error propagates. Single dependent resource, sothe fan-out is resumable: fully-synced deployments are skipped and the in-progress one resumes."""+ parent_name = config.fan_out_parentparent_id_field = config.parent_id_field+ assert parent_name is not None, "fan-out endpoints must define fan_out_parent"assert parent_id_field is not None, "fan-out endpoints must define parent_id_field"- parent_config = VELLUM_ENDPOINTS[_FANOUT_PARENT]+ parent_config = VELLUM_ENDPOINTS[parent_name]parent_params: dict[str, Any] = {"limit": PAGE_SIZE}if parent_config.ordering:parent_params["ordering"] = parent_config.orderingparent_resource: EndpointResource = {- "name": _FANOUT_PARENT,- "table_name": _FANOUT_PARENT,+ "name": parent_name,+ "table_name": parent_name,"write_disposition": "replace","table_format": "delta","endpoint": {@@ -180,7 +179,7 @@ def _fanout_resource("endpoint": {"path": config.path,"params": {- "deployment_id": {"type": "resolve", "resource": _FANOUT_PARENT, "field": "id"},+ "deployment_id": {"type": "resolve", "resource": parent_name, "field": "id"},"limit": PAGE_SIZE,},"data_selector": "results",@@ -215,9 +214,9 @@ def _fanout_resource(initial_paginator_state=initial_paginator_state,)child = next(r for r in resources if r.name == endpoint)- # include_from_parent injects the parent id under `_workflow_deployments_id`; rename it to the- # composite-key column the child rows are expected to carry.- return child.add_map(rename_parent_fields(_FANOUT_PARENT, {"id": parent_id_field}))+ # include_from_parent injects the parent id under `_<parent>_id`; rename it to the composite-key+ # column the child rows are expected to carry.+ return child.add_map(rename_parent_fields(parent_name, {"id": parent_id_field}))def vellum_source(@@ -230,7 +229,7 @@ def vellum_source() -> SourceResponse:config = VELLUM_ENDPOINTS[endpoint]- if config.fan_out_over_workflow_deployments:+ if config.fan_out_parent:resource = _fanout_resource(api_key, config, endpoint, team_id, job_id, resumable_source_manager)else:resource = _simple_resource(api_key, config, endpoint, team_id, job_id, resumable_source_manager)