fix(cli): honor an explicit --wallet-name default in gitt issues register - #1657
Open
tryeverything24 wants to merge 1 commit into
Open
fix(cli): honor an explicit --wallet-name default in gitt issues register#1657tryeverything24 wants to merge 1 commit into
tryeverything24 wants to merge 1 commit into
Conversation
…ster gitt issues register resolved its wallet with a bare != "default" comparison, so an explicitly passed --wallet-name default (or --wallet-hotkey default) was indistinguishable from "no flag given" and was silently replaced by the config file wallet. A user selecting the wallet actually named "default" got the config wallet coldkey instead — on the one command in this group that signs an owner-only on-chain transaction. gitt harvest already resolves wallets through resolve_wallet_config, which is ParameterSource-aware and honors explicit flags regardless of their spelling. Switch register to the same shared resolution and drop the now-unused config snapshot. The //Alice local-dev fallback semantics are unchanged. Regression tests cover all three resolution tiers: explicit flags (including flags spelled "default") beat config, config beats defaults, and defaults apply when neither is present.
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.
PR body — tryeverything24 → entrius/gittensor
Branch: fix/register-wallet-flag-resolution (commit c8a8257, in WSL /root/gtn-pr)
Base: test
Title: fix(cli): honor an explicit
--wallet-name defaultingitt issues registerSummary
gitt issues registerresolves its wallet with a bare string comparison:An explicitly passed
--wallet-name default(or--wallet-hotkey default) isindistinguishable from "no flag given", so when
~/.gittensor/config.jsonnames a differentwallet, the config value silently replaces the wallet the user asked for by name. Register is
the one command in this group that signs an owner-only on-chain transaction with the resolved
wallet's coldkey, so "loaded a different wallet than the one I typed" is the worst place
for this to happen.
The repo already has the correct resolver:
resolve_wallet_configinissue_commands/helpers.pyisParameterSource-aware (an explicit flag wins regardless ofits spelling) and
gitt harvest— in this same file — already uses it. Register kept thepre-helper heuristic.
Reproduction
Against
origin/test@ 28c1d4c, with~/.gittensor/config.jsoncontaining{"wallet": "treasury-cold", "hotkey": "tk"}and all network/GitHub/contract I/O stubbed:After the fix the same invocation loads
default/default; omitting the flags still fallsback to
treasury-cold/tkas documented.Fix
Switch
issue_registerto the sharedresolve_wallet_config(same call shape asharvest)and drop the now-unused
load_config()snapshot. Resolution priority is now genuinely"explicit CLI flags > config file > defaults" for every spelling of the flags. The
local-network
//Alicefallback still triggers on the same effective values as before —no dev-workflow change.
Tests
New
tests/cli/test_register_wallet_resolution.py(config written to a real temp file via aredirected
CONFIG_FILE, wallet construction captured through a stubbedbittensor.Wallet):test_explicit_default_flags_beat_config—--wallet-name defaultwith a config walletpresent loads
default/default(fails on currenttest: loads the config wallet)test_config_fills_in_when_no_flags_given— config wallet/hotkey used when flags omittedtest_explicit_named_wallet_beats_config— non-default explicit flags wintest_defaults_used_when_no_flags_and_no_config— bare invocation resolvesdefault/defaultNote: open PR #1650 also touches
issue_register, but only the confirmation-gate lines(
confirm_or_abort); this change is a different hunk (wallet resolution, ~15 lines below)and merges cleanly in either order.