: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(auth0): classify exhausted 429 retries as self-recovering (#123412)
Tom Owersb7622c70e56c
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/auth0/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/auth0/source.pyindex 98bfba0e38ba..2bc2b315d501 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/auth0/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/auth0/source.py@@ -237,6 +237,12 @@ Use your canonical tenant domain (for example `your-tenant.us.auth0.com`), not aPAGINATION_STALLED_ERROR: "Auth0 could not page past its 1000-result limit because too many rows share the same timestamp.",}+ def get_retryable_errors(self) -> set[str]:+ # `fetch` (auth0.py) already retries 429 via the tracked session's BoundedRetry, honoring+ # Retry-After; if that budget still exhausts, Temporal retries the whole activity, so the+ # failure is self-recovering rather than a bug to page on.+ return {"429 Client Error"}+def get_canonical_descriptions(self) -> CanonicalDescriptions:from products.warehouse_sources.backend.temporal.data_imports.sources.auth0.canonical_descriptions import (CANONICAL_DESCRIPTIONS,diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/auth0/tests/test_auth0_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/auth0/tests/test_auth0_source.pyindex 1613bf55431f..4d563acf5885 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/auth0/tests/test_auth0_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/auth0/tests/test_auth0_source.py@@ -39,6 +39,12 @@ class TestAuth0Source:# preserved client secret would be sent there.assert self.source.connection_host_fields == ["auth0_domain"]+ def test_retryable_errors_match_rate_limit_raise(self) -> None:+ # The message `fetch` (auth0.py) re-raises once the tracked session's own 429 retries exhaust.+ observed_error = "429 Client Error: Too Many Requests for url: https://tenant.us.auth0.com/api/v2/logs?page=1"+ retryable_errors = self.source.get_retryable_errors()+ assert any(key in observed_error for key in retryable_errors)+@pytest.mark.parametrize("schema_name", [None, "users"])def test_validate_credentials_passes_the_config_through(self, schema_name: Optional[str]) -> None:with mock.patch(f"{SOURCE_MODULE}.validate_auth0_credentials", return_value=(True, None)) as mock_validate: