Skip to content

fix(check): surface stale report on stderr when --silent fails#28

Merged
laulauland merged 2 commits intomainfrom
lau/silent-stderr-on-fail
Apr 21, 2026
Merged

fix(check): surface stale report on stderr when --silent fails#28
laulauland merged 2 commits intomainfrom
lau/silent-stderr-on-fail

Conversation

@laulauland
Copy link
Copy Markdown
Member

Summary

drift check --silent previously discarded the stale/broken report entirely — even on failure. Exit code was correct (1) but terminal users and CI logs saw nothing explaining what went stale.

With this change, --silent still suppresses output on a passing run, but on failure the same report (text or JSON, honoring --format) is written to stderr so the failure is observable. Non-silent behavior is unchanged.

Implementation: split lint.run into lint.compute + lint.renderText / lint.renderJson. main.zig now decides where to render based on silent and the run status. CheckResult exposes status() and checkedAny() helpers so the render functions don't need threaded booleans.

Test plan

  • zig build — clean
  • zig build test — all green
  • drift check --silent on a stale repo → stderr has the report, stdout empty, exit 1
  • drift check --silent 2>/dev/null → no output, exit 1
  • drift check --silent --format json → JSON on stderr, stdout empty, exit 1
  • drift check --silent on a passing run → no output, exit 0
  • drift check (non-silent) regression — stdout unchanged

Previously --silent unconditionally routed stdout to a discarding writer,
dropping the STALE lines and summary even on fail. Exit code was correct
but the human-readable signal was gone, so CI and terminal users got no
indication of what went stale.

Split lint.run into compute/renderText/renderJson so the caller in main
can decide where to render. In silent mode we skip stdout entirely on
pass, and on fail we render the same report to stderr (text or json,
matching --format). Non-silent behavior is unchanged.
The prior commit changed --silent behavior (report now goes to stderr on
failure) but left the flag undocumented in docs/CLI.md and the affected
bindings stale in drift.lock. Adds the CLI prose and refreshes the four
stale sigs (main.zig for CLAUDE.md / DESIGN.md / SKILL.md, lint.zig for
CLI.md).
@laulauland laulauland merged commit e53b501 into main Apr 21, 2026
5 checks passed
@laulauland laulauland deleted the lau/silent-stderr-on-fail branch April 21, 2026 16:26
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