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(data-imports): ignore VWO 400 for campaigns without sections (#124224)

Tom Owers034f4d737e31
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/vwo/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/vwo/settings.py
index 2d8b9ca1ee63..33f1c60d1369 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/vwo/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/vwo/settings.py
@@ -1,4 +1,4 @@
-from dataclasses import field
+from dataclasses import field, replace
from posthog.dataclasses import frozen
@@ -34,6 +34,16 @@ CAMPAIGN_FANOUT = DependentEndpointConfig(
child_response_actions=[{"status_code": 404, "action": "ignore"}],
)
+# VWO answers 400 for a campaign type that has no sections (e.g. a standard A/B test);
+# 404 for a campaign deleted after the parent listing.
+CAMPAIGN_SECTIONS_FANOUT = replace(
+ CAMPAIGN_FANOUT,
+ child_response_actions=[
+ {"status_code": 400, "action": "ignore"},
+ {"status_code": 404, "action": "ignore"},
+ ],
+)
+
# VWO documents no timestamp filter. Offset ordering and envelopes need verification with a live account.
ENDPOINTS: dict[str, VWOEndpoint] = {
"accounts": VWOEndpoint(name="accounts", path="accounts/{account_id}", singleton=True, partition_field="createdOn"),
@@ -44,7 +54,7 @@ ENDPOINTS: dict[str, VWOEndpoint] = {
name="campaign_sections",
path="accounts/{account_id}/campaigns/{campaign_id}/sections",
primary_keys=("campaign_id", "id"),
- fanout=CAMPAIGN_FANOUT,
+ fanout=CAMPAIGN_SECTIONS_FANOUT,
),
"feature_flags": VWOEndpoint(name="feature_flags", path="accounts/{account_id}/features", paginated=True),
"goals": VWOEndpoint(
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/vwo/tests/test_vwo.py b/products/warehouse_sources/backend/temporal/data_imports/sources/vwo/tests/test_vwo.py
index 3543a4e9e4f8..dc2e616e0a92 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/vwo/tests/test_vwo.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/vwo/tests/test_vwo.py
@@ -135,3 +135,16 @@ def test_deleted_campaign_does_not_stop_other_children() -> None:
)
assert result.raised is None
assert result.rows == [{"id": 1, "campaign_id": 12}]
+
+
+def test_campaign_without_sections_does_not_stop_other_children() -> None:
+ result = driver().run(
+ "campaign_sections",
+ [
+ collection([{"id": 11}, {"id": 12}], False),
+ ScriptedResponse(status=400, json={}),
+ collection([{"id": 1}], False),
+ ],
+ )
+ assert result.raised is None
+ assert result.rows == [{"id": 1, "campaign_id": 12}]