feat: the window and the server say each new state in words; a proof cut short is made again; the proof does not mistake the books' own recovery for a changed head

- books ahead of the folder (as after a restore from an older backup) offer a
  new backup set beside the old one, at the person's request: books.back_up_now
  new_set, back-up --new-set, a button in the Backups window
- a key file lost from a sealed destination stops backups and asks for the
  passphrase; plain is written only after an explicit removal, which the record
  keeps (a damaged record falls back to what the folder itself holds)
- a restore that is not of the newest backup says so first, in the warning
  colour, with both dates and how many backups it passes over
- a folder a sync service keeps (or may) is said in plain words at set-up and
  in the window: one computer only, kept offline, a second computer its own
- a drill that finds only an older whole backup fails in words
- a manifest whose proof was cut short is marked unproven and proven by the
  next backup, even one with nothing new; a saved backup file is proven whole
  before it is given its name
- the proof compares the journal its pieces make with the head the manifest
  records before the books open, and lets opening add only after it
- the restore tests are split from backups.rs to keep each under a minute; the
  clone-of-an-old-git-backup test builds the working tree without git

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-21 20:07:38 -07:00
1 parent 9ac47a3f10
commit 344b3b4abe
21 files changed
+2346 -690

No files matched your search

+22 -7
View File
@@ -317,21 +317,36 @@ pub const OLD_ARCHIVE: &str = "An older backup folder from an earlier version is
/// push that was made sealed or plain), with the key's fingerprint, which
/// opens nothing.
fn sealed_before(records: &[Map<String, Value>]) -> Option<(bool, Option<String>)> {
records.iter().rev().find_map(|r| {
let says = |r: &Map<String, Value>| -> Option<bool> {
if is(r, "setup") {
match r.get("passphrase").and_then(Value::as_str) {
Some("set") => Some((true, text(r, "fp"))),
Some("removed") => Some((false, None)),
Some("set") => Some(true),
Some("removed") => Some(false),
_ => None,
}
} else if is(r, "push") {
r.get("sealed")
.and_then(Value::as_bool)
.map(|sealed| (sealed, text(r, "fp")))
r.get("sealed").and_then(Value::as_bool)
} else {
None
}
})
};
let (at, sealed) = records
.iter()
.enumerate()
.rev()
.find_map(|(i, r)| says(r).map(|s| (i, s)))?;
// The fingerprint of the key the backups were sealed with: the newest
// record that was made with one (a push that couldn't be made says
// none).
let fp = sealed
.then(|| {
records[..=at]
.iter()
.rev()
.find_map(|r| says(r).filter(|s| *s).and_then(|_| text(r, "fp")))
})
.flatten();
Some((sealed, fp))
}
/// The records of a book's backup log, if it can be read.