Skip to content

fix(diff): report the error before the diff on a failed run#31

Merged
rickliujh merged 1 commit into
mainfrom
fix/diff-failure-ordering
Jul 22, 2026
Merged

fix(diff): report the error before the diff on a failed run#31
rickliujh merged 1 commit into
mainfrom
fix/diff-failure-ordering

Conversation

@rickliujh

Copy link
Copy Markdown
Owner

Follow-up to loom diff (#28, #29).

Problem

When a run failed, loom diff printed the collected diff — and a bogus ✔ complete success linebefore the run's error surfaced, burying the failure beneath the diff.

Fix

On failure, report the error first (right after the failing module's logs) and exit non-zero, with no success line. By default the diff is suppressed so the error stands alone.

Add --partial to still inspect the changes made before the error: the partial diff is printed after the error, beneath a warning marking it incomplete.

[failz] ...operation logs...

✖ operation "boom" failed: ...

⚠ run failed before finishing — the diff below shows only the changes made before the error

[failz] file:///…/repo (main)
diff --git a/a.yaml b/a.yaml
 +  added: loom

Details

  • New prettylog.Warningf (, amber) for the standalone warning.
  • New errReported sentinel in cmd so a command can print its own error while Execute still exits non-zero without repeating it.
  • Applies to both full and --quick modes.
  • Spec rule DF5 + a referencing test (TestDiff_DF5_FailureOrdering); docs/README/cli-diff.md updated with the --partial flag.
  • go test ./..., go vet, gofmt, and spectrace all clean.

🤖 Generated with Claude Code

Previously loom diff printed the collected diff (and a bogus "complete"
success line) before the run's error surfaced, burying the failure.

Now on failure the command exits non-zero and, by default, prints no diff
— only the error — so the failure stands alone. Add --partial to still
inspect the changes made before the error: the diff is printed beneath a
warning marking it incomplete, with the error shown above it.

Adds a Warningf pretty-printer, spec rule DF5, and a referencing test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rickliujh
rickliujh force-pushed the fix/diff-failure-ordering branch from 4af19bd to 7c59ef1 Compare July 22, 2026 23:18
@rickliujh
rickliujh merged commit 96ab242 into main Jul 22, 2026
2 checks passed
rickliujh added a commit that referenced this pull request Jul 23, 2026
* origin/main:
  feat: diff module breadcrumb (#32)
  fix(diff): report the error before the diff on a failed run (#31)
  fix(diff): head each deferred diff with its module and target (#29)
  feat: loom diff command (#28)

# Conflicts:
#	pkg/module/executor.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant