: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 LinkedIn Ads API version 202609 (#101527)
Tom Owers53248a8c99ce
diff --git a/.agents/skills/warehouse-source-new-version/SKILL.md b/.agents/skills/warehouse-source-new-version/SKILL.mdindex 1407f99c07fe..bcaf9cbefab4 100644--- a/.agents/skills/warehouse-source-new-version/SKILL.md+++ b/.agents/skills/warehouse-source-new-version/SKILL.md@@ -86,6 +86,7 @@ version sunset - confirm the version itself stops being served before deprecatin- A source's per-endpoint URL versions (a hardcoded `/v2/...`, `/v3/...` in the endpoint config) are independent of the framework's source-level version label. A source may already call the vendor's newest per-resource routes while still carrying the `UNVERSIONED_API_VERSION` default — so a version-add can be correct as declaration-only even when the vendor's own version numbers look far apart. Diff what the source actually requests, not the vendor's headline version.- When a vendor selects versions with a per-endpoint query param and _requires_ it on some endpoints regardless of version, those endpoints must send the selector under every pin, the legacy one included — they are version-independent even though the selector value matches the new label, and gating them on the resolved pin breaks the old pin. Gate on the pin only endpoints where the selector is optional and merely enriches the response (extra fields under the new version); those are the genuine divergence.- A change the vendor calls "breaking" (e.g. resource ids migrating int→string) still needs no per-version branch when the source only passes the affected values through opaquely — a primary key whose _column name_ is stable (type auto-inferred), cursors forwarded verbatim. The version still has to exist (the gate passed on a real divergence), but branch the request path only where the change hits a surface you hardcode: column hints, a parsed cursor, a typed primary key.+- A new version that only widens an accepted enum on a resource the source reads (an extra breakdown/pivot value, a new status) clears the gate — the label is a real divergence and a request input — but it needs no request branch while the source keeps requesting the existing values, and the table that would expose the new value is a separate feature, not part of the bump.- A version bump often changes **webhook payloads** too — if the source is a `WebhookSource`, check whether webhook-created clients (created at source-setup time, not sync time) also need the version and whether existing webhook subscriptions must be updated.- Credential-validation paths (`validate_credentials`, permission probes) run at creation time with no row pin; they may use the default/legacy version. Changing them is optional per version bump — verify the vendor accepts the validation calls under the new version before switching them.- A passing credential probe is not evidence sync works — the probe hits one endpoint, `get_rows` hits the rest; when they diverge per version, the probe passes while every table 404s.diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/source.pyindex 042cd2caff87..e1b926e5d2c8 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/source.py@@ -51,6 +51,7 @@ from .linkedin_ads import (LINKEDIN_ADS_VERSION_202606 = "202606"LINKEDIN_ADS_VERSION_202607 = "202607"LINKEDIN_ADS_VERSION_202608 = "202608"+LINKEDIN_ADS_VERSION_202609 = "202609"# Opaque source version label -> LinkedIn API version header. The legacy `v1` pin keeps sending the# header it always has (`API_VERSION`), so existing syncs are byte-for-byte unchanged.@@ -59,6 +60,7 @@ _API_HEADER_BY_VERSION = {LINKEDIN_ADS_VERSION_202606: LINKEDIN_ADS_VERSION_202606,LINKEDIN_ADS_VERSION_202607: LINKEDIN_ADS_VERSION_202607,LINKEDIN_ADS_VERSION_202608: LINKEDIN_ADS_VERSION_202608,+ LINKEDIN_ADS_VERSION_202609: LINKEDIN_ADS_VERSION_202609,}@@ -71,8 +73,9 @@ class LinkedInAdsSource(ResumableSource[LinkedinAdsSourceConfig, LinkedInAdsResuLINKEDIN_ADS_VERSION_202606,LINKEDIN_ADS_VERSION_202607,LINKEDIN_ADS_VERSION_202608,+ LINKEDIN_ADS_VERSION_202609,)- default_version = LINKEDIN_ADS_VERSION_202608+ default_version = LINKEDIN_ADS_VERSION_202609# LinkedIn supports each version for a minimum of one year, then starts rejecting it with a 426# `NONEXISTENT_VERSION` (see `get_non_retryable_errors`). The legacy `v1` pin sends the header it# always has (202508, August 2025 — `_API_HEADER_BY_VERSION`), which reached that one-year mark;diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/tests/test_linkedin_client.py b/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/tests/test_linkedin_client.pyindex 2c486654a08b..d3d119343424 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/tests/test_linkedin_client.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/tests/test_linkedin_client.py@@ -46,7 +46,7 @@ class TestLinkedinAdsClient:assert result == [{"id": "123", "name": "Test Account"}]mock_client_instance.finder.assert_called_once()- @pytest.mark.parametrize("api_version", ["202508", "202606", "202607", "202608"])+ @pytest.mark.parametrize("api_version", ["202508", "202606", "202607", "202608", "202609"])@mock.patch("products.warehouse_sources.backend.temporal.data_imports.sources.linkedin_ads.client.RestliClient")def test_request_sends_configured_api_version(self, mock_restli_client, api_version):"""The configured version must reach the Restli `version_string`, else every request hitsdiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/tests/test_linkedin_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/tests/test_linkedin_source.pyindex 97544fd4d788..726af7a7141e 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/tests/test_linkedin_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/linkedin_ads/tests/test_linkedin_source.py@@ -13,6 +13,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.linkedin_aLINKEDIN_ADS_VERSION_202606,LINKEDIN_ADS_VERSION_202607,LINKEDIN_ADS_VERSION_202608,+ LINKEDIN_ADS_VERSION_202609,LinkedInAdsSource,)@@ -82,19 +83,20 @@ class TestLinkedInAdsSource:retryable_errors = self.source.get_retryable_errors()assert not any(pattern in other_error for pattern in retryable_errors)- def test_defaults_new_sources_to_202608(self):- assert self.source.default_version == LINKEDIN_ADS_VERSION_202608+ def test_defaults_new_sources_to_202609(self):+ assert self.source.default_version == LINKEDIN_ADS_VERSION_202609assert set(self.source.supported_versions) == {"v1",LINKEDIN_ADS_VERSION_202606,LINKEDIN_ADS_VERSION_202607,LINKEDIN_ADS_VERSION_202608,+ LINKEDIN_ADS_VERSION_202609,}def test_deprecated_versions_carry_sunset_dates(self):# "v1" backs the sunset 202508 header (see client.API_VERSION); 202606 sunsets 2027-06-15.# The in-product deprecation banner depends on this metadata staying declared, and the default- # (202608) must never appear here.+ # (202609) must never appear here.assert self.source.deprecated_versions == (VersionDeprecation(version="v1", sunset_at=date(2026, 8, 1)),VersionDeprecation(version=LINKEDIN_ADS_VERSION_202606, sunset_at=date(2027, 6, 15)),@@ -110,8 +112,9 @@ class TestLinkedInAdsSource:(LINKEDIN_ADS_VERSION_202606, "202606"),(LINKEDIN_ADS_VERSION_202607, "202607"),(LINKEDIN_ADS_VERSION_202608, "202608"),+ (LINKEDIN_ADS_VERSION_202609, "202609"),# No pin resolves to the new default.- (None, "202608"),+ (None, "202609"),# An undeclared pin is honored verbatim and passed straight through for LinkedIn to validate.("209901", "209901"),],@@ -140,7 +143,7 @@ class TestLinkedInAdsSource:self.source.get_oauth_accounts(integration_id=456, team_id=self.team_id)- assert mock_client_for_integration.call_args.kwargs["api_version"] == "202608"+ assert mock_client_for_integration.call_args.kwargs["api_version"] == "202609"def test_demographic_breakdowns_are_offered_but_not_enabled_by_default(self):# These fan out to one row per day per demographic value on top of the performance tables,