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>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-21 12:19:58 -07:00
1 parent c47144a401
commit 2275c34e86
5 files changed
+115 -10

No files matched your search

+22
View File
@@ -1039,3 +1039,25 @@ fn shell_join(words: &[String]) -> String {
.collect::<Vec<_>>()
.join(" ")
}
/// With nothing running, `books list` reads the folder and says which
/// companies wait for a format upgrade, from what their journals declare
/// (no lock, nothing written): it used to say so only through a server.
#[test]
fn a_list_with_nothing_running_says_which_books_wait_for_an_upgrade() {
let home = Home::new("list-upgrade");
let dir = old_books(&home, "acme");
let before = journal(&dir);
let out = home.books(&["list"]);
let said = String::from_utf8_lossy(&out.stdout).into_owned();
assert!(out.status.success(), "{out:?}");
assert!(
said.contains("acme not open: Wanderbooks isn't running")
&& said.contains("waiting for a format upgrade (`wanderbooks books upgrade acme`)"),
"{said}"
);
// Reading it changed nothing and left nothing running.
assert_eq!(journal(&dir), before);
assert!(!ledger_host::opener::server_lock_held(&home.run_dir()));
assert!(!ledger_host::opener::host_lock_held(&home.run_dir()));
}