fix(admin): restore global stats trend chart#2217
Conversation
📝 WalkthroughWalkthroughThe PR refactors the ChangesGlobal Stats Trend SQL and Test Coverage
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Merging this PR will not alter performance
Comparing Footnotes
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|



Summary (AI generated)
global_statsmetric columns asgs.*in the admin trend self-join.global_statsrows and verifies/private/admin_statsreturns the trend payload with previous-day MRR.Motivation (AI generated)
The admin dashboard calls
/private/admin_statswithmetric_category: global_stats_trend. That query self-joinsglobal_statsfor previous-day values, but selected columns likeapps::intwere unqualified. PostgreSQL reports those columns as ambiguous, the helper catches the error, and the API returnssuccess: truewith an emptydataarray. The Cloudflare worker test lane also needs Node 24 because the currently locked Wrangler requires Node.js 22 or newer.Business Impact (AI generated)
This restores the production admin dashboard charts backed by
global_stats_trend, so platform operators can see usage, revenue, conversion, and build metrics again instead of an empty chart. Keeping the Cloudflare CI lane runnable also preserves coverage for the worker path used in production.Test Plan (AI generated)
bun lint:backendbunx eslint tests/admin-stats.test.tsbun typecheckbun run supabase:with-env -- bunx vitest run tests/admin-stats.unit.test.ts tests/admin-stats.test.tsbun run supabase:with-env -- bun test:allbun run supabase:with-env -- bun test:cloudflare:backendgit diff --checkcolumn reference "apps" is ambiguous2026-04-11through2026-05-10