fix: require solved_by_pr match for mirror linked-issue multiplier#1354
Open
carlos4s wants to merge 1 commit into
Open
fix: require solved_by_pr match for mirror linked-issue multiplier#1354carlos4s wants to merge 1 commit into
carlos4s wants to merge 1 commit into
Conversation
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
_is_valid_linked_issuewalked every anti-gaming gate for the issue multiplier — transferred, self-issue,created_at,state_reason,edited_after_merge, close-window — except solver attribution. The fieldMirrorLinkedIssue.solved_by_prwas already populated by das-github-mirror and treated as authoritative inissue_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 receiveSTANDARD_ISSUE_MULTIPLIERorMAINTAINER_ISSUE_MULTIPLIERwhenever the other gates happened to pass.This PR adds a single guard alongside the other PR-state-agnostic gates so both surfaces are covered:
+0..+1day close-window after another PR closed the linked issue (the close-window gate passes; nothing else caught the wrong-solver case).The gate fails open when
solved_by_pr is Noneto 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_prkeeps the issue multiplier; the rest fall back to1.0×on the issue slot (they still earn their fullbase_score). This mirrorsissue_discovery, which already awardsdiscovery_earned_scoreto 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_pris 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
Testing
New test class
TestLinkedIssueSolvedByPrintests/validator/oss_contributions/mirror/test_scoring.pycovers:solved_by_pr→ rejectedsolved_by_pr(collateral path) → rejectedsolved_by_pr→ still valid (regression guard)solved_by_pr is None→ still valid (fail-open regression guard)_calculate_issue_multiplierreturns1.0on mismatchMAINTAINER_ISSUE_MULTIPLIERshortcut)Commands run locally on the changed files and the full suite:
uv run pytest tests/validator/oss_contributions/mirror/test_scoring.py -q→ 67/67uv run pytest tests/ -q→ 864/864uv run ruff check gittensor/ tests/→ cleanuv run ruff format --check gittensor/ tests/→ cleanuv run pyright gittensor/validator/oss_contributions/mirror/scoring.py tests/validator/oss_contributions/mirror/test_scoring.py→ 0 errors / 0 warningsuv run pre-commit run --hook-stage pre-push --files <changed files>→ all hooks pass (vulture, pyright, pytest)Checklist