: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
fix(cdp): exclude v18 from google ads version-bump migration (#75708)
Daniel Marchukdef52deb6414
diff --git a/posthog/management/commands/test/test_update_hog_function_code.py b/posthog/management/commands/test/test_update_hog_function_code.pyindex 54af42076c5b..1411664158a7 100644--- a/posthog/management/commands/test/test_update_hog_function_code.py+++ b/posthog/management/commands/test/test_update_hog_function_code.py@@ -189,9 +189,7 @@ class TestUpdateHogFunctionCode(BaseTest):self.assertIn("Update completed", output)@patch("posthog.management.commands.update_hog_function_code.compile_hog")- def test_update_google_ads_api_version_bumps_whole_stale_range(self, mock_compile_hog):- """Google Ads uses a multi-version replacement range; destinations on different stale- versions (v18, v21) must all land on v24, and a v24 one is left untouched."""+ def test_update_google_ads_api_version_bumps_v19_to_v23_and_excludes_v18(self, mock_compile_hog):mock_compile_hog.return_value = "compiled_bytecode"base = ("let res := fetch(f'https://googleads.googleapis.com/{version}/customers/1:uploadClickConversions', {{}})"@@ -205,6 +203,14 @@ class TestUpdateHogFunctionCode(BaseTest):hog=base.replace("{version}", "v18"),enabled=True,)+ g_v19 = HogFunction.objects.create(+ team=self.team,+ name="G v19",+ type="destination",+ template_id="template-google-ads",+ hog=base.replace("{version}", "v19"),+ enabled=True,+ )g_v21 = HogFunction.objects.create(team=self.team,name="G v21",@@ -226,14 +232,17 @@ class TestUpdateHogFunctionCode(BaseTest):call_command("update_hog_function_code", replace_key="google-ads-api-version-update", stdout=out)g_v18.refresh_from_db()+ g_v19.refresh_from_db()g_v21.refresh_from_db()g_v24.refresh_from_db()- assert "googleads.googleapis.com/v24/" in g_v18.hog and "/v18/" not in g_v18.hog+ # v18 is deliberately excluded: Google already removed it, so bumping would revive dead destinations+ assert g_v18.hog == base.replace("{version}", "v18")+ assert "googleads.googleapis.com/v24/" in g_v19.hog and "/v19/" not in g_v19.hogassert "googleads.googleapis.com/v24/" in g_v21.hog and "/v21/" not in g_v21.hogassert g_v24.hog == base.replace("{version}", "v24") # unchangedoutput = out.getvalue()- self.assertIn("Found 3 destinations to process", output)+ self.assertIn("Found 4 destinations to process", output)self.assertIn("Updated: 2", output)@patch("posthog.management.commands.update_hog_function_code.compile_hog")diff --git a/posthog/management/commands/update_hog_function_code.py b/posthog/management/commands/update_hog_function_code.pyindex f9ec6a7865bb..32b63cf7cb3e 100644--- a/posthog/management/commands/update_hog_function_code.py+++ b/posthog/management/commands/update_hog_function_code.py@@ -61,15 +61,18 @@ class Command(BaseCommand):},],},- # Google Ads API v21 sunsets 2026-08-05 (VERSION_SUNSET). Bump the pinned version in- # existing destinations to v24 (current major, sunsets ~2027-05). Covers the whole stale- # range v18-v23 since destinations carry whatever version the template pinned when created;- # only one matches per destination, and a v24 no-op is skipped.+ # Google Ads API v21 sunsets 2026-08-05 (VERSION_SUNSET). Bump v19-v23 destinations to v24+ # so the v21 majority keeps working past the sunset. v18 is deliberately excluded: Google+ # has already removed it, so those destinations 404 today; bumping them would abruptly+ # revive dormant-but-enabled dead destinations and resume conversions into customers'+ # Google Ads accounts without warning. Reviving v18 (and older v17) destinations is handled+ # separately with customer awareness. Destinations carry whatever version the template+ # pinned at creation; only one matches per destination, and a v24 no-op is skipped."google-ads-api-version-update": {"template_id": "template-google-ads","replacements": [{"from_string": f"googleads.googleapis.com/v{v}/", "to_string": "googleads.googleapis.com/v24/"}- for v in range(18, 24)+ for v in range(19, 24)],},# Microsoft migrated Teams/Power Automate HTTP triggers to environment.api.powerplatform.com.