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.

fix(checkout_com): stop tracking transient payments-search 503s as bugs (#80212)

Tom Owers95c39a892892
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/checkout_com/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/checkout_com/source.py
index 07a0faee579c..124ba1c866cc 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/checkout_com/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/checkout_com/source.py
@@ -130,6 +130,18 @@ class CheckoutComSource(ResumableSource[CheckoutComSourceConfig, CheckoutComResu
)
return errors
+ def get_retryable_errors(self) -> set[str]:
+ # `/payments/search` has no internal retry wrapper — the shared session's retry adapter only
+ # covers GET/HEAD/OPTIONS, since POSTs aren't safe to blindly retry in general — but a search
+ # request has no side effects, so a 503 here is a transient upstream blip, not a bug. Temporal
+ # retries the whole activity, so this stays out of tracked exception noise. Matched on the full
+ # status+reason phrase (not just "for url: .../payments/search") so a 4xx on the same endpoint —
+ # which would be a real bug, e.g. a malformed request body — is never swallowed the same way.
+ return {
+ "503 Server Error: Service Unavailable for url: https://api.checkout.com/payments/search",
+ "503 Server Error: Service Unavailable for url: https://api.sandbox.checkout.com/payments/search",
+ }
+
@property
def get_source_config(self) -> SourceConfig:
return SourceConfig(
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/checkout_com/tests/test_checkout_com_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/checkout_com/tests/test_checkout_com_source.py
index 8777edd796b9..1979382a75d1 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/checkout_com/tests/test_checkout_com_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/checkout_com/tests/test_checkout_com_source.py
@@ -94,6 +94,32 @@ class TestCheckoutComSource:
non_retryable_errors = self.source.get_non_retryable_errors()
assert not any(key in other_error for key in non_retryable_errors)
+ @pytest.mark.parametrize(
+ "observed_error",
+ [
+ "503 Server Error: Service Unavailable for url: https://api.checkout.com/payments/search",
+ "503 Server Error: Service Unavailable for url: https://api.sandbox.checkout.com/payments/search",
+ ],
+ )
+ def test_retryable_errors_match_payments_search_503(self, observed_error):
+ retryable_errors = self.source.get_retryable_errors()
+ assert any(key in observed_error for key in retryable_errors)
+
+ @pytest.mark.parametrize(
+ "other_error",
+ [
+ # A 5xx from a different (potentially non-idempotent) endpoint must stay untouched.
+ "503 Server Error: Service Unavailable for url: https://api.checkout.com/payments/pay_1/actions",
+ "503 Server Error: Service Unavailable for url: https://api.checkout.com/reports",
+ # A 4xx on the search endpoint itself is a real bug (e.g. a malformed request), not a
+ # transient blip, and must not be classified as retryable.
+ "400 Client Error: Bad Request for url: https://api.checkout.com/payments/search",
+ ],
+ )
+ def test_retryable_errors_does_not_match_other_endpoints(self, other_error):
+ retryable_errors = self.source.get_retryable_errors()
+ assert not any(key in other_error for key in retryable_errors)
+
@mock.patch(DISCOVER_PATCH)
def test_get_schemas_static_catalog(self, mock_discover):
mock_discover.return_value = {}