name: Bug Report
about: Report a bug or unexpected behavior
labels: bug
Title
refactor: remove unreachable legacy partial-pagination cache-fallback branch in store_or_use_cached_evaluation
Description
neurons/validator.py:store_or_use_cached_evaluation still contains a legacy branch intended for a pre-mirror partial-pagination failure mode:
if not miner_eval .should_use_cache_fallback and not miner_eval .mirror_pr_fetch_failed :
bt .logging .warning (
f'UID { uid } : GitHub fetch failed after partial PR load; skipping cache store/fallback this round'
)
continue
After the mirror-only scoring refactor, that state is no longer constructible by current writers of github_pr_fetch_failed.
This leaves stale dead logic and a misleading inline comment in active validator code.
Steps to Reproduce
Inspect the stale branch in neurons/validator.py .
Check all writers of github_pr_fetch_failed = True:
Verify control flow:
identity transient path returns early in reward.py before PR load
mirror fetch failure sets both mirror/github failure flags and returns before PR append
Verify should_use_cache_fallback definition in gittensor/classes.py :
github_pr_fetch_failed and total_prs == 0
Expected Behavior
Validator cache-fallback code should not contain legacy branches that are unreachable under the current mirror-only execution model.
Actual Behavior
The legacy partial-pagination branch remains in neurons/validator.py even though:
only two current writers can set github_pr_fetch_failed = True
both paths produce total_prs == 0
one of them also forces mirror_pr_fetch_failed == True
So the guarded condition is unreachable.
Environment
OS: Ubuntu (VM)
Python version: N/A (static flow analysis)
Commit/Version: test branch @ 5291948abe3fd040771c31800b316906e1e92c95 (verified equal across local HEAD, origin/test, and upstream/test)
Additional Context
Unreachable state proof
The stale branch executes only when all are true:
github_pr_fetch_failed == True
not should_use_cache_fallback == True => total_prs > 0 (given property definition)
mirror_pr_fetch_failed == False
But in current code:
writer A (inspections.py) sets github_pr_fetch_failed only for transient identity failure, and reward.py returns before PR loading -> total_prs == 0
writer B (mirror/load.py) sets both github_pr_fetch_failed=True and mirror_pr_fetch_failed=True, and returns before PR loading -> total_prs == 0
No third writer exists in gittensor/ or neurons/.
Why this likely remained
Overlap check
No exact open/closed issue or PR currently targets this specific stale branch cleanup in store_or_use_cached_evaluation.
Open PR feat(validator): per-repository eligibility #1293 (feat/per-repository eligibility) touches neurons/validator.py but retains this branch.
Proposed fix
Remove only the unreachable block and stale comment in neurons/validator.py, leaving the normal cache-fallback path intact.
Optional follow-up test: assert invariant that any MinerEvaluation with github_pr_fetch_failed=True has total_prs==0 under current writers.
name: Bug Report
about: Report a bug or unexpected behavior
labels: bug
Title
refactor: remove unreachable legacy partial-pagination cache-fallback branch in
store_or_use_cached_evaluationDescription
neurons/validator.py:store_or_use_cached_evaluationstill contains a legacy branch intended for a pre-mirror partial-pagination failure mode:After the mirror-only scoring refactor, that state is no longer constructible by current writers of
github_pr_fetch_failed.This leaves stale dead logic and a misleading inline comment in active validator code.
Steps to Reproduce
neurons/validator.py.github_pr_fetch_failed = True:gittensor/validator/oss_contributions/inspections.pygittensor/validator/oss_contributions/mirror/load.pyreward.pybefore PR loadshould_use_cache_fallbackdefinition ingittensor/classes.py:github_pr_fetch_failed and total_prs == 0Expected Behavior
Validator cache-fallback code should not contain legacy branches that are unreachable under the current mirror-only execution model.
Actual Behavior
The legacy partial-pagination branch remains in
neurons/validator.pyeven though:github_pr_fetch_failed = Truetotal_prs == 0mirror_pr_fetch_failed == TrueSo the guarded condition is unreachable.
Environment
testbranch @5291948abe3fd040771c31800b316906e1e92c95(verified equal across localHEAD,origin/test, andupstream/test)Additional Context
Unreachable state proof
The stale branch executes only when all are true:
github_pr_fetch_failed == Truenot should_use_cache_fallback == True=>total_prs > 0(given property definition)mirror_pr_fetch_failed == FalseBut in current code:
inspections.py) setsgithub_pr_fetch_failedonly for transient identity failure, andreward.pyreturns before PR loading ->total_prs == 0mirror/load.py) sets bothgithub_pr_fetch_failed=Trueandmirror_pr_fetch_failed=True, and returns before PR loading ->total_prs == 0No third writer exists in
gittensor/orneurons/.Why this likely remained
#1202removed legacy scoring pipeline paths but did not touchneurons/validator.py, so this appears to be incomplete cleanup after large refactor sweep.Overlap check
store_or_use_cached_evaluation.feat/per-repository eligibility) touchesneurons/validator.pybut retains this branch.Proposed fix
Remove only the unreachable block and stale comment in
neurons/validator.py, leaving the normal cache-fallback path intact.Optional follow-up test: assert invariant that any
MinerEvaluationwithgithub_pr_fetch_failed=Truehastotal_prs==0under current writers.