: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): skip schema discovery on unparseable source config (#65703)
Tom Owersf763377245c2
diff --git a/posthog/temporal/data_imports/workflow_activities/sync_new_schemas.py b/posthog/temporal/data_imports/workflow_activities/sync_new_schemas.pyindex e4bbdcc22a09..f3183ba6daec 100644--- a/posthog/temporal/data_imports/workflow_activities/sync_new_schemas.py+++ b/posthog/temporal/data_imports/workflow_activities/sync_new_schemas.py@@ -57,7 +57,17 @@ def sync_new_schemas_activity(inputs: SyncNewSchemasActivityInputs) -> None:returnnew_source = SourceRegistry.get_source(source_type_enum)- config = new_source.parse_config(source.job_inputs)++ try:+ config = new_source.parse_config(source.job_inputs)+ except Exception:+ # Config parsing is deterministic over the stored `job_inputs`, so a corrupt or+ # double-encoded config fails identically on every discovery run - there is nothing+ # to retry. The per-schema sync path surfaces and disables the source on the same+ # config, so skip quietly here rather than spamming retries and error tracking.+ logger.warning("Skipping schema discovery: source config could not be parsed", exc_info=True)+ return+try:schemas = new_source.get_schemas(config, inputs.team_id)except Exception as e:diff --git a/posthog/temporal/data_imports/workflow_activities/tests/test_sync_new_schemas.py b/posthog/temporal/data_imports/workflow_activities/tests/test_sync_new_schemas.pyindex 1af91589fda5..ab238e6293f7 100644--- a/posthog/temporal/data_imports/workflow_activities/tests/test_sync_new_schemas.py+++ b/posthog/temporal/data_imports/workflow_activities/tests/test_sync_new_schemas.py@@ -58,3 +58,12 @@ def test_get_schemas_error_handling(error_msg, non_retryable, expected_exc):else:with pytest.raises(Exception, match=expected_exc):_run_activity(source_mock)+++def test_unparseable_config_is_skipped():+ source_mock = mock.MagicMock()+ source_mock.parse_config.side_effect = TypeError("Cannot build 'MySQLSourceConfig' from str; expected a mapping")++ _run_activity(source_mock)++ source_mock.get_schemas.assert_not_called()