refactor(cli): validate inputs with Click types at parse time#1168
Closed
tao-hunter wants to merge 2 commits into
Closed
refactor(cli): validate inputs with Click types at parse time#1168tao-hunter wants to merge 2 commits into
tao-hunter wants to merge 2 commits into
Conversation
- Add ONCHAIN_ISSUE_ID_TYPE, GITHUB_ISSUE_NUMBER_TYPE, BountyAlphaParam, and Ss58AddressParam; derive NETWORK_CHOICE from CLI_NETWORK_NAMES in constants. - Wire admin, vote, list, submissions, and register/harvest options to these types; drop require_valid_* helpers. - StyledCommand.make_context catches BadParameter when --json is in the subcommand argv so structured bad_parameter errors still go to stdout. - Reorder issues register to run strict GitHub checks before RPC resolution; bounty/issue bounds are enforced by Click before any side effects. - Tighten gitt config set network values; miner check/post --network uses Choice. - Fix tests to patch vote/admin modules via importlib and relax assertions for IntRange messages; skip substrate-heavy tests when optional deps absent. Co-authored-by: Cursor <cursoragent@cursor.com>
Collaborator
|
#1155 is better scoped and implemented. Closing. |
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.
Summary
Refactors issue/admin/vote/miner CLI validation to use Click’s built-in types (IntRange, Choice, custom ParamType for bounty/SS58) so bounds and allowed values are enforced at parse time and show correctly in --help. Removes require_valid_issue_id / require_valid_ss58. StyledCommand maps parse-time BadParameter to JSON when --json is present in the subcommand args. issues register runs strict GitHub checks before RPC/config resolution. Adds CLI_NETWORK_NAMES from NETWORK_MAP, validates gitt config set network, and tightens gitt miner check/post --network with Choice.
Related issues
Closes #1154
Type of change
Testing
Checklist