: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): support hookdeck API version 2026-09-01 (#112595)
Tom Owers8ae671539762
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hookdeck/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hookdeck/settings.pyindex cf1aa1af3306..9047367ce692 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hookdeck/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hookdeck/settings.py@@ -3,8 +3,8 @@ from typing import Optionalfrom products.warehouse_sources.backend.types import IncrementalField, IncrementalFieldType-# Hookdeck pins the API version as the first path segment. Omitting it resolves to the OLDEST-# supported version, so the version is always part of the base URL.+# Hookdeck pins the API version as the first path segment. Omitting it tracks the latest version,+# so the version is always part of the base URL.HOOKDECK_API_HOST = "https://api.hookdeck.com"# `limit` is documented as max 250 (the OpenAPI schema allows 255).diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hookdeck/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hookdeck/source.pyindex e5f1cc621e20..cfcabec96d91 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hookdeck/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hookdeck/source.py@@ -34,9 +34,11 @@ from products.warehouse_sources.backend.types import ExternalDataSourceTypeclass HookdeckSource(ResumableSource[HookdeckSourceConfig, HookdeckResumeConfig]):lists_tables_without_credentials = True # static endpoint catalog — safe for public docs# Hookdeck dates its API versions and carries the version in the URL path. An unversioned- # request resolves to the OLDEST supported version, so the pin is always sent.- supported_versions = ("2025-07-01",)- default_version = "2025-07-01"+ # request tracks the latest version, so the pin is always sent. 2026-09-01 only reshapes the+ # destination `config` JSON (rate limit fields move under `delivery_policy`), which is passed+ # through untouched, so both versions share one request path.+ supported_versions = ("2025-07-01", "2026-09-01")+ default_version = "2026-09-01"api_docs_url = "https://hookdeck.com/docs/api"@propertydiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hookdeck/tests/test_hookdeck.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hookdeck/tests/test_hookdeck.pyindex 1d5228670675..3c60c115c429 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hookdeck/tests/test_hookdeck.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hookdeck/tests/test_hookdeck.py@@ -28,7 +28,8 @@ HOOKDECK_SESSION_PATCH = ("products.warehouse_sources.backend.temporal.data_imports.sources.hookdeck.hookdeck.make_tracked_session")-API_VERSION = "2025-07-01"+API_VERSION = "2026-09-01"+SUPPORTED_VERSIONS = ["2025-07-01", "2026-09-01"]INCREMENTAL_ENDPOINTS = sorted(name for name, c in HOOKDECK_ENDPOINTS.items() if c.incremental_fields)FULL_REFRESH_ENDPOINTS = sorted(name for name, c in HOOKDECK_ENDPOINTS.items() if not c.incremental_fields)@@ -69,10 +70,10 @@ def _wire(session: mock.MagicMock, responses: list[Response]) -> list[dict[str,return param_snapshots-def _source(endpoint: str, manager: mock.MagicMock, **kwargs: Any):+def _source(endpoint: str, manager: mock.MagicMock, api_version: str = API_VERSION, **kwargs: Any):return hookdeck_source("hd_key",- API_VERSION,+ api_version,endpoint,team_id=1,job_id="job-1",@@ -102,9 +103,20 @@ class TestHookdeckTransport:assert result == expectedassert "+00:00" not in result- def test_base_url_carries_the_version_segment(self) -> None:- # An unversioned request resolves to Hookdeck's OLDEST supported version.- assert base_url(API_VERSION) == f"https://api.hookdeck.com/{API_VERSION}"+ @pytest.mark.parametrize("api_version", SUPPORTED_VERSIONS)+ def test_base_url_carries_the_version_segment(self, api_version: str) -> None:+ # An unversioned request tracks Hookdeck's latest version.+ assert base_url(api_version) == f"https://api.hookdeck.com/{api_version}"++ @pytest.mark.parametrize("api_version", SUPPORTED_VERSIONS)+ @mock.patch(HOOKDECK_SESSION_PATCH)+ def test_sync_requests_carry_the_pinned_version(self, MockSession, api_version: str) -> None:+ session = MockSession.return_value+ _wire(session, [_response([{"id": "des_1"}], None)])++ _rows(_source("destinations", _make_manager(), api_version=api_version))++ assert session.prepare_request.call_args.args[0].url == f"https://api.hookdeck.com/{api_version}/destinations"@pytest.mark.parametrize("endpoint", sorted(HOOKDECK_ENDPOINTS))def test_every_request_pins_ascending_order(self, endpoint: str) -> None:@@ -180,17 +192,18 @@ class TestHookdeckTransport:class TestHookdeckCredentials:@pytest.mark.parametrize("status_code, expected", [(200, True), (401, False), (403, False), (500, False)])+ @pytest.mark.parametrize("api_version", SUPPORTED_VERSIONS)@mock.patch(HOOKDECK_SESSION_PATCH)- def test_status_mapping(self, mock_session_factory, status_code: int, expected: bool) -> None:+ def test_status_mapping(self, mock_session_factory, api_version: str, status_code: int, expected: bool) -> None:mock_session_factory.return_value.get.return_value = mock.MagicMock(status_code=status_code)- is_valid, status = validate_credentials("hd_key", API_VERSION)+ is_valid, status = validate_credentials("hd_key", api_version)assert is_valid is expectedassert status == status_codecall = mock_session_factory.return_value.get.call_args- assert call.args[0] == f"https://api.hookdeck.com/{API_VERSION}/sources?limit=1"+ assert call.args[0] == f"https://api.hookdeck.com/{api_version}/sources?limit=1"assert call.kwargs["headers"]["Authorization"] == "Bearer hd_key"@mock.patch(HOOKDECK_SESSION_PATCH)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hookdeck/tests/test_hookdeck_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hookdeck/tests/test_hookdeck_source.pyindex 5b001a8542ad..cf9681b082a8 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hookdeck/tests/test_hookdeck_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hookdeck/tests/test_hookdeck_source.py@@ -117,7 +117,14 @@ class TestHookdeckSource:mock_validate.return_value = probe_resultassert self.source.validate_credentials(self.config, self.team_id, schema_name=schema_name) == expected- mock_validate.assert_called_once_with("hd_test_key", "2025-07-01")+ mock_validate.assert_called_once_with("hd_test_key", "2026-09-01")++ @pytest.mark.parametrize("pinned", ["2025-07-01", "2026-09-01"])+ @mock.patch(f"{SOURCE_MODULE}.validate_hookdeck_credentials", return_value=(True, 200))+ def test_validate_credentials_probes_under_the_pinned_version(self, mock_validate, pinned) -> None:+ self.source.validate_credentials(self.config, self.team_id, api_version=pinned)++ mock_validate.assert_called_once_with("hd_test_key", pinned)@mock.patch(f"{SOURCE_MODULE}.hookdeck_source")def test_source_for_pipeline_plumbs_arguments(self, mock_hookdeck_source) -> None:@@ -139,7 +146,15 @@ class TestHookdeckSource:assert kwargs["db_incremental_field_last_value"] == "2026-01-01T00:00:00.000Z"assert kwargs["incremental_field"] == "last_seen_at"- @pytest.mark.parametrize("pinned, expected", [(None, "2025-07-01"), ("2025-01-01", "2025-01-01")])+ @pytest.mark.parametrize(+ "pinned, expected",+ [+ (None, "2026-09-01"),+ ("2025-07-01", "2025-07-01"),+ ("2026-09-01", "2026-09-01"),+ ("2025-01-01", "2025-01-01"),+ ],+ )@mock.patch(f"{SOURCE_MODULE}.hookdeck_source")def test_source_for_pipeline_resolves_the_api_version(self, mock_hookdeck_source, pinned, expected) -> None:self.source.source_for_pipeline(self.config, mock.MagicMock(), _make_inputs(api_version=pinned))