: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): Decagon team members and watchtower tables (#80187)
jake sciotto856810d137e3
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/decagon/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/decagon/canonical_descriptions.pyindex 50a385146d0f..ddace2c45fc7 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/decagon/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/decagon/canonical_descriptions.py@@ -112,4 +112,37 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"details_after": "State of the resource after the change, as free-form JSON.",},},+ "team_members": {+ "description": (+ "A member of the Decagon team, one row per user including pending invites. "+ "Resolves the user ids referenced by other Decagon tables to a person."+ ),+ "docs_url": "https://docs.decagon.ai/api-reference/getting-started",+ "columns": {+ "id": "Unique identifier for the team member.",+ "email": "Email address of the team member.",+ "access": "Access level of the team member: viewer, QA, or admin.",+ },+ },+ "watchtower_jobs": {+ "description": (+ "A Watchtower QA/evaluation job, including the rubric and configuration needed to "+ "interpret its quality scoring."+ ),+ "docs_url": "https://docs.decagon.ai/api-reference/getting-started",+ "columns": {+ "id": "Unique identifier for the job.",+ "name": "Name of the job.",+ "description": "Description of the job.",+ "rubric": "Rubric the job evaluates against, as free-form JSON.",+ "rubric_type": "Type of the rubric.",+ "prompt": "Prompt the job runs, as free-form JSON.",+ "outputs": "Outputs the job produces, as free-form JSON.",+ "config": "Configuration of the job, as free-form JSON.",+ "created_at": "Timestamp at which the job was created.",+ "updated_at": "Timestamp at which the job was last updated.",+ "last_run_at": "Timestamp at which the job last ran.",+ "status": "Status of the job.",+ },+ },}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/decagon/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/decagon/settings.pyindex bcae2e3bf86e..c3995dcca010 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/decagon/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/decagon/settings.py@@ -228,6 +228,34 @@ DECAGON_ENDPOINTS: dict[str, DecagonEndpointConfig] = {# live account; config diffs can carry sensitive settings content.should_sync_default=False,),+ # /team/api/members is the roster that resolves the user ids other Decagon tables+ # reference. One unpaginated request; members carry no timestamp, so the table is+ # unpartitioned and full refresh only. show_invite_status is requested so pending+ # invites land too (a complete roster); the `access` param is not sent in case it+ # filters rather than annotates. Rows are staff email addresses, so the table is a+ # deliberate opt-in.+ "team_members": DecagonEndpointConfig(+ name="team_members",+ path="/team/api/members",+ data_key="members",+ primary_keys=["id"],+ incremental_fields=[],+ pagination="single",+ extra_params={"show_invite_status": "true"},+ should_sync_default=False,+ ),+ # /watchtower/all lists Decagon's QA/evaluation jobs with their rubrics and+ # configuration, the context needed to interpret any quality scoring. One unpaginated+ # request, full refresh; rubric/prompt/outputs/config land as free-form JSON.+ "watchtower_jobs": DecagonEndpointConfig(+ name="watchtower_jobs",+ path="/watchtower/all",+ data_key="jobs",+ primary_keys=["id"],+ incremental_fields=[],+ pagination="single",+ partition_key="created_at",+ ),}ENDPOINTS = tuple(DECAGON_ENDPOINTS.keys())diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/decagon/tests/test_decagon.py b/products/warehouse_sources/backend/temporal/data_imports/sources/decagon/tests/test_decagon.pyindex 08f7af0527b2..2778a3f3fdcb 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/decagon/tests/test_decagon.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/decagon/tests/test_decagon.py@@ -646,6 +646,47 @@ class TestAdminLogs:assert response.sort_mode == "desc"+class TestTeamAndWatchtowerTables:+ def test_team_members_requests_invite_status_but_never_an_access_filter(self) -> None:+ # show_invite_status completes the roster with pending invites; sending `access`+ # could filter the roster down to one level and silently lose members.+ manager = _fresh_manager()+ responses = [_make_response({"members": [{"id": 1, "email": "[email protected]", "access": "admin"}]})]+ sent_params, batches = _drive_rows(manager, responses, endpoint="team_members")++ assert sent_params == [{"show_invite_status": "true"}]+ assert [len(b) for b in batches] == [1]++ def test_team_members_response_is_unpartitioned(self) -> None:+ # Members carry no timestamp; wiring the datetime partitioning every other stream+ # uses would fail the sync on a missing column.+ response = decagon_source(+ api_key="key",+ endpoint="team_members",+ logger=MagicMock(),+ resumable_source_manager=MagicMock(spec=ResumableSourceManager),+ )+ assert response.primary_keys == ["id"]+ assert response.partition_mode is None++ def test_watchtower_jobs_is_a_single_request_partitioned_by_created_at(self) -> None:+ manager = _fresh_manager()+ responses = [_make_response({"jobs": [{"id": 1, "name": "j", "created_at": "2026-01-01T00:00:00Z"}]})]+ sent_params, batches = _drive_rows(manager, responses, endpoint="watchtower_jobs")++ assert sent_params == [{}]+ assert [len(b) for b in batches] == [1]++ response = decagon_source(+ api_key="key",+ endpoint="watchtower_jobs",+ logger=MagicMock(),+ resumable_source_manager=MagicMock(spec=ResumableSourceManager),+ )+ assert response.primary_keys == ["id"]+ assert response.partition_keys == ["created_at"]++class TestToEpochSeconds:# The pipeline hands the DateTime watermark back as a datetime, a date, or an epoch# number depending on how it round-tripped through storage; the request boundary mustdiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/decagon/tests/test_decagon_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/decagon/tests/test_decagon_source.pyindex 0d2813ccd8af..34c75b74822d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/decagon/tests/test_decagon_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/decagon/tests/test_decagon_source.py@@ -94,6 +94,16 @@ class TestDecagonSource:assert admin_logs.should_sync_default is Falseassert [f["field"] for f in admin_logs.incremental_fields] == ["created_at"]+ members = next(s for s in schemas if s.name == "team_members")+ # Staff email addresses must be a deliberate opt-in, not something an account+ # acquires by connecting the source.+ assert members.should_sync_default is False+ assert members.supports_incremental is False++ watchtower = next(s for s in schemas if s.name == "watchtower_jobs")+ assert watchtower.supports_incremental is False+ assert watchtower.supports_append is False+def test_get_schemas_filtered_by_names(self) -> None:assert [s.name for s in self.source.get_schemas(self.config, self.team_id, names=["conversations"])] == ["conversations"