: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(experiments): Flag empty precompute canary reads instead of skipping them (#98966)
Juraj Majerik89ef5efc3c42
diff --git a/products/experiments/backend/temporal/canary_logic.py b/products/experiments/backend/temporal/canary_logic.pyindex 440d4c7ec028..519badde3ecc 100644--- a/products/experiments/backend/temporal/canary_logic.py+++ b/products/experiments/backend/temporal/canary_logic.py@@ -285,7 +285,9 @@ def evaluate_canary_runs(under the per-query byte cap: stability is still checked, and a clean pair verdicts asuncheckable rather than pass because correctness stays unverified."""runs = tuple(run for run in (run_a, run_b, run_c) if run is not None)- if any(not run.variants for run in runs):+ # Skip only when every run is empty. A run that is empty while a sibling has data is a broken+ # read, not a young experiment — fall through so the path-flip and variant-set checks classify it.+ if all(not run.variants for run in runs):return CanaryVerdict(outcome=OUTCOME_SKIPPED, detail="empty results (no exposures yet)")# Checked before the variant-set comparison: a flipped run compares live vs frozen data, so it candiff --git a/products/experiments/backend/temporal/test_canary_logic.py b/products/experiments/backend/temporal/test_canary_logic.pyindex ab8b528ba6de..3d165529797c 100644--- a/products/experiments/backend/temporal/test_canary_logic.py+++ b/products/experiments/backend/temporal/test_canary_logic.py@@ -174,6 +174,16 @@ class TestEvaluateCanaryRuns:{"control": (500.0, 3090), "test": (500.0, 3000)},OUTCOME_DIVERGENCE,),+ ("all_runs_empty_is_skipped", "funnel", {}, {}, {}, OUTCOME_SKIPPED),+ (+ # A cache that lost its content must not pass as "no exposures yet".+ "empty_precomputed_reads_with_populated_direct_scan_is_error",+ "funnel",+ {},+ {},+ _BASE,+ OUTCOME_ERROR,+ ),])def test_outcomes(self, _name, metric_type, a, b, c, expected):@@ -238,10 +248,6 @@ class TestEvaluateCanaryRuns:)assert verdict.outcome == OUTCOME_ERROR- def test_empty_results_are_skipped(self):- verdict = evaluate_canary_runs("funnel", _snapshot("a", _BASE), _snapshot("b", {}), _snapshot("c", _BASE))- assert verdict.outcome == OUTCOME_SKIPPED-def test_low_volume_is_skipped(self):low = {"control": (10.0, 50), "test": (12.0, 60)}verdict = evaluate_canary_runs("funnel", _snapshot("a", low), _snapshot("b", low), _snapshot("c", low))