Skip to content

fix(validator): don't reject merged PRs with a missing base_ref#1619

Open
jaytbarimbao-collab wants to merge 1 commit into
entrius:testfrom
jaytbarimbao-collab:fix/mirror-scoring-null-base-ref
Open

fix(validator): don't reject merged PRs with a missing base_ref#1619
jaytbarimbao-collab wants to merge 1 commit into
entrius:testfrom
jaytbarimbao-collab:fix/mirror-scoring-null-base-ref

Conversation

@jaytbarimbao-collab

Copy link
Copy Markdown

Summary

check_merged_branch_eligibility gated the base_ref check with not branch_matches_pattern(base_ref or '', acceptable). When the mirror omits base_ref on pre-backfill rows (base_ref is Optional[str]None), base_ref or '' becomes '', which never matches the acceptable branch set — so a valid MERGED PR is dropped at load time and never enters merged_prs, earning no OSS contribution score even though it still counts toward eligibility.

The fix gates only when base_ref is present, so a missing base_ref falls through rather than false-positive-blocking. This matches three existing precedents:

  • the head_ref check in the same function (if acceptable and head_ref and ...), which already skips on a falsy head_ref;
  • the function's own docstring: "missing head_ref/head_repo_full_name skips the head_ref check rather than false-positive-blocking on older data";
  • issue discovery, which calls this same shared gate only when base_ref is not None (issue_discovery/scan.py), covered by test_missing_base_ref_falls_through_to_solved.

Related Issues

Fixes #1599

Type of Change

  • Bug fix

Testing

  • Tests added — TestEligibilityGate::test_missing_base_ref_falls_through_not_blocked asserts a merged PR with base_ref=None falls through the gate. Fails on test before the fix (blocked), passes after. A real non-matching base_ref is still blocked (existing eligibility tests unchanged, all 21 green).
  • Full suite green (961 passed), ruff + pyright clean.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Changes are documented (if applicable)

check_merged_branch_eligibility gated the base_ref check with
`not branch_matches_pattern(base_ref or '', acceptable)`. When the mirror
omits base_ref on pre-backfill rows (base_ref is Optional[str] -> None),
`base_ref or ''` becomes '', which never matches the acceptable branch
set, so a valid MERGED PR is dropped at load time and never enters
merged_prs — earning no OSS contribution score despite counting toward
eligibility.

Gate only when base_ref is present, so a missing base_ref falls through
rather than false-positive-blocking. This matches:
- the head_ref check in the same function (`if acceptable and head_ref
  and ...`), which already skips on a falsy head_ref;
- the function's own docstring ("missing head_ref/head_repo_full_name
  skips the head_ref check rather than false-positive-blocking on older
  data");
- issue discovery, which calls this same shared gate only when
  `base_ref is not None` (issue_discovery/scan.py), covered by
  test_missing_base_ref_falls_through_to_solved.

Add a regression test asserting a merged PR with base_ref=None falls
through the eligibility gate. A real non-matching base_ref is still
blocked (existing tests unchanged).

Fixes entrius#1599
@jaytbarimbao-collab

Copy link
Copy Markdown
Author

@anderdc @LandynDev fixes #1599 (bug, filed by @luciferlive112116). The shared check_merged_branch_eligibility gate false-positive-blocks a MERGED PR when the mirror omits base_ref on pre-backfill rows — the fix gates only when base_ref is present, matching the head_ref check in the same function, the docstring's stated intent, and issue discovery's base_ref is not None guard (which has test_missing_base_ref_falls_through_to_solved). +regression test. Couldn't self-apply the bug label (no triage access).

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(validator): OSS mirror scoring rejects merged PRs with null base_ref

1 participant