Standardize --json behavior#1152
Merged
Merged
Conversation
anderdc
approved these changes
May 12, 2026
10 tasks
anderdc
pushed a commit
that referenced
this pull request
May 12, 2026
Picks up: - #1066 (cache fallback on DAS issue-discovery fetch failure) - #1152 (standardized --json behavior across CLI) Resolutions: - forward.py: drop the legacy `mirror_repos` filter; pass evaluation_cache through to run_issue_discovery, which now handles the empty-repos case itself. - issue_discovery/scan.py: keep our renamed run_issue_discovery / _score_miner_issues identifiers; pick up the _restore_issue_discovery_from_cache call on MirrorRequestError from #1066. - tests/validator/issue_discovery/test_scan.py: adopt the new #1066 tests, retargeted to run_issue_discovery and merged_prs. - tests/validator/test_validator_cache_fallback.py: stays deleted — its imports (load_miners_prs, GraphQLPageResult, ScoredMirrorPR, merged_pull_requests) all reference symbols removed by the legacy-pipeline strip.
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.
Closes #1151
Summary
Three CLI surface differences collapsed into one:
gitt miner {post,check,score}shipped--json-output; every other command uses--json. Renamed everything to the--json.{"success": false, "error": "<string>"}; issue commands emit{"success": false, "error": {"type": ..., "message": ...}}. Unified everything on the nested shape.Invalid value for '--id',No such option,Missing option) printed plain text to stderr regardless of--json. Sometimes we throw such exceptions by ourselves. AddedJsonAwareAliasGroupat the root so parse errors surface as the canonical JSON envelope when--jsonis in argv. Without--jsonthe default Click rendering is preserved.Centralized the envelope helpers in a new
gittensor/cli/json_output.py(emit_json,emit_error_json,wants_json_output,click_error_type). Issue commands, miner commands, and the root group now import from one source.Before / After
Before:
After (standardized json error handling behavior across the whole codebase):
$ gitt issues list --json --id abc {"success": false, "error": {"type": "bad_parameter", "message": "Invalid value for '--id': 'abc' is not a valid integer."}}Testing
test_click_parse_errors_stay_human_without_json_flag- asserts plain-text rendering is preserved when--jsonis absenttest_click_parse_errors_emit_canonical_json- asserts that Click's own arg-parsing errors emit the canonical{success: false, error: {type, message}}envelope when--jsonis in argv.Other existing tests were updated according to the new behavior.