Uh oh!
There was an error while loading. Please reload this page.
feat(analytics): #122 gaps — tokens/day chart, error-rate trend, day-series table fallbacks - #491
Conversation
…series table fallbacks Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This pull request has been ignored for the connected project Preview Branches by Supabase. |
Warning Review limit reached
Next review available in:41 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe analytics dashboard adds daily error-rate calculations, compact count formatting, accessible chart data tables, responsive raw tables, and expanded usage, cost, token, call, and error visualizations with integration coverage. ChangesAnalytics dashboard
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant AdminAnalytics
participant errorRateSeries
participant DaySeriesTable
AdminAnalytics->>errorRateSeries: pass zero-filled errors and usage events
errorRateSeries-->>AdminAnalytics: return daily error-rate points
AdminAnalytics->>DaySeriesTable: pass errors and rate series
DaySeriesTable-->>AdminAnalytics: render expandable daily data table
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with |
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs | frontend-staging | a03d410 | Commit Preview URL Branch Preview URL | Jul 31 2026, 06:53 AM |
…opy, compact-count boundary
- DaySeriesTable and the two raw-table disclosures now carry per-chart
labels ("View data: errors per day", …) so the five identical summaries
are distinguishable to screen-reader users.
- Errors panel zero-fills unconditionally: a no-error range renders real
0s and a flat line, not em-dash "unknown" cells.
- Rate-chart fallback copy branches on summary error/loaded-empty/loading
instead of always promising the series will load.
- formatCompactCount promotes 999,950+ to "1M" instead of emitting
"1000k"; boundary cases and the errorRateSeries domain-drop contract
pinned in unit tests.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>Jose-Gael-Cruz-Lopez
commented
Jul 31, 2026
Automated review pass (Claude Code) on No criticals. The review's minors are now fixed in
Not addressed (accepted, with reasoning): rate can exceed 100% if the summary scan hits the 100k Outstanding process item (already flagged in the PR body): the pre-merge local E2E lane couldn't run on this machine — the admin-analytics journey should be run on a provisioned machine before merge, or watch the post-merge |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/src/components/screens/AdminAnalytics.tsx`:
- Around line 471-516: In the Errors panel render block, validate that
summary.data belongs to the current d.range before constructing eventPoints or
calling errorRateSeries; when summary.range differs, leave the denominator
unavailable so the rate shows the invalid/loading state rather than fabricated
0% values. Update the fallback message branching to distinguish this range
mismatch from summary.error and a genuinely empty events series.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: f7cfa34d-f710-4538-9c93-b3ede3e984bd
📒 Files selected for processing (5)
frontend/src/components/AnalyticsCharts.test.tsxfrontend/src/components/AnalyticsCharts.tsxfrontend/src/components/screens/AdminAnalytics.test.tsxfrontend/src/components/screens/AdminAnalytics.tsxfrontend/src/lib/daySeries.ts
Uh oh!
There was an error while loading. Please reload this page.
…ry ranges The summary hook keeps its last payload while a range change reloads, so the errors panel could zero-fill an old-range series against the new range and fabricate an all-0% rate line. The join now requires day-key range agreement; mismatch renders the waiting state. Also: TruncatedBadge propagates to the rate chart when the summary scan was truncated (the denominator undercounts, so the rate can overshoot), and formatPct floors tiny nonzero rates at "<0.1%" so they never read as "no errors". Regression test pins the stale-range guard. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
AndresL230
commented
Jul 31, 2026
Merged main in, reviewed, ran the E2E lane — all greenMerged Full local E2E cycle at
Review — no findings. Two agents over correctness and conventions. Things specifically checked and cleared:
Gates: Merging. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
PR #479 shipped the #122 dashboard, but a criterion-by-criterion audit against the issue spec found three concrete gaps. This PR closes them:
CostDayPointseries into zero-filled day series and renders a second lazyDayLineChart("Tokens per day"), with a compact-count axis formatter (formatCompactCountindaySeries.ts) so token magnitudes fit the y-gutter. No backend work — the API already returnedcalls/total_tokensper day.errorRateSeriesjoins the errors/day series with the usage summary's events/day series by date (both zero-filled over the panel range): rate = errors ÷ events as a percentage; zero-event days report 0, never NaN/Infinity. The absolute errors/day chart stays; the rate chart renders alongside it (muted note if the usage series hasn't loaded).DaySeriesTablemirrors the existing "View data"<details>pattern for every day-series chart (usage events/day; cost calls/tokens/cost; errors count/rate). Also wraps allminWidthtables in anoverflowX: autocontainer so narrow viewports scroll the table, not the page.Constraints preserved: hand-rolled SVG only (no chart lib),
next/dynamic+ssr:falselazy-loading and the JSX-freedaySeries.tssplit untouched,role="img"+ aria-labels on new charts, brand tokens, no glass/gradient-text, and every name/testid asserted bye2e/admin-analytics.spec.tsunchanged.Verification
View data ≥ 2smoke assert is replaced with panel-scoped assertions of specific day values (incl. a 25% rate = 1 error ÷ 4 events fixture)tsc --noEmitclean; eslint exit 0 on all touched filese2e.ymlruns the admin-analytics journey on push to main. All names/testids that journey asserts are unchanged.Closes#122
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Improvements