Skip to content

fix(posthog): the weekly report reports real numbers - #1109

Open
blove wants to merge 1 commit into
mainfrom
blove/weekly-report-real-numbers
Open

blove wants to merge 1 commit into
mainfrom
blove/weekly-report-real-numbers

Conversation

@blove

@blove blove commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Every row of the generated weekly GTM report read Unavailable.

Two causes: the insight fetch used refresh: force_cache, which never recomputes a stale cache, and breakdown insights (9 of 13 managed insights) were refused outright.

  • Fetch insights with refresh: blocking (serve fresh cache, otherwise recalculate synchronously), with a bounded poll if PostHog answers with a pending query_status. Never hangs, never prints a zero it cannot stand behind.
  • Breakdown insights now report a true total by re-issuing the same trends query with the breakdown removed — summing the top-N breakdown series would undercount. The row is labelled "total across all breakdown values".
  • All correctness refusals kept: non-trends, non-daily, non-additive math, short/undated series.

Verified against live PostHog: every row in all three dashboards now carries a real number.

🤖 Generated with Claude Code

Every row rendered Unavailable for two independent reasons: the insight
fetch asked PostHog for `refresh: 'force_cache'`, which never recomputes,
so a stale or short cache failed the complete-28-day-window check; and
any insight carrying a breakdown was refused outright, which covers 9 of
the 13 managed insights.

The fetch now asks for `refresh: 'blocking'`, which serves a fresh cache
and otherwise recalculates synchronously. If PostHog still answers with a
pending query_status, we re-read the cache a bounded number of times and
leave the row Unavailable rather than hanging or printing a zero.

Breakdown insights are no longer refused. Because breakdown_limit means
PostHog returns only the top N values, summing them would undercount, so
we re-issue the insight's own trends query with the breakdown stripped and
label the row "total across all breakdown values". Every existing refusal
that protects correctness is unchanged: non-trends insights, non-daily
intervals, non-additive math, and short or undated result series still
render Unavailable with their current reasons.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@blove
blove enabled auto-merge (squash) September 18, 2026 18:38
@vercel

vercel Bot commented Sep 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
threadplane Ready Ready Preview Sep 18, 2026 6:52pm UTC

Request Review

@github-actions

github-actions Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Claude finished @blove's task in 0s —— View job


I'll analyze this and get back to you.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

This branch was successfully deployed

1 active deployment
Preview – threadplane c4a6b061 Deployed Sep 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant