Skip to content

: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.

fix(warehouse_sources): make default_version the newest supported version (#74002)

Daniel RCf4bdf34445fe
diff --git a/.agents/skills/warehouse-source-new-version/SKILL.md b/.agents/skills/warehouse-source-new-version/SKILL.md
index 32323ec7512e..ee88779ffb90 100644
--- a/.agents/skills/warehouse-source-new-version/SKILL.md
+++ b/.agents/skills/warehouse-source-new-version/SKILL.md
@@ -105,3 +105,4 @@ After you finish a version-update or deprecation PR using this skill, **append w
- When the new version's credentials can't be derived from the old ones, there is no repin migration to write: an `api_version` UPDATE would point existing rows at credentials they don't have. Ship the `deprecated_versions` banner and document the manual re-credential path instead.
- Keep the schema/table name set identical across versions even when the vendor renames a collection (Harvest `scheduled_interviews` -> v3 `interviews`): put the rename in a per-version path on the endpoint config, so discovery diffs can't orphan a table on repin.
- Vendor OpenAPI is often embedded in the docs pages themselves (`/reference/get_v3-<resource>.md`, indexed by `llms.txt`) — parse it to confirm paths, filter params, response envelope, and id types for all endpoints at once instead of trusting a prose migration guide.
+- The registry invariant now enforces `default_version == supported_versions[-1]` (test_source_versions.py): declare versions oldest→newest and flip the default in the same PR — a held-back default fails CI, and `[-1]` is a trustworthy "latest" accessor.
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hubspot/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hubspot/source.py
index a5358b946916..46d38a2cdc71 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hubspot/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hubspot/source.py
@@ -53,10 +53,7 @@ class HubspotSourceOldConfig(config.Config):
@SourceRegistry.register
class HubspotSource(ResumableSource[HubspotSourceConfig | HubspotSourceOldConfig, HubspotResumeConfig], OAuthMixin):
supported_versions = (HUBSPOT_API_VERSION_V3, HUBSPOT_API_VERSION_2026_03)
- # 2026-03 is available for opt-in, but new sources stay on v3 until the date-versioned
- # objects/search/association-batch-read paths are confirmed against the live HubSpot API.
- # Flip the default once a real 2026-03 sync has been verified end to end.
- default_version = HUBSPOT_API_VERSION_V3
+ default_version = HUBSPOT_API_VERSION_2026_03
api_docs_url = "https://developers.hubspot.com/docs/api-reference/latest/overview"
lists_tables_without_credentials = True # static endpoint catalog — safe for public docs
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hubspot/test/test_source_routing.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hubspot/test/test_source_routing.py
index 785b9a6e9caf..9acffb3de811 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hubspot/test/test_source_routing.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hubspot/test/test_source_routing.py
@@ -279,13 +279,13 @@ def test_transient_http_error_is_retryable(error_msg: str) -> None:
class TestApiVersion:
- def test_defaults_to_v3_until_date_version_is_verified(self) -> None:
+ def test_defaults_to_latest_date_version(self) -> None:
src = HubspotSource()
- assert src.default_version == HUBSPOT_API_VERSION_V3
- # A source with no pin (a newly created one) resolves to the v3 default...
- assert src.resolve_api_version(None) == HUBSPOT_API_VERSION_V3
- # ...while a 2026-03 pin is honored verbatim so opt-in sources use the date version.
- assert src.resolve_api_version(HUBSPOT_API_VERSION_2026_03) == HUBSPOT_API_VERSION_2026_03
+ assert src.default_version == HUBSPOT_API_VERSION_2026_03
+ # A source with no pin (a newly created one) resolves to the 2026-03 default...
+ assert src.resolve_api_version(None) == HUBSPOT_API_VERSION_2026_03
+ # ...while a v3 pin is honored verbatim so existing sources stay on the legacy paths.
+ assert src.resolve_api_version(HUBSPOT_API_VERSION_V3) == HUBSPOT_API_VERSION_V3
def test_both_versions_supported(self) -> None:
assert set(HubspotSource().supported_versions) == {HUBSPOT_API_VERSION_V3, HUBSPOT_API_VERSION_2026_03}
@@ -317,7 +317,7 @@ class TestApiVersion:
@pytest.mark.parametrize(
"pin,expected",
[
- (None, HUBSPOT_API_VERSION_V3),
+ (None, HUBSPOT_API_VERSION_2026_03),
(HUBSPOT_API_VERSION_V3, HUBSPOT_API_VERSION_V3),
(HUBSPOT_API_VERSION_2026_03, HUBSPOT_API_VERSION_2026_03),
],
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/kustomer/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/kustomer/source.py
index 6524228367c8..fb09b9570a67 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/kustomer/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/kustomer/source.py
@@ -45,10 +45,8 @@ class KustomerSource(ResumableSource[KustomerSourceConfig, KustomerResumeConfig]
# for both — the "v2" docs toggle keeps these list endpoints at `/v1/`. So the
# version is a pin recorded on the source, not a request-layer branch: every
# version resolves to the same `/v1/<resource>` requests (see settings.py).
- # v2 stays declared-but-dormant and the default remains v1 until a `/v2/<resource>`
- # endpoint is confirmed to serve these resources, rather than 404.
supported_versions = ("v1", "v2")
- default_version = "v1"
+ default_version = "v2"
api_docs_url = "https://developer.kustomer.com"
lists_tables_without_credentials = True # static endpoint catalog — safe for public docs
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/kustomer/tests/test_kustomer_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/kustomer/tests/test_kustomer_source.py
index 9e6f29ab575c..4686d71ad6aa 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/kustomer/tests/test_kustomer_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/kustomer/tests/test_kustomer_source.py
@@ -117,10 +117,10 @@ class TestKustomerSource:
assert isinstance(manager, ResumableSourceManager)
assert manager._data_class is KustomerResumeConfig
- def test_version_declaration_keeps_v1_default_with_v2_supported(self):
- # v2 is declared but dormant; new sources stay stamped v1 until a /v2/ path is confirmed live.
+ def test_version_declaration_defaults_to_v2_with_v1_supported(self):
+ # Both labels resolve to the same /v1/ requests, so the default tracks the newest label.
assert self.source.supported_versions == ("v1", "v2")
- assert self.source.default_version == "v1"
+ assert self.source.default_version == "v2"
assert self.source.deprecated_versions == ()
@mock.patch("products.warehouse_sources.backend.temporal.data_imports.sources.kustomer.source.kustomer_source")
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/tests/test_source_versions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/tests/test_source_versions.py
index b60ab94e125a..a96319fc229b 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/tests/test_source_versions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/tests/test_source_versions.py
@@ -26,6 +26,11 @@ def test_every_source_declares_valid_versions(source_type):
f"{source_type}: default_version {source.default_version!r} is not in supported_versions — "
f"a missing pin would resolve to a version the source does not implement"
)
+ assert source.default_version == source.supported_versions[-1], (
+ f"{source_type}: default_version {source.default_version!r} must be the newest supported version "
+ f"{source.supported_versions[-1]!r} — supported_versions is declared oldest→newest and the default "
+ f"is never held back (see .agents/skills/warehouse-source-new-version/SKILL.md)"
+ )
assert all(isinstance(d, VersionDeprecation) for d in source.deprecated_versions), (
f"{source_type}: deprecated_versions must contain VersionDeprecation entries"