fix(node): validate --format before bootstrap does any work - #187
Merged
Conversation
tas50
force-pushed
the
fix/bootstrap-validates-format-first
branch
from
September 8, 2026 15:16
95d2412 to
05deeab
Compare
`node bootstrap` resolved --format after the SSH run, so a typo cost the user a real bootstrap first. With `--format yaml` the command generated a client key, created the client on the server, connected over SSH and ran the installer, and only then failed: error = printer: unknown output format "yaml" (want human or json) client created on server = true; ssh runs = 1 The user is left with an orphaned client and a half-configured host, and a non-zero exit that says nothing about either. Resolve the format first, as every other command in the tree already does. Nothing else moves. Signed-off-by: Tim Smith <tim@mondoo.com>
tas50
force-pushed
the
fix/bootstrap-validates-format-first
branch
from
September 8, 2026 17:32
05deeab to
a32afbd
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.
The defect
node bootstrapresolved--formatafter the SSH run. Every other command in the tree resolves it first, before touching anything.So a typo costs the user a real bootstrap. With
--format yaml, the command generates a client key, creates the client on the server, connects over SSH, runs the installer, and only then fails:The user is left with an orphaned client on the server and a half-configured host, plus a non-zero exit that mentions neither.
bootstrapis the single most side-effecting command in the CLI, which makes it the worst place to validate flags late.The fix
Resolve the format at the top of
RunE. Nothing else moves.Tests
TestNodeBootstrapRejectsBadFormatBeforeDoingWorkdrives the real command with a bad--formatand asserts no client was created and no SSH ran. Verified red before the fix by stashing it:go test ./...,go vet ./..., andgofmt -l .are clean.Note
This touches the same function as the
--dry-runprofile-validation fix in the sibling PR. They are independent changes so they are separate PRs as requested, but whichever lands second will want a trivial rebase.