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.

feat(warehouse_sources): deprecate teamtailor api version 20240404 (#119189)

Tom Owers2e938f1ad210
diff --git a/.agents/skills/warehouse-source-new-version/SKILL.md b/.agents/skills/warehouse-source-new-version/SKILL.md
index 61654b1da02b..b97af1508259 100644
--- a/.agents/skills/warehouse-source-new-version/SKILL.md
+++ b/.agents/skills/warehouse-source-new-version/SKILL.md
@@ -52,7 +52,7 @@ The opposite gap also occurs: a reference rendered from one version-blind OpenAP
## Adding a new version, step by step
-1. **Read the vendor's changelog** (the source's `api_docs_url`) and list what changed between the currently supported version(s) and the new one: renamed/removed fields, changed pagination, new required headers, changed webhook payloads, or a field the source reads becoming opt-in behind a new query parameter (a field returned by default in the old version now empty unless requested — restore it by adding that parameter on the new version's request path). Verification is docs-only — there are no stored credentials and no live-sync harness, so the docs are the sole source of truth for what each version serves. When the vendor's docs page renders client-side and comes back as an empty shell, read its machine-readable mirror (an `llms.txt`, a `sitemap.md`, or the same path with a `.md` suffix) rather than treating the version as undocumented. The reverse also happens: a `.md` mirror can be a stub that links to a spec without the endpoint, while the rendered HTML page carries the full request line and schema, so read the HTML before concluding the docs are missing. When the vendor publishes only one version-blind spec for the current version and no changelog, diff it against an archived copy (the Wayback Machine's CDX index lists snapshots; the `id_` form returns the raw file, sometimes still gzip-encoded) and check which label that copy names: differences it shows span every version between that copy and now, so do not attribute them to the new label alone. For a GraphQL vendor that serves a schema per version, validate the source's exact query strings against each version's SDL (for example with `graphql-core`'s `validate`): it names every removed field a query selects, and it settles changelog entries that only say a removal is "planned". This is also the evidence the gate above runs on.
+1. **Read the vendor's changelog** (the source's `api_docs_url`) and list what changed between the currently supported version(s) and the new one: renamed/removed fields, changed pagination, new required headers, changed webhook payloads, or a field the source reads becoming opt-in behind a new query parameter (a field returned by default in the old version now empty unless requested — restore it by adding that parameter on the new version's request path). Verification is docs-only — there are no stored credentials and no live-sync harness, so the docs are the sole source of truth for what each version serves. When the vendor's docs page renders client-side and comes back as an empty shell, read its machine-readable mirror (an `llms.txt`, a `sitemap.md`, or the same path with a `.md` suffix) rather than treating the version as undocumented. A Postman-published docs site carries `ownerId` and `publishedId` meta tags; `https://documenter.gw.postman.com/api/collections/<ownerId>/<publishedId>?versionTag=latest` returns the whole collection as JSON, changelog included in `info.description`. The reverse also happens: a `.md` mirror can be a stub that links to a spec without the endpoint, while the rendered HTML page carries the full request line and schema, so read the HTML before concluding the docs are missing. When the vendor publishes only one version-blind spec for the current version and no changelog, diff it against an archived copy (the Wayback Machine's CDX index lists snapshots; the `id_` form returns the raw file, sometimes still gzip-encoded) and check which label that copy names: differences it shows span every version between that copy and now, so do not attribute them to the new label alone. For a GraphQL vendor that serves a schema per version, validate the source's exact query strings against each version's SDL (for example with `graphql-core`'s `validate`): it names every removed field a query selects, and it settles changelog entries that only say a removal is "planned". This is also the evidence the gate above runs on.
2. **Declare the version** (only once the gate says the version has to exist): add the new label to `supported_versions` and flip `default_version` to it — new sources always start on the newest stable version. A pinned row's **sync** path is unaffected by a default flip (that is the point of pinning), but two things still follow the new default: discovery/`get_schemas` if the pin isn't threaded there (step 3), and any row whose `api_version` is NULL. Reference the request layer's version constants instead of duplicating string literals.
3. **Dispatch on `SourceInputs.api_version`** at the request layer:
- Keep it minimal. If the version is just a header/URL segment and response shapes are compatible, thread the version string down to where the client/URL is built (see Stripe: `StripeSource.source_for_pipeline` passes `self.resolve_api_version(inputs.api_version)` → `stripe_source(...)` → `StripeClient(stripe_version=...)`). Resolve through `resolve_api_version` at the source class — never hardcode a fallback version in the request layer.
diff --git a/products/warehouse_sources/backend/migrations/0187_repin_teamtailor_api_version.py b/products/warehouse_sources/backend/migrations/0187_repin_teamtailor_api_version.py
new file mode 100644
index 000000000000..f9fae5d34fad
--- /dev/null
+++ b/products/warehouse_sources/backend/migrations/0187_repin_teamtailor_api_version.py
@@ -0,0 +1,41 @@
+from django.db import migrations
+
+# Teamtailor's changelog entry of 2025-10-01 requires `X-Api-Version: 20240904` on every request, so
+# "20240404" is no longer served. This repins source-level pins from "20240404" to "20240904" (the
+# current default).
+#
+# No data or schema transform accompanies the repin. Both versions call the same `/v1` list paths
+# with the same JSON:API cursor pagination, and only the `X-Api-Version` header differs. The one
+# breaking change in "20240904" reshapes the notes listing, which this source does not read. Every
+# Teamtailor table is full refresh, so each rebuilds on its next sync.
+TEAMTAILOR_SOURCE_TYPE = "Teamtailor"
+TEAMTAILOR_API_VERSION_20240404 = "20240404"
+TEAMTAILOR_API_VERSION_20240904 = "20240904"
+
+
+def repin_teamtailor_20240404_to_20240904(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 source's `default_version` ("20240904"), so they need no
+ # update. Matching only `api_version="20240404"` keeps this idempotent: a second run matches
+ # nothing.
+ ExternalDataSource.objects.filter(
+ source_type=TEAMTAILOR_SOURCE_TYPE, api_version=TEAMTAILOR_API_VERSION_20240404
+ ).update(api_version=TEAMTAILOR_API_VERSION_20240904)
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("warehouse_sources", "0186_pin_whop_api_version_2025_01_01"),
+ ]
+
+ operations = [
+ # Reverse is a no-op: once repinned, "20240904" rows are indistinguishable from
+ # natively-created ones, so a blanket downgrade would clobber legitimate "20240904" pins
+ # and move customers back onto the retired version.
+ migrations.RunPython(repin_teamtailor_20240404_to_20240904, migrations.RunPython.noop, elidable=True),
+ ]
diff --git a/products/warehouse_sources/backend/migrations/max_migration.txt b/products/warehouse_sources/backend/migrations/max_migration.txt
index 6b0c0cff4164..238fb1f3f85b 100644
--- a/products/warehouse_sources/backend/migrations/max_migration.txt
+++ b/products/warehouse_sources/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0186_pin_whop_api_version_2025_01_01
+0187_repin_teamtailor_api_version
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/source.py
index c78eec993cb5..471c9166be4b 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/source.py
@@ -1,3 +1,4 @@
+from datetime import date
from typing import Optional, cast
from products.warehouse_sources.backend.facade.codebase_detection import detect
@@ -8,7 +9,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,
)
@@ -28,6 +33,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.teamtailor
TEAMTAILOR_ENDPOINTS,
)
from products.warehouse_sources.backend.temporal.data_imports.sources.teamtailor.teamtailor import (
+ API_VERSION_20240404,
DEFAULT_API_VERSION,
SUPPORTED_API_VERSIONS,
TeamtailorResumeConfig,
@@ -44,6 +50,8 @@ class TeamtailorSource(ResumableSource[TeamtailorSourceConfig, TeamtailorResumeC
supported_versions = SUPPORTED_API_VERSIONS
default_version = DEFAULT_API_VERSION
api_docs_url = "https://docs.teamtailor.com"
+ # Teamtailor's changelog entry of 2025-10-01 requires `X-Api-Version: 20240904` on every request.
+ deprecated_versions = (VersionDeprecation(version=API_VERSION_20240404, sunset_at=date(2025, 10, 1)),)
lists_tables_without_credentials = True # static endpoint catalog — safe for public docs
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/tests/test_teamtailor_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/tests/test_teamtailor_source.py
index 17b6e7edae02..0fc9ad0d4c8c 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/tests/test_teamtailor_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/tests/test_teamtailor_source.py
@@ -1,3 +1,5 @@
+from datetime import date
+
from unittest import mock
from parameterized import parameterized
@@ -49,6 +51,11 @@ class TestTeamtailorSource:
assert self.source.supported_versions == (API_VERSION_20240404, API_VERSION_20240904)
assert self.source.default_version == API_VERSION_20240904
+ def test_legacy_version_is_deprecated_with_the_vendor_sunset_date(self) -> None:
+ deprecation = self.source.get_version_deprecation(API_VERSION_20240404)
+ assert deprecation is not None and deprecation.sunset_at == date(2025, 10, 1)
+ assert self.source.get_version_deprecation(API_VERSION_20240904) is None
+
@parameterized.expand(
[
("no_pin_uses_default", None, API_VERSION_20240904),