Skip to content

fix(#722): add sync --dry-run so the sync preview can't under-report the apply - #723

Merged
admarble merged 1 commit into
mainfrom
feature/722-update-dry-run-reports-0-modified-but-apply-rewrit
Jun 9, 2026
Merged

admarble merged 1 commit into
mainfrom
feature/722-update-dry-run-reports-0-modified-but-apply-rewrit

Conversation

@admarble

@admarble admarble commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Reproduction (gate) first: the literal update --dry-run "0 modified" vs apply-rewrites-everything divergence does not reproduce on update. It derives its summary and write-set from a single computeTemplateChanges() call, which already classifies a header-missing SKILL.md as modified. Verified against a pre-2.6.2-marker fixture: update --dry-run reports 17 modified, never 0.
  • Real gap = sync: on a .sequant-version mismatch (e.g. an install predating the bug(customization): .claude/.local/skills (and likely hooks) never load — documented override layer is non-functional #711 / 2.6.2 <!-- sequant:local-override --> overlay header) sync runs copyTemplates(force:true) and silently rewrites the whole tree (+AGENTS.md) with no preview and no --dry-run — the untrustworthy-preview surface the issue is really about (the reporter's apply was sync, and/or npx version skew).
  • Fix: add sequant sync --dry-run / -d. It reuses the same source of truth to report the exact set the apply would write — new + modified + local-override (the force copy overwrites in-place customizations, so they are counted, never under-reported), mutates nothing, and exits non-zero when work is pending so the preview can gate CI/automation. The override classifier stays keyed on a real .claude/.local/ twin, not the in-band marker.

Scope respected the spec non-goals: no change to update, to computeTemplateChanges, or to the apply write-set itself.

Pre-PR AC Verification

AC Description Status Evidence
AC-1 Preview never under-reports the apply write-set ✅ Live verify: sync --dry-run preview = 18 files, real apply changed 18. Tests in sync.test.ts.
AC-2 Override classification keyed on real .claude/.local/ twin, not the marker ✅ Existing templates.ts:231-234 (unchanged); locked by new test in templates.test.ts.
AC-3 Header-missing installed vs header-bearing template → Modified in preview ✅ New test in templates.test.ts; reproduced live (17 modified).

Files changed

  • src/commands/sync.ts — dryRun option + preview guard before copyTemplates
  • bin/cli.ts — register -d, --dry-run on sync
  • src/commands/sync.test.ts — AC-1 dry-run tests
  • src/lib/templates.test.ts — AC-2 / AC-3 regression tests
  • CHANGELOG.md, docs/reference/cheat-sheet.md — document the flag

Test plan

  • npm run build — passes
  • npm run lint — passes (0 warnings)
  • npx vitest run on sync/templates/update-integration/doctor/cli-integration — 102 passed
  • Live fixture verify: sync --dry-run reports the full write-set, mutates nothing, exits 1; preview count equals real apply count

Closes #722

…the apply

The reported `update --dry-run` "0 modified" vs apply-rewrites-everything
divergence does not reproduce on `update`: it derives its summary and write-set
from one `computeTemplateChanges()` call, and that already classifies a
header-missing SKILL.md as `modified` (verified against a pre-2.6.2-marker
fixture — `update --dry-run` reports 17 modified, never 0).

The real gap is `sync`: on a `.sequant-version` mismatch it runs
`copyTemplates(force:true)` and rewrites the whole tree (+AGENTS.md) with no
preview and no `--dry-run`, so an operator/CI had no trustworthy way to see
pending work. Add `sync --dry-run` / `-d`, reusing the same source of truth to
report the exact set the apply writes — new + modified + local-override (the
force copy overwrites in-place customizations, so they are counted, never
under-reported) — mutating nothing and exiting non-zero when work is pending so
the preview can gate automation. The override classifier stays keyed on a real
`.claude/.local/` twin, not the in-band marker.

Regression tests lock all three ACs (sync.test.ts, templates.test.ts).

Entire-Checkpoint: a39a1f216e80
@admarble
admarble merged commit fb039c5 into main Jun 9, 2026
4 checks passed
@admarble
admarble deleted the feature/722-update-dry-run-reports-0-modified-but-apply-rewrit branch June 9, 2026 03:56
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 reports "0 modified" but apply rewrites every SKILL.md (dry-run vs apply divergence)

1 participant