: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): stop double-classifying transient object-store errors as bugs (#77336)
Tom Owersfceb6cf14c0e
diff --git a/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta/errors.py b/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta/errors.pyindex 4ba9949de781..7a05559d9d5f 100644--- a/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta/errors.py+++ b/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta/errors.py@@ -44,7 +44,11 @@ def is_transient_object_store_error(error: BaseException) -> bool:match), but hitting our own instance-role-authenticated bucket always means the same transientresolution hiccup, so it's recognized by type rather than by message."""- if isinstance(error, botocore.exceptions.NoCredentialsError):+ if isinstance(error, TransientObjectStoreError | botocore.exceptions.NoCredentialsError):+ # Already classified and wrapped by a prior call to this same function (see+ # `_capture_unless_transient`) — a caller further up the stack that catches broadly and+ # re-runs this classifier on the wrapper, rather than the original OSError/DeltaError it+ # wraps, must still treat it as transient.return Truereturn isinstance(error, OSError | deltalake.exceptions.DeltaError) and any(needle in str(error) for needle in TRANSIENT_OBJECT_STORE_ERRORSdiff --git a/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta/test/test_delta_errors.py b/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta/test/test_delta_errors.pyindex ed2e44d25b0f..8d0695f0f8c3 100644--- a/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta/test/test_delta_errors.py+++ b/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta/test/test_delta_errors.py@@ -5,6 +5,7 @@ import botocore.exceptionsfrom parameterized import parameterizedfrom products.warehouse_sources.backend.temporal.data_imports.pipelines.core.delta.errors import (+ TransientObjectStoreError,is_transient_delta_maintenance_error,is_transient_maintenance_error,is_transient_object_store_error,@@ -32,6 +33,11 @@ class TestIsTransientObjectStoreError:True,),("unrelated_exception_type", ValueError("some other unrelated failure"), False),+ # `get_delta_table` re-raises a recognized transient blip as this wrapper (see+ # `_capture_unless_transient`) instead of the original OSError/DeltaError. A caller+ # further up the stack that catches broadly and re-runs this classifier on the caught+ # exception sees the wrapper, not the original — it must still read as transient.+ ("already_wrapped_transient_error", TransientObjectStoreError("Please reduce your request rate"), True),])def test_classifies_transient_errors(self, _name: str, error: Exception, expected: bool):diff --git a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_repartition_table.py b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_repartition_table.pyindex f3b115e04011..e8e7d6191e43 100644--- a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_repartition_table.py+++ b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_repartition_table.py@@ -5,6 +5,9 @@ from unittest.mock import AsyncMock, MagicMock, patchfrom parameterized import parameterized+from products.warehouse_sources.backend.temporal.data_imports.pipelines.core.delta.errors import (+ TransientObjectStoreError,+)from products.warehouse_sources.backend.temporal.data_imports.workflow_activities.repartition_table import (RepartitionActivityInputs,_maybe_flag_pre_extraction,@@ -93,27 +96,27 @@ class TestMaybeFlagPreExtraction:[("generic_s3_error",- OSError(- "Generic S3 error: Error getting list response body: HTTP error: "- "request or response body error: operation timed out"- ),+ "Generic S3 error: Error getting list response body: HTTP error: "+ "request or response body error: operation timed out",),("credential_provider_timeout",- OSError(- "Operation not supported: an error occurred while loading credentials: "- "dispatch failure: timeout: client error (Connect): HTTP connect timeout occurred: timed out"- ),+ "Operation not supported: an error occurred while loading credentials: "+ "dispatch failure: timeout: client error (Connect): HTTP connect timeout occurred: timed out",),])@patch(f"{MODULE}.capture_exception")def test_transient_object_store_error_is_not_reported(- self, _name: str, error: OSError, mock_capture: MagicMock+ self, _name: str, message: str, mock_capture: MagicMock) -> None:+ # `get_delta_table` never lets the raw OSError/DeltaError escape for a recognized transient+ # blip — it re-raises `TransientObjectStoreError` instead (see `_capture_unless_transient`).+ # Mocking the raw error here would miss the exact bug this test guards: a caller re-running+ # `is_transient_object_store_error` on the wrapper it actually receives, not on the original.schema = _schema(name="stripe_charge", s3_folder_name=None)helper = MagicMock()- helper.get_delta_table = AsyncMock(side_effect=error)+ helper.get_delta_table = AsyncMock(side_effect=TransientObjectStoreError(message))result = _maybe_flag_pre_extraction(schema, MagicMock(), helper, MagicMock(), enabled=True)