fix(cli)(sphere-sdk#282): route wallet use confirmation to STDERR#29
Merged
Merged
Conversation
Residual #2 of the §D `manual-test-full-recovery.sh` ALL GREEN campaign. The `sphere wallet use <name>` subcommand printed its confirmation lines ✓ Switched to wallet profile: <name> Nametag: <tag> L1 Addr: <alpha1...> via `console.log` (stdout). The harness captures `sphere balance > file` snapshots; some snapshot blocks bracket the `wallet use` invocation outside the redirect (peer2: `sphere wallet use alice ; sphere balance > file`), others inside a subshell (peer1: `( … sphere wallet use alice && sphere balance ) > file`). The two flows yield different captured-stdout content for the same logical operation, so the resulting peer1-vs-peer2 diff failed assertion even though both wallets had identical balances. Fix: route the entire confirmation block (success and `(wallet not initialized in this profile)` fallback) through `console.error`. Errors (usage hint, profile-not-found) were already on stderr, so this brings the success path in line with them. Behaviour for human operators is unchanged — terminal sessions still see the banner; only `>` / `|` stdout pipelines are now unaffected by it. Side-benefit: any future shell tooling that pipes `sphere wallet use <name> | …` no longer has to filter the banner out of the consumed stream. Tests * `test/integration/cli-wallet-profile.integration.test.ts` — the "`wallet use alice` switches the active profile" assertion now expects the banner on `r.stderr` (with a negative match on `r.stdout`) per the new contract. * Full integration suite: 25 / 25 passed. * Full default unit suite: 119 / 119 passed. Refs sphere-sdk#282
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
Companion to sphere-sdk PR #283. Residual #2 of the §D
manual-test-full-recovery.shALL GREEN campaign —sphere wallet use <name>confirmation lines now go to STDERR so shell pipelines capturing the next command's stdout don't accidentally include the wallet-use banner.Root cause
sphere wallet use aliceprintedvia
console.log(stdout). The harness capturessphere balance > filesnapshots; some snapshot blocks bracketwallet useoutside the redirect (peer2:sphere wallet use alice ; sphere balance > file), others inside a subshell (peer1:( … sphere wallet use alice && sphere balance ) > file). The two flows yield different captured-stdout content for the same logical operation, so the peer1-vs-peer2 diff failed despite identical balances.Fix
Route the entire confirmation block (success and
(wallet not initialized in this profile)fallback) throughconsole.error. Errors (usage hint, profile-not-found) were already on stderr, so this brings the success path in line. Human operators in terminal sessions still see the banner; only>/|stdout pipelines are now unaffected.Test plan
test/integration/cli-wallet-profile.integration.test.ts— the existingwallet use aliceassertion now expects the banner onr.stderrwith a negative match onr.stdout.npx vitest run --config vitest.integration.config.ts test/integration/cli-wallet-profile.integration.test.ts— 25/25 pass (including the updated assertion + the offline help-text and arg-validation pins).npx vitest run(default unit suite) — 119/119 pass.npm run build— clean.npm run lint— no new errors.Refs sphere-sdk#282