: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(luma): classify exhausted 429/5xx retries as self-recovering (#116108)
Tom Owers155ac0a46a0c
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/luma/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/luma/source.pyindex 1310a1b7d2bf..197a229b745b 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/luma/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/luma/source.py@@ -78,6 +78,12 @@ You can create an API key under **Settings → Developer** in [Luma](https://lum"403 Client Error: Forbidden for url: https://public-api.luma.com": "Your Luma API key does not have access to this data. Check the key's calendar or organization scope, then reconnect.",}+ def get_retryable_errors(self) -> set[str]:+ # 429/5xx are already retried in-process by `_fetch_page`'s tenacity backoff (see luma.py);+ # if that budget still exhausts, Temporal's activity retry picks it back up, so this is+ # self-recovering rather than a tracked-exception-worthy failure.+ return {"Luma API error (retryable): status=429", "Luma API error (retryable): status=5"}+def get_schemas(self,config: LumaSourceConfig,diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/luma/tests/test_luma_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/luma/tests/test_luma_source.pyindex 974eb9a55590..2adcbe8d5e97 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/luma/tests/test_luma_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/luma/tests/test_luma_source.py@@ -40,6 +40,25 @@ class TestLumaSource:non_retryable = self.source.get_non_retryable_errors()assert not any(key in unrelated_error for key in non_retryable)+ @parameterized.expand(+ [+ ("rate_limited", "Luma API error (retryable): status=429, path=/public/v1/calendar/list-events"),+ ("server_error", "Luma API error (retryable): status=500, path=/public/v1/event/get-guests"),+ ]+ )+ def test_retryable_errors_match_exhausted_backoff(self, _name: str, observed_error: str) -> None:+ # `_fetch_page` already retries these in-process; once that budget exhausts, Temporal's own+ # activity retry recovers it, so it shouldn't reach error tracking as a tracked exception.+ retryable = self.source.get_retryable_errors()+ assert any(key in observed_error for key in retryable)++ def test_retryable_errors_ignore_unexpected_payload(self) -> None:+ # A malformed payload shape is a potential bug worth seeing in error tracking, not a+ # self-healing rate-limit/5xx condition.+ unrelated_error = "Luma returned an unexpected payload for /public/v1/calendar/list-events: list"+ retryable = self.source.get_retryable_errors()+ assert not any(key in unrelated_error for key in retryable)+@mock.patch("products.warehouse_sources.backend.temporal.data_imports.sources.luma.source.luma_source")def test_source_for_pipeline_plumbs_arguments(self, mock_source: mock.MagicMock) -> None:inputs = mock.MagicMock()