Files
wanderbooks/crates/ledger-host
swaitsandClaude Sonnet 5.5 26b42c6d01 fix(mcp): after a close is answered nothing of this process can write to the book, and a close says when its last backup wasn't whole
A close ended with the process still alive, so the faults that process
exit used to bound now lived on: something of the server's own could
still write to a book that was reported closed, or, once the book was
opened again (here or by another process), to the new book's files. One
rule now: after a close is answered this process holds nothing that
writes to the book's folder, and every path that touches the book is
either counted by its gate or checks, under the lock of its own write,
that the book is still open. The close answers only when that is true.

 * A refusal's access record is written by a task that carries the
   request's place inside the door, so a client hanging up no longer
   leaves the record to land after the close; the access log, uploads,
   exports and backups are closed under their own locks by the close, so a
   record, sweep or run still on its way is refused, unwritten.
 * A restore over an open book lets go as a close does (drain, sessions,
   backups, closing the logs) before it moves the book to legacy/: an
   upload half received no longer leaves its part in legacy/ nor writes to
   the replaced book's log after.
 * The backup at a close is bounded, and a run past its bound is stopped
   (git killed with all it started) and waited for to end, instead of its
   future being dropped while its blocking task went on; the close answers
   closed_backup_incomplete, with why, when the last backup wasn't whole.
   The server's own close does the same.
 * Every timer (the sweep, the look for a backup due, the look for a drill
   due) works on handles closed with the book; the sweep also takes its
   place inside the door. They take --timers for tests.
 * A format upgrade, run, drill and record through a backup handle from
   before a close do nothing.
 * A call whose answer isn't read within the grace is the case of a
   connection dropped at any other moment: its record, written before its
   answer, says it ran. No journaled call carries a client key or a
   duplicate check, so a retry isn't made safe; said in INVARIANT 14, and
   left as an open design point.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 10:30:56 -07:00
..
2026-10-30 01:24:10 -06:00