: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(doit): stop retrying an invalid or revoked DoIt API key (#102220)
Tom Owers5c73b1fd155a
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/doit/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/doit/source.pyindex 9d82de0eadc5..437e4876f2e1 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/doit/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/doit/source.py@@ -67,6 +67,9 @@ class DoItSource(SimpleSource[DoItSourceConfig]):"Report no longer exists": report_gone,# A row that resolves by id hits the fetch directly, so a deleted report surfaces there."Request to get report failed with status: 404": report_gone,+ # DoIt's own rejection text for a bad key, stable across both the list and get-report+ # endpoints since they share the same bearer token check.+ "invalid or revoked access key": "Your DoIt API key is invalid or has been revoked. Please create a new key and reconnect.",}def source_for_pipeline(self, config: DoItSourceConfig, inputs: SourceInputs) -> SourceResponse:diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/doit/tests/test_doit_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/doit/tests/test_doit_source.pyindex 3874123ec703..61ee98716901 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/doit/tests/test_doit_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/doit/tests/test_doit_source.py@@ -21,12 +21,24 @@ class TestDoItSource:def setup_method(self):self.source = DoItSource()- @pytest.mark.parametrize("pattern", ["Report no longer exists", "Request to get report failed with status: 404"])+ @pytest.mark.parametrize(+ "pattern",+ [+ "Report no longer exists",+ "Request to get report failed with status: 404",+ "invalid or revoked access key",+ ],+ )def test_non_retryable_errors_includes_pattern(self, pattern):errors = self.source.get_non_retryable_errors()assert pattern in errors+ def test_non_retryable_errors_tells_the_customer_to_reconnect_on_a_bad_key(self):+ errors = self.source.get_non_retryable_errors()++ assert "reconnect" in (errors["invalid or revoked access key"] or "")+def test_get_schemas_stamps_the_report_id_so_renames_stay_resolvable(self):with patch(f"{_SOURCE_MODULE}.doit_list_reports",