Skip to content

fix(cli): stop YACD_* shadowing wallet URLs and bleeding timeout/wait - #123

Merged
jmgilman merged 1 commit into
masterfrom
feat/cli-ux-p1-env-collisions
Jun 8, 2026
Merged

jmgilman merged 1 commit into
masterfrom
feat/cli-ux-p1-env-collisions

Conversation

@jmgilman

@jmgilman jmgilman commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

P1 / PR-1.5 of the CLI UX overhaul — the YACD_* collision/bleed fixes (design §8.3). Reads the command-local behavior flags straight off cmd.Flags() instead of the shared viper, so an ambient YACD_* can no longer drive them.

What's here

  • Wallet funding shadow (fix): chainOverridesFromViper → chainOverridesFromFlags(cmd), reading --ogmios-url/--kupo-url from the flags so YACD_OGMIOS_URL/YACD_KUPO_URL cannot shadow them. (No trust gate — funding submits a locally-signed tx and Kupo is read-only; the deleted faucet gate is not reintroduced.)
  • Cross-command bleed (fix): up/down/install/devnet read timeout/wait/dry-run/bare via cmd.Flags().GetDuration/GetBool. These flags exist on several commands, so an ambient YACD_TIMEOUT/YACD_WAIT/YACD_DRY_RUN/YACD_BARE silently affected all of them.

Intentionally unchanged

  • --file / --allow-mainnet stay on viper — YACD_FILE is a documented part of the test-harness contract.
  • install's --values/--set/--set-string already read off cmd.Flags() (viper's StringArray binding mangles the Helm --set a=1,b=2 comma syntax).

Testing

  • gofmt/go vet/go build clean; golangci-lint 0 issues; moon run root:check + moon run root:test (full envtest gate) green; git diff --check clean.
  • New env_collisions_test.go: chainOverridesFromFlags ignores the env and reads the flags; a mechanism test shows viper is shadowed by YACD_TIMEOUT while cmd.Flags() is immune (demonstrating both the bug and the fix); and a child-env guard asserts the CLI-injected host env (run.go's connected.env) carries only the documented host-access keys — never the flag-only UX keys (YACD_OUTPUT/YACD_VERBOSE/YACD_QUIET/…) — even when those are exported.

Part of the P1 foundation series (1.1 #119, 1.2 #120, 1.3 #121, 1.4 #122 merged → 1.5 → 1.6).

🤖 Generated with Claude Code

…eout/wait

P1 foundation (PR-1.5) of the CLI UX overhaul. Read the command-local behavior
flags straight off cmd.Flags() instead of the shared viper, so an ambient
YACD_* can no longer drive them:

- wallet funding: chainOverridesFromViper becomes chainOverridesFromFlags(cmd),
  reading --ogmios-url / --kupo-url from the flags so YACD_OGMIOS_URL /
  YACD_KUPO_URL cannot shadow them.
- up/down/install/devnet: read timeout/wait/dry-run/bare via
  cmd.Flags().GetDuration/GetBool, killing the cross-command YACD_TIMEOUT /
  YACD_WAIT / YACD_DRY_RUN / YACD_BARE bleed (these flags exist on several
  commands, so an ambient env value silently affected all of them).

--file and --allow-mainnet stay on viper (YACD_FILE is an intentional part of
the harness contract); install's --values/--set/--set-string already read off
cmd.Flags() (viper StringArray mangles the Helm --set comma syntax).

Tests: chainOverridesFromFlags ignores the env and reads the flags; a mechanism
test shows viper is shadowed by YACD_TIMEOUT while cmd.Flags() is immune; and a
child-env guard asserts the CLI-injected host env (run.go connected.env) carries
only the documented host-access keys, never the flag-only UX keys, even when
those are exported.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jmgilman
jmgilman merged commit 652a766 into master Jun 8, 2026
12 checks passed
@jmgilman
jmgilman deleted the feat/cli-ux-p1-env-collisions branch June 8, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant