Repository navigation
fix(diff): print errors once, from the command, not inline - #597
Merged
Merged
Conversation
The renderers wrote every OutputError to stderr as "ERROR: Kind/name: ...", and the processors also returned the failure, which main printed again as "Error: ...". A failing run reported each error twice in two formats. Stop the renderers printing errors and drop OutputError.FormatError. Structured output keeps errors[] unchanged, and warnings still go to stderr when raised. main prints every returned error, schema-validation ones included, since the renderers no longer print them. DiffComposition now names each failing resource in its returned error, as PerformDiff already did. The integration harness prints a returned error as main does so stderr assertions see what a user sees. Backport of crossplane/cli#436 (19817b2). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
jcogilvie
force-pushed
the
print-errors-once
branch
from
October 21, 2026 01:35
ba0da94 to
90aa5a1
Compare
jcogilvie
marked this pull request as ready for review
October 21, 2026 01:45
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 of your changes
Backports the error-printing rework from crossplane/cli#436 (commit 19817b2, "print errors once, from the command, not inline"). crossplane/cli is importing diff as the baseline for
simulate, and this change came out of that work.Errors were printed in more than one place: the renderers wrote
ERROR:lines to stderr, andmainprinted the returned error again. Now they are printed once, bymain:OutputErrorto stderr.OutputError.FormatErroris removed. Warnings still go to stderr when raised.mainprints it asError: %v.mainno longer skipsIsSchemaValidationError. Otherwise exit code 2 would print nothing.DiffCompositionreturns the joined per-XR failures (impact analysis failed for N XR(s)) and, only when every composition failed,failed to process all compositions. A partial composition failure still succeeds.--output json|yaml) is unchanged:errors[]still carries every error.The patch could not be applied as-is after #593/#594/#595, so this reimplements its intent against the current architecture.
Tests: renderer tests now assert nothing is written to stderr for errors. Processor tests assert on the returned error. The integration harness prints the returned error as
Error: ...into its stderr buffer, asmaindoes, before the stderr assertions.README.md,CLAUDE.mdand the design doc are updated to match.I have:
earthly -P +reviewableto ensure this PR is ready for review.README.md; architecture indesign/design-doc-cli-diff.mdand its diagrams).Need help with this checklist? See the cheat sheet.
🤖 Generated with Claude Code