feat: Add PR open time distribution histogram [issue: #167]Feat/pr open time histogram#392
Conversation
|
@abdullahxyz85 is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Priyanshu-byte-coder check it now, I close the older PR and create new PRs by spliting from each others, please review and merge and make sure to add the labels, gssoc:approved and level. |
Priyanshu-byte-coder
left a comment
There was a problem hiding this comment.
Three bugs in prs/route.ts:
1. Duplicate fetchPRMetrics function definition
The diff adds a second async function fetchPRMetrics(token, days) above the original async function fetchPRMetrics(token) that still exists in the file. TypeScript will throw a duplicate identifier error. Remove the old fetchPRMetrics signature and replace it with the new days parameter version. This is a merge conflict artifact.
2. Duplicate mergeRate in return object
return {
...
mergeRate: data.total_count > 0 ? merged / data.total_count : 0, // ← first (wrong)
timeDistribution,
mergeRate: sampleTotal > 0 ? merged / sampleTotal : 0, // ← duplicate
};Duplicate property — remove the first mergeRate line. The sampleTotal formula is correct.
3. Time distribution uses closedPRs + closed_at — should use mergedPRs + merged_at
The buckets loop over closedPRs (PRs closed without merging) and use closed_at. This mixes rejected PRs into the 'time to open' distribution. The chart should show time-to-merge only — loop over mergedPRs and use merged_at.
…tead of closedPRs in time distribution and avgReview, use merged_at not closed_at, remove duplicate mergeRate
|
@Priyanshu-byte-coder Done! Please make sure to add the label: gssoc:approved and level:adavanced. |
Priyanshu-byte-coder
left a comment
There was a problem hiding this comment.
- route.ts will not compile — unresolved merge conflict artifacts: duplicate formatPRMetrics declarations, two result bindings in same scope, unclosed if block. Fully rebase on main and resubmit. 2. Cache bypassed — fetchPRMetrics called directly in all branches, skipping fetchCachedPRMetrics. Restore caching. 3. cursor={{ fill: var(--accent)/10 }} — invalid Recharts prop value. Use rgba() instead.
|
@Priyanshu-byte-coder Conflicts are resolved and fix all the things , please review and merge it and add label: gssoc:approved and level |
Summary [Issue: #167 ]
Adds a histogram showing how long PRs stay open before being merged, broken into time buckets to reveal code review velocity patterns.
What's Changed
Implementation Details
/api/metrics/prs/route.tsto calculate and return time distribution dataPRMetrics.tsxto render histogram below existing statsVisual Preview
Acceptance Criteria Met [issue: #167 ]
/api/metrics/prsendpoint