Skip to content

fix(validator): handle unavailable mirror scoring data - #837

Closed
YB0y wants to merge 2 commits into
entrius:testfrom
YB0y:fix/mirror-scan-scoring-data-unavailable-no-cache
Closed

fix(validator): handle unavailable mirror scoring data#837
YB0y wants to merge 2 commits into
entrius:testfrom
YB0y:fix/mirror-scan-scoring-data-unavailable-no-cache

Conversation

@YB0y

@YB0y YB0y commented Apr 28, 2026

Copy link
Copy Markdown

Summary

Closes #836.

This PR treats the mirror's scoring_data_stored=False signal as unavailable scoring data, not as a valid zero-score result. It covers two sibling bugs in different validator paths:

  • Issue discovery: _resolve_solving_pr_score now returns None and leaves the per-cycle solving-PR cache untouched when mirror file scoring data is unavailable. This prevents one unavailable response from poisoning later miners' issue-discovery scoring with a cached zero.
  • OSS contributions: mirror merged PRs that cannot be scored are removed before finalization. This prevents unscored merged PRs from inflating credibility or rescuing reward eligibility.

Fix

  • Check MirrorPullRequestFilesResponse.scoring_data_stored after fetching solving-PR files in gittensor/validator/issue_discovery/mirror_scan.py.
  • Return False from score_mirror_pr when a mirror PR cannot be scored because data is unavailable, file fetching fails, or no files are returned.
  • Keep only successfully scored MERGED mirror PRs in mirror_eval.merged_prs before finalize_miner_scores uses those PRs for eligibility, credibility, and score aggregation.
  • Rebased onto current test and squashed into one commit.

Test plan

  • uv run --extra dev python -m pytest tests/validator/issue_discovery/test_mirror_scan.py tests/validator/oss_contributions/mirror -q
  • uv run --extra dev ruff check gittensor/validator/issue_discovery/mirror_scan.py gittensor/validator/oss_contributions/mirror/scoring.py tests/validator/issue_discovery/test_mirror_scan.py tests/validator/oss_contributions/mirror/test_scoring_data_stored_eligibility.py
  • uv run --extra dev ruff format --check gittensor/validator/issue_discovery/mirror_scan.py gittensor/validator/oss_contributions/mirror/scoring.py tests/validator/issue_discovery/test_mirror_scan.py tests/validator/oss_contributions/mirror/test_scoring_data_stored_eligibility.py

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label Apr 28, 2026
@YB0y

YB0y commented Apr 30, 2026

Copy link
Copy Markdown
Author

@anderdc can you review this please?

@YB0y
YB0y force-pushed the fix/mirror-scan-scoring-data-unavailable-no-cache branch from 5266124 to dc49509 Compare April 30, 2026 16:30
@YB0y YB0y changed the title fix(mirror-scan): don't cache zero when scoring data unavailable fix(validator): handle unavailable mirror scoring data Apr 30, 2026
Treat scoring_data_stored=False as an availability signal instead of a valid zero-score result in both mirror scoring paths.

For issue discovery, solving PR file data that is unavailable now returns None and stays out of the per-cycle cache so later lookups can retry instead of hitting a cached zero.

For OSS contributions, merged mirror PRs that cannot be scored are removed before finalization so they cannot inflate credibility or rescue reward eligibility.

Closes entrius#836

Closes entrius#904
@YB0y
YB0y force-pushed the fix/mirror-scan-scoring-data-unavailable-no-cache branch from dc49509 to c76b445 Compare April 30, 2026 16:47
@YB0y

YB0y commented Apr 30, 2026

Copy link
Copy Markdown
Author

Hello @anderdc how are you? Could you review this please?

@anderdc

anderdc commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

Please stop pinging me incessantly. I will ignore your PRs if you continue that behavior or implement them myself.

@anderdc anderdc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please scope this PR down to just the mirror_scan.py changes (the issue-discovery cache fix). That half is unambiguous correctness — caching an unavailable lookup as zero is wrong regardless of policy.

Drop the mirror/scoring.py changes (filtering unscored merged PRs out of mirror_eval.merged_prs). After cross-referencing with legacy at oss_contributions/scoring.py:86-91, this is actually a policy change rather than a bug fix — legacy leaves unscored PRs in the eval with no base_score, contributing 0 to score totals while still counting toward credibility, and we're keeping that behavior on mirror for parity. See the comment on #836 for full reasoning.

Drop the tests/.../test_scoring_data_stored_eligibility.py file too since it's tied to that half. Keep the new tests in test_mirror_scan.py.

@anderdc

anderdc commented May 5, 2026

Copy link
Copy Markdown
Collaborator

No commits in 12+ hours since changes were requested. Closing.

@anderdc anderdc closed this May 5, 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] Mirror issue-discovery caches a fabricated zero score when scoring_data_stored=False

2 participants