Skip to content

fix: count old open mirror issues for issue spam multiplier#930

Merged
anderdc merged 2 commits into
entrius:testfrom
MkDev11:fix/929-mirror-issue-open-spam-count
May 13, 2026
Merged

fix: count old open mirror issues for issue spam multiplier#930
anderdc merged 2 commits into
entrius:testfrom
MkDev11:fix/929-mirror-issue-open-spam-count

Conversation

@MkDev11
Copy link
Copy Markdown
Contributor

@MkDev11 MkDev11 commented May 1, 2026

Summary

Splits mirror issue-discovery scoring from open-issue spam counting.

The scoring path still uses the lookback-bounded mirror /issues response, but total_open_issues is now resolved independently so older still-open issues count toward calculate_open_issue_spam_multiplier().

This also adds support for a future mirror open_issue_count response field. Until the mirror serves that field, the validator falls back to a separate all-time current-open issue fetch and filters it to mirror-enabled repos.

Related Issues

Fixes #929

Type of Change

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

Testing

  • Tests added/updated
  • Manually tested

Commands run:

uv run pytest tests/validator/issue_discovery/test_mirror_scan.py tests/utils/test_mirror_models.py tests/utils/test_mirror_client.py
uv run ruff check gittensor/utils/mirror/models.py gittensor/validator/issue_discovery/mirror_scan.py tests/validator/issue_discovery/test_mirror_scan.py tests/utils/test_mirror_models.py
uv run ruff format --check gittensor/utils/mirror/models.py gittensor/validator/issue_discovery/mirror_scan.py tests/validator/issue_discovery/test_mirror_scan.py tests/utils/test_mirror_models.py
uv run pyright
git diff --check

Checklist

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

@anderdc
Copy link
Copy Markdown
Collaborator

anderdc commented May 6, 2026

Still debating on merging this — putting a pin in it.

@MkDev11
Copy link
Copy Markdown
Contributor Author

MkDev11 commented May 6, 2026

thanks @anderdc , totally understand you.

My only push for merging is that this is the exact follow-up called out in #796: scoring should stay lookback-bounded, but the open-issue spam count should be current open issue load.

The PR keeps the scoring fetch unchanged. It only separates total_open_issues, prefers the future open_issue_count field when present, and falls back to current behavior if the extra count fetch fails.

If the concern is the temporary second mirror request, I can drop that fallback and only wire the future field, but that would leave #929 unfixed until the mirror serves it.

@anderdc
Copy link
Copy Markdown
Collaborator

anderdc commented May 11, 2026

das-github-mirror awaiting push to prod so this is done in a simplified manner. Please be on standby for further direction on this PR in the next few days.

Copy link
Copy Markdown
Collaborator

@anderdc anderdc left a comment

Choose a reason for hiding this comment

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

das-github-mirror's since-omitted issues endpoint is now in prod (entrius/das-github-mirror#27). When the issues request omits since, the response is all currently-OPEN issues across mirror-tracked repos, no CLOSED rows. That makes both compatibility paths in this PR obsolete — drop them and call the endpoint with no since directly.

Specifics:

  • gittensor/utils/mirror/models.py — remove the open_issue_count field on MirrorIssuesResponse and its parsing block. It won't be served; the no-since request shape replaced it.
  • gittensor/validator/issue_discovery/mirror_scan.py — replace _resolve_current_open_issue_count with a single client.get_miner_issues(github_id) call (no since). The result is _count_open_issues(current_response.issues, enabled_names). Drop _OPEN_ISSUE_COUNT_SINCE, the open_issue_count is not None short-circuit, and the MirrorRequestError fallback to the bounded response — a failed open-count fetch should take the same fetch_errors += 1; continue path the scoring fetch already uses, not silently fall back to the wrong signal.
  • tests/utils/test_mirror_models.py — drop the two open_issue_count tests.
  • tests/validator/issue_discovery/test_mirror_scan.py — delete test_open_issue_count_field_avoids_second_fetch. Keep test_old_open_issues_outside_scoring_window_still_trip_spam but assert the second get_miner_issues call passes since=None (or no since kwarg), not _OPEN_ISSUE_COUNT_SINCE.

Also rebase on test to clear the conflict.

@MkDev11 MkDev11 force-pushed the fix/929-mirror-issue-open-spam-count branch from b6f336d to d8f8478 Compare May 12, 2026 22:44
@MkDev11 MkDev11 force-pushed the fix/929-mirror-issue-open-spam-count branch from d8f8478 to 6327c35 Compare May 12, 2026 22:57
@MkDev11 MkDev11 requested a review from anderdc May 12, 2026 23:00
@anderdc anderdc removed the blocked label May 13, 2026
@anderdc anderdc merged commit c6bcc0f into entrius:test May 13, 2026
3 checks passed
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 spam count ignores open issues older than lookback window

2 participants