: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(cloudflare): skip zones where the legacy firewall rules api is gone (#113255)
Tom Owersad3224fd7f15
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/cloudflare/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/cloudflare/settings.pyindex e7ce884d55fb..a9dfc9a09977 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/cloudflare/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/cloudflare/settings.py@@ -69,20 +69,21 @@ CLOUDFLARE_ENDPOINTS: dict[str, CloudflareEndpointConfig] = {# --- Zone-scoped security configuration ---# Cloudflare deprecated the legacy Firewall Rules API (and the Filters API its rules# reference) in favor of the Ruleset Engine; a zone that has moved to WAF custom rules- # gets a 400 on both rather than an empty list. Same shape as `rate_limits` below.+ # gets a 400 on both rather than an empty list, and a zone where the API is retired+ # gets a 410 Gone. Same shape as `rate_limits` below."firewall_rules": CloudflareEndpointConfig(name="firewall_rules",path="/zones/{zone_id}/firewall/rules",parent=ZONES_PARENT,parent_key="_zone_id",- extra_skip_status_codes=(400,),+ extra_skip_status_codes=(400, 410),),"filters": CloudflareEndpointConfig(name="filters",path="/zones/{zone_id}/filters",parent=ZONES_PARENT,parent_key="_zone_id",- extra_skip_status_codes=(400,),+ extra_skip_status_codes=(400, 410),),"rulesets": CloudflareEndpointConfig(name="rulesets",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/cloudflare/tests/test_cloudflare_client.py b/products/warehouse_sources/backend/temporal/data_imports/sources/cloudflare/tests/test_cloudflare_client.pyindex 14e1f43fc226..7f68863bb5c0 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/cloudflare/tests/test_cloudflare_client.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/cloudflare/tests/test_cloudflare_client.py@@ -327,7 +327,9 @@ class TestZoneFanout:("rate_limits", 410),("custom_certificates", 400),("firewall_rules", 400),+ ("firewall_rules", 410),("filters", 400),+ ("filters", 410),("pagerules", 400),],)@@ -335,7 +337,8 @@ class TestZoneFanout:def test_skips_zone_missing_plan_feature_and_continues(self, MockSession, endpoint, status_code) -> None:# Cloudflare returns a non-403/404 error when a zone's plan doesn't include a# feature, or when it has moved off a deprecated API (legacy rate limiting is- # 410 Gone, custom certs, page rules and the legacy firewall rules/filters are 400), rather+ # 410 Gone, custom certs and page rules are 400, the legacy firewall rules/filters are 400+ # or 410), rather# than an empty list — one such zone must not abort the whole stream.session = MockSession.return_value_wire(