docs: packages need nothing for backups; handbook, tools and install words without git
The Linux packages, the AUR recipe and the rpm metadata no longer depend on another program for backups (WB-pkg-4 is replaced); the Windows host's PATH no longer carries Git for Windows; the handbook an assistant reads, the tool descriptions, the install notes and the site say plain folders. A test adopts a clone of an old backup as the docs describe. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
4313464bd7
commit
91d88dcee7
21 files changed
+277
-208
No files matched your search
@@ -75,8 +75,6 @@ workspace = true
|
||||
# program: `just package-linux`. Paths are relative to the workspace root.
|
||||
[package.metadata.generate-rpm]
|
||||
name = "wanderbooks"
|
||||
# Backups run the system's git (WB-pkg-4): dnf fetches it.
|
||||
requires = { git = "*" }
|
||||
summary = "Double-entry bookkeeping your agent keeps and you can read"
|
||||
license = "MIT OR Apache-2.0"
|
||||
url = "https://wanderbooks.ai"
|
||||
|
||||
@@ -1236,3 +1236,118 @@ async fn old_settings_and_an_old_backup_history_are_left_alone_and_said() {
|
||||
drop(c);
|
||||
assert!(server.close().success());
|
||||
}
|
||||
|
||||
/// docs/backups.md, "A backup made with an older version": a person who
|
||||
/// still has a backup made with git clones it themselves (git is their own
|
||||
/// tool now) and adopts the plain folder. This makes such a backup the way
|
||||
/// an older version did (a repository whose one commit is the books'
|
||||
/// files), clones it as the docs say, and adopts the clone with its vault
|
||||
/// and key as the docs say.
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
|
||||
async fn a_clone_of_an_old_git_backup_is_adopted_as_a_plain_folder() {
|
||||
let git = |dir: &Path, args: &[&str]| {
|
||||
let out = Command::new("git")
|
||||
.arg("-C")
|
||||
.arg(dir)
|
||||
.args(["-c", "user.name=t", "-c", "user.email=t@t.invalid"])
|
||||
.args(args)
|
||||
.output();
|
||||
match out {
|
||||
Ok(o) => {
|
||||
assert!(o.status.success(), "{args:?}: {o:?}");
|
||||
true
|
||||
}
|
||||
// No git on this machine: the path is the person's own tool's.
|
||||
Err(_) => false,
|
||||
}
|
||||
};
|
||||
let home = Home::new("old-backup");
|
||||
let server = Server::start(&home, Duration::from_secs(3600));
|
||||
home.create("acme");
|
||||
let c = connect(&home, "acme", home.token("acme", &ALL)).await;
|
||||
call(
|
||||
&c,
|
||||
"books.add_party",
|
||||
json!({"name": "Mo", "roles": ["member"]}),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
call(
|
||||
&c,
|
||||
"books.set_tin",
|
||||
json!({"party": "Mo", "tin": "12-3456789", "tin_type": "ein"}),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let (folder, want) = backed_up_acme(&home).await;
|
||||
drop(c);
|
||||
assert!(server.close().success());
|
||||
// The old backup: the books' files, committed, in a bare repository.
|
||||
let book = home.book_dir("acme");
|
||||
let work = home.outside("old-work");
|
||||
std::fs::create_dir_all(&work).unwrap();
|
||||
for part in ["journal.jsonl", "blobs", "vault", "keys", "access.jsonl"] {
|
||||
let from = book.join(part);
|
||||
if from.is_dir() {
|
||||
copy_dir(&from, &work.join(part));
|
||||
} else if from.is_file() {
|
||||
std::fs::copy(&from, work.join(part)).unwrap();
|
||||
}
|
||||
}
|
||||
if !git(&work, &["init", "-q", "-b", "main"]) {
|
||||
return;
|
||||
}
|
||||
git(&work, &["add", "-A", "-f"]);
|
||||
git(&work, &["commit", "-q", "-m", "seq 1 head x\n\nbook acme"]);
|
||||
let bare = home.outside("acme.git");
|
||||
let out = Command::new("git")
|
||||
.args(["clone", "-q", "--bare"])
|
||||
.arg(&work)
|
||||
.arg(&bare)
|
||||
.output()
|
||||
.unwrap();
|
||||
assert!(out.status.success(), "{out:?}");
|
||||
// The person's steps: clone it, then adopt the folder with its vault
|
||||
// and key.
|
||||
let clone = home.outside("acme-old");
|
||||
let out = Command::new("git")
|
||||
.args(["clone", "-q"])
|
||||
.arg(&bare)
|
||||
.arg(&clone)
|
||||
.output()
|
||||
.unwrap();
|
||||
assert!(out.status.success(), "{out:?}");
|
||||
let other = Home::new("old-backup-new");
|
||||
let server = Server::start(&other, Duration::from_secs(3600));
|
||||
let request = |confirmed: bool, expect_head: Option<(u64, String)>| Request::Adopt {
|
||||
id: "acme".into(),
|
||||
source: clone.clone(),
|
||||
settings_toml: None,
|
||||
config_json: None,
|
||||
vault_dir: Some(clone.join("vault")),
|
||||
vault_key: Some(clone.join("keys").join("legacy.key")),
|
||||
confirmed,
|
||||
expect_head,
|
||||
skip_unknown: false,
|
||||
};
|
||||
let preview = match other.admin(request(false, None)) {
|
||||
Response::Preview(p) => p,
|
||||
r => panic!("{r:?}"),
|
||||
};
|
||||
match other.admin(request(true, Some(preview.source_head))) {
|
||||
Response::Adopted(a) => {
|
||||
assert!(a.problem.is_none(), "{a:?}");
|
||||
assert_eq!(a.head, live_head(&home, "acme"));
|
||||
}
|
||||
r => panic!("{r:?}"),
|
||||
}
|
||||
let c = connect(&other, "acme", other.token("acme", &["read"])).await;
|
||||
assert_eq!(figures(&c).await, want);
|
||||
let party = call(&c, "books.party", json!({"party": "Mo"}))
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(party["party"]["tin"]["in_vault"], true, "{party}");
|
||||
drop(c);
|
||||
assert!(server.close().success());
|
||||
let _ = folder;
|
||||
}
|
||||
@@ -684,26 +684,30 @@ fn only_a_person_runs_the_workflow_that_publishes_the_repositories() {
|
||||
);
|
||||
}
|
||||
|
||||
/// WB-pkg-4: on Linux git is a dependency of every package, so the package
|
||||
/// manager fetches it; nothing carries a git of its own.
|
||||
/// WB-pkg-4: a backup is plain files the program writes itself, so no
|
||||
/// package depends on another program for it and none carries one.
|
||||
#[test]
|
||||
fn the_linux_packages_depend_on_git_and_none_carries_one() {
|
||||
let packager = read("deploy/packaging/packager.toml");
|
||||
assert_eq!(
|
||||
packager.matches("\"git\"").count(),
|
||||
2,
|
||||
"the deb and the pacman package depend on git"
|
||||
);
|
||||
assert!(read("crates/ledger-cli/Cargo.toml").contains("requires = { git = \"*\" }"));
|
||||
assert!(read("deploy/packaging/aur/PKGBUILD").contains("'git'"));
|
||||
fn no_package_depends_on_another_program_for_backups() {
|
||||
let word = |text: &str| {
|
||||
text.to_lowercase()
|
||||
.split(|c: char| !c.is_ascii_alphanumeric())
|
||||
.any(|w| w == "git")
|
||||
};
|
||||
for file in [
|
||||
"deploy/packaging/packager.toml",
|
||||
"deploy/packaging/aur/PKGBUILD",
|
||||
"crates/ledger-cli/Cargo.toml",
|
||||
"deploy/packaging/windows/wanderbooks.nsi",
|
||||
"deploy/packaging/macos/build-macos.sh",
|
||||
] {
|
||||
let text = read(file).to_lowercase();
|
||||
assert!(
|
||||
!text.contains("mingit") && !text.contains("git.exe"),
|
||||
"{file} bundles a git"
|
||||
);
|
||||
let text = read(file);
|
||||
// (Cargo.toml may name a git *dependency* of the build, never a
|
||||
// package requirement.)
|
||||
let checked: String = text
|
||||
.lines()
|
||||
.filter(|l| !l.contains("git ="))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
assert!(!word(&checked), "{file} depends on, or bundles, a git");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user