: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(vitally): skip custom-object discovery without credentials (#65860)
Tom Owers11c0be1bc85d
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/vitally/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/vitally/source.pyindex 1c1562c04394..f6d521b2cbcc 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/vitally/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/vitally/source.py@@ -76,7 +76,11 @@ class VitallySource(SimpleSource[VitallySourceConfig]):# definitions; instances live at `/resources/customObjects/:id/instances`.# Skip the outbound request when the caller only wants static schemas, and never# let a discovery failure take down the static endpoints that need no network call.- if names is None or any(name.startswith(CUSTOM_OBJECT_SCHEMA_PREFIX) for name in names):+ # The credential-free documentation catalog calls this with a placeholder config whose+ # `region` is an empty string rather than a `VitallyRegionConfig`; without a token there+ # is nothing to discover, so bail out before touching `config.region`.+ wants_custom_objects = names is None or any(name.startswith(CUSTOM_OBJECT_SCHEMA_PREFIX) for name in names)+ if wants_custom_objects and config.secret_token:try:definitions = list_custom_object_definitions(config.secret_token, config.region.selection, config.region.subdomaindiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/vitally/tests/test_vitally.py b/products/warehouse_sources/backend/temporal/data_imports/sources/vitally/tests/test_vitally.pyindex 33720a44c5e0..d89278432e8d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/vitally/tests/test_vitally.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/vitally/tests/test_vitally.py@@ -299,6 +299,24 @@ class TestVitallySourceGetSchemas:mock_list.assert_not_called()assert {s.name for s in schemas} == {"Accounts", "Conversations"}+ @patch("products.warehouse_sources.backend.temporal.data_imports.sources.vitally.source.capture_exception")+ @patch(+ "products.warehouse_sources.backend.temporal.data_imports.sources.vitally.source.list_custom_object_definitions"+ )+ def test_credential_free_placeholder_config_skips_discovery(self, mock_list, mock_capture):+ # The public documentation catalog calls get_schemas with a placeholder config whose+ # `region` is an empty string, not a VitallyRegionConfig. Discovery must be skipped rather+ # than crash on `config.region.selection` and spam error tracking.+ source = VitallySource()++ schemas = source.get_schemas(source._placeholder_config(), team_id=0)++ mock_list.assert_not_called()+ mock_capture.assert_not_called()+ names = {s.name for s in schemas}+ assert {"Accounts", "Conversations", "Custom_Objects", "Messages"} <= names+ assert not any(s.name.startswith(CUSTOM_OBJECT_SCHEMA_PREFIX) for s in schemas)+@patch("products.warehouse_sources.backend.temporal.data_imports.sources.vitally.source.capture_exception")@patch("products.warehouse_sources.backend.temporal.data_imports.sources.vitally.source.list_custom_object_definitions"