Replace custom validators with Click primitives#1155
Merged
Conversation
4d0ddd0 to
9281032
Compare
anderdc
approved these changes
May 13, 2026
11 tasks
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 #1154
Summary
Replaces a layer of parameter-validation helpers across the CLI with Click's built-in primitives.
validate_issue_id/require_valid_issue_idreplaced withContractIssueTypeClick param type.validate_ss58_address/require_valid_ss58replaced withSS58AddressTypeClick param type.GitHubIssueTypeClick param type.RepoNameType- for--repoparameter, checks "owner/repo" string againstREPO_PATTERN.--networkgetstype=NETWORK_CHOICE(the existingclick.Choice(['finney','test','local']), so invalid networks fail at parse instead of at subtensor connect time.--patgetsenvvar='GITTENSOR_MINER_PAT', the body-levelos.environ.get(...)fallback is deleted.Behavior change worth flagging:
gitt i list --json --id 0andgitt i submissions --json --id 0no longer emit a JSON envelope on bad id, but it already covered by #1152 (which makes--jsonhandle Click's exceptions).How it looks like
User-visible error-message changes (sample, captured via Click test runner):
--helpexcerpts (auto-generated by Click fromIntRange/Choice):Testing
Dropped several basic tests which check
issue_idparameter + dropped test which checks that incorrectissue_idparameter makes CLI response with a specific error format when used with--json(covered in #1152)