Skip to content

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

Closed

Description

@admarble

Summary

sequant sync --dry-run exits non-zero (process.exitCode = 1) when work is pending, so CI/automation can gate on it (the #709 "trustworthy preview" intent). sequant update --dry-run does not — it always returns exit 0 regardless of pending changes (src/commands/update.ts:226-228), so a CI job scripting update --dry-run has to parse stdout to detect drift.

This is the exit-code asymmetry surfaced during QA of #722 / PR #723. PR #723 made the sync surface CI-gateable; this issue tracks bringing update's preview to parity.

Current behavior

// src/commands/update.ts (dry-run tail)
if (options.dryRun) {
  console.log(chalk.gray("\n(dry-run mode - no changes made)"));
  return; // exit code stays 0 even when newFiles/modifiedFiles are non-empty
}

update already computes applySet ([...newFiles, ...modifiedFiles], plus localOverrides under --force) from a single computeTemplateChanges() call, so the pending-work signal is already in hand — it just isn't surfaced as an exit code in dry-run mode.

Suggested fix

In the dry-run branch, set process.exitCode = 1 when the apply set is non-empty, mirroring sync --dry-run:

if (options.dryRun) {
  console.log(chalk.gray("\n(dry-run mode - no changes made)"));
  if (applySet.length > 0) process.exitCode = 1;
  return;
}

(Note: the early "Everything is up to date!" short-circuit at update.ts:188-199 returns before the dry-run tail, so the no-op case correctly stays exit 0.)

Compatibility caveat (why this is a follow-up, not folded into #723)

This changes the exit code of update --dry-run from always-0 to 1-on-pending. Any existing script that runs update --dry-run and treats exit 0 as "command ran" (rather than "nothing to do") would start seeing failures. Low risk — update is the interactive command and sync is the documented non-interactive/CI surface — but it warrants its own release note rather than riding along in #722's fix.

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).

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

Activity

  1. added
    bug
    needs-improvement
    on Jun 8, 2026
  2. admarble commented on Jun 9, 2026

    @admarble
    ContributorAuthor

    /fullsolve Complete

    Issue: #724
    Status: READY_FOR_MERGE
    PR: #725

    AC Coverage — 4/4 MET

    • ✅ AC-1: update --dry-run sets process.exitCode = 1 when applySet.length > 0 (new + modified; + local-overrides under --force)
    • ✅ AC-2: exits 0 on the no-op case (short-circuits at "Everything is up to date!" before the dry-run tail)
    • ✅ AC-3: unit test src/commands/update.test.ts covering both exit codes (4 cases)
    • ✅ AC-4: CHANGELOG entry under ### Changed noting the potential breaking change

    Change

    One guarded line in the update.ts dry-run tail, reusing the existing applySet (the same [...newFiles, ...modifiedFiles], +localOverrides under --force) — no new comparison logic. Mirrors sync --dry-run exactly.

    Quality

    • Tests: update 11/11, sync 27/27 — all pass
    • Build: tsc clean
    • Diff: 4 files (update.ts + new unit test + integration test fix + CHANGELOG) + troubleshooting doc
    • No CLI wiring needed — -d, --dry-run already registered for update

    Iterations

    • Test loop: skipped (backend/CLI, no UI labels)
    • QA loop: 1 (adversarial self-review — confirmed no other tests assert the old exit-0 behavior; added a parity note to docs/troubleshooting.md that previously steered CI users only to sync)

    Ready for human review and merge.

  3. added a commit that references this issue on Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-improvement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions