[codex] fix admin global stats primary read#2245
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR updates ChangesGlobal stats query and error handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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_stats_trendadmin metrics to use the primary DB connection instead of the read-only replica path.success: truewith fake empty chart data on query failure.Motivation (AI generated)
Production primary has
global_statsrows for the requested window, but the deployed worker still returned an empty dataset. The remaining failure path was the replica read plus error masking ingetAdminGlobalStatsTrend.Business Impact (AI generated)
Restores admin dashboard trend charts and makes future DB/schema drift visible as an API error instead of silently hiding reporting failures.
Test Plan (AI generated)
bun lint:backendbun typecheckbun run supabase:with-env -- bunx vitest run tests/admin-stats.unit.test.ts tests/admin-stats.test.tsbun run supabase:with-env -- bunx vitest run tests/admin-stats.test.ts --config vitest.config.cloudflare.tsbun test:backendbun run supabase:with-env -- bun test:cloudflare:backendglobal_statshas 28 rows from2026-04-12through2026-05-11for the current 30-day window.Summary by CodeRabbit