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

+6 -2
View File
@@ -809,14 +809,18 @@ impl Root {
let (books, _) = self.private_subdir(BOOKS_DIR, false)?;
let mut ids = Vec::new();
for entry in std::fs::read_dir(books)? {
let entry = entry?;
// A folder that vanishes while the list is made (a book put
// aside or removed meanwhile) is not one of the books.
let Ok(entry) = entry else { continue };
let Some(name) = entry.file_name().to_str().map(str::to_string) else {
continue;
};
let Ok(id) = BookId::parse(&name) else {
continue;
};
if entry.file_type()?.is_dir() && entry.path().join(JOURNAL_FILE).is_file() {
if entry.file_type().is_ok_and(|t| t.is_dir())
&& entry.path().join(JOURNAL_FILE).is_file()
{
ids.push(id);
}
}