feat(dashboard): recent-review teaser and comma-formatted token counts #80

Merged
rcsheets merged 1 commit from feat/home-recent-review into main 2026-07-24 01:03:46 +00:00
Owner

Add a "most recent review" card to the home page showing the signed-in
user's newest involved review (repo, PR, verdict, tier, and a one-line
summary). Admins with no reviews of their own fall back to their saved
"view as" identity, labeled as such.

Also format the input/output token tallies with thousands separators via
a new humanCount helper so they read as "1,234,567" rather than a wall of
digits.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

Add a "most recent review" card to the home page showing the signed-in user's newest involved review (repo, PR, verdict, tier, and a one-line summary). Admins with no reviews of their own fall back to their saved "view as" identity, labeled as such. Also format the input/output token tallies with thousands separators via a new humanCount helper so they read as "1,234,567" rather than a wall of digits. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
feat(dashboard): recent-review teaser and comma-formatted token counts
All checks were successful
ci / check (pull_request) Successful in 47s
336e7727b2
Add a "most recent review" card to the home page showing the signed-in
user's newest involved review (repo, PR, verdict, tier, and a one-line
summary). Admins with no reviews of their own fall back to their saved
"view as" identity, labeled as such.

Also format the input/output token tallies with thousands separators via
a new humanCount helper so they read as "1,234,567" rather than a wall of
digits.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator

Automated review by pr-reviewer v0.39.0 | Safety Check | Claude Sonnet 5 | tracking id r-62b853-c15fb9
This is an AI-generated review and may contain mistakes.

Status: Completed


⚠️ The primary review (Mistral Small) failed. The review below is from Claude Sonnet 5, which reviewed the same diff.

Verdict: LGTM — Additive dashboard feature (recent-review teaser + comma-formatted token counts) with reasonable tests and no security or breaking-change concerns.

Reviewed the diff:

  • humanCount: straightforward comma-formatting logic, tested with several cases including negatives. Looks correct.
  • summarize: trims first non-empty line, truncates by rune count with ellipsis. Reasonable, tested.
  • recentReviewForUser / recentReviewFor: uses s.store.ReviewsVisibleToUser(ctx, email, 1) — relies on that method properly scoping to the user's visible/involved reviews (not shown in diff, presumed already correct/existing). Falls back to admin's "view as" email only if it differs from the real email, and labels it appropriately. Nil-safe on missing user, and errors are logged and treated as "no review" rather than propagated — reasonable fail-open behavior for a non-critical dashboard widget.
  • Template changes are straightforwardly additive and guarded by {{if .RecentReview}} and {{if .RecentReview.Summary}}, no obvious injection risk since html/template auto-escapes.
  • No secrets, no large files, no breaking changes to existing routes/handlers. New fields are additive to an anonymous struct, template addition is backward compatible when RecentReview is nil.
  • Two source files (templates.go, user_handlers.go) lack dedicated tests per repo context note, but home_render_test.go does exercise the new template logic and humanCount/summarize helpers substantially, so coverage isn't absent, just not per-file.

Nothing alarming: no secrets, no obvious logic bugs, no breaking changes.

*Automated review by [pr-reviewer](https://git.brooktrails.org/brooktrails/pr-reviewer) v0.39.0 | Safety Check | Claude Sonnet 5 | tracking id `r-62b853-c15fb9`* *This is an AI-generated review and may contain mistakes.* **Status:** ✅ Completed --- > ⚠️ The primary review (**Mistral Small**) failed. The review below is from **Claude Sonnet 5**, which reviewed the same diff. **✅ Verdict: LGTM** — Additive dashboard feature (recent-review teaser + comma-formatted token counts) with reasonable tests and no security or breaking-change concerns. Reviewed the diff: - `humanCount`: straightforward comma-formatting logic, tested with several cases including negatives. Looks correct. - `summarize`: trims first non-empty line, truncates by rune count with ellipsis. Reasonable, tested. - `recentReviewForUser` / `recentReviewFor`: uses `s.store.ReviewsVisibleToUser(ctx, email, 1)` — relies on that method properly scoping to the user's visible/involved reviews (not shown in diff, presumed already correct/existing). Falls back to admin's "view as" email only if it differs from the real email, and labels it appropriately. Nil-safe on missing user, and errors are logged and treated as "no review" rather than propagated — reasonable fail-open behavior for a non-critical dashboard widget. - Template changes are straightforwardly additive and guarded by `{{if .RecentReview}}` and `{{if .RecentReview.Summary}}`, no obvious injection risk since html/template auto-escapes. - No secrets, no large files, no breaking changes to existing routes/handlers. New fields are additive to an anonymous struct, template addition is backward compatible when RecentReview is nil. - Two source files (templates.go, user_handlers.go) lack dedicated tests per repo context note, but home_render_test.go does exercise the new template logic and humanCount/summarize helpers substantially, so coverage isn't absent, just not per-file. Nothing alarming: no secrets, no obvious logic bugs, no breaking changes.
rcsheets deleted branch feat/home-recent-review 2026-07-24 01:03:46 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
brooktrails/pr-reviewer!80
No description provided.