Skip to content

fix(#724): exit non-zero on update --dry-run when work is pending - #725

Merged
admarble merged 2 commits into
mainfrom
feature/724-update-dry-run-should-exit-non-zero-on-pending
Jun 10, 2026
Merged

admarble merged 2 commits into
mainfrom
feature/724-update-dry-run-should-exit-non-zero-on-pending

Conversation

@admarble

@admarble admarble commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Brings sequant update --dry-run to parity with sync --dry-run (#722): it now sets process.exitCode = 1 when work is pending, so CI/automation can gate on the preview's exit code instead of parsing stdout. Closes the exit-code asymmetry surfaced during QA of #722 / PR #723.

Change

src/commands/update.ts — in the dry-run tail, set process.exitCode = 1 when applySet.length > 0 (new + modified, plus local-override under --force). Reuses the applySet already derived from the single computeTemplateChanges() call — no new comparison logic. The no-op case still exits 0 because it short-circuits at the "Everything is up to date!" return before the dry-run tail.

Acceptance criteria

  • update --dry-run sets process.exitCode = 1 when applySet.length > 0 (new + modified; + local-overrides under --force)
  • update --dry-run exits 0 when there is nothing to apply (no-op case unchanged)
  • Unit test in src/commands/update.test.ts covering both exit codes
  • CHANGELOG entry noting the exit-code behavior change (potential breaking change for scripts)

Tests

  • New src/commands/update.test.ts (4 cases): pending → exit 1; no-op → exit 0; local-override protected (no --force) → exit 0; --force overwrites override → exit 1.
  • Updated the existing update.integration.test.ts dry-run test: its seeded "new" template is pending work, so it now asserts exit 1 (the read-only/no-prompt/no-save assertions are unchanged).
  • update (11) + sync (27) suites pass; npm run build (tsc) clean.

Compatibility note

Potentially breaking for scripts: any automation running update --dry-run that treated exit 0 as "command ran" (rather than "nothing to do") will now see a non-zero exit when updates are pending. Low risk — update is the interactive command and sync is the documented non-interactive/CI surface. Documented in CHANGELOG (### Changed) and docs/troubleshooting.md.

Related: #722, #709, PR #723.

Fixes #724

Bring `update --dry-run` to parity with `sync --dry-run` (#722): set
process.exitCode = 1 when the apply set is non-empty (new + modified, plus
local-overrides under --force) so CI/automation can gate on the preview
without parsing stdout. The no-op case still exits 0 via the existing
"Everything is up to date!" short-circuit before the dry-run tail.

Reuses the applySet already derived from the single computeTemplateChanges()
call — no new comparison logic. Adds src/commands/update.test.ts covering
both exit codes (+ the local-override protected vs --force cases), updates
the existing dry-run integration test (its seeded new template is now pending
work, so it exits 1), and documents the behavior change in CHANGELOG +
troubleshooting.

Fixes #724
The internal testing checklist said `update --dry-run` "works without errors",
which is now ambiguous: it exits non-zero whenever updates are pending. Reword
so a manual tester doesn't read the expected non-zero exit as a failure.
@admarble
admarble merged commit 2c53020 into main Jun 10, 2026
4 checks passed
@admarble
admarble deleted the feature/724-update-dry-run-should-exit-non-zero-on-pending branch June 10, 2026 03:51
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.

update: --dry-run should exit non-zero on pending changes (parity with sync --dry-run)

1 participant