Add live evidence-linked contributor leaderboard - #2
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThe change adds an evidence-linked contributor-by-subsystem leaderboard. It records review events, computes scores and trends, exposes leaderboard data through ChangesContributor leaderboard
Estimated code review effort: 3 (Moderate) | ~25 minutes Mergeability Score: ⚪ Minimal · up to The PR adds the contributor leaderboard and related live evidence handling, with the supplied checks passing and no actionable merge-blocking risk remaining after normal review. Sequence Diagram(s)sequenceDiagram
participant Browser
participant LiveServer
participant LeaderboardOperation
participant MongoDB
Browser->>LiveServer: Request /api/live
LiveServer->>LeaderboardOperation: Fetch contributor leaderboard
LeaderboardOperation->>MongoDB: Load profiles and GitHub receipts
MongoDB-->>LeaderboardOperation: Return source records
LeaderboardOperation-->>LiveServer: Return scored rows
LiveServer-->>Browser: Return live data
MongoDB-->>LiveServer: Emit leaderboard_profiles change
LiveServer-->>Browser: Send leaderboard SSE event
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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f2b0253e89
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function eventKind(status) { | ||
| if (status === 'blocked') return 'missing-evidence'; | ||
| if (status === 'concerns') return 'review-concerns'; | ||
| if (status === 'approved') return 'verified-evidence'; |
There was a problem hiding this comment.
Restrict verified-evidence credit to actual evidence
When a PR has no active contract, the standard review path can approve it without checking any evidence, yet this status-only mapping records a verified-evidence event and adds +3. Consequently, ordinary approved GitHub PRs inflate the public evidence-readiness score even when receipt.evidence is empty; create this event only when the reviewer has actually validated the required evidence, and leave ordinary approvals unscored.
Useful? React with 👍 / 👎.
| { prNum: pr.prNum }, | ||
| { | ||
| $set: { status: 'blocked', review }, | ||
| $push: { reviewEvents: reviewEventForReceipt(pr, 'blocked', new Date()) }, |
There was a problem hiding this comment.
Deduplicate repeated verdict events for the same receipt
When GitHub sends an edited, reopened, or ready_for_review delivery without a new head SHA, processGitHubDelivery reuses the existing receipt, resets it to submitted, and retains reviewEvents; this unconditional $push then scores the same blocked verdict again. Routine metadata edits can therefore repeatedly subtract 5 points from one unchanged PR (and the approval branch can similarly add points), so append only a genuinely new evidence/verdict transition or use an idempotency key.
Useful? React with 👍 / 👎.
| return | ||
| } | ||
| byId('leaderboard').innerHTML = rows.map((row, index) => { | ||
| const latest = row.events?.[row.events.length - 1] |
There was a problem hiding this comment.
Render links for every event included in the score
For any row with multiple scored events, selecting only latest hides all earlier evidence links and transitions even though those events still contribute to the displayed total. For example, the documented two-blocked-PR row shows a −10 movement but exposes only the second PR's 95→90 transition, preventing users from auditing the first −5; render the full event list or otherwise provide access to every contributing event.
Useful? React with 👍 / 👎.
Summary
Verification
Merge safety
This branch was refreshed against main at 9125f5a immediately before commit. It does not touch the teammates untracked shared-worktree files.
Summary by CodeRabbit