Skip to content

: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.

fix(warehouse-sources): recognize cross-source non-retryable errors in schema discovery (#97715)

Tom Owers6ce9ced53d68
diff --git a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/sync_new_schemas.py b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/sync_new_schemas.py
index de7055a6edb5..af4c68ed8917 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/sync_new_schemas.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/sync_new_schemas.py
@@ -16,6 +16,7 @@ from products.warehouse_sources.backend.models.external_data_schema import (
sync_old_schemas_with_new_schemas,
)
from products.warehouse_sources.backend.models.external_data_source import ExternalDataSource
+from products.warehouse_sources.backend.temporal.data_imports.external_data_job import Any_Source_Errors
from products.warehouse_sources.backend.temporal.data_imports.sources import SourceRegistry
from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import error_message_matches
from products.warehouse_sources.backend.temporal.data_imports.sources.common.errors import (
@@ -103,7 +104,12 @@ def sync_new_schemas_activity(inputs: SyncNewSchemasActivityInputs) -> None:
if is_transient_egress_proxy_error(error_msg):
logger.warning(f"Transient egress-proxy error during schema discovery: {error_msg}")
raise NonReportableError(error_msg) from e
- non_retryable_errors = new_source.get_non_retryable_errors()
+ # Cross-source non-retryable errors (an unresolvable/private database host, bad SSH
+ # tunnel auth, a widened column type) are raised from shared connection/pipeline code,
+ # not any one source, so they never make it into a source's own get_non_retryable_errors.
+ # Without merging this in, discovery retries the activity's whole budget and reports on
+ # every attempt for a failure that will never recover on its own.
+ non_retryable_errors = {**Any_Source_Errors, **new_source.get_non_retryable_errors()}
if error_message_matches(error_msg, non_retryable_errors):
logger.warning(f"Skipping schema discovery due to non-retryable source error: {error_msg}")
return
diff --git a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_sync_new_schemas.py b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_sync_new_schemas.py
index 1c3e137d0750..b10590d3c8b9 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_sync_new_schemas.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_sync_new_schemas.py
@@ -137,6 +137,19 @@ def test_proxy_auth_failure_is_still_reported():
assert not isinstance(exc_info.value, NonReportableError)
+def test_all_source_non_retryable_error_is_skipped():
+ # "Database host not allowed" (and the rest of Any_Source_Errors) is raised from shared
+ # connection code, not any one source, so it's never in a source's own
+ # get_non_retryable_errors. Without merging it in here, discovery retries forever and spams
+ # error tracking on a host that will never resolve.
+ source_mock = mock.MagicMock()
+ source_mock.parse_config.return_value = {}
+ source_mock.get_schemas.side_effect = Exception("Database host not allowed: could not resolve host")
+ source_mock.get_non_retryable_errors.return_value = {}
+
+ _run_activity(source_mock)
+
+
def test_undecrypted_integration_secret_error_is_skipped():
# Checked by type, not message, so it must be skipped even when get_non_retryable_errors
# has no matching entry — otherwise discovery retries forever on an unrecoverable decryption