535f4fed40bb5f3cb598c0ec41bc7aeab415545a
8
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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> |
||
|
|
3bc198594b |
fix(host): APPIMAGE is believed only when this program runs from that image
The AppImage launcher sets APPIMAGE (the image's file) and APPDIR (where
it is mounted) for the program it starts, and every program that one
starts inherits both: a terminal, an editor, an agent's app. The host's
start, the agent's pointer file, the host's check for a replaced program
and `update` each read APPIMAGE and believed it whenever it named a file.
So a wanderbooks run from inside another app's AppImage took that app's
image for its own:
- it started that image as the host, and the books never opened ("the
books server keeps failing to start");
- `connect` would have written that image into the agent's pointer file;
- `wanderbooks update` replaced that app's file with wanderbooks.
Found by the batch's gate: the_host_outlives_the_app_scope_that_started_it
passes its own environment on (the other tests clear it), and this gate
ran in a session started from an AppImage app. The first and the third
are reproduced by two new tests, which fail without this change (the
update test read an ELF header where the other app's file had been).
The rule now (start.rs INVARIANT 6, from the AppImage documentation's
"Environment variables"): the image is this program's own only when
APPIMAGE is an absolute file, APPDIR an absolute folder, and the running
executable's file is inside APPDIR, compared as resolved paths. One
function decides (`own_appimage`), and all four readers ask it. The host
is handed APPDIR beside APPIMAGE, and neither unless both are its own.
No books and no figure are touched. The tests that pretend to be an
AppImage now set APPDIR as a launcher does; translocation.rs used a bare
APPIMAGE to stand in for a macOS path, the very thing this closes, and
names the program's folder as the mount.
The failing test's message now lists the lines that did arrive, which is
what showed the host was refused rather than slow.
Not checked against a built AppImage (none has been built with this
change): the first trial of one shows `update` and a restart find the
image.
Co-Authored-By: Claude <noreply@anthropic.com>
|
||
|
|
53a233d687 |
feat: accept a staged update in the app
The host has staged a downloaded, signature-checked update since step 4, but the only way to apply it was `wanderbooks update` at a terminal, and nothing in the viewer or on an agent's first call said one waited. The owner's accept is the name plan 8.0.3 allocated for it: the lease socket gains `Intent::ApplyUpdate`, and the host installs the staged copy from a thread and lets its existing watch for a replaced program (host.rs INVARIANT 7) restart onto it once no call runs, so the books stay open and every holder's session carries on. With no host running there is no call to cut off, so the viewer applies it itself. The viewer reads `<root>/updates/staged/meta.json` every few seconds and shows a standing notice with "Update now"; Books gains "Check for updates" (which looks at the feed at once, whatever the daily look last did) and "Update to X". `books.start` gains the allocated `update_waiting` field and a next step telling the agent to tell the human; no tool can accept. `apply_staged` waits up to five seconds for the update lock: running the new tests showed the host's own look can hold it for a moment after it writes `meta.json`, and the owner's accept should wait that out rather than answer "nothing waits". Tests: `books_start_says_an_update_waits` and `the_owner_accepts_a_staged_update_in_the_app` in `crates/ledger-cli/tests/update.rs` (a bridge writes all through the restart, each account in the chart exactly once); `the_menu_checks_for_updates_and_a_waiting_update_shows_a_notice_that_accepts` and `books_outside_a_data_root_have_no_update_notice` in `crates/ledger-gui/tests/update_notice.rs`. |
||
|
|
ccc5d21941 |
test(cli): the staged-update test no longer asserts the staged folder is gone
The gate on
|
||
|
|
888742166b |
test(cli): the update tests wait for the host's asynchronous work, and compare programs by hash
Two tests raced the host: one asserted the staged copy was applied the instant the books reopened, the other that a dropped tampered copy's folder was gone, when the new host may look at the feed again and stage a fresh, true copy in its place. Both wait for what they mean now (the apply; the tampered bytes gone). Every whole-program comparison is on the sha256, so a failure's message is a line, not two binaries (GitHub kept nine lines of a step's log on one such message). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp |
||
|
|
6e7deb15c7 |
feat(host): the daily update check and the staged update (P11a step 4)
While the books are open the host looks at the release feed at most once a day (knob update_check, noted in updates/checked so a restart does not look again), and only downloads and verifies a newer release into <root>/updates/staged/ (sha256 AND minisign signature, as for update). It never swaps: the staged program is applied (a) by an opener just before it starts a host, when no host runs, so no call is cut off, after a second check against the key (a staged file that fails or does not start is dropped), and (b) by wanderbooks update, the owner's say-so, which reuses the staged copy instead of downloading again. A local release can be named in <root>/updates/feed (file:// only, with its key file, same rule as --trusted-key). The program's version is set by main since packages rewrite only the cli's. No new dependency. Tests (crates/ledger-cli/tests/update.rs): 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. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp |
||
|
|
562b893c64 |
feat(host): an AppImage's host learns its image and restarts onto a replaced one (P11a step 3 gap)
An AppImage runs the program from a mount that goes away with the image it came from, so a host held open past an update kept running the old mount and never noticed the replaced image. The host now reads APPIMAGE (added to its environment allow-list only when it names an absolute file; it is a path the host reads about itself and never tells an agent, so I-2 holds), runs and restarts from that file, and tells a replaced program by its file's inode, size and last write. Test: a_replaced_appimage_restarts_the_books (the programs run from one file while APPIMAGE names another, as in a mount). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp |
||
|
|
23f9e9395b |
feat(cli): wanderbooks update and rollback (P11a step 2)
`wanderbooks update` reads a release manifest (default: GitHub Releases' fixed address, D-26), refuses anything not higher than this version, downloads the platform's file and accepts it only if its sha256 matches the manifest AND its minisign signature verifies against the release key compiled into the program (WANDERBOOKS_RELEASE_PUBKEY at build time; a build without one updates from nothing but a file:// feed whose key the owner names with --trusted-key, so a local release can be tried). The verified file is staged under <root>/updates/<version>/, the running version is kept under updates/previous/ with the journal format it understood, and the program file is replaced by a rename of a complete copy made beside it (a reader sees the old file or the new, never a part). The new program must answer --help; if not, the old one is put back. Nothing tells the books to stop: the host already notices a replaced executable and restarts onto it, finishing calls in progress (host.rs INVARIANT 7). `wanderbooks rollback` swaps the kept version back, and refuses while any book declares a journal format or feature the kept version does not know (plan 3.9: after the owner consents to a newer format the only way back is the pre-upgrade restore). A package-managed install (a package ships share/wanderbooks/install-method beside bin/) refuses both and says to use the package manager. An AppImage replaces the file named by $APPIMAGE. Tests (crates/ledger-cli/tests/update.rs): update_is_atomic, failed_update_rolls_back, unsigned_update_refused (another key, other bytes, a sha that differs, no signature, not a signature), bridge_survives_update, update_waits_for_a_running_call, package_managed_install_refuses_update, the kept-version and format-gate tests; unit tests in ledger-host/src/update.rs. Dependencies: minisign-verify 0.3 in ledger-host (what cargo-packager's updater uses to check release files; no dependencies of its own) and minisign 0.10 as a ledger-cli dev-dependency (the tests sign with a key they make). sha2 and the two minisign crates are built optimized in debug and test builds: the tests hash a debug build's program. The release profile strips symbols, for the packages (P11a step 3). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp |