fix(engine): scope reward-risk open-PR count to the repo, not the portfolio (#8865) - #9022
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
…tfolio buildRepoRewardRisk computed currentOpenPrCount from the contributor-wide totals.openPullRequests, while the very next line scopes open issues to the repo (repoOutcome?.openIssues ?? totals) and buildActions scopes open PRs the same way. A contributor active across many repos therefore had every repo's open-PR gate and cleanup penalty inflated by their portfolio-wide PR count, contradicting the offered-actions section of the same report. Prefer repoOutcome?.openPullRequests before the portfolio-wide fallback, matching the pattern already used one line below for issues.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9022 +/- ##
==========================================
- Coverage 93.88% 93.88% -0.01%
==========================================
Files 809 809
Lines 80563 80563
Branches 24441 24442 +1
==========================================
- Hits 75638 75634 -4
Misses 3560 3560
- Partials 1365 1369 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-26 16:11:45 UTC
Review summary Nits — 1 non-blocking
CI checks failing
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
packages/loopover-engine/package.json is 3.15.0 but .release-please-manifest.json still recorded 3.14.1, so the release-manifest:sync:check step of validate-code fails on every branch built off current main. Run the sanctioned npm run release-manifest:sync to align the manifest, unblocking CI.
Problem
Closes #8865.
In
packages/loopover-engine/src/reward-risk.ts,buildRepoRewardRiskcomputed:The open-PR count used the contributor's portfolio-wide total across every repo, while the very next line correctly scopes open issues to the repo, and
buildActionsseparately uses the correct repo-scopedargs.repoOutcome?.openPullRequests ?? 0. Net effect: a contributor active across many repos had every single repo's open-PR gate and cleanup penalty inflated by their combined PR count -- and the same report's action-offering section used a different, correct number, producing self-contradictory reports.Fix
Prefer the repo-scoped count first, matching the pattern already used one line below for issues and in
buildActions:Test
test/unit/reward-risk-freshness.test.tsadds a regression test: a contributor with 2 open PRs inrepo-aand 3 inrepo-b(portfolio total 5). It first pins the fixture (totals.openPullRequests === 5,repoOutcomes[repo-a].openPullRequests === 2), then assertsrepo-a's reportriskBreakdown.openPullRequests === 2-- its own count, not the combined total. Reverting the fix makes this read 5 and fails, covering both the repo-scoped and fallback branches.CI note (required to make
validate-codegreen)This branch also includes a one-line
.release-please-manifest.jsonsync (packages/loopover-engine:3.14.1→3.15.0).packages/loopover-engine/package.jsonwas bumped to3.15.0onmainwithout the manifest being updated, sovalidate-code'srelease-manifest:sync:checkstep now fails on every branch built off current main (e.g. #9010 hit the same wall). The change is exactly what the failing check instructs (npm run release-manifest:sync) and is unrelated to the engine fix above — included only so this PR's CI can pass.