A refusal is decided before anything is written; a failed call on the
record is for a call that failed part way. Four tools wrote a line and then
refused, so under T1 each left a begun line, its lines and a failed closing
line in the journal for a plain "no":
- books.attach_receipt and books.file_document: bytes already filed are one
file, so filing them again links the existing attachment; a link it
already holds was refused after the earlier links were written. The store
now asks first (Store::check_filing_links).
- books.draft_entry and books.draft_from_template: a no_party_reason that
names a full tax id was refused by the mark, after the draft was made.
Ledger::check_no_party_reason is asked first.
- books.dispose_asset: a receipt named twice was refused at its second
link, after the disposal was posted. The ids are checked for repeats
first.
Each has a test that the journal is byte for byte as it was. No journal
format or frame shape changes.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Rule 6 of section 4 now says every new sign-in is asked and an approval is
never reused; WB-remote-1, 5, 6, 7, 8 and the interface carry the matching
code, the neutral words, the per-start secret B3 must send first, and the
limits as built.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Ties WB-format-8 to 10, the calls.rs spec block, the command-steps map and
plan 2a to bookspec law 47 (Calls.lean): a call is a Steps run, no new Step.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
WB-format-8 now says every reader applies the frame rule because ids are
reused after a failed call, and names the committed accessor and the labels;
WB-format-9 the keyed argument digest, the bounded answer, the in-memory
table for calls that wrote nothing and what a repeat of a long answer is
told; WB-format-10 the vault staged inside the transaction and the honest
words when the closing line is on disk. docs/mcp-interface.md, the receipt
store's frame paragraph and the handbook (contract, tracing figures) say the
same.
Tests follow the new shapes: a call that wrote nothing leaves no line, the
head a write answers is where its own lines end and its closing line follows,
the idempotency table compares events, and the checks that a refusal or a
preview wrote nothing compare the raw journal.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
P15 unit A4, plan 3.3 and D-79. The window only reads the books, so it
now says so by what it offers. Each company is in one of three states
(no assistant, connected, working) read from the books server's own
sessions answer, never waited for, drawn as a shape on its tab and said
in words with the last thing done at the right of the top bar; the
sidebar gives up no height, because the links must all fit at 1479x519.
Where a button that edits would be there is "Ask your assistant", which
copies a ready sentence. The Connect page has a row per local tool with
exact commands, the keys with who is on each, and Revoke through the
existing command path. Closing the window or a tab with an assistant
connected warns first, before and never beside the server's own close.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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>
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>
Accounting reasoning: these are financial books reached over the internet,
where a request is retried. A write whose answer is lost and then sent again
must not post twice, a call half done must not be left looking done, and a
failed write must be on the record.
Every tool that can change the books (83 of the 140: three that only read
what is sealed and may answer with a TIN are reads) takes a required
`request_key`, added to its schema in tools/list and taken out of the
arguments before the tool runs, so no tool, preview digest or check changes.
A write without a usable key is refused in words. Write calls take turns,
and each runs as one transaction of the store: opened (or answered from the
books if its key committed: the same tool and arguments return the first
answer and write nothing; other arguments are refused as a misuse of the
key; the access log says `repeat`), then closed with its answer if it
answered ok, or rolled back and closed `failed` if it errored, failed or was
stopped by a close. Books an older version wrote take no write at all until
the owner's go-ahead (D-89): every write is refused with the upgrade remedy;
reads work as ever. `books.import_bank_csv` is one transaction like the rest.
The handbook, docs/mcp-interface.md, the claims (WB-format-8 to 12, and
WB-format-3 amended for D-89) and docs/parity.md say so. Tests that wrote to
old books through the tools now assert the refusal and write after the
upgrade; the shared wire helpers add a fresh key to every tool call (the
journal helpers leave the call frames out, as they left out nothing before),
so no other test changed. The store-level `_waits_for_<feature>` tests still
check each feature's own gate. No figure and no golden moved.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Accounting reasoning: a write that is retried after a lost answer must
happen once, and a call that dies between its journal lines must never be
replayed as if whole. The journal feature `call_transactions` frames a
call's lines with `call.begun` and `call.closed`; the lines between count
only when the closing line says `ok`. Every replay (open, the viewer,
verify, rebuild, the projection's catch-up) goes through one gate
(`CallGate`), so no state is built from half a call and a replay of any
prefix ending inside a call equals the replay of the prefix before it. A
call that never closed is closed `unfinished` at the next open; a call that
fails after writing lines is closed `failed`, its SQLite changes (one
transaction per call) rolled back and the live ledger rebuilt without them.
The closing line keeps the answer given, so a repeat of a request key
returns it; the key table is rebuilt from the journal alone.
The envelope is untouched. Lines outside a frame apply as ever, so every
journal written before the feature replays as it was. Books get a unique id
(`books_id`) at creation, and older books at the format upgrade, in the
`journal.format_set` that declares the feature. The frame lines never move
the audit's figure head. The upgrade's declaration now also carries the id,
so the three tests that pinned its exact payload compare it without the id.
No figure and no golden moved.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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>
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>
`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>
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>
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>
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>
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>
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>
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>
The heading row is the badge and name with the live dot and word at the right; the event ends the journal chain line. Folded, the card is the heading alone (or the heading over the failure line). The rail's badge carries the dot. The four sidenav tests are at their original sizes, the minimum window height is 400, and the goldens and snapshots are regenerated.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
architecture.md says how a tab owns its threads and what is kept under
what key; testing.md lists the tests, how each fix was shown to matter,
and why the sidenav window sizes were not restored (15 and 11 points
short at 519).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A close waited, unbounded, for a running books.back_up_now (git only Backups::shut
could cancel), for a restore, create or adopt (they hold the one lifecycle lock,
and at the server's close admin_jobs.wait() waited for them before anything was
released), and, through the store lock, for a verification or a package reading
every stored file. The bound's T_calls term was not finite.
Now a close calls hurry at its start, and the stoppable work looks at it:
books.back_up_now and timer-asked backups (git stopped, a stopped run records
'stopped' and no result of its own), books.verify (per journal line and file; a
heal of a drifted database is begun only if no stop came before it: stopped half
way it would leave the live ledger part replayed), books.export_cpa_package (per
stored file). Such a call answers that it was stopped because the books are
closing, and its access record says refused: stopped_by_close. On the admin
socket restore, adopt, create and open take a JobStop: asked at each phase and
file copied, they remove what they wrote and leave the root byte for byte as it
was; the renames that put the books in place are the point of no return, after
which they finish (two renames and two syncs). A close of any book, and the
server's own, raises the flag before it waits for the lifecycle lock.
A close whose last backup had to be killed in the owner's folder now says which
file was left, and the target's backup is marked failed by shut when the run's
future was dropped at its bound. INVARIANT 10 is rewritten so each term of the
bound is enforced by code, and lists the calls that can run long (and the one
known exception, books.import_bank_csv); INVARIANTS 8 and 9 say exactly which
refusals are recorded and why an unrecorded one never ran; the format upgrade's
wording says a stop is honoured up to its final look.
Tests: the close is held to the bound while a backup call, a verification, a
package and each admin job is running and would never end; the stopped job leaves
the root byte for byte as it was; a lock left in a backup folder is reported and
never removed. Sleeps that stood for 'the other side got there' now wait on the
condition (Expect: 100-continue for a half-sent body, a writable named pipe for a
fetch that is reading).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The tab, the sidebar's header and the Overview's heading all said the
company's name side by side. Now the tab is the company's identity (badge
and name); the sidebar header and the Overview heading are gone (the
summary sentence leads the page, at the theme's heading size); and the
status card at the foot of the sidebar opens with a heading row, the
badge and the name (the rail shows the badge alone, the name on hover), so
"these are this company's books: verified, live" is on every page, at the
opposite corner from the tabs. The top of the sidebar is an empty
`top_slot` for the assistant's connection state, a later unit.
Each company has one of eight badge hues (theme::BADGE_HUES, light and
dark) chosen by FNV-1a of the id of its books: a function of the id alone,
so it is the same on its tab and its card, after a restart, in any order of
opening and on every machine. A test computes the contrast of every hue in
both themes: letter 4.5:1, badge 3:1 on each surface it sits on.
No figure, date or amount changed. Regenerated: the tall sidebar's shapes
and pixel goldens (header gone, links moved up, card heading row, hue) and
the eight tabs_* snapshots (hue, Overview lead, the rail's badge).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Close bound. A drill ran to its end however large the book, and a format
upgrade counted by the store's close held it, because only git was
cancellable. Now a close hurries them at its start (Backups::hurry): a drill
stops at its next look (git killed, journal line, file, chunk) and its
scratch clone is removed, nothing said of its target (it is due again at
open); a format upgrade is stopped before its journal.format_set line is
appended (reported not done, the books unchanged) and finishes once it is.
The close's last backup, and shut's stop of what is left of it, are not
hurried. INVARIANT 10 now states the bound as the sum of its named parts.
Lock files a stopped git left are removed by the store (previous commit) and
recorded here (lock_removed / lock_left, also those found at open).
Server's own close. It cut a stalled body only after admin jobs, store
closes and the serial 60 s backups, and never shut a gate or closed a log.
It is now Books::release for every open book (gates shut and the cut set for
one grace at the start, books released together, logs, uploads, exports,
backups and store closed), so there is one closing path; INVARIANT 15 says
what is true. A request that finds a shut door during the server's close is
refused as closing, not recorded.
Tests that passed with the fix removed. The timers test now holds a timer
between taking a book's handles and acting on them (--timer-hold), closes the
book in between and requires the tree not to move; the slow-upload test is
driven by conditions (a minute's grace) and has a mirror proving the cut of
an active upload; the line of the cut (a body read to its end is never cut)
has a unit test; a slow drill (--slow-steps) and a format upgrade are held by
the close test; REAL git killed inside init, a commit and a push by a close
leaves no lock and the next backup succeeds (this found that a killed init
left HEAD.lock, fixed in the store); the server's close with a stalled
upload and a stalled call exits 0 with both cut.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ledger-store: a file coming in (Uploads::receive) now writes each chunk under
the lock a close takes and stops at the first chunk after a close, removing
its part; an export fetch (Exports::get) reads under that lock, so a close
waits for it. The INVARIANTS say exactly this: after close() returns no byte
is written or kept and none is read for a caller; the one thing a request
begun before the close does after it is remove the part file only it made;
a request still waiting for its next bytes is not woken by the type (the
books server's gate waits for it and cuts one that never finishes).
ledger-mcp: a restore over an open book took the book out of the list
before it shut the door, so every call while the restore waited for what was
inside got 404 'no such books' for a book that exists. The door is shut
first and the book listed closed: such a call gets the closed refusal (503,
the words), as in a close. The drain test now requires 503 throughout.
(A refusal at a shut door is not written to the access log, as in a close:
INVARIANT 11.)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The owner's rule, given when a retried write after a lost answer turned
out to record twice. Reading the write path showed more than that: a
tool call may append several journal lines with nothing joining them, so
a crash between them leaves part of a call in the books. The plan now
says what the code does today and the rule that replaces it: a call's
lines commit together under a closing line, every write carries a
request key, a repeat returns the answer first given, and a failed write
is on record. It is a journal feature, built as its own unit before the
remote door.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A client that begins an upload or an MCP POST and stops sending is inside
the book's door, and the close waited for it with no bound. Now, when the
close's answer grace runs out, every request inside whose body has not been
read to its end is cut: connection closed, an upload's part file removed by
receive's read error, the access record (written before the answer) says
cut_by_close. A body read to its end is whole and never cut, so a running
call still finishes. Nothing of an MCP call can be journaled by a cut: rmcp
reads the whole body (expect_json) before any message reaches a session or
tool, and the handler checks for the cut again before binding a session.
Holds for a book's close, a restore over an open book (Books::release) and
the server's close. The restore-waits test now uses a grace longer than its
5 s watch: an upload finishing within the grace is still waited for.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>