: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 non-retryable errors reaching error tracking (#78391)
Tom Owers68af6c1d8d61
diff --git a/products/warehouse_sources/backend/temporal/data_imports/tests/test_util.py b/products/warehouse_sources/backend/temporal/data_imports/tests/test_util.pyindex 7df20ffdedbe..e1fe016455dc 100644--- a/products/warehouse_sources/backend/temporal/data_imports/tests/test_util.py+++ b/products/warehouse_sources/backend/temporal/data_imports/tests/test_util.py@@ -7,8 +7,11 @@ from unittest.mock import AsyncMock, MagicMock, patchimport botocore.exceptionsfrom parameterized import parameterized+from posthog.temporal.common.errors import NonReportableError+from products.warehouse_sources.backend.temporal.data_imports import util as util_modulefrom products.warehouse_sources.backend.temporal.data_imports.util import (+ NonRetryableException,_is_transient_s3_connection_error,prepare_s3_files_for_querying,)@@ -16,6 +19,15 @@ from products.warehouse_sources.backend.temporal.data_imports.util import (_UTIL_MODULE = "products.warehouse_sources.backend.temporal.data_imports.util"+def test_non_retryable_exception_is_non_reportable_error():+ # Every NonRetryableException raise site (handle_non_retryable_error, custom-source config+ # errors, CDC failure classification) already vetted the error as a known customer/upstream+ # condition before raising it. Subclassing NonReportableError is what keeps that already-known+ # condition out of error tracking; without it, the activity interceptor reports a fresh+ # "bug" for every occurrence of an error a source already classified as non-retryable.+ assert issubclass(NonRetryableException, NonReportableError)++def _fake_s3(**kwargs):defaults = {"invalidate_cache": lambda: None,diff --git a/products/warehouse_sources/backend/temporal/data_imports/util.py b/products/warehouse_sources/backend/temporal/data_imports/util.pyindex 5d4838f8081d..45ba484a94e6 100644--- a/products/warehouse_sources/backend/temporal/data_imports/util.py+++ b/products/warehouse_sources/backend/temporal/data_imports/util.py@@ -12,6 +12,7 @@ from structlog.types import FilteringBoundLoggerfrom posthog.exceptions import capture_exceptionfrom posthog.settings.utils import get_from_env+from posthog.temporal.common.errors import NonReportableErrorfrom posthog.utils import str_to_boolfrom products.data_warehouse.backend.facade.api import aget_s3_client@@ -32,7 +33,13 @@ def _is_transient_s3_connection_error(error: BaseException) -> bool:return isinstance(error, _TRANSIENT_S3_CONNECTION_EXCEPTIONS)-class NonRetryableException(Exception):+class NonRetryableException(NonReportableError):+ """Raised only for errors already classified as a permanent customer/upstream condition+ (bad credentials, denied permissions, a deleted remote) via a source's+ ``get_non_retryable_errors`` or an equivalent shared-code check, never for a fresh,+ unclassified failure. Subclassing ``NonReportableError`` keeps that already-known condition+ out of error tracking instead of reporting it as a new bug on every occurrence."""+@propertydef cause(self) -> Optional[BaseException]:"""Cause of the exception.