: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(warehouse-sources): say to reconnect when a Google account owns no property (#98918)
Tom Owers8830468dc900
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/source.pyindex 1d951d825e9d..66c7d936e3b9 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/source.py@@ -299,6 +299,11 @@ class GoogleSearchConsoleSource(normalized = {url: site.get("permissionLevel") for site in sites if (url := site.get("siteUrl")) is not None}site_url = normalize_site_url(config.site_url)+ if not normalized:+ # The account owns no property at all, so no value can ever validate. The "not visible"+ # message below sends the user back to re-checking the URL format they got right, which+ # is the loop we keep seeing. Same failure the 403 listing path names, so same wording.+ return False, _PROPERTY_LIST_ACCESS_ERRORif site_url not in normalized:suggestion = suggest_registered_site(site_url, normalized.keys())if suggestion is not None:diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/tests/test_google_search_console_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/tests/test_google_search_console_source.pyindex f8cc2d71ca3d..12621f01b04e 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/tests/test_google_search_console_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/google_search_console/tests/test_google_search_console_source.py@@ -339,6 +339,23 @@ def test_validate_credentials_rejects_unknown_site():assert "is not visible to the connected Google account" in (message or "")+def test_validate_credentials_says_to_reconnect_when_account_owns_no_property():+ with (+ mock.patch(+ "products.warehouse_sources.backend.temporal.data_imports.sources.google_search_console.source.google_search_console_session"+ ),+ mock.patch(+ "products.warehouse_sources.backend.temporal.data_imports.sources.google_search_console.source.list_sites",+ return_value=[],+ ),+ ):+ ok, message = GoogleSearchConsoleSource().validate_credentials(_config(), team_id=1)++ assert ok is False+ assert "can't read any Search Console property" in (message or "")+ assert "is not visible to the connected Google account" not in (message or "")++def test_validate_credentials_suggests_registered_property_for_bare_hostname():# User entered a bare hostname; the account has the URL-prefix property. Point them# at the exact string to paste rather than the dead-end "not visible" message.