Repository navigation
feat(prs): show PRs reviewed and review participation rate - #3639
Merged
Priyanshu-byte-coder merged 1 commit intoNov 16, 2026
Conversation
The "Reviews you gave" panel counted review submissions, so three reviews on one PR looked like three PRs and reviews left on your own PRs counted as participation. It had no way to compare how much you review with how much you ship, which is what Priyanshu-byte-coder#191 asks for. - src/lib/pull-requests.ts: the review contributions query now also fetches each reviewed PR's URL and author. summarizePullRequests adds reviews.prsReviewed (distinct PRs by someone else, deduped across linked accounts, own and linked-account PRs excluded), reviews.participationRate (PRs reviewed / PRs opened in the range, null when none were opened) and reviews.sampled (more reviews than the 100 one request returns, so the count is a lower bound). - src/app/api/metrics/prs/route.ts: bump the cache key version so cached payloads without the new fields are not served. - src/components/PRMetrics.tsx: show "PRs reviewed" next to reviews submitted, with the tooltip from the issue, and the participation rate as a percentage. A sampled count shows as "80+", and the rate line explains itself when no PRs were opened in the range. - Tests: unit tests for dedupe, self-review exclusion, linked accounts, null authors, no PRs opened and sampling; a component test for the panel. The e2e mocks and docs/api.md describe the new fields. Closes Priyanshu-byte-coder#191
officialasishkumar
requested a review
from Priyanshu-byte-coder
as a code owner
November 15, 2026 22:55
Priyanshu-byte-coder
merged commit Nov 16, 2026
373aa77
into
Priyanshu-byte-coder:main
14 checks passed
|
🎉 Merged! Thanks for contributing to DevTrack. If the project has been useful to you, a ⭐ star on the repo is the easiest way to support it — it helps DevTrack get discovered by more developers. Keep an eye on open issues for your next contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the review participation metric from #191 to the Reviews you gave panel: the number of distinct PRs by other people you reviewed in the range, and that number as a percentage of the PRs you opened. Until now the panel only counted review submissions, so three reviews on one PR looked like three PRs, and reviews on your own PRs counted too.
Closes #191
Type of Change
What Changed
src/lib/pull-requests.ts: the existingpullRequestReviewContributionsselection also fetchespullRequest { url author { login } }. This is the same single GraphQL request, so there are no extra API calls (the issue suggested areviewed-by:search; the contributions data already covers it and matches the selected range exactly).summarizePullRequestsadds three fields toreviews:prsReviewed: distinct reviewed PRs, deduped by URL across reviews and linked accounts. PRs authored by the signed-in login or any linked account are excluded, compared case-insensitively.participationRate:prsReviewed / openedfor the range, ornullwhen no PRs were opened.sampled:truewhen you gave more reviews than the 100 nodes one request returns, so the count is a lower bound.src/app/api/metrics/prs/route.ts: cache keyv: 2→v: 3so cached payloads without the new fields aren't served.src/components/PRMetrics.tsx: a PRs reviewed figure next to "reviews submitted", with the tooltip from the issue ("PRs where you left a review comment or approval"), and a line like 150% review participation. A sampled count shows as80+with "(latest 100 reviews)". When no PRs were opened in the range, the line says so instead of showing a rate. It follows the 7d / 30d / 90d range like the rest of the panel.test/pull-requests.test.tscovers repeat reviews on one PR, reviews on your own and linked-account PRs, the same PR seen from two accounts,nullPR authors (deleted accounts), no PRs opened, and sampling. The newtest/components/PRMetrics.test.tsxcovers the rendered count, the rate, the sampled+, and the no-PRs message. All of these fail without the change.e2e/helpers/dashboard-mocks.js,e2e/dashboard.spec.ts) and the/api/metrics/prsrow indocs/api.mdinclude the new fields.How to Test
pnpm vitest run test/pull-requests.test.ts test/components/PRMetrics.test.tsxExpected result: The panel shows how many distinct PRs you reviewed and the percentage compared with the PRs you opened, and both change with the range. With no PRs opened, it shows the explanatory line instead of a rate.
Checklist
console.log, debug code, or commented-out blocksnpm run lintpasses locallynpm run type-check)Accessibility (UI changes only)
Additional Context
summarizePullRequests: the counts matched the distinct PR URLs in the response.tsc --noEmit, ESLint, and Prettier on the changed files.