: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(bing_ads): classify transient SOAP 400 as retryable (#76815)
Tom Owers9638458e712a
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/bing_ads/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/bing_ads/source.pyindex f38f0dec6793..8c2f3dc6dc4b 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/bing_ads/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/bing_ads/source.py@@ -143,6 +143,16 @@ class BingAdsSource(ResumableSource[BingAdsSourceConfig, BingAdsResumeConfig], O"Bing Ads OAuth application credentials not configured": None,}+ def get_retryable_errors(self) -> set[str]:+ # A Bing SOAP call that comes back with a bare HTTP 400 (no SOAP fault) is rejected at the+ # transport/edge layer, not by request validation — suds surfaces it as `Exception((400,+ # 'Bad Request'))`, which our wrapper re-raises as `ValueError(... Exception: (400, 'Bad+ # Request'))`. A genuinely malformed report request instead returns a coded WebFault+ # (InvalidReportColumn, etc.), so this shape is a transient upstream blip that Temporal's+ # activity retry clears — keep it out of error tracking as noise rather than paging as a bug.+ # Match the stable status tuple only; a fault-backed 400 never produces this substring.+ return {"(400, 'Bad Request')"}+@propertydef get_source_config(self) -> SourceConfig:return SourceConfig(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/bing_ads/tests/test_bing_ads_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/bing_ads/tests/test_bing_ads_source.pyindex 48b9eb07b401..ae8ec063c3eb 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/bing_ads/tests/test_bing_ads_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/bing_ads/tests/test_bing_ads_source.py@@ -5,6 +5,7 @@ from posthog.schema import ReleaseStatus, SourceFieldOauthAccountSelectConfig, Sfrom products.warehouse_sources.backend.temporal.data_imports.sources.bing_ads.source import BingAdsSourcefrom products.warehouse_sources.backend.temporal.data_imports.sources.bing_ads.utils import BingAdsResumeConfig+from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import error_message_matchesfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.resumable import ResumableSourceManagerfrom products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs.bingads import (BingAdsSourceConfig,@@ -391,6 +392,16 @@ class TestBingAdsSource:assert not any(pattern in transient_message for pattern in non_retryable_errors)+ def test_transient_bad_request_is_retryable_not_disabling(self):+ # A bare transport-level HTTP 400 on a Bing SOAP call (no coded WebFault) is a transient edge+ # rejection: it must be recognised as retryable (kept out of error tracking) and must NOT match+ # any non-retryable pattern, or a transient blip would disable the schema.+ error_message = "Failed to generate ad_performance_report report: Exception: (400, 'Bad Request')"++ # Assert through the same case-insensitive matcher production classification uses.+ assert error_message_matches(error_message, self.source.get_retryable_errors())+ assert not error_message_matches(error_message, self.source.get_non_retryable_errors())+def test_get_resumable_source_manager(self):"""Test that get_resumable_source_manager returns a manager that round-trips BingAdsResumeConfig."""inputs = mock.MagicMock()