Skip to content

fix: require solved_by_pr match for mirror linked-issue multiplier#1354

Open
carlos4s wants to merge 1 commit into
entrius:testfrom
carlos4s:fix/linked-issue-solved-by-pr-check
Open

fix: require solved_by_pr match for mirror linked-issue multiplier#1354
carlos4s wants to merge 1 commit into
entrius:testfrom
carlos4s:fix/linked-issue-solved-by-pr-check

Conversation

@carlos4s
Copy link
Copy Markdown
Contributor

Summary

_is_valid_linked_issue walked every anti-gaming gate for the issue multiplier — transferred, self-issue, created_at, state_reason, edited_after_merge, close-window — except solver attribution. The field MirrorLinkedIssue.solved_by_pr was already populated by das-github-mirror and treated as authoritative in issue_discovery/scan.py (scan.py:3,13), but the PR-multiplier path ignored it. A PR that referenced an issue but was not the actual solver could still receive STANDARD_ISSUE_MULTIPLIER or MAINTAINER_ISSUE_MULTIPLIER whenever the other gates happened to pass.

This PR adds a single guard alongside the other PR-state-agnostic gates so both surfaces are covered:

  • Merged PRs within the +0..+1 day close-window after another PR closed the linked issue (the close-window gate passes; nothing else caught the wrong-solver case).
  • Open PRs on the collateral path, which skips the close-window gate entirely and previously had no solver-attribution check at all.

The gate fails open when solved_by_pr is None to preserve behavior on older mirror snapshots that don't populate the field. This matches the conservative posture used elsewhere in the validator.

One-PR-per-issue semantics

If multiple PRs reference the same issue, only the one matching the mirror's solved_by_pr keeps the issue multiplier; the rest fall back to 1.0× on the issue slot (they still earn their full base_score). This mirrors issue_discovery, which already awards discovery_earned_score to a single solver per issue. Loosening to "any PR that referenced the issue" would re-open the multiplier-farming gap this PR closes.

Mirror attribution

If the mirror's solved_by_pr is wrong for a given issue, that's a mirror-side correction, not a validator-side relaxation. The validator's job is to consume the field consistently across paths.

Related Issues

Close #1353

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other (describe below)

Testing

  • Tests added/updated
  • Manually tested

New test class TestLinkedIssueSolvedByPr in tests/validator/oss_contributions/mirror/test_scoring.py covers:

  • merged PR with mismatched solved_by_pr → rejected
  • open PR with mismatched solved_by_pr (collateral path) → rejected
  • matching solved_by_pr → still valid (regression guard)
  • solved_by_pr is None → still valid (fail-open regression guard)
  • end-to-end _calculate_issue_multiplier returns 1.0 on mismatch
  • maintainer-authored mismatch still rejected (no MAINTAINER_ISSUE_MULTIPLIER shortcut)

Commands run locally on the changed files and the full suite:

  • uv run pytest tests/validator/oss_contributions/mirror/test_scoring.py -q → 67/67
  • uv run pytest tests/ -q → 864/864
  • uv run ruff check gittensor/ tests/ → clean
  • uv run ruff format --check gittensor/ tests/ → clean
  • uv run pyright gittensor/validator/oss_contributions/mirror/scoring.py tests/validator/oss_contributions/mirror/test_scoring.py → 0 errors / 0 warnings
  • uv run pre-commit run --hook-stage pre-push --files <changed files> → all hooks pass (vulture, pyright, pytest)

Checklist

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

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 24, 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.

[Bug] _is_valid_linked_issue Grants Issue Multiplier Without Checking solved_by_pr

1 participant