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(warehouse-sources): stop reporting exhausted wordpress retries to error tracking (#82948)

Tom Owers4efc90d34984
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/wordpress/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/wordpress/source.py
index ebbb4b6fc982..741ad89de91a 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/wordpress/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/wordpress/source.py
@@ -114,6 +114,12 @@ To sync private content or authenticate, create an [Application Password](https:
"CertificateError": "The WordPress site's TLS certificate doesn't match its domain. This is often caused by a hosting platform's default certificate not covering a custom domain. Ask your hosting provider to install a certificate for this domain, then try again.",
}
+ def get_retryable_errors(self) -> set[str]:
+ # Raised by get_rows()'s fetch_page for a 429/5xx response, only once its own tenacity
+ # retry budget (5 attempts with backoff) is already exhausted. The status code and URL
+ # that follow are variable, so match the stable prefix only.
+ return {"WordPress API error (retryable):"}
+
def get_canonical_descriptions(self) -> CanonicalDescriptions:
from products.warehouse_sources.backend.temporal.data_imports.sources.wordpress.canonical_descriptions import (
CANONICAL_DESCRIPTIONS,
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/wordpress/tests/test_wordpress_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/wordpress/tests/test_wordpress_source.py
index 41eb4058d92b..b40c8d85198a 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/wordpress/tests/test_wordpress_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/wordpress/tests/test_wordpress_source.py
@@ -79,6 +79,16 @@ class TestWordpressSource:
matches = [friendly for key, friendly in errors.items() if key in raised]
assert matches and matches[0] is not None
+ @pytest.mark.parametrize("status_code", [429, 503])
+ def test_exhausted_retryable_error_message_matches_retryable_error(self, status_code):
+ # get_rows()'s fetch_page raises this once its own tenacity retry budget for a 429/5xx
+ # response is exhausted. The status code and URL that follow are variable, so the
+ # classifier must match on the stable prefix alone to keep this out of error tracking.
+ raised = (
+ f"WordPress API error (retryable): status={status_code}, url=https://example.com/wp-json/wp/v2/categories"
+ )
+ assert any(pattern.lower() in raised.lower() for pattern in self.source.get_retryable_errors())
+
def test_get_schemas_returns_all_endpoints(self):
schemas = self.source.get_schemas(self.config, self.team_id)
assert {s.name for s in schemas} == set(ENDPOINTS)