fix: blueprints validate exits non-zero on invalid blueprint in non-interactive mode - #50
Open
kawacukennedy wants to merge 1 commit into
Open
Conversation
…nteractive mode The interactive path returns an error when a Blueprint has validation errors, which exits non-zero. The non-interactive paths (--output json/yaml/text) printed the validation result and returned nil, so a script or CI job could not tell whether validation failed — the exact case a validate command exists to catch. Match the interactive contract: after printing the result, return the same "has validation errors" error when result.Valid is false. Also guard against a 200 response with an empty/unparseable body (result == nil) that previously panicked on result.Valid. Adds tests covering valid/invalid blueprints across json, yaml, and text output, the workspace ID sent to the validate endpoint, and the empty-response guard.
kawacukennedy
force-pushed
the
fix/blueprint-validate-exit-code
branch
from
August 13, 2026 19:38
7a36e48 to
7aab3aa
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.
What
render blueprints validatenow exits non-zero when a Blueprint has validation errors in non-interactive modes (--output json/yaml/text). It also no longer panics if the API returns a200with an empty/unparseable body.Why
This is a validate command — its primary use case is scripting and CI, where the exit code is the contract. Today:
"<file> has validation errors"and exits1(cmd/blueprintvalidate.go:201).nil, sorender blueprints validate -o json ./bad.yamlexits 0 even when the blueprint is invalid. A CI job or script cannot tell valid from invalid.The two paths disagree on the same command's contract. This change makes non-interactive mode match interactive mode.
How
command.PrintData, return the same"<path> has validation errors"error whenresult.Validis false.200response with an empty body (result == nil), which previously panicked onresult.Valid.Testing
cmd/blueprintvalidate_test.gousing anhttptestserver (following thelogout_test.goprecedent):json/yaml/textmodes, and the workspace ID is sent to the endpoint."valid": falseplus a non-zero exit.200response returns a clear error instead of panicking.1.go test ./cmd/... ./pkg/... ./internal/...passes.main).