fix(review): sum per-PR review-effort minutes with fallback in public-stats (#2070) - #4058
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
…-stats Closes JSONbored#2070 Replace reviewed * AVG(reviewEffortMinutes) with SUM(COALESCE(minutes, MINUTES_SAVED_PER_PR)) so mixed ledgers credit missing per-PR estimates with the documented flat fallback instead of under-reporting ROI. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review result - reject/close recommendedReview updated: 2026-07-07 18:53:26 UTC
🛑 Suggested Action - Reject/Close
Review summary Blockers
Nits — 4 non-blocking
Why this is blocked
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
|
Gittensory is closing this pull request on the maintainer's behalf (AI reviewers agree on a likely critical defect: src/review/public-stats.ts ~line 322-327: once any allowlisted repo has published PRs, `minutesSaved` equals the own-ledger-only `minutesSavedTotal`, but `reviewed` (`reviewedOf(totals)`) includes Orb-fleet merged/closed counts folded in earlier (`totals.merged += orb.merged; totals.closed += orb.closed`) — since the file's header states the own-ledger side is a frozen snapshot post-cutover while Orb keeps growing live ('the Orb aggregate only captures merged/closed, not reversals or a trailing-7-day split'), the public minutesSaved counter will stop scaling with reviewed once Orb activity grows, unlike the prior `reviewed * avgReviewEffortMinutes` formula; this interaction is untested.). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4058 +/- ##
=======================================
Coverage 93.59% 93.59%
=======================================
Files 379 379
Lines 35584 35585 +1
Branches 13050 13050
=======================================
+ Hits 33304 33305 +1
Misses 1618 1618
Partials 662 662
🚀 New features to boost your workflow:
|
Summary
Closes #2070
Completes the public-stats ROI fix:
minutesSavednow sums each distinct published PR'sreviewEffortMinutes, usingMINUTES_SAVED_PER_PRonly as a per-PR fallback when metadata is missing.Root cause
#1955 persisted per-PR estimates, but
getPublicStatsstill computedreviewed * AVG(minutes). SQLite'sAVGskips NULLs, so mixed ledgers (some PRs with stored effort, some without) under-reported time saved — e.g. PR #10 with 4 min + PR #11 with no estimate reported 8 instead of 24.Fix
AVG(minutes)toSUM(COALESCE(minutes, MINUTES_SAVED_PER_PR))at the per-PR grain (after deduping republish events)minutesSaved; preservereviewed === 0 -> 0Impact
Public ROI counter is credible during mixed rollout; fully-migrated ledgers behave the same as before when every PR has an estimate.
Test plan
npm run typechecknpx vitest run test/unit/public-stats.test.ts(19/19)reviewEffortMinutes+ one without -> sum uses fallback per missing PR