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(clerk): skip the domains table when the feature is off instead of failing (#89111)

Tom Owers84aded5c83ce
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/clerk/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/clerk/settings.py
index 185277a89bea..fcfd3029cbbe 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/clerk/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/clerk/settings.py
@@ -75,7 +75,16 @@ CLERK_ENDPOINTS: dict[str, ClerkEndpointConfig] = {
is_wrapped_response=True,
gated_feature="Restrictions (the allow-list and block-list)",
),
- "domains": ClerkEndpointConfig(name="domains", path="/domains", partition_key=None, is_wrapped_response=True),
+ "domains": ClerkEndpointConfig(
+ name="domains",
+ path="/domains",
+ partition_key=None,
+ is_wrapped_response=True,
+ # Clerk answers 404 resource_not_found for the domains list on instances that don't have the
+ # feature switched on — the same feature-off signal the OAuth applications and Restrictions
+ # endpoints give. Skip zero rows instead of failing the schema every run.
+ gated_feature="Satellite domains",
+ ),
"saml_connections": ClerkEndpointConfig(
name="saml_connections", path="/saml_connections", is_wrapped_response=True
),
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/clerk/tests/test_clerk.py b/products/warehouse_sources/backend/temporal/data_imports/sources/clerk/tests/test_clerk.py
index c1f97c164242..13c5a17f146b 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/clerk/tests/test_clerk.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/clerk/tests/test_clerk.py
@@ -522,6 +522,8 @@ class TestClerkFeatureGatedEndpoints:
("allowlist_identifiers", 404, {"errors": [{"code": "resource_not_found"}]}),
# OAuth applications off: the list endpoint answers the same 404 resource_not_found.
("oauth_applications", 404, {"errors": [{"code": "resource_not_found"}]}),
+ # Domains feature off: the list endpoint answers the same 404 resource_not_found.
+ ("domains", 404, {"errors": [{"code": "resource_not_found"}]}),
],
)
def test_feature_not_enabled_syncs_no_rows_instead_of_failing(