Skip to content

feat(code-review): dedicated Code Review section with analytics and org-wide review rules - #1211

Merged
Makisuo merged 4 commits into
mainfrom
feat/code-review-section
Oct 2, 2026
Merged

Makisuo merged 4 commits into
mainfrom
feat/code-review-section

fix(code-review): keep the app shell out of startup, bound analytics …

79e3bdb
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Oct 2, 2026 in 7m 59s

Confidence 4/5 · No issues found

🟢 Confidence 4/5 · likely safe to merge
The new reads are org-scoped and cursor-paged with PGlite tests over totals, windows, paging and tenant isolation; the only defect is the author filter's eight-option cap.
quality 98/100 · 1 note · tests covered · risk medium · 1/2 new units observable

Adds a Code Review section served by a new org-scoped codeReview HttpApi group backed by Postgres aggregates over pr_reviews/pr_review_findings, with the author filter fix and the analytics window cap in this iteration. Safe to merge; one small gap in the author filter.

  • PrReviewAnalyticsService serves analytics, org-wide review list, review detail and findings, cursor-paged
  • CodeReviewFilters loads the window's authors itself, so every tab can filter by one
  • List routes reset limit only for patches other than review, keeping loaded rows
  • Analytics start moves up to 366 days before endTime, bounding the bucket series

Findings

🔵 Note · F3 · CodeReviewFilters offers only the window's top 8 authors

correctness · apps/web/src/components/code-review/code-review-layout.tsx:150-166

The Author select is built from analytics.authors, which the service caps at TOP with .limit(TOP) (packages/backend/src/services/pr-review/PrReviewAnalyticsService.ts:422). In an organization with more than eight PR authors in the window, the ninth and beyond can never be picked: the tab's own query would return their rows, but the filter holds no option for them, and the "Clear filters" empty state is the only way back.

Give the filter list its own bound larger than the leaderboard's `TOP` (or a dedicated authors query), so every author with a review in the window is selectable.

Fixed since the last review

  • ✅ F2 · Opening a review's sheet resets limit, collapsing the loaded pages
What was checked
  • Bucket keys: SQL floor(epoch/width)*width*1000 and the JS Math.floor(startTime/bucketMs) agree on exact epoch ms
  • MAX_SPAN_MS bounds the series to ≤53 buckets; the new test covers startTime: 0
  • Tenant scoping: every new query filters OrgId; getReview flips NotFound for another org
Observability coverage: 1 of 2 changes observable
Change Kind Observable Evidence
GET /api/code-review/{analytics,reviews,reviews/:reviewId,findings} http entrypoint yes CodeReviewApiGroup is served like the other org groups; each PrReviewAnalyticsService method is an Effect.fn annotated with orgId and maple.* attributes
Postgres reads in PrReviewAnalyticsService (10 analytics queries, list, detail, findings) database no runs through makeDbExecute/drizzle without a per-query span or db.system/peer.service, matching the repo's existing drizzle call sites

79e3bdb · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.

Annotations

Check notice on line 166 in apps/web/src/components/code-review/code-review-layout.tsx

See this annotation in the file changed.

@maple-review-bot maple-review-bot / Maple / review

correctness: `CodeReviewFilters` offers only the window's top 8 authors

The Author select is built from `analytics.authors`, which the service caps at `TOP` with `.limit(TOP)` (`packages/backend/src/services/pr-review/PrReviewAnalyticsService.ts:422`). In an organization with more than eight PR authors in the window, the ninth and beyond can never be picked: the tab's own query would return their rows, but the filter holds no option for them, and the "Clear filters" empty state is the only way back.