fix: clear stale issue_discovery_score when fresh mirror data makes cached miner ineligible#1245
Open
bitloi wants to merge 1 commit into
Open
Conversation
…ached miner ineligible When _score_miner_issues() determines is_eligible=False after a successful mirror issue fetch, it returned immediately without zeroing the evaluation's issue_discovery_score. A miner restored from cache could therefore keep a positive score from a prior eligible cycle even though the current authoritative data shows it is below the valid-solved gate. Fix: set evaluation.issue_discovery_score = 0.0 in the ineligible early-return branch, matching the field that normalize_issue_discovery_rewards() reads when building reward shares. All other diagnostic fields (total_solved_issues, total_valid_solved_issues, issue_credibility, is_issue_eligible, etc.) are already written from fresh data before this branch, so only the aggregate score field needs clearing here. The cache-failure restore path (_restore_issue_discovery_from_cache) is unaffected: that path runs before _score_miner_issues and only when the fetch itself raises MirrorRequestError, not when it succeeds with ineligible data. Tests: add TestStaleScoreClearedOnIneligible with three cases: - fresh ineligible fetch zeroes issue_discovery_score while preserving counts - normalizer returns 0.0 for the formerly-stale miner after zeroing - control: mirror-fetch failure still restores the cached score unchanged
1c544b4 to
026fcb4
Compare
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
When
_score_miner_issues()determines a miner is ineligible after a successful mirror fetch, it returned early without zeroingevaluation.issue_discovery_score. AMinerEvaluationrestored from a prior cycle kept its old positive score even though the current authoritative data showed ineligibility.normalize_issue_discovery_rewards()then read that stale score and awarded an undeserved emission share.Fix: add
evaluation.issue_discovery_score = 0.0in the ineligible early-return branch. All other diagnostic fields (total_solved_issues,issue_credibility,is_issue_eligible, counts) are already written from fresh data before this branch and are intentionally preserved for operator diagnostics.The cache-failure restore path (
_restore_issue_discovery_from_cache) is unaffected — it runs only onMirrorRequestError, not on a successful-but-ineligible result.Related Issues
Closes #1244
Type of Change
Testing
Regression test
TestStaleScoreClearedOnIneligible(3 cases):8.12score zeroed to0.0when fresh fetch is ineligible — FAIL before fix, PASS afternormalize_issue_discovery_rewardsreturns0.0instead of1.0— FAIL before fix, PASS afterFull suite: 728/728 passed.
Checklist