: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): fix handle_non_retryable_error call for schema type changes (#73220)
Tom Owers957959e1b785
diff --git a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/import_data_sync.py b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/import_data_sync.pyindex e02022405d5c..b0f6ff2210a2 100644--- a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/import_data_sync.py+++ b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/import_data_sync.py@@ -351,7 +351,9 @@ async def _handle_import_error(# on every retry regardless of source — classify it non-retryable by type here rather than# relying on each source listing the message in get_non_retryable_errors.if isinstance(error, SchemaColumnTypeChangedException):- await handle_non_retryable_error(job_inputs, error_msg, logger, error)+ await handle_non_retryable_error(+ job_inputs.team_id, str(job_inputs.source_id), job_inputs.run_id, error_msg, logger, error+ )non_retryable_errors = source_cls.get_non_retryable_errors()if any(match in error_msg for match in non_retryable_errors):diff --git a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_import_data_sync.py b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_import_data_sync.pyindex 851452f64e43..690005078d46 100644--- a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_import_data_sync.py+++ b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_import_data_sync.py@@ -208,9 +208,11 @@ async def test_schema_column_type_changed_routes_through_handler_without_source_logger.aexception = mock.AsyncMock()logger.adebug = mock.AsyncMock()+ # autospec enforces handle_non_retryable_error's real signature, so a call with the wrong+ # positional args (as this branch once had) fails here instead of only at runtime.with (mock.patch.object(module.SourceRegistry, "get_source", return_value=source),- mock.patch.object(module, "handle_non_retryable_error", new=mock.AsyncMock()) as handle_mock,+ mock.patch.object(module, "handle_non_retryable_error", autospec=True) as handle_mock,):handle_mock.side_effect = NonRetryableException()with pytest.raises(NonRetryableException):@@ -218,7 +220,7 @@ async def test_schema_column_type_changed_routes_through_handler_without_source_handle_mock.assert_awaited_once()assert handle_mock.await_args is not None- assert handle_mock.await_args.args[3] is error+ assert handle_mock.await_args.args[5] is errorlogger.aexception.assert_not_awaited()