Repository navigation
test(cli): add import-graph, v2-path, and stdout-purity guards - #124
Merged
Merged
Conversation
P1 foundation (PR-1.6, final) of the CLI UX overhaul. Add three CI tripwires that keep the foundation's boundaries enforced structurally instead of by review: - cli/internal/ui/guard_test.go: TestManagerImportGraphHasNoCharm runs `go list -deps ./cmd` and fails if the operator manager's graph contains charm/lipgloss/huh/bubble/ultraviolet/colorprofile/charmbracelet/ogmigo/kugo/ internal/cardano/tx (charm is confined to cli/internal/ui, never the manager). TestNoLegacyCharmPaths bans github.com/charmbracelet/(lipgloss|huh| log) v0/v1 paths anywhere under cli/ so the eventual v2 (charm.land/*) adoption cannot regress. - cli/internal/cli/purity_test.go: TestNoRawStreamWrites bans raw os.Std* / writer-less fmt.Print* / lipgloss.Print* / fmt.Fprint*(commandContext.out|err) in cli/internal/cli, allowing a per-line "// ui-passthrough-ok" pragma. All three are green on the current charm-free graph. Because P1 routes nothing through cc.io yet, the 24 existing raw-write sites (connect/devnet/down/info/ install/list/orphan/run/up/version/wallet/wallet_fund) are tagged "// ui-passthrough-ok" as an interim; the routing phase removes most pragmas as it moves each line onto cc.io.Data/Encode/Status. Helper writers that take an io.Writer parameter are intentionally not matched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
P1 / PR-1.6 (final foundation PR) of the CLI UX overhaul. Adds three CI tripwires that keep the foundation's boundaries enforced structurally instead of by review. All three are green on the current charm-free graph — they exist to catch regressions in the routing (P3) and charm/styling (P4) phases.
The guards
cli/internal/ui/guard_test.goTestManagerImportGraphHasNoCharm— runsgo list -deps ./cmdand fails if the operator manager's import graph containscharm|lipgloss|huh|bubble|ultraviolet|colorprofile|charmbracelet|ogmigo|kugo|internal/cardano/tx. Charm is confined tocli/internal/ui; the manager must never pull it (or the CLI-only heavy deps) in.TestNoLegacyCharmPaths— bansgithub.com/charmbracelet/(lipgloss|huh|log)v0/v1 paths anywhere undercli/, so the eventual v2 (charm.land/*) adoption in P4 can't silently regress to a v0/v1 API.cli/internal/cli/purity_test.goTestNoRawStreamWrites— bans rawos.Std*/ writer-lessfmt.Print*/lipgloss.Print*/fmt.Fprint*(commandContext.out|err)incli/internal/cli, with a per-line// ui-passthrough-okpragma escape hatch. Full comment lines are skipped (so prose mentioningos.Stdoutdoesn't trip it); helper writers that take anio.Writerparameter are intentionally not matched (they receivecc.io.Data()once routing lands).Interim pragmas
P1 routes nothing through
cc.ioyet, so the guard is green only because the 24 existing raw-write sites (connect/devnet/down/info/install/list/orphan/run/up/version/wallet/wallet_fund) are tagged// ui-passthrough-ok. This is the intended "tag-now, remove-in-P3" lifecycle: the routing phase strips most pragmas as it moves each line ontocc.io.Data/Encode/Status. Therun/execchild passthrough and thewallet_fundos.Stdoutswap keep theirs permanently.Testing
gofmt/go vet/go buildclean;golangci-lint0 issues (the import-graph loop usesstrings.SplitSeq; the pragma is spaced forrevive);moon run root:check+moon run root:testgreen;git diff --checkclean.go list -deps ./cmdhas no banned deps and nocli/internal/*).Completes the P1 foundation series (1.1 #119, 1.2 #120, 1.3 #121, 1.4 #122, 1.5 #123 merged → 1.6). After this, the foundation is in place; the remaining overhaul phases (P2 RunE thinning, P3 routing + JSON shapes, P4 spinners + charm) build on it.
🤖 Generated with Claude Code