Commit Graph
1107 Commits
Author SHA1 Message Date
swaitsandClaude Fable 5.2 a61df668ef docs: the holder of the books is read from what the server says (WB-app-1, 2, 3, 5)
Plan P15 unit A5, fix round. The claims for WB-app-2, 3 and 5 and the invariants
of opener.rs, app_server.rs, commands.rs, bridge.rs, serving.rs and ledger-mcp
local.rs say: a server says what started it and whether it is closing
(run/server.info), only the app's is "the app", a command's server and a closing
one are waited for in words inside one `open_wait`, a command racing a start joins
it, a command's own server starts clean (and why the app's own child does not),
a bridge that held a host follows the app, `books list` shows the upgrade pending,
and the app's notice for a host that holds the books has a button.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 12:30:26 -07:00
swaitsandClaude Fable 5.2 da0ed04bb3 test(cli): what holds the books is known; the thinned tests say what their names say
Plan P15 unit A5, fix round. Each of these fails without its fix (checked by
disabling the fix): a serve, a command and `close`/`doctor` meeting a closing
server or a command's server (orphan of a killed host, another command's),
a command's own server holding server.lock and books.lock while it works and
refusing the app's start and making `serve` wait, a command's server holding none
of the invoker's environment, pipes or folder, a command racing the app's start,
two commands at once with nothing running, a bridge that held a host following the
app that takes its place, the app asking a host to close, and server.info itself.

Thinned tests, mended: the_host_starts_without_a_scope_when_systemd_run_fails
drove `books create`, which never starts a host, and passed with the fallback
broken; it now drives `serve` and fails with the fallback broken.
with_nothing_running_a_command_runs_its_own_server… asserted
`success || stderr contains "backup"`, which passes on a failure; it asserts the
real outcome (exit 1, "No backups are set up"; a backup that is made is
books_are_backed_up_now_from_the_command_line).
the_bridge_reaches_the_books_serve_holds… has its close after the last lease back
(serve let go, the books close). a_command_leaves_nothing_running_and_serve_closes…
has "a lease arriving within the delay cancels the close" back (a second `serve`
within `close_after` keeps the same host). books_commands_hold_the_books_while_they_run
points to the test of a command's own server.

Moved tests, one line each (what each still protects, read against the diff of
e9a520138):
 a_command_leaves_nothing_running_and_serve_closes_after_its_last_holder: nothing
  left by a command or a bridge, serve's delay and its cancel (restored).
 serve_and_the_bridges_share_one_host_and_one_server: one host, one server, two
  `serve`s racing, bridges and a command joining.
 the_bridge_answers_initialize_itself_during_a_slow_start, …gives_up_on_books_that_never_open,
 a_call_cancelled_at_once_is_never_made, a_signalled_bridge_goes_at_once,
 books_made_mid_session_and_bad_requests: still the bridge's waiting on a host whose
  server is slow (`serve` with `server_delay`), the same knobs.
 books_commands_hold_the_books_while_they_run: commands lease a host that serve holds.
 a_command_ends_at_its_deadline_during_a_restart: still a command ending at its
  deadline while update.lock is held (`token list`; `books list` reads the folder).
 a_bridge_started_without_stderr_keeps_its_descriptors_apart,
 the_commands_given_run_as_the_agents_own_token,
 an_agent_is_connected_and_reaches_the_books_by_what_it_was_given: unchanged bodies
  behind a `serve` that holds the books; the properties are the bridge's and the
  token's, not who started the host.
 doctor_says_whether_the_books_are_open_and_what_holds_them: asserts the new closed words.
 the_host_serve_starts_is_clean_from_a_hostile_serve: the host's scrub, from serve.
 the_viewers_new_books_are_made_by_the_server: new books through a server that runs.
update.rs (9 moved): the diff is the harness only (`keep_host`, the request key); their
 subjects (restart onto a replaced program, update.lock, staging, verifying, applying
 before a host starts) are the host's, which `serve` starts the same way; read in full
 for the_host_stages_a_daily_update_and_the_next_start_applies_it (the next start is now
 serve's), the others by the diff and a green run.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 12:30:26 -07:00
swaitsandClaude Fable 5.2 2275c34e86 fix(store,host): books list with nothing running says which books wait for a format upgrade
Plan P15 unit A5, fix round. With nothing running, `books list` reads the folder
and takes no lock (nothing is opened), so it stopped showing which companies wait
for a format upgrade, which a server showed. It now reads what each journal
declares (`ledger_store::declared_format`: no lock, nothing written, the hash
chain not verified, so it says what the books declare and no more) and adds
"; waiting for a format upgrade (`wanderbooks books upgrade ID`)"; a journal that
cannot be read says why on its line. The listing no longer fails when a company's
folder vanishes while it is made (a book put aside meanwhile): a vanished entry is
skipped, not an error (`list_books_inner` used `entry?`).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 12:19:58 -07:00
swaitsandClaude Fable 5.2 c47144a401 feat(gui): the notice for a host that holds the books has a button that closes it
Plan P15 unit A5, fix round. When an older build's detached host (or `wanderbooks
serve`) holds the books, the app's start is refused, and the notice said to run
`wanderbooks close`. A packaged Mac or Windows install may have no command line
on the path. The notice now says what will happen, and carries a "Close it"
button that asks the host to close the books and waits until it has
(`commands::close_the_host`, what `wanderbooks close` does, over the unchanged
lease protocol, which an older host speaks), then starts the app's own server
and takes the notice away. The line to type stays in the words as the fallback.
A close that fails says why and offers the button again; a start refused for any
other reason offers none. The `Owner` trait gets two methods with default bodies
(`serve_host_holds`, `serve_close_host`), so existing implementations, test mocks
included, are untouched.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 12:19:46 -07:00
swaitsandClaude Fable 5.2 6164d0fa68 fix(host): a bridge that held a host follows the app that takes its place
Plan P15 unit A5, fix round. A bridge started under a `serve` host, when that
host went and the app started in its place, took a lease on the app's server:
a lease with no host behind it, which never ends. When the app later closed,
the assistant got a generic timeout and never "Wanderbooks isn't running". A
lease with no host now turns the bridge into the line to whatever runs, as a
bridge that began without a host is (`Lease::is_hostless`, `Bridge::keep`), and
it answers in the same words when the app is closed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 12:16:24 -07:00
swaitsandClaude Fable 5.2 2ff2913274 fix(host): what holds the books is known, not guessed; a command joins what starts beside it
Plan P15 unit A5, fix round. A server answering its admin socket with no host
over it was taken to be "the app". Three wrong outcomes followed: a `serve`
started while a killed host's server was still finishing its last backup was
told "the app has these books open" and exited, `close` and `doctor` said "the
app" during such a close, and a command attached to another command's short-lived
server as if it were the app (refused "not open" for another company, or its
server closed under the other).

A server now says what it is. `wanderbooks server --started-by app|host|command`
writes run/server.info beside its lock (who started it, its pid, whether it has
begun to close), moved into place whole as soon as the lock is its, rewritten
`closing` the moment it is told to close, removed just before the lock goes. It
is read only while the lock is held, which is when it is the lock holder's. A
file beside the lock, not a field in the admin hello: it also covers a server
that has no admin socket yet (opening) and costs the older admin protocol
nothing. A server that says nothing (an earlier build's) is taken for the app's,
as before. `opener::what_holds` reads it: only a server the app started, not
closing and answering, is the app. A command's server, or one that is closing
(the app's, or the orphan of a host that went), is waited for, said in words,
bounded by `open_wait` (a bridge waits as long as its session does), and the
holder or command goes on once it is gone. `close`, `doctor` and the bridge say
the true thing for each.

A command racing another program's start no longer fails with "close it" or waits
silently 300 s: if its own server loses the lock to a program that started after
its look, it lets its start go and joins what runs (`wait_ready_unless_beaten`,
`reach`), inside one `open_wait`.

A command's own server is started clean, as a host is: the host's environment
only, the root as an absolute path, `/` as its folder (Windows: `run/`), and
every server closes the descriptors above 2 at its start, so one that outlives
its command (still closing after 90 s) holds none of the invoker's pipes. The
app's own child keeps its environment: it is the window's child, closes with the
window and needs the user's session (ssh agent, git configuration) for backups;
it too loses stray descriptors, since the server does that for any starter.

Test knobs: `--start-delay` (a server's slow start) and `timer_hold=1` for a
command's own server, following `--timer-hold`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 12:12:28 -07:00
swaitsandClaude Fable 5.2 6b95ce59ad docs: how an assistant and a command reach the books under the app (WB-app-1, 3, 5)
WB-app-1 and WB-app-3 lose the permanent run/app-hosted marker; WB-app-5 is
new: a command finds what runs, never starts a host, and with nothing running
runs a server of its own for the work or says "Start Wanderbooks first", with
the table command by command. architecture.md, deploy/README.md and
mcp-interface.md say the app is the host and only serve keeps a detached one.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 11:34:19 -07:00
swaitsandClaude Fable 5.2 e9a520138d test(cli): the detached-host tests follow the new shape: only serve starts a host
Plan P15 unit A5. Nothing but `wanderbooks serve` starts a host, so the tests
that had a bridge or a command start one now have `serve` hold the books (a
`serve` the harness keeps: Home::keep_host), or run a server of their own
(the commands), or are retired. Every test of the three files plan section 6
names, and what became of it:

open_while_held.rs (44 tests)
 KEPT, still true for serve (28): closing_the_books_ends_every_lease_and_the_bridge_stays_closed,
  closing_during_a_burst_of_posts_through_the_bridge_loses_nothing,
  a_killed_host_is_replaced_by_its_holders,
  holders_back_off_and_give_up_on_a_host_that_keeps_failing,
  the_lease_socket_takes_only_the_owners_intents, a_restart_is_not_a_close,
  another_apps_appimage_is_never_run_as_the_host,
  the_host_outlives_the_app_scope_that_started_it,
  the_bridge_serves_a_client_without_initialize,
  the_bridge_recovers_when_the_server_dies_under_it,
  a_message_too_large_is_refused_and_the_session_goes_on,
  malformed_and_boundary_input_never_ends_the_session,
  the_host_starts_without_a_scope_when_systemd_run_fails,
  a_scrubbed_app_scope_doesnt_take_the_host_with_it,
  doctor_doesnt_hang_on_a_frozen_host, doctor_doesnt_hang_on_a_frozen_server,
  serve_hears_ctrl_c_while_it_waits_to_try_again,
  every_malformed_message_is_answered, books_that_didnt_open_refuse_plainly,
  close_and_list_dont_hang_on_frozen_processes,
  the_books_command_takes_its_flags_and_asks_before_adopting,
  adopted_books_old_copies_are_put_aside_from_the_command_line,
  the_token_commands_and_the_bridge (the bridges there are held by serve
  through Agent::start), an_agent_sends_and_saves_files_with_the_commands_it_is_given,
  a_backup_is_restored_from_the_command_line,
  books_are_backed_up_now_from_the_command_line,
  connect_makes_anew_a_token_whose_file_is_gone_and_says_when_an_agent_refuses,
  token_check_says_where_the_token_file_stands_and_an_unreadable_one_is_said
  (these commands now run a server of their own with nothing running).
 MOVED, rewritten for the new shape (15):
  a_command_opens_the_books_and_they_close_after_the_last_holder ->
   a_command_leaves_nothing_running_and_serve_closes_after_its_last_holder;
  openers_share_one_host_and_one_server ->
   serve_and_the_bridges_share_one_host_and_one_server (two serves at once
   are the race now);
  the_bridge_opens_closed_books_and_holds_them_for_the_session ->
   the_bridge_reaches_the_books_serve_holds_and_holds_them_for_the_session;
  the_host_starts_clean_from_a_hostile_bridge ->
   the_host_serve_starts_is_clean_from_a_hostile_serve;
  the_bridge_answers_initialize_itself_during_a_slow_start,
  the_bridge_gives_up_on_books_that_never_open, a_call_cancelled_at_once_is_never_made,
  a_signalled_bridge_goes_at_once, books_made_mid_session_and_bad_requests
   (a slow `serve` holds the host; the bridge starts after it holds the root);
  books_commands_hold_the_books_while_they_run (serve holds, the commands lease);
  a_command_ends_at_its_deadline_during_a_restart (`token list`: `books list`
   with nothing running reads the folder and waits for nothing);
  a_bridge_started_without_stderr_keeps_its_descriptors_apart,
  the_commands_given_run_as_the_agents_own_token,
  an_agent_is_connected_and_reaches_the_books_by_what_it_was_given
   (Home::keep_host);
  doctor_says_whether_the_books_are_open_and_what_holds_them (new closed words).
 RETIRED (1): the_viewers_hold_new_books_and_close_the_books. Its viewer
  lease (hold_for_viewer) and "Close the books" (close_books) no longer
  exist: the app is the host. Covered by ledger-gui serving.rs
  (a_tab_opening_asks_the_server_to_open_that_company, a_tab_closing_asks_the_server_to_close_that_company,
  closing_the_window_stops_the_server_and_waits_for_it), owner_menu.rs (no
  "Close the books" item), and the replacement
  the_viewers_new_books_are_made_by_the_server (new_books through a server).
 Behaviours retired inside the moved tests, and what covers them: a command
  or a bridge starting a host and holding it for the close delay does not
  exist (app_server.rs: a_command_with_the_app_running_goes_to_its_server_and_leaves_it_running,
  with_nothing_running_a_command_runs_its_own_server_or_says_to_start_wanderbooks,
  the_bridge_says_the_app_isnt_running_then_works_once_it_is,
  a_command_leaves_nothing_running_and_serve_closes_after_its_last_holder);
  the close delay itself is kept for serve's host (same test).

update.rs (16 tests)
 KEPT (6): an_update_replaces_the_program_keeps_the_old_one_and_rollback_brings_it_back,
  update_is_atomic, failed_update_rolls_back, unsigned_update_refused,
  package_managed_install_refuses_update, rollback_refuses_after_a_book_consented_to_a_newer_format,
  an_update_never_replaces_another_apps_appimage (the `update` command and
  the AppImage guard: no host involved).
 MOVED (9): bridge_survives_update, update_waits_for_a_running_call,
  a_replaced_appimage_restarts_the_books, the_host_stages_a_daily_update_and_the_next_start_applies_it,
  a_daily_update_that_is_not_ours_is_not_staged,
  update_installs_the_copy_the_host_staged_without_downloading_again,
  a_staged_update_that_was_tampered_with_is_dropped_not_applied,
  books_start_says_an_update_waits, the_owner_accepts_a_staged_update_in_the_app:
  the host they describe is serve's (restart onto a replaced file,
  update.lock, the daily look, the staged copy applied before a host
  starts), so the harness's Agent::start has a `serve` hold the books
  (Home::keep_host); the bridge's tool calls carry the request_key every
  write needs since D-88. RETIRED (0).

translocation.rs (1 test)
 KEPT: translocated_app_refuses_to_connect. The refusal stays: an agent's
 pointer file records this program's path, which a quarantined download
 loses when the app closes, whatever starts the books.

app_server.rs: no test retired. Changed: the_bridge_says_the_app_isnt_running_then_works_once_it_is
(no marker; the words now name `wanderbooks serve`), a refusal touches
nothing (the retired marker). New: a_mark_an_earlier_build_left_is_ignored_and_removed,
a_terminal_ctrl_c_reaches_the_window_and_never_the_server (fails without the
server's own process group: checked by removing it),
a_command_with_the_app_running_goes_to_its_server_and_leaves_it_running,
with_nothing_running_a_command_runs_its_own_server_or_says_to_start_wanderbooks,
a_command_waits_in_words_for_a_server_that_is_still_opening.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 11:34:19 -07:00
swaitsandClaude Fable 5.2 d81f6d5c83 feat(host): a command that names a company opens it in its own server; a bridge says a server is still opening
A command with nothing running opens in its own server the one company it
names (token create, check, revoke, back-up, upgrade, extract), so the owner
is still told of a format upgrade that company waits for and the work that
needs the company open can run. A bridge facing a server that holds the books
but has no socket yet (the app opening large companies, or finishing a last
backup) says it is still opening, not that Wanderbooks isn't running. The
lib and commands spec blocks follow (WB-app-5).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 11:29:34 -07:00
swaitsandClaude Fable 5.2 22f447c0ba feat(host): nothing starts a detached host but wanderbooks serve
Plan P15 3.1: the desktop app is the host. The bridge and every command that
needs the books now find what runs (a host held by serve, the app's server,
or nothing) and never start a host. The permanent run/app-hosted marker is
gone: a root is the app's only while a server runs on it with no host.

- opener: no host and no server is HoldError::NotRunning for every holder
  but serve; a server holding run/server.lock with no admin socket yet is
  waited for, in words (an opening or finishing server); the admin socket
  answering is the leaseless hold on the app's server, marker or none.
- commands: with nothing running, a command that manages the books' files
  or reads (list, create, adopt, restore, back-up, upgrade, token, connect)
  runs a server of its own, the one the app starts, for the length of the
  work and closes it, taking the same server.lock and books.lock; a command
  that needs an open company held by Wanderbooks (books open/close, upload,
  download) says "Start Wanderbooks first". The format upgrade goes to the
  server as an admin request when no host is there. doctor and close say
  what runs. hold_for_viewer and close_books are removed.
- bridge: the line to the app is the default with no host; a bridge whose
  host went away becomes it. The words an assistant gets name both ways to
  start the books (the app, or wanderbooks serve).
- app server: the child is its own process group on Unix (a terminal Ctrl+C
  reaches the window alone) and breaks away from a launcher's job on
  Windows (a kill-on-close job no longer kills it mid-backup); a stale
  marker from an earlier build is removed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 11:03:23 -07:00
swaitsandClaude Fable 5.2 8d2187bae7 refactor(gui): remove "Close the books": the app is the host and a company's tab closes the company
The menu item asked a host's lease socket, which the app does not have, and
under the app could only answer "the app has these books open". Closing a
company's tab closes that company in the app's server (WB-app-2) and closing
the window closes them all (WB-app-4), so the item had no job left. The
Owner trait loses close_books; the test owners lose their copies.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 11:03:23 -07:00
swaitsandClaude Fable 5.2 eafd269ba0 docs(delegation-log): T1
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 10:45:02 -07:00
swaitsandClaude Fable 5.2 38647e2143 Merge branch 't3/transactional-mcp-writes': every write through the tools is one transaction, exactly once (P15 T1, D-88, D-89)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 10:40:34 -07:00
swaitsandClaude Fable 5.2 b592aaf416 docs,test: claims WB-format-8 to 10, the interface, the handbook and the tests follow the review
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>
2026-11-21 10:40:00 -07:00
swaitsandClaude Fable 5.2 4c23fade7a test(store): the call frames and an old-books fixture written before call transactions (P15 T1, 8.0.6 items 1 and 2)
books_written_under_older_rules_still_open gains hand-written call frames
through JournalWriter (an ok call, a failed call whose party id is handed
out again, a call that never finished, a call with an answer too long to
keep): only the lines of calls that closed ok are the books'.

old-books/p15_t1_before was written by main 7058fbd2, the version before
this unit (no frames, no request keys), through the old-books-writer
pattern, with that version's expected.json: this version opens it, every
line counts, the figures are the same, it takes no call until the owner's
upgrade and keeps every figure after it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 10:23:47 -07:00
swaitsandClaude Fable 5.2 92af0bf6be docs(delegation-log): A4 and the T1 review
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 10:23:35 -07:00
swaitsandClaude Fable 5.2 c3efb6b301 Merge branch 't3/p15-a4-connect-page': connection states, Ask your assistant, the Connect page (P15 A4)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 10:23:35 -07:00
swaitsandClaude Fable 5.2 fd847701e8 fix(host,gui): the Connect page's keys: never replaced, no admin, revoked by id, a quoted command, a leftover file said
Make the key asks the server first and never replaces: a live key whose copy
is missing here may be in use, so it is said in words and left alone. A
page-made key carries read, write and post, not admin (the connect command
keeps its scopes). Revoke names the key's id, so a stale row cannot end a
newer key of the same name; a revoke that leaves the token file says the key
is dead and where the file is. The copyable command is single-quoted for a
POSIX shell and PowerShell, and refused when cmd.exe would act on a part.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 10:23:11 -07:00
swaitsandClaude Fable 5.2 98cbabde8e fix(mcp,vault,store): the tax-id vault is inside the transaction; a read never sees an open call; the commit outcome is told truthfully (P15 T1 review)
The vault wrote a tax id before its journal line, so a call that failed or
was cut left the new tax id (and lost the old) with no line to say so. A
vault write made for a call is now staged under a name no reader opens
(.staged-TAG, .purging-TAG) and is made final, or dropped, only when the
call closes: a purge is set aside and put back if the call fails. A crash
between the closing line and the settle is finished at the next start by
what the journal says of the call. The readers that check a vault record
against the party's committed vault_record hash (the 1099 and CPA package
paths) therefore only ever see committed records; the filing scan reads
every final record on purpose (more tax ids scanned is safer).

close_call(Done) told the caller none of a call counted when its closing
line was on disk and only SQLite failed. It counted: the store now heals
from the journal where it can, and otherwise says the call counts, stops
taking writes and rebuilds at the next open.

A call whose begin line the projection refused left its frame open, so the
next call began inside it (a corrupt journal): the frame is now closed
failed.

A read arriving between a call's return and its closing line waits for the
close (a call that has written no line leaves reads free), so no read shows
what a call did before it committed.

Tests added through the tools: a call that writes lines and fails, a repeat
arriving while its original runs, the same key under two tokens, a crash
with the ok close on disk and SQLite behind, the vault under a failed and a
crashed call, a key reused for another tax id. The helpers that drop frame
lines no longer back the checks that a refusal or a preview wrote nothing.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 10:19:26 -07:00
swaitsandClaude Fable 5.2 e34b18ec73 feat(gui): one Another assistant card, a popover for Ask your assistant, one Books menu entry
The four untested tools shared one text four times: now one card. The
copied sentence no longer pushes the page down: a popover under the
button. The Books menu's two connect entries became one that opens the
Connect page. Link::Working has no glyph (it is a drawn arc). Shape
baselines re-blessed: assist_{working,none,connected,connect_page,ask}
in light and dark.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 10:16:26 -07:00
swaitsandClaude Fable 5.2 f58191c9de fix(gui): the word a person reads is assistant, with no tool names
The bottom panel, the welcome steps, empty states and notices said
agent, bookkeeper or a books.* tool name; they now say assistant.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 10:16:26 -07:00
swaitsandClaude Fable 5.2 f218bf4552 test(cli): the roster and a key's revoke, through the real books server
A bridge session opened with a key is on the roster; revoking the key
takes the key and its session off, refuses the session's next call and
deletes the token file's copy.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 10:16:26 -07:00
swaitsandClaude Fable 5.2 d4c0036599 fix(store,gui,package): every reader that derives facts reads the committed journal (P15 T1 review)
A failed call's ids are handed out again (nothing it wrote counted), so a
reader of the raw journal pins dead lines on whatever takes the id next: a
failed books.create_bill for entry 42 then a manual entry 42 showed as a
Bill. One accessor, calls::committed (lines outside a call and of calls
that closed ok, the frame left out), now feeds the viewer's books (entry
events and origin, asset trails, party events), the package feed attention
reads, and the adopt preview's settings check. The journal page and
journal_history keep every line and say in words of each line of a call
that failed, never finished or is still running that it did not count.

A call's closing line is now bounded (ANSWER_CAP 4 KiB: above it, the
answer's SHA-256 and length), a call that wrote no line leaves no line (its
key and answer live in a bounded in-memory table), and the journaled
argument digest is an HMAC under the books' own call key, so two requests
that differ only in a tax id are two requests and nothing journaled lets a
guess of one be tested.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 10:09:17 -07:00
swaitsandClaude Fable 5.2 022c0c642f feat(gui): each company's assistants: three states, Ask your assistant, the Connect page, a warning before closing
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>
2026-11-21 10:03:35 -07:00
swaitsandClaude Fable 5.2 1d1a2a5a88 feat(host,gui): the command that reaches a company's books is made in one place
The Connect page of P15 unit A4 shows an assistant the exact command it
must run to reach a company (`<this program> mcp --book ID`, with --root
when a root was named). `connect` already built that command, so it is
now one function (`bridge_serve_args`/`command_line`) used by both, and
the step `connect` does first (the company's default key exists and its
copy is in the token file) is `ensure_key`, which the page offers by
itself for assistants it has no button for.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 10:03:35 -07:00
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 e542319e63 feat(mcp): every write call is one transaction with a request key (P15 T1, D-88, D-89)
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>
2026-11-21 09:43:52 -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 016f1b2afc feat(host,gui): the window can ask the books server who is connected, and end a token
Unit A4 of plan P15 needs the window to read who is connected to each
open company and to end a token. Both go through admin requests the
server already answers (Sessions, TokenList, TokenRevoke): the window's
server handle gains a quick roster (an Err in words while the server is
starting, gone or slow; never a wait) and a revoke that does what
`wanderbooks token revoke` does, including removing the token file's
copy. The command that reaches a company's books is now made in one
place (`bridge_serve_args`) for `connect` and for the Connect page.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 09:28:50 -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 2633109d55 feat(store): a tool call is one journal transaction (P15 T1, D-88)
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>
2026-11-21 09:16:03 -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