Commit Graph
1135 Commits
Author SHA1 Message Date
swaitsandClaude Fable 5.2 1a07eba93d docs(delegation-log): the Mac and Windows fix
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 14:37:27 -07:00
swaitsandClaude Fable 5.2 fd779a6f1a Merge branch 't3/fix-windows-close-macos-lock-tests': git's output is read when git has ended; the lock test removes every lock named
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 14:37:03 -07:00
swaitsandClaude Fable 5.2 91a654101d test(cli): the owner removes every lock the words name, the HEAD lock too
A push to a bare folder repository locks HEAD as well as the branch when it
moves the branch HEAD names. Both locks are left when git is killed, and the
server names both. A newer git (Linux) goes on past a stale HEAD.lock, an older
one (macOS) refuses the push with "cannot lock ref 'HEAD'"; the test removed
only main.lock, so the last backup failed on macOS. The test now removes each
lock the report names (and asserts each is named), as the words tell the owner;
the program already reported both.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 12:44:36 -07:00
swaitsandClaude Fable 5.2 c30e381678 test(cli): the open/close hammer says what every git command did when a close is slow or refused
The server is told to write WANDERBOOKS_GIT_TIMINGS; when a close is not
`Closed` or takes over 10 s the test prints the slowest ten commands and the
last hundred (when, command, exit, how many ran at once, spawn, ran, pipes,
and how each pipe ended), so the next Windows run shows where the time went.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 12:44:36 -07:00
swaitsandClaude Fable 5.2 17624bfd40 fix(store): a git's output is taken when git has ended and the pipes hold nothing, not after a fixed wait on a pipe that has no end
run_with waited up to 10 s for each of stdout and stderr to reach end-of-file
after git exited. On Windows a pipe has no end while any process holds a copy
of its write end: std makes the child's end of each pipe inheritable when it
makes the pipe and starts every child with all inheritable handles, so a
process started at the same moment (a `taskkill` that stops another git while
a close's own last backup begins) keeps the pipe open until it ends. Each
command then cost up to 20 s, and the close's last backup passed its 60 s
bound (the open/close hammer on Windows: 106 s).

The reader now takes what git wrote as soon as git has ended and the pipe
holds nothing (PeekNamedPipe on Windows, poll(2) on Unix, the reader seen
blocked in its read for 100 ms), and never loses a byte already in the pipe;
the 10 s wait stays only as the last resort. `taskkill` goes through
lock::spawn, and on Windows spawns are exclusive, so no child takes a copy of
another's pipe ends. WANDERBOOKS_GIT_TIMINGS=<file> appends one line per git
command (ran, spawn, pipes, how each pipe ended) for runs nobody can watch.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 12:44:36 -07:00
swaitsandClaude Fable 5.2 a9fec9ee27 fix(spec): WB-app-5 names a file and a test in words the claims check accepts
run/server.info is made at run time, so it is not a path in the tree;
the test is named by its file and what it shows.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 12:37:20 -07:00
swaitsandClaude Fable 5.2 610e41d1d1 Merge branch 't3/wanderbooks-app-hosted-bridge': nothing on the desktop starts a detached host (P15 A5)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 12:32:59 -07:00
swaitsandClaude Fable 5.2 8a6d731c32 docs(delegation-log): refusals write nothing
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 12:31:55 -07:00
swaitsandClaude Fable 5.2 bf977b1bc7 Merge branch 't3/mcp-refusals-write-nothing': a refused call writes nothing; four tools checked before writing
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 12:30:50 -07:00
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 3f2ab70219 test(cli): a broad guard that a refusal writes nothing
Every test's books, when dropped, hold no failed call unless the test
injected the fault on purpose (common::expect_failed_calls): a tool that
writes a line and then refuses now fails every test that makes it refuse.
hostile_args gains a guard that drives refused calls over every tool, and
the same arguments with a made-up full tax id in each string in turn, and
asserts the journal is byte for byte what it was after each refusal, with
no trace of the tax id.

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 a0fee420cd test(cli): the tax-policy journey counts the call's frame lines
An account made through books.add_account with its tax category is the
begun line, account.added, account.tax_set and the closing line: four
lines, not two (WB-format-8).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 12:30:25 -07:00
swaitsandClaude Fable 5.2 38612ab553 fix(mcp,store,core): four refusals are decided before the call's first line (P15 T1, D-88)
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>
2026-11-21 12:30:25 -07:00
swaitsandClaude Fable 5.2 bb83bed92a docs(delegation-log): B1 and A5's review
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 12:22:38 -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 5a98e417a1 Merge branch 't3/remote-mcp-oauth-signin': the remote door and sign-in for web assistants (P15 B1, D-83, D-86, D-90)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 12:16:48 -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 afad9d1e14 docs: D-90 in the remote door's claims, interface and plan section 4 (P15 B1)
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>
2026-11-21 12:16:15 -07:00
swaitsandClaude Fable 5.2 32acdc1c44 fix(mcp): the remote door's limits, disk cost, names and front line after review (P15 B1)
Per-address limits count an IPv4 address or an IPv6 /64 (mapped addresses
as the IPv4 one) and the table evicts per-address entries only, never a
connection's own call limit; waiting requests give way to a new one (an
address's oldest, or the fullest address's) instead of filling the window;
a stale client document is used when the fetch budget is spent and nothing
is fetched from /token. Registrations nobody allowed live in memory only,
a redirect is at most 512 bytes and a client's together 4 KiB. An error of
a sign-in for a client nobody approved is a page, never a redirect.
Names lose invisible and direction-changing characters and are cut to
forty; a revoked key frees its place; calls refused for rate or another
company's books are counted, not written, the limit asked first. The
client document fetch refuses ::/96 and 2002::/16, uses no proxy; the host
is read from the request's authority under HTTP/2; remote.json is private
on Windows too; every connection must begin with a per-start secret before
the PROXY header, given to the app over the admin socket.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 12:16:15 -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 c4fd1580d8 fix(mcp): every web sign-in is asked in the window, with a matching code (P15 B1 review, D-90)
An approval is never reused for a new sign-in: the product's redirect host
is public, so a stranger registering a client with claude.ai's callback got
a code with no Allow. /authorize now always parks the request. Every Allow
is a new approval with exactly the permissions ticked, a revoke ends the
approval's tokens at once under the lock, and raising or lowering posting
swaps the token in one step (a revoke during it wins). The window shows a
short code the browser's page also shows, says what is known in neutral
words (where it is sent back to first), counts the requests beyond the
newest few, and no request is presented as a known product on the strength
of its host. Refresh checks and marks the token used in one hold of the
lock, so two refreshes at once cannot both succeed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 12:05:09 -07:00
swaitsandClaude Fable 5.2 a9b85da712 docs(plan): D-90, every new sign-in is asked in the window
The owner's decision, 2026-11-21: an approval is not reused for a new
sign-in, because the app knows the product and not the account.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 11:49:31 -07:00
swaitsandClaude Fable 5.2 bc55a10101 test(cli): the TIN-file refusals compare the raw journal on both sides
The journal taken before the refusals was raw (frame lines in) and the one
taken after still dropped frame lines, so the two could never match after
T1. Both are raw now, with no filter for closing lines: a refused call
leaves no begun line, no line, and no closing line with an error text.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 11:42:22 -07:00
swaitsandClaude Fable 5.2 1ad6d9e41c test(cli): the rename journey counts a verify that wrote nothing as no frame
A verify that finds nothing to heal writes no journal line, so it has no
call frame (WB-format-8). The rename journey counted a closing line for it
and so expected one line more than the journal holds. The refusals now
compare the raw journal byte for byte, and the counts are what the journal
holds.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 11:42:02 -07:00
swaitsandClaude Fable 5.2 0a91656f14 docs: claims WB-remote-1 to 10 and WB-assist-5, the remote door in the interface, parity
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 11:39:39 -07:00
swaitsandClaude Fable 5.2 c9b6614688 feat(gui): the person is asked when a web assistant wants to connect (P15 B1, D-83)
The window shows a card, over any page of the company and on the Connect page,
that says in plain words who is asking (the product by where it is sent back
to, never by what it calls itself), where it will be sent back to, the
internet address it asked from and what it will be able to do: read and draft,
and post only if the box is ticked. Allow and Don't allow answer through the
owner and the admin socket (ledger-host AppServer::web_decide); nothing on the
web page approves. Each web connection shows what it may do, with a button to
let it post or stop. Revoke stays the one row of 'Who can reach these books'.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 11:39:38 -07:00
swaitsandClaude Fable 5.2 4c36c1f020 test(mcp): a key for a product that takes only a key, and a Host with the default port
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 11:39:38 -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 e00e52f2f3 feat(mcp): the remote door and the sign-in behind it (P15 B1, D-83, D-86)
A second HTTP listener in the books server, on 127.0.0.1 only, off until the
app's admin request (RemoteStart) names the one public address. Every
connection begins with the relay's PROXY v2 header, whose address is the
caller's (never an HTTP header); the door speaks stateless plain-JSON MCP for
one company per path, and is its own OAuth 2.1 server: metadata at every
place products look, client ID metadata documents, dynamic registration and
a typed client id and secret, PKCE S256, exact redirects, single-use short
codes, rotated refresh tokens (a reused one ends its family), short access
tokens, the issuer pinned. /authorize never approves: it parks the request
and only the owner-only admin socket turns it into a code. An approval is one
principals token (so A4's list and revoke see it) plus a record naming the
product, which survives the product registering again. Read and draft by
default; posting raised per approval. Every table is bounded and expires;
secrets are kept as SHA-256 only. A stranger's unsigned request is a 401 with
the metadata pointer and is counted, never written to the books' record.

The access record gains an optional 'from' (the caller's address), kept as an
IP when it is one (the TIN masking would turn it to dots).

The tools a model reaches for first now carry the company's name and 'call
books.start first' in their own descriptions (plan 3.4), local and remote.

Dependencies: none new to the tree. reqwest (client documents, as ledger-host
already uses it), subtle, getrandom and hyper-util (already pulled in by
ledger-store and axum) are now declared by ledger-mcp; cargo deny and the
notices check pass unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 11:15:26 -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 af77939f62 docs(delegation-log): law 47 and the pin
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 11:00:12 -07:00
swaitsandClaude Fable 5.2 97e658717e Merge branch 't3/bookspec-pin-law-47-writes': bookspec pinned at law 47
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 11:00:12 -07:00
swaitsandClaude Fable 5.2 d66cc98ee5 docs(verification): law 47, a write is one transaction, exactly once (P15 T1, D-88)
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>
2026-11-21 10:59:55 -07:00
swaitsandClaude Fable 5.2 2d3250709b build: pin bookspec at 5127b5b, law 47 (a write is one transaction, exactly once)
Moves the checker, the runner and the Lean package together from 79cb439 so the pin test holds.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-21 10:55:18 -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