fix(issue-discovery): gate solving PRs on branch eligibility#1408
Merged
Conversation
Issue discovery credited any issue closed by a MERGED PR regardless of which branch the PR merged into, while OSS PR scoring rejects PRs merged to non-acceptable branches via _should_skip_merged_mirror_pr. A miner could merge a solving PR into a throwaway branch and still earn discovery credit for the closed issue. Extract the branch-eligibility check into a shared helper and apply it in _classify_issue. The gate only fires when the solving PR carries base_ref (exposed by the mirror per entrius/das-github-mirror#131); pre-backfill data with a null base_ref falls through, so this is safe to deploy before the mirror change lands.
entrius
approved these changes
May 29, 2026
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.
What
Issue discovery credits an issue as solved whenever its linked PR is
MERGED, with no check on which branch the PR merged into. OSS PR scoring already rejects PRs merged to non-acceptable branches (_should_skip_merged_mirror_pr). The two paths disagreed, so a miner could merge a solving PR into a throwaway branch (e.g.scratch-do-not-score) and still earn discovery credit for the closed issue — a reward-integrity bypass of the repo branch restrictions.Change
_should_skip_merged_mirror_printo a sharedcheck_merged_branch_eligibilityhelper (OSS path behavior unchanged — same checks, same messages)._classify_issue, so a solving PR merged outside the acceptable branch set classifies asnot-solved-closedinstead ofsolved.base_ref,head_ref,head_repo_full_name,default_branchtoMirrorSolvingPRso the gate has the branch metadata to read.Deploy ordering
The gate only fires when the solving PR carries
base_ref. The mirror starts exposing branch metadata on the inlinesolving_prin entrius/das-github-mirror#131; until that lands,base_refis null and the gate falls through, scoring as before. So this is safe to deploy independently of, or before, the mirror change — the gate activates automatically once the mirror sends the field. Pairs with das-github-mirror#131 (addresses das-github-mirror#130).Tests
Added
_classify_issuecases for default-branch (solved), non-scoring branch (not-solved-closed), additional-acceptable-branch (solved), missingbase_reffall-through (solved), andNonerepo_config (gate skipped). Full suite: 886 passed.