Commit Graph
1079 Commits
Author SHA1 Message Date
swaitsandClaude Fable 5.2 5693390614 fix(spec): WB-app-1 names AppServer's drop in words, not as an item
The claims check reads a backticked word as a code item; Drop is a
trait, not an item of this workspace.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 09:55:38 -07:00
swaitsandClaude Fable 5.2 40c8a5dce5 docs(plan): the relay's follow-ups and delegation lines
check / check (cli) (push) Canceled after 0s
check / check (gui-tests) (push) Canceled after 0s
check / check (gui-unit) (push) Canceled after 0s
check / check (lint) (push) Canceled after 0s
check / check (rest) (push) Canceled after 0s
portable-macos / portable (macos-latest) (push) Canceled after 0s
portable-windows / portable (windows-latest) (push) Canceled after 0s
two-user / two-user (push) Canceled after 0s
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 09:53:58 -07:00
swaitsandClaude Fable 5.2 06daffea76 Merge branch 't3/p15-b2-relay-service': the relay service (P15 B2)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 09:53:38 -07:00
swaitsandClaude Fable 5.2 a4624c16bc docs(spec): the relay's claims after the security review
WB-relay-2 to 5 and 7 say what is now true: one refusal for a stranger,
the secret label's 128 bits, the word list's 1 427 words and 40-bit floor,
the claim ceiling and the certificate budget charged at first publish with
their per-prefix numbers, the block reaching a live line within 10 s, no
static binding secret, CAA from the list, and the limits in one table with
what stays unsolved.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 09:52:54 -07:00
swaitsandClaude Fable 5.2 13adeac382 fix(relay): one address or network cannot stop the relay for the others
A review found ways for one cheap attacker to stop the service.

- Line handshakes were limited only by a global pool: one address could
  finish a hello, stall, and repeat. A handshake now holds a place for its
  address (4) and network (64) from the relay's host name to the verdict.
- Claims were counted per full address and against the certificate
  authority's weekly 50: one IPv6 /64 could spend all 50 with throwaway
  keys. Addresses now count by IPv6 /64 and /48 and IPv4 address and /24;
  claiming a name is limited by a separate safety ceiling (5 000 a day) and
  by those prefix limits, and the authority's weekly budget is charged when
  a name first publishes a proof record (once per name, renewals free,
  durable in the registry), under per-prefix limits of its own.
- IPv4 callers on a dual-stack listener (::ffff:a.b.c.d) shared one slot:
  every table now makes the address canonical first.
- The pool of unfinished hellos also counts per /48 and /24, and a
  reserve is kept for addresses that held a proven line lately (the server
  name is not known before the hello, so it is for who calls, not what is
  asked).
- A static account-binding secret was served to anyone with a name: the
  list file may no longer carry one (refused at load), a binding comes only
  from a per-app source, and an authority that needs one and has none is
  served without and marked not usable.
- Blocking now reaches a live line: the next publish and a sweep every
  10 s close it.
- Unclaimed, held-by-another-key and blocked names answer a stranger the
  same.
- A hostile app and caller could make a line hold 13 MiB: yamux fixes each
  stream's window at 256 KiB, so the stream limits are 8+2+4 (3.5 MiB), and
  the splice has a minimum rate in place of a per-write stall check.
- DNS answers truncated over the per-address rate, has a global ceiling,
  answers CAA from the authority list (issue per authority, dns-01 only),
  and passes over a Windows UDP connection reset without sleeping.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 09:52:54 -07:00
swaitsandClaude Fable 5.2 8988769015 fix(relay): a name read aloud is unambiguous, and the secret label holds 128 bits
The word list had 'dong' and three words of death and estates (probate,
testament, executor); it held both a word and its inflection (accrue and
accrued, audit and audited, ...) and homophones (peer and pier, sell and
cell, current and currant, ...). Four spoken words must identify one
name, so each pair keeps the base form or one spelling, 'fulfil' is
'fulfill', and the list is 1 427 words: 41.9 bits for four, over the
40-bit floor, which a test now states. A second test scans the list for
stem + ed/s/ing pairs and a list of alike-sounding groups.

The secret label was accepted at 16 characters ('aaaaaaaaaaaaaaaa'). The
app makes it from at least 128 random bits, 25 or more base 36 characters,
and the relay now refuses a label shorter than 25.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 09:52:54 -07:00
swaitsandClaude Fable 5.2 5902580819 docs(spec): WB-relay-1 to WB-relay-7, the relay's product rules
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 09:33:03 -07:00
swaitsandClaude Fable 5.2 b87a5adf7c test(relay): routing, proof, replay, DNS, authorities, bounds and the idle-line memory bench
Real TLS and real lines on loopback with in-process clients: an assistant
reaches an app with the app's own certificate; unknown and offline names
close alike; a wrong key, a name claimed twice, a replayed or relayed proof
are refused; a proof record is published for one's own name only; the list
of authorities follows its file; a silent, dripping or slow peer, too many
streams, lines or unfinished hellos are all bounded. tests/memory.rs (ignored
by default) measures the relay's resident memory per idle line with the apps
in a child process: 15.2 KiB at 20 000 lines, flat under churn.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 09:33:03 -07:00
swaitsandClaude Fable 5.2 31f706bd7e feat(relay): the relay service for wanderbooks.link (P15 unit B2)
A new crate, crates/relay (lib `relay`, binary wanderbooks-relay), with no
ledger-* dependency. Routes an assistant's TLS connection by the server name
in its ClientHello down the line an app holds open, forwarding encrypted
bytes only; the line is yamux over TLS 1.3 on 443, the app proving its key
with an Ed25519 signature bound to the session's TLS exporter and a fresh
nonce. One durable table (SQLite: name, key, created, blocked), four-word
names from a curated list of 1454 words (42.0 bits), a PROXY v2 header with
the caller's address, an authoritative DNS server that publishes an app's
ACME DNS-01 value for its own name only, and a list of certificate
authorities served as data. Every table, queue, buffer and time is bounded.

New dependencies, each permissive and passing cargo deny: yamux 0.14
(Apache-2.0 OR MIT; the multiplexer), hickory-proto 0.26 (MIT OR Apache-2.0;
DNS wire format, std only), rusqlite (already in the tree), rustls and
tokio-rustls (already in the tree, ring provider), ring (Ed25519, already in
the tree); dev only: rcgen 0.14 (MIT OR Apache-2.0), proptest, tempfile.
Added to the kernel-only lint list (no Decimal in the crate).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 09:33:03 -07:00
swaitsandClaude Fable 5.2 4c474ee1d9 docs(plan): A2's follow-ups and delegation lines
check / check (cli) (push) Canceled after 0s
check / check (gui-tests) (push) Canceled after 0s
check / check (gui-unit) (push) Canceled after 0s
check / check (lint) (push) Canceled after 0s
check / check (rest) (push) Canceled after 0s
portable-macos / portable (macos-latest) (push) Canceled after 0s
portable-windows / portable (windows-latest) (push) Canceled after 0s
two-user / two-user (push) Canceled after 0s
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 09:22:00 -07:00
swaitsandClaude Fable 5.2 02468a824d Merge branch 't3/p15-a2-app-hosts-books-server': the app starts and stops the books server (P15 A2)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 09:21:46 -07:00
swaitsandClaude Fable 5.2 c6b3cb614b docs(spec): the app claims say what the fix round made true, and that app-hosted is permanent
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 09:21:21 -07:00
swaitsandClaude Fable 5.2 9f3f292bf5 fix(gui): a failed start can be tried again, and a close that was not whole stays on screen
The window retries a failed server start when the next tab opens or when the
person asks, says a server still starting is starting, tells the person which
wanted companies did not open, and when the close reports an incomplete last
backup or a bad exit it stays up with a Close anyway button. ViewerOwner only
forwards to AppHost now, and the format upgrade goes to the window's own server.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 09:21:20 -07:00
swaitsandClaude Fable 5.2 acc17a7703 fix(host): the window's server is managed or stopped, its close and upgrade are said in words
AppHost holds what the window does with its books server, so what the tests
drive is what the window runs. A server that is alive but not ready is waited
for; a failed start, or a window closed before the child was stored, closes
the child's input and waits for it, so no server runs that nothing manages.
The close first closes each open company, so a closing backup that was not
whole, and a server that exited badly, come back as words. The format
upgrade goes to the server as an admin request (there is no host to ask),
and the companies the window wanted that the server did not open are told.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 09:21:20 -07:00
swaitsandClaude Fable 5.2 7357a30c73 test(app): the child's lifetime, tabs driving the server, and the bridge's two messages
The server child starts, closes on input close and on the window's death (a
killed stand-in window leaves no server and a whole book), a stop that runs out
of time leaves it closing and says so, a start is refused while a server or host
holds the books; a tab opened or closed opens or closes that company, in order,
with failures said in words; closing the window waits in view and asks the owner
once; the bridge answers 'Wanderbooks isn't running' and 'Company X isn't open'
in one running session, starting no host. Claims for WB-app-1 to WB-app-4 name
them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 09:07:34 -07:00
swaitsandClaude Fable 5.2 f476c95a64 feat(gui): a tab is a company open in the app's books server; closing the window closes it in view
The window starts the server with the companies it restores, a tab opened or
closed opens or closes that company in it (one queue per company, so one
company's backup at close delays no other), failures and incomplete backups are
notices under the tab bar, and asked to close the window waits, saying so, for
the server's bounded close (WB-app-2, WB-app-4). The viewer no longer starts a
detached host.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 08:58:51 -07:00
swaitsandClaude Fable 5.2 c8c0f5e0d9 feat(host): the app's books server is a child process; the bridge says in words when the app isn't running or a company isn't open
The desktop app is the host (D-77, D-84): AppServer starts the books server
from the program's own executable, closes it by closing its input, and never
signals it. A window that dies closes the same pipe, so the books close
cleanly. A start is refused in words when host.lock or server.lock is held.
Starting writes run/app-hosted; for such a root with no host the bridge holds
no lease and starts no host, and answers 'Wanderbooks isn't running' or
'Company X isn't open' (WB-app-1, WB-app-3). Owner commands and the viewer
take a lease-less hold on the app's server instead of starting a host beside
it; closing the books and wanderbooks serve say the app has them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 08:58:51 -07:00
swaitsandClaude Fable 5.2 5682258f8d docs(delegation-log): the Mac, Windows and lint fix
check / check (cli) (push) Canceled after 0s
check / check (gui-tests) (push) Canceled after 0s
check / check (gui-unit) (push) Canceled after 0s
check / check (lint) (push) Canceled after 0s
check / check (rest) (push) Canceled after 0s
portable-macos / portable (macos-latest) (push) Canceled after 0s
portable-windows / portable (windows-latest) (push) Canceled after 0s
two-user / two-user (push) Canceled after 0s
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 08:41:48 -07:00
swaitsandClaude Fable 5.2 2cd67da1b1 Merge branch 't3/fix-ci-macos-windows-lint'
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 08:41:35 -07:00
swaitsandClaude Fable 5.2 7058fbd2b9 docs(plan): the first test release waits for the relay
The owner's decision, 2026-11-21: test users get nothing until web
assistants work, so every P15 unit is built before the first installer.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 08:40:24 -07:00
swaitsandClaude Fable 5.2 124be0afd8 test(cli): macOS refuses socket options on a cut connection; a failure names what it waited for
Raw::until_closed set a read timeout on a connection the server had already
cut. macOS answers EINVAL to setsockopt on a socket whose peer has closed,
where Linux accepts it, so five tests failed there before they could observe
the cut they wait for. Such a socket cannot block a read, so that refusal
alone is passed over (a zero bound is asserted against, and any other error
still fails); a read that reports NotConnected is the same cut. The timers
test now says which timer never held, and the hammer test how long each close
took, so a platform failure names its cause. The deaf shim flag (see the
store commit) is used by the lock test.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 08:34:04 -07:00
swaitsandClaude Fable 5.2 b9ef35592c test(mcp): the tree digest names files with / on every system
handles_from_before_a_close_do_nothing_after_the_book_is_open_again adds the
planted stray file to the digest as uploads/stray.bin, but the walk keyed the
same file by the system's path, uploads\stray.bin on Windows, so the two
maps could never be equal there. The helper now keys with / everywhere; the
assertion (an old handle changes no file) is untouched.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 08:34:04 -07:00
swaitsandClaude Fable 5.2 e9dc03a44a test(store): a git that cannot end on SIGTERM is deaf to it, not stopped
On macOS a SIGTERM sent to a SIGSTOPped git ended it inside the grace and it
removed its own locks, so the three tests that need a git the kill must end
failed there (the grace was not waited, no lock was left). A blocked signal
stays pending on every system, and the mask is inherited through exec and
through git's own children: the test shim blocks SIGTERM for a git when a
deaf flag file exists. The program's stop (SIGTERM, grace, SIGKILL) is
unchanged. Checked here with the stop turned off: the tests still pass.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 08:27:50 -07:00
swaitsandClaude Fable 5.2 cf1644627f fix(deps): ignore RUSTSEC-2026-0543, chrono's unmaintained notice
Not a vulnerability and no upgrade is offered; replacing chrono with jiff
is the owner's decision.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 08:18:08 -07:00
swaitsandClaude Fable 5.2 232af014c4 docs(delegation-log): the two fix-ups after GitHub's run
check / check (cli) (push) Canceled after 0s
check / check (gui-tests) (push) Canceled after 0s
check / check (gui-unit) (push) Canceled after 0s
check / check (lint) (push) Canceled after 0s
check / check (rest) (push) Canceled after 0s
portable-macos / portable (macos-latest) (push) Canceled after 0s
portable-windows / portable (windows-latest) (push) Canceled after 0s
two-user / two-user (push) Canceled after 0s
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-20 22:44:09 -07:00
swaits 40d818fb5e Merge branch 't3/fix-linux-ci-failures' 2026-11-20 22:43:10 -07:00
swaitsandClaude Sonnet 5.5 ca57ac03cc docs(notices): regenerated for zip 9.8.1 and its zstd, lzma-rust2
The new zstd-sys carries the BSD 2-Clause text of its legacy decoders, so the
notices gain that licence. libc was already listed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 22:22:43 -07:00
swaitsandClaude Sonnet 5.5 70f24daf99 fix(deps): zip 9.0.2 to 9.8.1, for RUSTSEC-2026-0548
zip's reader extracted entries under local-header names that can differ from
the central directory (fixed in 9.0.5). ledger-package reads packages with
it. Lock file only; ledger-package builds and its unit tests pass.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 22:19:40 -07:00
swaitsandClaude Sonnet 5.5 e42c3909fa fix(gui): the tab strip's width is folded, not summed, so kernel-only passes
scripts/raw-decimal-arith.sh refuses an Iterator::sum of any type (it cannot
tell widths from money without types it does not have). The tab widths are f32
layout, no money; a fold says the same and the check reads 0 places.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 22:17:20 -07:00
swaitsandClaude Sonnet 5.5 13e676a101 fix(gui): the tab bar's pictures are compared as shapes, and no picture depends on a temporary name
The stored tab-bar images were compared pixel for pixel on every machine.
GitHub's software renderer rasterizes the same shapes differently from the
GPU that made them (thousands of faint pixels, dozens strong along glyph
edges); sidenav.rs already says so and compares shapes everywhere, pixels
only locally. The tab bar now does the same: a hash of the visible shapes
(tests/snapshots/<name>.shapes, TABS_BLESS=1 writes them), the pixels with
TABS_PIXELS=1. The images are unchanged and still pass locally.

The hash is of a description of each shape, not of its debug form, for
two things in the debug form depended on the run, not on the books: a
glyph's place in egui's font atlas changes with which tests ran in the
process before (the same view hashed differently alone and beside another
test), and the page under a short bar holds the current time, clipped
away, which no picture shows. Shapes whose clip is off the window are
left out.

A new test renders the same companies from two differently named
temporary folders, light and dark, and requires the same hue keys (the
book ids), the same shapes and the same pixels. The sidenav fixture's
copy outside a data root is in a folder of a fixed name, not the temporary
folder's random one, since that folder's name is its badge's hue key.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 21:48:18 -07:00
swaitsandClaude Fable 5.2 d9e0df7a70 docs(plan): one more follow-up, and the day's delegation records
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-20 21:37:30 -07:00
swaits c618ad4d84 Merge branch 't3/fix-book-close-open-race' 2026-11-20 21:37:30 -07:00
swaits 7801455336 fix(store): a store's writer lock is free when it is dropped, even with a child forked from another thread
Cause: a book's writer lock is a flock, which lasts as long as any copy of
its open file description does. A child forked by another thread of the
server (git, for another book's backup, on a timer) holds a copy of every
descriptor from its fork until its exec, so a close of book B, answered
after its Store was dropped, could be followed by an open of B that found
the lock still held: "another program has these books open". The open's
failed attempt left B failed, and the next close found it not open. This
broke the unit's rule that a close answers only once the lock is released,
and that closing book A never refuses a job on book B (the hammer's maker
thread saw it on GitHub's slower runner; with a 40 ms fork-to-exec delay in
the backup's git it fails on every cycle).

Fix: every child the crate starts goes through lock::spawn, which holds a
process-wide gate while it runs (it returns once the child has exec'd);
dropping the Store's WriterLock closes the file, waits for the gate to
empty of spawns begun before, then takes the lock afresh and lets it go
(the kernel lets go of a closed file's last copy a moment after the exec),
for 500 ms at most. A test with a child held between fork and exec fails
without it.
2026-11-20 21:36:57 -07:00
swaitsandClaude Sonnet 5.5 c072e68fda docs(store): the doc link to take_lock_notes is a method link
rustdoc -D warnings refused [`take_lock_notes`]: a method is linked as Self::take_lock_notes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 21:23:44 -07:00
swaitsandClaude Sonnet 5.5 62364fec62 docs(spec): WB-format-1 names the function that picks the newer-journal message
`verified` is a field of a StoreError::NewerJournal variant, which the claims
check does not read as an item; it passed before only because a doc comment
in gui app.rs quoted "verified" (a string literal, removed today). The claim
now names newer_journal_text, the function that reads the flag, and says in
words what the flag is.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 21:23:44 -07:00
swaitsandClaude Sonnet 5.5 5c9c980072 fix(gui): jobs.rs cites the plan, not a product rule no claims file defines
WB-GUI-2 was never written into docs/spec/claims/, so the source-line test
could not find it. What the module rests on is plan 3.2 (D-78: a tab's
threads end with it); the hold on a change an owner has begun is a
CONVENTION, named as one.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 21:23:44 -07:00
swaitsandClaude Sonnet 5.5 15845f71c8 fix(gui): the dock compiles on Windows, where the agent ends when its pty drops
check / check (cli) (push) Canceled after 0s
check / check (gui-tests) (push) Canceled after 0s
check / check (gui-unit) (push) Canceled after 0s
check / check (lint) (push) Canceled after 0s
check / check (rest) (push) Canceled after 0s
portable-macos / portable (macos-latest) (push) Canceled after 0s
portable-windows / portable (windows-latest) (push) Canceled after 0s
two-user / two-user (push) Canceled after 0s
Pty::child exists only on Unix; the child's pid is now Some on Unix and
None on Windows, so the kill after the grace happens only where it can.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 20:50:41 -07:00
swaitsandClaude Fable 5.2 3fe6b2f9c9 docs(delegation-log): P15 A3a's last change, merged
portable-macos / portable (macos-latest) (push) Canceled after 0s
portable-windows / portable (windows-latest) (push) Canceled after 0s
two-user / two-user (push) Canceled after 0s
check / check (cli) (push) Canceled after 0s
check / check (gui-tests) (push) Canceled after 0s
check / check (gui-unit) (push) Canceled after 0s
check / check (lint) (push) Canceled after 0s
check / check (rest) (push) Canceled after 0s
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-20 20:31:39 -07:00
swaitsandClaude Fable 5.2 b994a901bf merge: P15 A3a, the viewer is one window with a tab per open company
The viewer was a read-only window on one company per process. D-78 makes
a company reachable exactly while it has a tab, so the window now holds
one tab per open company, each with its own loader, navigation, page
state and assistant dock, and nothing shared between them. The company
is named once in the frame, on its tab; the status card at the foot of
the sidebar carries its badge and name with the live state; each company
has its own badge colour. A restore or a format upgrade in progress is
never abandoned by closing its tab or the window. The viewer still
writes nothing to the books.

docs/testing.md: both units added their test records at the end; both
are kept.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-20 20:30:01 -07:00
swaitsandClaude Sonnet 5.5 6f916f8bbd fix(gui): the status card's live word at its right edge, the event on hover, and no line ever wraps
The heading row is badge and name (elided) at the left, the live dot and word at the right edge; the event is the heading's hover and the live word's accessible label, not a printed row. The check lines are as before, with no event. Every text elides to one line; a test lays the card out in every state with a very long name and event 1,234,567. The heading is its badge's height and the card's vertical padding 8, so the sidebar still fits at 1479x519.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 20:29:23 -07:00
swaitsandClaude Fable 5.2 1e49272243 docs(delegation-log): P15 A1's last round, merged
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-20 20:25:09 -07:00
swaitsandClaude Fable 5.2 a19473b282 merge: P15 A1, the server opens and closes one book while it runs
The books server could only open every book at start and close them all
at exit. The app is becoming one window with a tab per open company
(D-77, D-78), so a company must be reachable exactly while its tab is
open. The server now opens and closes one book on request, refuses calls
to a closed book in words an agent can relay, and lists who is connected.

Four independent reviews shaped it. After a close is answered nothing in
the server can write to that book; a call either ran and is journaled or
was refused, cut or stopped and left nothing; a close ends within a
stated bound; closing one book never stops another's work; and nothing
is ever deleted in a backup folder the owner chose.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-20 20:24:00 -07:00
swaitsandClaude Sonnet 5.5 ee58d1ab10 test(cli): a close's own backup is asserted without a timer's backup beside it
a_close_whose_backup_fails... asserted a plain Closed, but with the timers
looking every 20 ms a timer's open-time backup could be in flight at the
close. The close hurries it; under heavy load its git can miss the 5 s
terminate grace, be killed, and leave a lock in the target folder, and the
close's own backup then fails against it, so the close truthfully answers
ClosedBackupIncomplete. The timers now look once an hour in this test, so the
first look (at the server's start, before the book exists) is the only one
and no timer backup runs; the assertion stays exact.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 20:21:56 -07:00
swaitsandClaude Sonnet 5.5 49ae7c0d13 fix(store): a stopped heal leaves no copy and no rebuild, and the bound names the heal
verify_and_heal copied the database aside before looking at the stop, so a
verification or an open that was stopped right after finding a drift left a
.mismatch copy behind. The look now comes first (heal_drift), before anything
is done: a stopped heal leaves the database and the folder exactly as they
were. The rebuild and its verification stay unstoppable once begun, since
stopped half way the live ledger would be part replayed.

INVARIANT 10's close bound said that heal was one pass over the journal and
named no term for it. It is about six (three in the rebuild, three in the
verification) plus the copy and one hash of each stored file, so it is now the
fourth named exception to the bound, with that cost, and 'an open stops
anywhere' says where it cannot.

Test: a stop before the heal leaves no copy and no rebuild; the same drift
heals when not stopped. It fails with the look moved back after the copy.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 20:20:24 -07:00
swaitsandClaude Sonnet 5.5 30e5fcf6da fix(mcp): a CPA package the build will refuse leaves no decision on record
The override decisions (exporting without an audit, with open drafts) were
journaled once only the two named refusals were past, but build_package can
still refuse for what the books say, such as a member whose capital account
is not in the chart. That left 'was exported' on record with no package, and
a new decision on every retry.

When a decision is to be recorded, the build now runs once first, in memory:
it is read-only (the books by shared reference, written nowhere), so it
changes nothing, and it is left without the stored files and the vault, which
only a failing machine can refuse. Only if it succeeds is the decision
journaled and the package built for real. The spec block says what can still
fail after a decision (the machine) and that the decision then stands, with
the reason in the access log.

Test: a package refused for an unknown capital account, with an override
reason, journals nothing, on the first try and on the retry; it fails without
the dry run (the journal grows).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 20:18:39 -07:00
swaitsandClaude Sonnet 5.5 b70a8ab8eb fix(mcp): a close never waits behind a preview, and stops every job holding its book's turn
A restore preview changes nothing, yet it took the book's turn and then
queued on books.lock and cloned, so a close of that book (which waits for
the turn) waited for the whole preview, and behind it for any adoption
holding books.lock. An adoption held the turn through its preview and
placement on the server's stop alone, so the comment saying a close of the
id stops its opening was not true.

A preview (restore, unconfirmed adopt) now takes no turn, and only the
server's close stops it. Every job that does hold an id's turn (adopt,
create, a confirmed restore, open) listens to that id's stop, which a close
raises before it waits for the turn, and which the server's close raises
too. A close of X stops the work making or replacing X before its point of
no return and never waits behind it; a close of another book still touches
nothing.

Tests: a close is answered while a preview of its book is held; a close of
an id stops the adoption making it. Each fails with the fix disabled.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 20:16:13 -07:00
swaitsandClaude Fable 5.2 3a8e652ceb docs(plan): P15's follow-ups from the reviews of A1 and A3a, written down
The last rounds of both units fix what blocks a merge and no more. What
was left out on purpose is listed in the plan so it is not lost.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-20 20:07:12 -07:00
swaitsandClaude Fable 5.2 80e08291b8 docs(routing): long runs go to Haiku, short ones to Ember
Ember twice ended its turn while a long command ran, and the command
died with it; it was exact on short runs and on one hour-long single
command. The table now splits run-only work by length.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-20 20:04:08 -07:00
swaitsandClaude Sonnet 5.5 a66b56c5c7 fix(mcp): a close stops only the work on its own book; each book has its own turn
Closing or opening book A must never block, fail, stop or delay anything on
book B. Two things were server-wide: the stop a close raised for the admin
jobs (a close of one book stopped another's restore, create and adopt, and
refused opens of others while it ran), and the one lifecycle lock a close
held for its whole length (an open of another book waited out the close's
last backup).

Each book now has its own turn and its own stop (Books::lives). A close of X
stops the work on X only: an open of X and a restore that replaces X. A
create, an adoption and a restore that replaces nothing make a new book, which
no close of a book is the close of; only the server's own close stops them
(and every other job: stop_every_job). The stop is lowered while the book's
turn is still held, so an open queued behind a close is not told it was
stopped by a close that is over. The server's close no longer takes a lock:
every admin job has ended by then. "One at a time" remains for making books
(run/books.lock, ledger_store::root INVARIANT 5), where a queued job leaves at
once when stopped.

INVARIANT 10 now names the calls that are neither stoppable nor bounded by one
request, with their worst cases, so the close's bound as written is true:
books.import_bank_csv (a full import of the largest file accepted), a report
over the whole book, and a package after its decision is journaled (one build
over the whole book).

Tests: a restore over beta, a create and an adoption in flight while acme is
closed and opened over and over, its close slow, with another book opened and
closed during each close (mutations: a server-wide stop; one global lock);
a close stops the restore and open of its own book, and the server's close
stops every job; the hammer also makes books and cycles a third book; a close
before a package's decision journals nothing and one after it does not stop it
(mutations: no look before; a stoppable build after). Spec blocks,
docs/mcp-interface.md and docs/testing.md updated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 19:57:16 -07:00
swaitsandClaude Sonnet 5.5 d05d1ed7ec fix(mcp): a package's decisions are journaled only once it will be made
books.export_cpa_package journals the reason given to export without an audit
or with open drafts as a decision, and did so before it knew the package
would be made: a later refusal (open drafts after an audit reason) or a close
that stopped the build left a decision on record for a package that was never
made.

Every refusal is now decided first, then the decisions are journaled. They stay
ahead of the build for a reason the code states: the package counts them (its
README and every report footer carry the journal's event count at the build),
so moving them after would change the package's contents. A close is looked
for once, immediately before the first decision is journaled; from there to the
hand-over nothing looks at the stop (the build is entered without the close's
cancel scope), so a decision on record is a package handed over. What is
journaled and what the package holds are unchanged.

Test: an open draft that refuses the package after an audit reason journals no
decision (mutation-checked: journaling before the refusal fails it).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 19:57:16 -07:00