fix(cli): honor an explicit --wallet/--hotkey in issues register#1594
Open
swengieer0829 wants to merge 1 commit into
Open
fix(cli): honor an explicit --wallet/--hotkey in issues register#1594swengieer0829 wants to merge 1 commit into
issues register#1594swengieer0829 wants to merge 1 commit into
Conversation
register resolved the wallet with a value comparison (wallet_name != 'default') instead of Click's ParameterSource, so an explicitly-passed --wallet/--hotkey that equals the option default was silently overridden by the config wallet -- unlike harvest and the other commands, which resolve via resolve_wallet_config. Since register is owner-only and spends real ALPHA, signing with the wrong wallet matters. Resolve through the shared resolve_wallet_config helper so register honors an explicit flag identically to its siblings; drop the now-unused config = load_config() and its import (resolve_wallet_config loads it). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
|
please provide before and after screenshots |
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
gitt issues registersilently ignores an explicitly-passed--wallet/--hotkeywhen the value equals the option default, substituting the config wallet instead.registerresolved the wallet with a value comparison:So
--wallet default(the wallet literally nameddefault) is treated as "not supplied" and the config wallet wins. Every other wallet-taking command — includingharvest, in the same file — resolves viaresolve_wallet_config, which uses Click'sParameterSourceto distinguish an explicitly-passed flag from a defaulted one.registeris the only command that doesn't, so it resolves the wallet inconsistently with the rest of the CLI.This is not merely cosmetic:
registeris owner-only and spends real ALPHA on-chain. A user who explicitly selects--wallet defaultto sign the registration gets signed with a different (config) wallet — a silent, surprising override of an explicit flag on a money-moving command.Fix: resolve the wallet through the shared
resolve_wallet_confighelper (already imported and already used byharvest), soregisterhonors an explicit flag exactly like its sibling commands. The now-unusedconfig = load_config()line and its import are removed —resolve_wallet_configloads the config internally.Behavior
~/.gittensor/config.json={"wallet": "alice"}, running:alice— the explicit--wallet defaultis ignored.default— the explicit flag is honored. Omitting--walletstill falls back toalice.(No user-facing output shape changes; the only observable difference is that the
Loading wallet …status line now names the wallet the user actually asked for.)Related Issues
Type of Change
Testing
Added
tests/cli/test_issue_register.py(the command had no prior test coverage):test_register_honors_explicit_wallet_default_over_config— explicit--wallet defaultbeats configalice.test_register_falls_back_to_config_wallet_when_flag_omitted— omitting the flag still uses the config wallet, guarding against over-correction.Both drive the real
issues registercommand and assert on the wallet passed tobittensor.Wallet. Both fail on the pre-fix code and pass with the fix.ruff check,ruff format --check, andvultureare clean.Checklist