: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(data-imports): don't re-report transient object-store errors from the idempotency fallback (#77154)
Tom Owers6e4c5e451f6d
diff --git a/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline_v3/load/idempotency.py b/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline_v3/load/idempotency.pyindex 38af50dd19cc..ff70a3db916f 100644--- a/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline_v3/load/idempotency.py+++ b/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline_v3/load/idempotency.py@@ -7,6 +7,7 @@ from asgiref.sync import async_to_syncfrom posthog.exceptions_capture import capture_exceptionfrom posthog.redis import get_client+from posthog.temporal.common.errors import NonReportableErrorfrom products.warehouse_sources.backend.temporal.data_imports.pipelines.core.delta.writer import DeltaWriterfrom products.warehouse_sources.backend.temporal.data_imports.pipelines.core.delta_table_helper import DeltaTableHelper@@ -89,7 +90,11 @@ def is_batch_already_processed(batch_index=batch_index,error=str(e),)- capture_exception(e)+ # get_delta_table already re-raises known-transient object-store blips as+ # NonReportableError (see delta_table_helper._capture_unless_transient) and+ # intentionally skips reporting them itself — don't undo that here.+ if not isinstance(e, NonReportableError):+ capture_exception(e)raisediff --git a/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline_v3/load/test_idempotency.py b/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline_v3/load/test_idempotency.pyindex f0857e6b84e8..24eeef3a1294 100644--- a/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline_v3/load/test_idempotency.py+++ b/products/warehouse_sources/backend/temporal/data_imports/pipelines/pipeline_v3/load/test_idempotency.py@@ -3,6 +3,8 @@ from unittest.mock import AsyncMock, MagicMock, patchfrom parameterized import parameterized+from posthog.temporal.common.errors import NonReportableError+from products.warehouse_sources.backend.temporal.data_imports.pipelines.pipeline_v3.load.idempotency import (get_idempotency_key,is_batch_already_processed,@@ -143,6 +145,31 @@ class TestIsBatchAlreadyProcessed:team_id=1, schema_id="s", run_uuid="r", batch_index=0, delta_table_helper=helper)+ @parameterized.expand(+ [+ # (name, error, expect_captured)+ ("non_transient_error_is_reported", RuntimeError("delta blew up"), True),+ ("non_reportable_error_is_not_reported", NonReportableError("transient object-store blip"), False),+ ]+ )+ def test_capture_exception_respects_non_reportable_errors(self, _name, error, expect_captured):+ """get_delta_table already classifies transient object-store blips as NonReportableError+ and skips reporting them itself; this call site must not undo that by reporting again."""+ client = _redis_client(0)+ helper = _delta_helper(error)++ with (+ patch(REDIS_CLIENT_PATH) as mock_get_client,+ patch(f"{_IDEMPOTENCY_MODULE}.capture_exception") as mock_capture,+ ):+ mock_get_client.return_value.__enter__.return_value = client+ with pytest.raises(type(error)):+ is_batch_already_processed(+ team_id=1, schema_id="s", run_uuid="r", batch_index=0, delta_table_helper=helper+ )++ assert mock_capture.called is expect_captured+class TestMarkBatchAsProcessed:def test_sets_key_with_ttl(self):