refactor: the server, restore and the window's seams on the plain-folder backup; git removed from the store

Restore reads a destination folder, a set's folder, or a backup file with an
optional passphrase; the server cuts the books under the store's lock and
writes the folder outside it; the format upgrade proves a local backup in the
book's folder (the same form) before it moves the format. The old backup
(git processes, their locks, the output drain) and every test of it are gone;
what each test protected is held by the new form's tests (table in the
report). Old settings and an old history in a book's folder are said in the
status and left alone.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-21 17:42:05 -07:00
1 parent 9f4529b078
commit a6cd89d2a6
35 files changed
+1150 -6636

No files matched your search

+7 -1
View File
@@ -264,7 +264,13 @@ impl Owner for Fake {
fn back_up_now(&self, _: &str) -> Result<Vec<String>, String> {
Err("not here".into())
}
fn plan_restore(&self, _: &str, _: Option<String>, _: bool) -> Result<RestorePlan, String> {
fn plan_restore(
&self,
_: &str,
_: Option<String>,
_: bool,
_: Option<ledger_gui::owner::Secret>,
) -> Result<RestorePlan, String> {
Err("not here".into())
}
fn restore(&self, _: &RestorePlan) -> Result<Vec<String>, String> {
+7 -1
View File
@@ -34,7 +34,13 @@ impl Owner for Fake {
fn back_up_now(&self, _: &str) -> Result<Vec<String>, String> {
Err("not here".into())
}
fn plan_restore(&self, _: &str, _: Option<String>, _: bool) -> Result<RestorePlan, String> {
fn plan_restore(
&self,
_: &str,
_: Option<String>,
_: bool,
_: Option<ledger_gui::owner::Secret>,
) -> Result<RestorePlan, String> {
Err("not here".into())
}
fn restore(&self, _: &RestorePlan) -> Result<Vec<String>, String> {
@@ -91,6 +91,7 @@ impl Owner for Fake {
_source: &str,
_id: Option<String>,
_replace: bool,
_passphrase: Option<ledger_gui::owner::Secret>,
) -> Result<RestorePlan, String> {
Err("not in these tests".into())
}
+7 -1
View File
@@ -80,7 +80,13 @@ impl Owner for Held {
fn back_up_now(&self, _: &str) -> Result<Vec<String>, String> {
Err("not here".into())
}
fn plan_restore(&self, _: &str, _: Option<String>, _: bool) -> Result<RestorePlan, String> {
fn plan_restore(
&self,
_: &str,
_: Option<String>,
_: bool,
_: Option<ledger_gui::owner::Secret>,
) -> Result<RestorePlan, String> {
Err("not here".into())
}
fn restore(&self, _: &RestorePlan) -> Result<Vec<String>, String> {
+7 -5
View File
@@ -48,11 +48,13 @@ impl Owner for Fake {
source: &str,
id: Option<String>,
replace: bool,
passphrase: Option<ledger_gui::owner::Secret>,
) -> Result<RestorePlan, String> {
std::thread::sleep(std::time::Duration::from_millis(300));
self.said(format!("plan {source} {id:?} {replace}"));
Ok(RestorePlan {
source: source.to_string(),
passphrase,
id: id.unwrap_or_else(|| "acme".into()),
replace,
head: (7, "ab".repeat(32)),
@@ -220,7 +222,7 @@ fn the_books_menu_hands_each_action_to_the_owner_and_writes_nothing() {
h.get_all_by_role(egui::accesskit::Role::TextInput)
.nth(page_fields)
.unwrap()
.type_text("/media/disk/acme.git");
.type_text("/media/disk/backups");
h.run_steps(2);
assert!(
h.query_by_label("Restore it").is_none(),
@@ -230,7 +232,7 @@ fn the_books_menu_hands_each_action_to_the_owner_and_writes_nothing() {
settle(&mut h, &f, start + 3);
assert_eq!(
f.asked.lock().unwrap()[start + 2],
"plan /media/disk/acme.git None false"
"plan /media/disk/backups None false"
);
assert!(
h.query_by_label_contains("is whole: through event 7")
@@ -240,7 +242,7 @@ fn the_books_menu_hands_each_action_to_the_owner_and_writes_nothing() {
settle(&mut h, &f, start + 4);
assert_eq!(
f.asked.lock().unwrap()[start + 3],
"restore /media/disk/acme.git acme 7"
"restore /media/disk/backups acme 7"
);
// There is no "Close the books": a company's tab, or the window, closes
@@ -307,7 +309,7 @@ fn nothing_is_changed_while_it_is_at_work() {
h.get_all_by_role(egui::accesskit::Role::TextInput)
.nth(page_fields)
.unwrap()
.type_text("/media/disk/acme.git");
.type_text("/media/disk/backups");
h.run_steps(2);
h.get_by_label("Check it").click();
h.run_steps(2);
@@ -390,7 +392,7 @@ fn screenshots() {
h.get_all_by_role(egui::accesskit::Role::TextInput)
.nth(page_fields)
.unwrap()
.type_text("/media/disk/acme.git");
.type_text("/media/disk/backups");
shot(&mut h, "restore-ask");
h.get_by_label("Check it").click();
let n = f.asked.lock().unwrap().len();
+14 -2
View File
@@ -179,7 +179,13 @@ impl Owner for Fake {
fn back_up_now(&self, _: &str) -> Result<Vec<String>, String> {
Err("not here".into())
}
fn plan_restore(&self, _: &str, _: Option<String>, _: bool) -> Result<RestorePlan, String> {
fn plan_restore(
&self,
_: &str,
_: Option<String>,
_: bool,
_: Option<ledger_gui::owner::Secret>,
) -> Result<RestorePlan, String> {
Err("not here".into())
}
fn restore(&self, _: &RestorePlan) -> Result<Vec<String>, String> {
@@ -464,7 +470,13 @@ fn a_window_with_no_server_asks_nothing_of_any() {
fn back_up_now(&self, _: &str) -> Result<Vec<String>, String> {
Err("not here".into())
}
fn plan_restore(&self, _: &str, _: Option<String>, _: bool) -> Result<RestorePlan, String> {
fn plan_restore(
&self,
_: &str,
_: Option<String>,
_: bool,
_: Option<ledger_gui::owner::Secret>,
) -> Result<RestorePlan, String> {
Err("not here".into())
}
fn restore(&self, _: &RestorePlan) -> Result<Vec<String>, String> {
+7 -1
View File
@@ -42,7 +42,13 @@ impl Owner for Quiet {
fn back_up_now(&self, _: &str) -> Result<Vec<String>, String> {
Err("not here".into())
}
fn plan_restore(&self, _: &str, _: Option<String>, _: bool) -> Result<RestorePlan, String> {
fn plan_restore(
&self,
_: &str,
_: Option<String>,
_: bool,
_: Option<ledger_gui::owner::Secret>,
) -> Result<RestorePlan, String> {
Err("not here".into())
}
fn restore(&self, _: &RestorePlan) -> Result<Vec<String>, String> {
+9 -1
View File
@@ -585,7 +585,13 @@ impl Owner for Agentic {
fn back_up_now(&self, _: &str) -> Result<Vec<String>, String> {
Err("not here".into())
}
fn plan_restore(&self, _: &str, _: Option<String>, _: bool) -> Result<RestorePlan, String> {
fn plan_restore(
&self,
_: &str,
_: Option<String>,
_: bool,
_: Option<ledger_gui::owner::Secret>,
) -> Result<RestorePlan, String> {
Err("not here".into())
}
fn restore(&self, _: &RestorePlan) -> Result<Vec<String>, String> {
@@ -2105,9 +2111,11 @@ impl Owner for Gated {
source: &str,
id: Option<String>,
replace: bool,
passphrase: Option<ledger_gui::owner::Secret>,
) -> Result<RestorePlan, String> {
Ok(RestorePlan {
source: source.to_string(),
passphrase,
id: id.unwrap_or_else(|| "alpha".into()),
replace,
head: (7, "ab".repeat(32)),
+7 -1
View File
@@ -40,7 +40,13 @@ impl Owner for Fake {
fn back_up_now(&self, _: &str) -> Result<Vec<String>, String> {
Err("not in these tests".into())
}
fn plan_restore(&self, _: &str, _: Option<String>, _: bool) -> Result<RestorePlan, String> {
fn plan_restore(
&self,
_: &str,
_: Option<String>,
_: bool,
_: Option<ledger_gui::owner::Secret>,
) -> Result<RestorePlan, String> {
Err("not in these tests".into())
}
fn restore(&self, _: &RestorePlan) -> Result<Vec<String>, String> {
+1
View File
@@ -183,6 +183,7 @@ impl Owner for Web {
_source: &str,
_id: Option<String>,
_replace: bool,
_passphrase: Option<ledger_gui::owner::Secret>,
) -> Result<RestorePlan, String> {
Err("not here".into())
}
+7 -1
View File
@@ -47,7 +47,13 @@ impl Owner for Fake {
fn back_up_now(&self, _: &str) -> Result<Vec<String>, String> {
Err("not here".into())
}
fn plan_restore(&self, _: &str, _: Option<String>, _: bool) -> Result<RestorePlan, String> {
fn plan_restore(
&self,
_: &str,
_: Option<String>,
_: bool,
_: Option<ledger_gui::owner::Secret>,
) -> Result<RestorePlan, String> {
Err("not here".into())
}
fn restore(&self, _: &RestorePlan) -> Result<Vec<String>, String> {