fix(signals): rank contributor opportunities before the per-repo cap - #394
Merged
JSONbored merged 3 commits intoJun 5, 2026
Merged
Conversation
JSONbored
approved these changes
Jun 5, 2026
JSONbored
left a comment
Owner
There was a problem hiding this comment.
@galuis116 this is good to merge.
A few notes:
- The ranking logic fits the signal layer and does not add a separate review path.
- The unit test gives enough coverage for the new evidence ordering.
- No code changes requested from me.
Validation expected:
- Current green CI is enough.
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
buildContributorOpportunities(src/signals/engine.ts) selected the issues to surface per repo by taking the first 5 of an unsorted list (rankable.slice(0, 5), raw DB order), then scoring only those. The list is namedrankablebut was never ranked before the cap, so issues at index 5+ were dropped before their opportunity score was ever computed.This discards the ranking the issue-quality producer goes to effort to build:
buildIssueQualityReportscores each issue and returns them sorted best-first, but the consumer keyed the report by issue number for per-issue lookups and ignored the ordering. The quality signal therefore only adjusted the score of whichever 5 issues came first, never which 5 were chosen. A "ready", high-fit issue that the system itself ranked #1 was invisible if it happened to be the 6th available issue in DB order. Closes #393.This is not cosmetic: these opportunities feed
buildContributorFitand the contributor decision pack (queue/processors.ts,services/decision-pack.ts), and the global top-25 ranking was drawn from a biased per-repo sample — steering miners toward lower-fit issues while hiding the highest-value work.Scope
src/signals/engine.ts— score every eligible (rankable) issue per repo, then keep that repo's top 5 by computed opportunity score (tie-break on issue number, mirroring the producer's order), instead of capping the raw list to 5 before scoring. The existing global sort + top-25 cap are unchanged.test/unit/issue-quality.test.ts— fail-on-revert: a "ready" issue sitting 6th in DB order (behind five "hold" issues) must now surface and rank first.Validation
npx tsc --noEmit— clean.npx vitest run(full suite) — 1066 passed, 1 skipped; no other assertions affected.Safety
Notes
The fix selects by the consumer's own opportunity score (lane fit + label-history overlap + quality adjustment − queue/bounty penalties), which is the value the pipeline ultimately ranks on, so per-repo selection and global ranking are now consistent.