: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): deprecate hookdeck API version 2025-07-01 (#113218)
Tom Owersbfbe91e632a5
diff --git a/.agents/skills/warehouse-source-new-version/SKILL.md b/.agents/skills/warehouse-source-new-version/SKILL.mdindex 866328a0fc21..020347717179 100644--- a/.agents/skills/warehouse-source-new-version/SKILL.md+++ b/.agents/skills/warehouse-source-new-version/SKILL.md@@ -71,7 +71,7 @@ The opposite gap also occurs: a reference rendered from one version-blind OpenAP1. Implement the newer version first (steps above) if not already supported. When the version being sunset is the vendor's **terminal** version (the whole product is discontinued and there is no successor to add), per-version deprecation cannot apply — the framework never deprecates a source's sole/default version, and there is no version to repin to. Don't fabricate a successor or relax the invariant to force the metadata: leave `supported_versions`/`default_version` unchanged, document the vendor sunset and the customer off-ramp (move off the source entirely before shutdown) in the PR, and surface whether a source-level whole-product deprecation surface is warranted for a human to decide.2. Add the old version to `deprecated_versions` with the vendor's announced sunset date (or `sunset_at=None` if none). When the vendor gives only a month ("supported until January 2027"), use the first day of that month: it is the earliest day the version can stop working, so the warning never comes after the vendor stops serving the version. Never deprecate `default_version` — flip the default to the new version in the same PR.3. The in-product warning banner and API fields light up automatically from the metadata — zero per-source UI work.-4. **Deprecated is not migrated.** Existing pins move only when the vendor has announced the version will stop being served (a sunset/removal date). A deprecation without a sunset date is advisory: mark it, leave every existing pin on it fully supported, and write no migration — repinning working customers off a version the vendor still serves is exactly the silent version move the pinning framework exists to prevent. Two narrow cases still repin under an advisory (`sunset_at=None`) deprecation: the deprecated label resolves to a byte-identical request as the new default (a pure alias — no per-version dispatch — so the repin is not a move), or the vendor already errors on the old version (e.g. `410`/`406`) so leaving pins is worse than moving them. A source that sends a per-version header/URL for a version the vendor still serves is neither — stay advisory.+4. **Deprecated is not migrated.** Existing pins move only when the vendor has announced the version will stop being served (a sunset/removal date). A deprecation without a sunset date is advisory: mark it, leave every existing pin on it fully supported, and write no migration — repinning working customers off a version the vendor still serves is exactly the silent version move the pinning framework exists to prevent. Two narrow cases still repin under an advisory (`sunset_at=None`) deprecation: the deprecated label resolves to a byte-identical request as the new default (a pure alias — no per-version dispatch — so the repin is not a move), or the vendor already errors on the old version (e.g. `410`/`406`) so leaving pins is worse than moving them. A source that sends a per-version header/URL for a version the vendor still serves is neither — stay advisory. A published fixed support window ("each dated version is supported for N months after release") is an announced sunset: compute `sunset_at` from it, even when that date has already passed, and repin. If the docs do not say how the API answers an expired version, add no rejection signature to `get_non_retryable_errors`.5. Only for a sunsetting version: include a **written-not-run** migration script that repins affected `ExternalDataSource` rows (`api_version` column) from the deprecated version to the new one, plus any safe data/schema transforms. It must be idempotent and reviewable, and its reverse must be a no-op — repinned rows are indistinguishable from natively-created ones, so a blanket downgrade would clobber legitimate native pins. Repin only rows explicitly on the deprecated version: when the default is already the target (you are deprecating an old label without flipping the default in this PR), do not also repin NULL pins — they already resolve to the current default, so touching them is redundant churn — and leave other still-served deprecated versions alone. Where migration is lossy or unsafe — including when the new version needs credentials that can't be derived from the stored ones — do not script it: document the manual path in the PR. When only a subset of rows is unsafe (the version diverges for one endpoint that needs a credential others don't), split the cohort: script the repin for the safe rows and exclude the unsafe ones by querying their schemas, documenting only that cohort as manual — don't drop the whole migration to manual because one endpoint can't move. Whether a column whose _type_ changes across the versions needs a transform is decided by the schema's sync type, not by the type change: a full-refresh schema drops its table before every sync, so the next run rebuilds it under the newly inferred types and the repin alone is enough, while a merge-based schema carries the old type forward and needs a `reset_pipeline` stamp (delta-rs cannot widen in place, and the automatic resync covers only safe numeric widenings). Do not execute migrations or backfills; humans review and run them.6. **Never touch `ExternalDataSchema.api_version` overrides** in migration scripts — they are user-managed by design. The schema-level deprecation warning covers them; the user migrates them from the schema's configuration page.diff --git a/products/warehouse_sources/backend/migrations/0177_repin_hookdeck_api_version.py b/products/warehouse_sources/backend/migrations/0177_repin_hookdeck_api_version.pynew file mode 100644index 000000000000..5fcbf97b1b2e--- /dev/null+++ b/products/warehouse_sources/backend/migrations/0177_repin_hookdeck_api_version.py@@ -0,0 +1,40 @@+from django.db import migrations++# Hookdeck supports each dated API version for one year after its release, so "2025-07-01" stopped+# being officially supported on 2026-07-01. This repins source-level pins from "2025-07-01" to+# "2026-09-01" (the current default).+#+# No data or schema transform accompanies the repin. The only difference between the versions is+# that a destination's `config.rate_limit` / `config.rate_limit_period` move to+# `config.delivery_policy.rate` / `.period`. That shape reaches only the `destinations` and+# `connections` tables, both full refresh, so the next scheduled sync drops each table and+# rebuilds it in the new shape.+HOOKDECK_SOURCE_TYPE = "Hookdeck"+HOOKDECK_API_VERSION_2025_07_01 = "2025-07-01"+HOOKDECK_API_VERSION_2026_09_01 = "2026-09-01"+++def repin_hookdeck_2025_07_01_to_2026_09_01(apps, schema_editor):+ ExternalDataSource = apps.get_model("warehouse_sources", "ExternalDataSource")++ # Source-level pin only. Schema-level `ExternalDataSchema.api_version` overrides are user-managed+ # (a customer intentionally pinned that schema) and are left alone. The schema-level deprecation+ # warning prompts the user to migrate those.+ #+ # NULL pins already resolve to the default ("2026-09-01"), so they need no update. Matching only+ # `api_version="2025-07-01"` keeps this idempotent: a second run matches nothing.+ ExternalDataSource.objects.filter(+ source_type=HOOKDECK_SOURCE_TYPE, api_version=HOOKDECK_API_VERSION_2025_07_01+ ).update(api_version=HOOKDECK_API_VERSION_2026_09_01)+++class Migration(migrations.Migration):+ dependencies = [+ ("warehouse_sources", "0176_repin_lightspeed_retail_api_version_2026_07"),+ ]++ operations = [+ # Reverse is a no-op: once repinned, "2026-09-01" rows are indistinguishable from+ # natively-created ones, so a blanket downgrade would clobber legitimate "2026-09-01" pins.+ migrations.RunPython(repin_hookdeck_2025_07_01_to_2026_09_01, migrations.RunPython.noop, elidable=True),+ ]diff --git a/products/warehouse_sources/backend/migrations/max_migration.txt b/products/warehouse_sources/backend/migrations/max_migration.txtindex 94a9f6bc2f0e..ef3396355239 100644--- a/products/warehouse_sources/backend/migrations/max_migration.txt+++ b/products/warehouse_sources/backend/migrations/max_migration.txt@@ -1 +1 @@-0176_repin_lightspeed_retail_api_version_2026_07+0177_repin_hookdeck_api_versiondiff --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 cfcabec96d91..29b9665788d7 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@@ -1,3 +1,4 @@+from datetime import datefrom typing import Optional, castfrom products.warehouse_sources.backend.facade.source_config import (@@ -7,7 +8,11 @@ from products.warehouse_sources.backend.facade.source_config import (SourceFieldInputConfig,SourceFieldInputConfigType,)-from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import FieldType, ResumableSource+from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import (+ FieldType,+ ResumableSource,+ VersionDeprecation,+)from products.warehouse_sources.backend.temporal.data_imports.sources.common.canonical_descriptions import (CanonicalDescriptions,)@@ -40,6 +45,8 @@ class HookdeckSource(ResumableSource[HookdeckSourceConfig, HookdeckResumeConfig]supported_versions = ("2025-07-01", "2026-09-01")default_version = "2026-09-01"api_docs_url = "https://hookdeck.com/docs/api"+ # Hookdeck supports each dated version for one year after its release.+ deprecated_versions = (VersionDeprecation(version="2025-07-01", sunset_at=date(2026, 7, 1)),)@propertydef source_type(self) -> ExternalDataSourceType: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 cf9681b082a8..713e088729c2 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@@ -1,3 +1,5 @@+from datetime import date+import pytestfrom unittest import mock@@ -168,3 +170,17 @@ class TestHookdeckSource:self.source.source_for_pipeline(self.config, mock.MagicMock(), inputs)assert mock_hookdeck_source.call_args.kwargs["db_incremental_field_last_value"] is None+++class TestHookdeckVersionDeprecation:+ def setup_method(self) -> None:+ self.source = HookdeckSource()++ def test_2025_07_01_is_deprecated_with_sunset_date(self) -> None:+ deprecation = self.source.get_version_deprecation("2025-07-01")+ assert deprecation is not None+ assert deprecation.sunset_at == date(2026, 7, 1)++ @pytest.mark.parametrize("version", ["2026-09-01", None])+ def test_current_version_is_not_deprecated(self, version: str | None) -> None:+ assert self.source.get_version_deprecation(version) is None