review brief: console-analytics-ui round 2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+93
−0
docs/superpowers/reviews/CODEX-REVIEW-BRIEF-console-analytics-ui-R2.md+93 −0
CI failed — run details
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-console-analytics-ui-R2.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-console-analytics-ui-R2.md| new file mode 100644 |
| index 000000000..b71cff56e |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-console-analytics-ui-R2.md |
| @@ -0,0 +1,93 @@ |
| +# Review brief: branch console-analytics-ui, round 2 of 3 |
| + |
| +Repo carlos/platform, branch `console-analytics-ui`, commit 5de6a68c3ecefcfe4c060f09e8a43abf847c2472. |
| +Under review: the diff `803c6800..5de6a68c` (internal/console only). |
| +Authorities: the errors and analytics design |
| +(docs/superpowers/specs/2026-09-07-errors-and-analytics-design.md, if |
| +present on main), the console UX and perf work (150 ms warm / 500 ms cold |
| +GET budgets), AGENTS.md (stopping rules, request-cost rules). Do not |
| +review against unmerged branches. |
| + |
| +You are an independent reviewer. Read the diff, then the code it calls, |
| +and check every claim in comments and in the commit message against that |
| +code. |
| + |
| +## Fixed: do not re-argue |
| + |
| +- Paul asked for: a UI overhaul of the Analytics tab, an analytics preview |
| + on the Overview tab, tooltips on the bar chart, country names instead of |
| + codes, bytes in KB/MB/GB, and that it be very performant. |
| +- Copy has had a Luna pass on Paul's house rules (no em dashes, sentence |
| + case). Report copy only where it states something false. |
| +- The chart is HTML, not SVG, by design. The Overview card shows the |
| + 7-day window. |
| + |
| +## What to check |
| + |
| +1. The settled-day cache (internal/console/usagedays.go). usageDayDate now |
| + recognises analytics day keys (`apps/<sqid>/<app>/analytics/<box>/days/<date>.json`). |
| + Can a key a tenant or box can influence (app name, box label) be |
| + mistaken for another family's key, or another account's? Is the |
| + settled horizon (date+2) safe for analytics, given failed flushes are |
| + re-queued (internal/host/usage_loop.go, analytics.Meter.Requeue)? Did |
| + widening usageDayFirstKept change anything for the economics sweep? |
| +2. readAnalyticsRange runs analytics.ReadRange through readConcurrently |
| + (internal/console/hotreads.go) with a "{}" dry body. Does the dry pass |
| + ask for exactly the keys the real pass reads? Can an error, a timeout |
| + or an over-cap file now yield a silently wrong total rather than an |
| + error? Is TestAnalyticsReadsSettledDaysOnce a sound witness? |
| +3. handleApp (internal/console/server.go) now starts a goroutine for the |
| + traffic card. Leaks, races on the page struct, a request context used |
| + after the handler returns, and the worst-case added latency. |
| +4. Tenant boundary: the card and the tab read only the requesting |
| + account's app. Paths, referrers and event names are tenant- or |
| + visitor-controlled strings: check every place they reach the HTML |
| + (titles, aria-label, style attributes) is escaped by html/template, and |
| + that nothing visitor-controlled lands in a style or script context. |
| +5. Arithmetic in internal/console/analyticsdisplay.go: niceCeil, bar |
| + heights, share percentages, humanBytes rounding at unit boundaries, |
| + the average that excludes today, future and partial hours at the UTC |
| + day boundary, x-axis labels for 7 and 30 days. |
| +6. The inline keyboard script in app_analytics.html: correct when two |
| + charts are on one page, harmless without JavaScript. |
| +7. Anything in the diff that would fail CI (darwin and windows builds |
| + included) or break an existing test that I did not update. |
| + |
| +## Round 2 |
| + |
| +Earlier rounds: round 1, docs/superpowers/reviews/CODEX-FINDINGS-console-analytics-ui-R1.md |
| +(1 P1, 4 P2; fixes in commit 5de6a68c). |
| + |
| +First give one line per P1 and P2 from round 1: resolved, partly, or not. |
| +Carry every unresolved or partly resolved finding forward at its current |
| +severity, then add new findings, looking hardest at the fix diff |
| +`933b227d..5de6a68c`. The verdict covers everything outstanding. HTTP tests |
| +need listening sockets; if your sandbox forbids them, say so rather than |
| +guessing. |
| + |
| +## Severity |
| + |
| +- **P1**: unsafe, would not compile, a test fails, or it would not work. |
| + Blocks merge. |
| +- **P2**: wrong or missing. Fixed without reopening this review. |
| +- **P3**: clarity or polish. Goes on a follow-up list; never a reason for |
| + another round. |
| + |
| +A P1 states its failure scenario and the evidence (file:line). Do not |
| +raise a P2 to P1 to keep the review open. |
| + |
| +## Output |
| + |
| +Findings ranked P1, P2, P3. Each gives the area, the problem, the |
| +evidence (file:line, verified), the failure scenario, a concrete fix and |
| +the invariant or trust boundary it breaks (its fault family). End with |
| +exactly one verdict: |
| + |
| +- **READY**: no P1 and no P2. |
| +- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another |
| + round. |
| +- **NOT READY**: one or more P1s, listed. |
| + |
| +Do not edit files. Do not spawn Anthropic-model reviewers or subagents of |
| +your own. Do not run the full test suites; targeted `go test -run` on |
| +internal/console is fine. |