Skip to content

fix(issue-discovery): gate solving PRs on branch eligibility#1408

Merged
entrius merged 2 commits into
testfrom
fix/issue-discovery-branch-eligibility
May 29, 2026
Merged

fix(issue-discovery): gate solving PRs on branch eligibility#1408
entrius merged 2 commits into
testfrom
fix/issue-discovery-branch-eligibility

Conversation

@anderdc
Copy link
Copy Markdown
Collaborator

@anderdc anderdc commented May 29, 2026

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

  • Extract the branch-eligibility logic from _should_skip_merged_mirror_pr into a shared check_merged_branch_eligibility helper (OSS path behavior unchanged — same checks, same messages).
  • Apply that helper in _classify_issue, so a solving PR merged outside the acceptable branch set classifies as not-solved-closed instead of solved.
  • Add base_ref, head_ref, head_repo_full_name, default_branch to MirrorSolvingPR so 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 inline solving_pr in entrius/das-github-mirror#131; until that lands, base_ref is 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_issue cases for default-branch (solved), non-scoring branch (not-solved-closed), additional-acceptable-branch (solved), missing base_ref fall-through (solved), and None repo_config (gate skipped). Full suite: 886 passed.

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 entrius merged commit 0b46873 into test May 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants