Skip to content

feat(code-review): add review analytics#4073

Open
alex-alecu wants to merge 1 commit into
mainfrom
feat/code-review-analytics
Open

feat(code-review): add review analytics#4073
alex-alecu wants to merge 1 commit into
mainfrom
feat/code-review-analytics

Conversation

@alex-alecu

Copy link
Copy Markdown
Contributor

Summary

  • Adds optional Code Reviewer analytics for personal and organization accounts.
  • Saves structured change and finding totals when a review finishes, while keeping retries and repeat callbacks safe.
  • Adds filters, coverage details, repository tables, and a GitHub organization contributor view.

Verification

  1. Open Code Reviewer settings for GitHub or GitLab and select the Analytics tab.
  2. Turn on analytics collection, complete a new review, and confirm its totals appear for the matching date and repository.
  3. Turn collection off and confirm saved analytics stay visible while new reviews are not added.
  4. For a GitHub organization, confirm members can view the dashboard but only owners and billing managers can change collection.

Visual Changes

N/A - local app services were not running for screenshots.

Reviewer Notes

  • Collection is off by default and does not fill in old reviews.
  • Contributor rankings are limited to GitHub organizations because GitLab does not provide a stable author identity here.

@kilo-code-bot

kilo-code-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Adds opt-in Code Reviewer analytics with bounded taxonomy persistence, snapshot-based enrollment, and dashboard queries. No PII, GDPR, security, or data integrity concerns found.

Files Reviewed (29 files)
  • CONTEXT.md - Documentation: Code Reviewer terms, boundaries, and rules
  • apps/web/src/app/(app)/code-reviews/ReviewAgentPageClient.tsx - UI: Analytics tab for personal reviews
  • apps/web/src/app/(app)/organizations/[id]/code-reviews/ReviewAgentPageClient.tsx - UI: Analytics tab for org reviews
  • apps/web/src/app/api/internal/code-review-status/[reviewId]/route.ts - Callback: analytics manifest parsing and finalization
  • apps/web/src/app/api/internal/code-review-status/[reviewId]/route.test.ts - Tests
  • apps/web/src/components/code-reviews/analytics/AnalyticsBreakdownBars.tsx - New UI component
  • apps/web/src/components/code-reviews/analytics/AnalyticsTables.tsx - New UI component
  • apps/web/src/components/code-reviews/analytics/CodeReviewAnalyticsPanel.tsx - New UI component
  • apps/web/src/lib/agent-config/db/agent-configs.ts - Config: review_analytics_enabled field in JSONB
  • apps/web/src/lib/code-reviews/analytics/contracts.ts - Validation schemas, manifest parser, prompt appendix
  • apps/web/src/lib/code-reviews/analytics/contracts.test.ts - Tests
  • apps/web/src/lib/code-reviews/analytics/db.ts - Persistence: results, findings, dashboard queries
  • apps/web/src/lib/code-reviews/analytics/db.test.ts - Tests
  • apps/web/src/lib/code-reviews/analytics/settings.ts - Analytics enable/disable settings
  • apps/web/src/lib/code-reviews/analytics/settings.test.ts - Tests
  • apps/web/src/lib/code-reviews/db/code-reviews.ts - Attempt creation with analytics snapshot
  • apps/web/src/lib/code-reviews/db/code-reviews.test.ts - Tests
  • apps/web/src/lib/code-reviews/dispatch/dispatch-pending-reviews.ts - Analytics enrollment at dispatch
  • apps/web/src/lib/code-reviews/dispatch/dispatch-pending-reviews.test.ts - Tests
  • apps/web/src/routers/code-reviews-router.ts - Default review_analytics_enabled: false
  • apps/web/src/routers/code-reviews-router.test.ts - Tests
  • apps/web/src/routers/code-reviews/code-review-analytics-router.ts - New tRPC router
  • apps/web/src/routers/code-reviews/code-review-analytics-router.test.ts - Tests
  • apps/web/src/routers/code-reviews/code-reviews-router.ts - Router registration
  • apps/web/src/routers/organizations/organization-code-reviews-router.ts - Org defaults
  • packages/db/src/migrations/0166_open_xorn.sql - New tables + column + FKs + indexes
  • packages/db/src/schema-types.ts - TypeScript types and Zod schemas
  • packages/db/src/schema.ts - Drizzle table definitions
  • packages/db/src/schema.test.ts - Schema tests

Reviewed by deepseek-v4-pro-20260423 · 1,187,949 tokens

Review guidance: REVIEW.md from base branch main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant