Skip to content

feat(writes): all-or-nothing batch corrections (refs #1)#31

Merged
tenfourty merged 1 commit into
mainfrom
feat/cow-atomicity
Jun 24, 2026
Merged

feat(writes): all-or-nothing batch corrections (refs #1)#31
tenfourty merged 1 commit into
mainfrom
feat/cow-atomicity

Conversation

@tenfourty

Copy link
Copy Markdown
Owner

Issue #1 slice 2 — COW batch atomicity. apply_corrections (the correct --apply batch, the only true multi-file write) is now all-or-nothing: phase 1 computes every change in memory, phase 2 writes them, and on any write failure the files already written are restored from their in-memory originals before re-raising. A bulk correction across many files can no longer leave a half-applied state (the issue's exact pain). Snapshot-rollback approach (approved over temp-tree swap). TDD: injected mid-batch write failure → all files restored; happy path → all changed. ruff + mypy + bandit clean. Follow-up: a graceful CLI message on the (rare) rollback path.

apply_corrections now runs in two phases: compute every change in memory
first, then write them; if any write fails, restore the files already
written from their in-memory originals and re-raise. A bulk `correct
--apply` across many files can no longer leave a half-applied state — it's
all-or-nothing (issue #1's COW slice 2). Single-file writes were already
atomic, so this is the only batch that needed it.
@tenfourty tenfourty merged commit 69dbd86 into main Jun 24, 2026
8 checks passed
@tenfourty tenfourty deleted the feat/cow-atomicity branch June 24, 2026 13:09
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