Skip to content

fix(cli): distinguish inconclusive PAT reply from no-response in miner check#1407

Merged
anderdc merged 2 commits into
entrius:testfrom
jakearmstrong59:fix/miner-check-inconclusive-pat
May 29, 2026
Merged

fix(cli): distinguish inconclusive PAT reply from no-response in miner check#1407
anderdc merged 2 commits into
entrius:testfrom
jakearmstrong59:fix/miner-check-inconclusive-pat

Conversation

@jakearmstrong59
Copy link
Copy Markdown
Contributor

Summary

Fixes #1406

After #1107, handle_pat_check returns has_pat=True, pat_valid=None on a transient GitHub failure — a validator that has the miner's PAT but couldn't confirm validity because GitHub's /user lookup momentarily failed. The CLI consumer _pat_check_row_category had no branch for that shape, so it fell through to no_response, rendering a healthy validator identically to one that never replied:

  • Table mode: shows — no response (contradicting the truthful "retry in a few minutes" reason in the adjacent column).
  • --json mode: counted under no_response, excluded from valid, and can flip success to false.

This adds a fifth inconclusive category so the two states are distinguishable. It does not change exit codes or the success = valid_count > 0 rule (cf. the closed #1129 / #542, which were exit-code/success policy for a valid zero result) — it only fixes the categorization of a reply that genuinely arrived. This is the same class of accuracy fix as the merged #724 / #807 in this same file.

Relationship to existing work

Changes

  • gittensor/cli/miner_commands/helpers.py
    • New inconclusive branch in _pat_check_row_category, placed after the invalid_pat branch and guarded on has_pat is True so a genuinely silent validator (has_pat=None, pat_valid=None) still resolves to no_response.
    • inconclusive key added to _pat_check_aggregate_counts (auto-surfaces in --json via the existing **counts spread).
  • gittensor/cli/miner_commands/check.py
    • inconclusive entry in _PAT_CHECK_STATUS_MARKUP. Required, not cosmetic: the table renders via a bare _PAT_CHECK_STATUS_MARKUP[category] lookup, so a new category without a markup entry would raise KeyError.
  • tests/cli/test_miner_commands.py
    • TestPatCheckRowCategory: every category, including inconclusiveno_response, silent-validator → no_response, and missing-keys → no_response.
    • Updated the existing aggregate-counts assertion to include inconclusive, plus a non-collapse test.
    • A categorizer↔markup parity guard (test_every_category_has_table_markup) so a future category addition can't silently reintroduce the KeyError.
    • CLI-level gitt miner check --json integration tests (parity with the sibling miner post test): inconclusive surfaces distinctly, success stays False for an inconclusive-only result, and the table render does not KeyError.

Testing

  • pytest tests/892 passed.
  • ruff check / ruff format --check → clean.
  • Verified the new tests fail against pre-fix code (regression locked).

Scope

Consumer-side categorization only. Out of scope: the validator producer (pat_handler.py, already merged in #1107), exit-code / success-rule changes, PAT-whitespace handling (#1392/#1393), and gitt miner post categorization (different reply shape — PatBroadcastSynapse has no pat_valid field).

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 29, 2026
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.

too many tests for a two line change, remove the tests

…r check

After entrius#1107 a validator emits has_pat=True, pat_valid=None on a transient
GitHub failure, but _pat_check_row_category had no branch for it and
collapsed it into 'no_response' — indistinguishable from a validator that
never answered, in both the table and --json output.

Add an 'inconclusive' category in the categorizer, the aggregate-counts
dict, and the check.py status-markup map (the table does a bare
_PAT_CHECK_STATUS_MARKUP[category] lookup, so the markup entry is required
to avoid a KeyError). success = valid_count > 0 is unchanged.
@jakearmstrong59 jakearmstrong59 force-pushed the fix/miner-check-inconclusive-pat branch from 0300bec to 58513ab Compare May 29, 2026 21:05
@jakearmstrong59
Copy link
Copy Markdown
Contributor Author

Hi @anderdc, how are you. I've fixed. Thanks for the review.

@anderdc anderdc merged commit 5c9e81f into entrius:test May 29, 2026
3 checks passed
@jakearmstrong59
Copy link
Copy Markdown
Contributor Author

Thanks @anderdc

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] gitt miner check reports a validator's inconclusive PAT reply (has_pat=True, pat_valid=None) as "no response"

2 participants