Repository navigation
Conversation
synackd
added this pull request to stack #180
October 5, 2026 22:27
synackd
force-pushed
the
stack/coverage/08-output-and-error-injection
branch
from
October 5, 2026 22:43
1f99598 to
53cb61a
Compare
synackd
marked this pull request as ready for review
October 6, 2026 16:50
Route command output through the CLI's injected output stream (cli.Ios.Out()) instead of process-global stdout, across service output, configuration display, version information, cloud-init data, and command prompts, so callers and tests can observe output without replacing operating-system globals; the command test harness no longer swaps os.Stdout. dialWebSocket returns the error from parsing a malformed console URI instead of ignoring it and dereferencing a nil URL, and ConnectConsole returns a failure to restore the terminal after an interactive session instead of discarding it. Turn on errcheck's check-blank, so errors discarded with `_ =` are reported, and exempt the command flag getters (Flags().GetBool etc.): every flag read back this way is registered with the matching type on the same command, so their errors can't occur. Tests that discarded errors now check them. Add discover-static and BSS error-arm tests in companion _errors_test.go files, and tests for pkg/discover, pkg/format, and pkg/xname. Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com>
synackd
force-pushed
the
stack/coverage/08-output-and-error-injection
branch
from
October 8, 2026 04:50
53cb61a to
4b83e26
Compare
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.
Description
Context
This is branch 8 of 16 in a stacked series (
stack/coverage/01-exit-code-contract→stack/coverage/16-convention-checks) that replaces ochami's package-global CLI state with an invocation-scoped runtime, adds a regression test suite, makes the tests safe to run in parallel under Go's race detector, and enforces the test conventions in CI. It is stacked onstack/coverage/07-command-and-client-cleanupand merges beforestack/coverage/09-http-client-foundations. Review each branch's own diff.Branches
stack/coverage/01-exit-code-contractstack/coverage/02-client-contract-testsstack/coverage/03-command-e2e-and-interactivestack/coverage/04-public-configstack/coverage/05-injected-boundariesstack/coverage/06-coverage-regressionsstack/coverage/07-command-and-client-cleanupstack/coverage/08-output-and-error-injection← THIS BRANCHstack/coverage/09-http-client-foundationsstack/coverage/10-configfile-and-rcs-hardeningstack/coverage/11-typed-batches-and-contextstack/coverage/12-local-command-optionsstack/coverage/13-runtime-core-and-command-migrationstack/coverage/14-test-parallelization-and-race-detectionstack/coverage/15-final-coverage-closurestack/coverage/16-convention-checksSummary
Route command output through the CLI's injected output stream (
cli.Ios.Out()) instead of process-global stdout: service output, configuration display, version information, cloud-init data, and prompts. Callers and tests can capture output without replacingos.Stdout, and the command test harness no longer swaps it.dialWebSocketreturns the error from parsing a malformed console URI instead of ignoring it and dereferencing a nil URL, andConnectConsolereturns a failure to restore the terminal after an interactive session instead of discarding it..golangci.ymlturns on errcheck'scheck-blank, so errors discarded with_ =are reported, and exempts the command flag getters (Flags().GetBooletc.), whose errors can't occur for flags registered with the matching type on the same command. Tests that discarded errors now check them. New discover-static and BSS error-arm tests live in_errors_test.gofiles, andpkg/discover,pkg/format, andpkg/xnameget new tests.Why
Writing to process-global stdout prevents capturing output per invocation and makes output assertions depend on swapping operating-system globals.
Review notes
Check that every migrated command writes to the injected stream. No output format or wording change is intended. Write failures are still ignored, as before.
Checklist
make test(or equivalent) locally and all tests passgit commit -s) with my real name and email<filename>.licensesidecarLICENSES/directoryType of Change