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(web-analytics): warm the cleaned paths variant dashboards actually read (#69773)

Lucas Ricoybf511c98244c
diff --git a/products/web_analytics/dags/eager_web_analytics_precompute.py b/products/web_analytics/dags/eager_web_analytics_precompute.py
index cfe434d27d6e..780741d20d42 100644
--- a/products/web_analytics/dags/eager_web_analytics_precompute.py
+++ b/products/web_analytics/dags/eager_web_analytics_precompute.py
@@ -265,14 +265,16 @@ def _warm_baseline_for_team(context: dagster.OpExecutionContext, team: Team) ->
# through to the raw stats query and the paths preagg table stays cold.
if breakdown in (WebStatsBreakdown.PAGE, WebStatsBreakdown.INITIAL_PAGE):
query["includeBounceRate"] = True
- # EXIT_PAGE is served by the simple precompute, which bakes the cleaned-or-raw
- # path into the stored breakdown value and the job hash (unlike PAGE/INITIAL_PAGE,
- # whose paths precompute stores raw paths and cleans at read time). The End-paths
- # tile sends `doPathCleaning=isPathCleaningEnabled` (true for teams with cleaning
- # rules), so without this the warmer fills the raw variant while the dashboard
- # reads the cleaned one and misses. True is a no-op for teams without cleaning
- # rules (`apply_path_cleaning` returns the bare expression → identical hash).
- if breakdown == WebStatsBreakdown.EXIT_PAGE:
+ # Every path breakdown bakes the cleaned-or-raw path into the stored breakdown
+ # value at INSERT time (#65660 for PAGE/INITIAL_PAGE via the paths precompute,
+ # and the simple precompute for EXIT_PAGE), so cleaned and raw are distinct job
+ # hashes. The dashboard tiles send `doPathCleaning=isPathCleaningEnabled` (true
+ # for teams with cleaning rules); without matching it here the warmer fills the
+ # raw variant while those teams' dashboards read the cleaned one and stay
+ # permanently cold, rebuilding synchronously on every real load. True is a
+ # no-op for teams without cleaning rules (`apply_path_cleaning` returns the
+ # bare expression, so the hash is identical).
+ if breakdown in (WebStatsBreakdown.PAGE, WebStatsBreakdown.INITIAL_PAGE, WebStatsBreakdown.EXIT_PAGE):
query["doPathCleaning"] = True
queries.append(query)
diff --git a/products/web_analytics/dags/tests/test_eager_web_analytics_precompute.py b/products/web_analytics/dags/tests/test_eager_web_analytics_precompute.py
index 535266ad7aa2..b2f36a807cd8 100644
--- a/products/web_analytics/dags/tests/test_eager_web_analytics_precompute.py
+++ b/products/web_analytics/dags/tests/test_eager_web_analytics_precompute.py
@@ -300,9 +300,14 @@ class TestWarmBaselineForTeam(APIBaseTest):
assert q["includeBounceRate"] is True
else:
assert "includeBounceRate" not in q
- # EXIT_PAGE (simple precompute) bakes path cleaning into the stored value,
- # so the warmer must match the dashboard's cleaned End-paths request.
- if q["breakdownBy"] == WebStatsBreakdown.EXIT_PAGE.value:
+ # Every path breakdown bakes cleaned-or-raw into the job hash, and the
+ # dashboard sends doPathCleaning=true for teams with cleaning rules,
+ # so the warmer must warm the variant those dashboards actually read.
+ if q["breakdownBy"] in (
+ WebStatsBreakdown.PAGE.value,
+ WebStatsBreakdown.INITIAL_PAGE.value,
+ WebStatsBreakdown.EXIT_PAGE.value,
+ ):
assert q["doPathCleaning"] is True
else:
assert "doPathCleaning" not in q