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.

chore(data-warehouse): require new sources to target the vendor's latest API version (#75375)

Tom Owers3e8776e5d675
diff --git a/.agents/skills/implementing-warehouse-sources/SKILL.md b/.agents/skills/implementing-warehouse-sources/SKILL.md
index fcfb145b5dea..36320feba32b 100644
--- a/.agents/skills/implementing-warehouse-sources/SKILL.md
+++ b/.agents/skills/implementing-warehouse-sources/SKILL.md
@@ -79,7 +79,7 @@ Follow this order. Each step maps to TODOs in `source.template`.
- Airbyte: <https://airbyte.com/connectors> (connector pages often link to source code — useful reference)
- Fivetran: <https://www.fivetran.com/connectors>
- Stitch: <https://www.stitchdata.com/docs/integrations/>
- Find the official API docs or OpenAPI spec. Make sure it's the current version, not a deprecated one.
+ Find the official API docs or OpenAPI spec, and **work out the vendor's latest generally-available API version before you write any request code** — that is the version the source must be built against. Check the vendor's changelog, versioning, or deprecation page, not just whichever page ranked first; docs sites routinely default to an older version, and Airbyte/Fivetran connectors are often years behind. See "Vendor API version metadata" for what counts as latest and what to do when the newest channel isn't GA.
2. **Bootstrap the source.** Copy the template and wire up the enum/type references:
```sh
@@ -306,9 +306,24 @@ Two cases:
api_docs_url = "https://vendor.example/docs/api" # API reference or changelog page (https, not the marketing site)
```
- Pin **the version the source's own code actually calls** (the base URL path, a version header, or a version
- constant in `settings.py` / `{source}.py`) — not the vendor's newest version. Examples already in the tree:
- GitHub `("2022-11-28",)` (dated header), HubSpot `("v3",)` (path), Klaviyo `("2024-10-15",)` (dated revision).
+ **Build the source against the vendor's latest generally-available version, and pin that.** A new source starts
+ on one version and every customer who connects it lands there, so shipping on an older version means shipping a
+ migration someone has to run later. Two rules, and they must agree:
+
+ 1. Write the request code against the newest GA version the vendor offers.
+ 2. Declare **the version that code actually calls** (the base URL path, a version header, or a version constant
+ in `settings.py` / `{source}.py`). Never declare a version the code doesn't send — that pin is a lie the
+ framework can't detect, and it makes the deprecation warnings and the upgrade path wrong for every customer.
+
+ If you can't reach the newest version — it's preview/beta/unstable/RC, it's gated behind an application or a
+ paid tier, or its response shapes aren't implemented yet — build against the newest GA version you can actually
+ call, pin that, and say why in a comment on the class. "Latest" means latest stable: don't pin Shopify's
+ `unstable`, a vendor's `-rc` channel, or a version whose docs are still marked preview.
+
+ Examples already in the tree: Anthropic `("2023-06-01",)` (dated `anthropic-version` header),
+ ActiveCampaign `("v3",)` (`/api/3` path segment), Alguna `("2026-04-01",)` (dated version header).
+ A source that later gains a second version declares them oldest→newest — GitHub `("2022-11-28", "2026-03-10")`,
+ HubSpot `("v3", "2026-03")` — but that's the `/warehouse-source-new-version` skill's job, not this one.
- **The vendor has no meaningful API versioning** — set only `api_docs_url`; leave `supported_versions` /
`default_version` at the framework default (`("v1",)`, the `UNVERSIONED_API_VERSION` sentinel). A bare `/v1/`
@@ -318,6 +333,11 @@ Rules:
- `default_version` must equal the single entry in `supported_versions`, and `api_docs_url` must be `https://`.
- Use the vendor's exact version string; never invent one.
+- **Never ship a new source on a version the vendor has already deprecated or given a sunset date.** A brand-new
+ source with a `deprecated_versions` entry covering its only version is a bug — it means the source was written
+ against the wrong version. `test_source_versions.py` fails the build if `default_version` is deprecated.
+- Prefer an `api_docs_url` that points at the vendor's versioning/changelog page over a generic API landing page —
+ it's where the next version gets announced, and it's what the next person checks before repinning.
- Don't hardcode a fallback version in the transport/request layer — resolve it from the source class
(`self.resolve_api_version(inputs.api_version)`), which already falls back to `default_version`.
- Adding support for a **new** vendor version later, or **deprecating** an old one, is the