The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore(storage): reformat layout migration code and tests
Steven Enamakelf6fb2fca0a05
diff --git a/crates/openhuman-app/Cargo.lock b/crates/openhuman-app/Cargo.lockindex 041d7a5eaf..6a4d4ca3b0 100644--- a/crates/openhuman-app/Cargo.lock+++ b/crates/openhuman-app/Cargo.lock@@ -3891,6 +3891,7 @@ dependencies = ["x25519-dalek","zeroize","zip 2.4.2",+ "zstd",][[package]]diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rsindex 0f0382036f..059c6a89b5 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs@@ -595,8 +595,9 @@ impl OpenHumanPersistence {) -> Result<Option<(String, u64)>, SubagentError> {let record = self.store()?.record(key)?;if let Some(terminal) = record.terminal {- return Ok((!terminal.agent_id.is_empty())- .then_some((terminal.agent_id, terminal.elapsed_ms)));+ return Ok(+ (!terminal.agent_id.is_empty()).then_some((terminal.agent_id, terminal.elapsed_ms))+ );}Ok(Self::pause_of(&record, key)?.and_then(|checkpoint| {(!checkpoint.agent_id.is_empty())diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle_store.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle_store.rsindex 032e64cd34..5b32a9b038 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle_store.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle_store.rs@@ -275,7 +275,9 @@ fn import_legacy(kv: &StateKv, dir: &Path) -> anyhow::Result<()> {let value: serde_json::Value = match serde_json::from_slice(&bytes) {Ok(value) => value,Err(error) => {- log::warn!("[subagent:lifecycle] legacy index {component} unparsable ({error})");+ log::warn!(+ "[subagent:lifecycle] legacy index {component} unparsable ({error})"+ );continue;}};diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle_store_tests.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle_store_tests.rsindex fea2bdd60e..ce12f33a56 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle_store_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle_store_tests.rs@@ -48,9 +48,7 @@ fn a_legacy_lifecycle_directory_is_imported_once_and_left_in_place() {let record = store.record(&paused).unwrap();assert_eq!(record.pause.unwrap().question, "which one?");assert_eq!(store.index_keys("task-a").unwrap(), vec![paused.clone()]);- assert!(lifecycle- .join(format!("{component}.pause.json"))- .exists());+ assert!(lifecycle.join(format!("{component}.pause.json")).exists());// A later change is not undone by reopening, which does not import again.store@@ -78,7 +76,10 @@ fn a_legacy_bare_terminal_outcome_is_read_as_a_terminal_record() {.unwrap();std::fs::write(lifecycle.join("notes.txt"), "not a lifecycle file").unwrap();- let record = LifecycleStore::open(dir.path()).unwrap().record(&done).unwrap();+ let record = LifecycleStore::open(dir.path())+ .unwrap()+ .record(&done)+ .unwrap();let terminal = record.terminal.unwrap();assert_eq!(terminal.outcome.output, "finished");assert!(terminal.agent_id.is_empty());@@ -91,7 +92,10 @@ fn the_default_checkpoint_directory_belongs_to_its_workspace() {workspace_of(&workspace.join(".openhuman/subagent_checkpoints")),workspace);- assert_eq!(workspace_of(std::path::Path::new("/x/y")), std::path::Path::new("/x/y"));+ assert_eq!(+ workspace_of(std::path::Path::new("/x/y")),+ std::path::Path::new("/x/y")+ );}#[test]diff --git a/crates/openhuman-core/src/config/schema/load/dirs.rs b/crates/openhuman-core/src/config/schema/load/dirs.rsindex 39ce8ae46d..d756f1fb58 100644--- a/crates/openhuman-core/src/config/schema/load/dirs.rs+++ b/crates/openhuman-core/src/config/schema/load/dirs.rs@@ -436,7 +436,8 @@ pub(super) async fn resolve_config_dirs_ignoring_env(if let Some(user_id) = read_active_user_id_checked_async(default_openhuman_dir).await? {// The shared profile layout (`users/<id>/{config.toml,workspace}`),// the same one a SaaS core lays its profiles out with.- let profile = crate::config::schema::ProfileLayout::resolve(default_openhuman_dir, &user_id);+ let profile =+ crate::config::schema::ProfileLayout::resolve(default_openhuman_dir, &user_id);tracing::debug!(user_id = %user_id,user_dir = %profile.dir.display(),@@ -459,9 +460,8 @@ pub(super) async fn resolve_config_dirs_ignoring_env());}- let profile = crate::config::schema::ProfileLayout::resolve_at(pre_login_user_dir(- default_openhuman_dir,- ));+ let profile =+ crate::config::schema::ProfileLayout::resolve_at(pre_login_user_dir(default_openhuman_dir));tracing::debug!(user_id = %PRE_LOGIN_USER_ID,user_dir = %profile.dir.display(),diff --git a/crates/openhuman-core/src/config/schema/load_profile_layout_parity_tests.rs b/crates/openhuman-core/src/config/schema/load_profile_layout_parity_tests.rsindex eae5490b69..f75a7f3924 100644--- a/crates/openhuman-core/src/config/schema/load_profile_layout_parity_tests.rs+++ b/crates/openhuman-core/src/config/schema/load_profile_layout_parity_tests.rs@@ -52,7 +52,10 @@ async fn a_fresh_pre_login_profile_resolves_to_the_v2_layout() {assert_eq!(config_dir, layout.dir);assert_eq!(workspace_dir, layout.workspace_dir);assert_eq!(config_dir, root.join("users").join("local"));- assert_eq!(workspace_dir, root.join("users").join("local").join("files"));+ assert_eq!(+ workspace_dir,+ root.join("users").join("local").join("files")+ );assert!(config_dir.join(".layout").is_file());}diff --git a/crates/openhuman-core/src/memory/deletion_tests.rs b/crates/openhuman-core/src/memory/deletion_tests.rsindex ed48c0d53b..531023ad66 100644--- a/crates/openhuman-core/src/memory/deletion_tests.rs+++ b/crates/openhuman-core/src/memory/deletion_tests.rs@@ -104,4 +104,3 @@ async fn a_blank_thread_id_queues_nothing() {assert_eq!(forget_thread(&config, " ").await, 0);assert!(pending(&config.workspace_dir).is_empty());}-diff --git a/crates/openhuman-core/src/memory/lifecycle/jobs_tests.rs b/crates/openhuman-core/src/memory/lifecycle/jobs_tests.rsindex 9899ca1761..29d31f175d 100644--- a/crates/openhuman-core/src/memory/lifecycle/jobs_tests.rs+++ b/crates/openhuman-core/src/memory/lifecycle/jobs_tests.rs@@ -27,9 +27,11 @@ async fn duplicates_merge_and_the_queue_survives_a_reload() {let queue = snapshot(&config).await;assert_eq!(queue.pending.len(), 3, "one per (root, job)");- assert!(crate::memory::state_store::load::<JobQueue>(&config.workspace_dir, "jobs")- .unwrap()- .is_some());+ assert!(+ crate::memory::state_store::load::<JobQueue>(&config.workspace_dir, "jobs")+ .unwrap()+ .is_some()+ );}#[tokio::test]@@ -103,7 +105,11 @@ async fn the_build_delay_comes_from_the_recall_config_and_the_file_store_is_the_let stored: JobQueue = crate::memory::state_store::load(&config.workspace_dir, "jobs").unwrap().unwrap();- assert_eq!(stored.pending.len(), 1, "persisted in the memory state store");+ assert_eq!(+ stored.pending.len(),+ 1,+ "persisted in the memory state store"+ );assert!(run(&config, Selection::Due).await.unwrap().is_empty());}diff --git a/crates/openhuman-core/src/memory/local_root_tests.rs b/crates/openhuman-core/src/memory/local_root_tests.rsindex 1aea421ca0..70508b0d18 100644--- a/crates/openhuman-core/src/memory/local_root_tests.rs+++ b/crates/openhuman-core/src/memory/local_root_tests.rs@@ -126,4 +126,4 @@ fn a_recorded_root_lives_in_the_state_store_not_a_file() {.unwrap().unwrap();assert_eq!(stored.root, root);-}\ No newline at end of file+}diff --git a/crates/openhuman-core/src/memory/tool_writes.rs b/crates/openhuman-core/src/memory/tool_writes.rsindex f74be01173..bd7609dddd 100644--- a/crates/openhuman-core/src/memory/tool_writes.rs+++ b/crates/openhuman-core/src/memory/tool_writes.rs@@ -267,7 +267,11 @@ fn read_file(path: &Path) -> std::io::Result<Vec<Entry>> {fn write_file(file: &Path, entries: &[Entry]) -> std::io::Result<()> {let (workspace, name) = coordinates(file)?;- if serde_json::to_vec(entries).map_err(std::io::Error::other)?.len() > MAX_BYTES {+ if serde_json::to_vec(entries)+ .map_err(std::io::Error::other)?+ .len()+ > MAX_BYTES+ {return Err(std::io::Error::other("queue too large"));}super::state_store::save(workspace, name, &entries).map_err(std::io::Error::other)@@ -350,8 +354,8 @@ fn owner_state(config: &Config) -> &'static OwnerState {fn partitions(config: &Config) -> MemoryResult<Vec<PathBuf>> {let prefix = format!("{}-", owner_prefix(config));- let names = super::state_store::names(&config.workspace_dir, &prefix)- .map_err(|_| unavailable())?;+ let names =+ super::state_store::names(&config.workspace_dir, &prefix).map_err(|_| unavailable())?;if names.len() > MAX_PENDING {return Err(unavailable());}diff --git a/crates/openhuman-core/src/memory/tool_writes_tests.rs b/crates/openhuman-core/src/memory/tool_writes_tests.rsindex 8eb208dd36..2d27a687fc 100644--- a/crates/openhuman-core/src/memory/tool_writes_tests.rs+++ b/crates/openhuman-core/src/memory/tool_writes_tests.rs@@ -89,7 +89,11 @@ fn persistence_failure_and_invalid_scope_never_acknowledge_a_write() {let args = json!({"action":"learn","text":"Prefers tea"});assert!(enqueue(&config, &args, &facts).is_err());assert!(!path(&config.workspace_dir).exists());- std::fs::write(config.workspace_dir.join("storage"), "blocks the storage directory").unwrap();+ std::fs::write(+ config.workspace_dir.join("storage"),+ "blocks the storage directory",+ )+ .unwrap();assert!(enqueue(&config, &args, &self::facts(&config)).is_err());}diff --git a/crates/openhuman-core/src/modules/site_memory_host.rs b/crates/openhuman-core/src/modules/site_memory_host.rsindex 8e73fc2af2..3f3ee583d9 100644--- a/crates/openhuman-core/src/modules/site_memory_host.rs+++ b/crates/openhuman-core/src/modules/site_memory_host.rs@@ -174,10 +174,7 @@ impl SiteStore {/// Copies the legacy `<site>.json` files of `dir`, dated by their last change/// so the 30-day sweep treats them as before. An existing record wins; a file/// that does not parse, or a copy set aside, is skipped.-fn import_legacy(- kv: &crate::storage::state_kv::StateKv,- dir: &Path,-) -> anyhow::Result<()> {+fn import_legacy(kv: &crate::storage::state_kv::StateKv, dir: &Path) -> anyhow::Result<()> {let entries = match std::fs::read_dir(dir) {Ok(entries) => entries,Err(error) if error.kind() == std::io::ErrorKind::NotFound => return Ok(()),diff --git a/crates/openhuman-core/src/modules/site_memory_host_tests.rs b/crates/openhuman-core/src/modules/site_memory_host_tests.rsindex 5bbe40b8e8..c88ba44421 100644--- a/crates/openhuman-core/src/modules/site_memory_host_tests.rs+++ b/crates/openhuman-core/src/modules/site_memory_host_tests.rs@@ -79,7 +79,10 @@ async fn legacy_site_files_are_imported_once_dated_by_their_last_change_and_leftlet store = SiteStore::open(dir.path()).unwrap();assert_eq!(store.load("fresh.com").await.unwrap(), memory());assert!(store.load("broken.com").await.unwrap().is_empty());- assert!(sites.join("fresh.com.json").exists(), "the legacy file is not touched");+ assert!(+ sites.join("fresh.com.json").exists(),+ "the legacy file is not touched"+ );// The imported old site is swept like any other that nothing changed.store.sweep();assert!(store.load("old.com").await.unwrap().is_empty());diff --git a/crates/openhuman-core/src/storage/layout/archive.rs b/crates/openhuman-core/src/storage/layout/archive.rsindex dcbf862b92..7e39c64a1a 100644--- a/crates/openhuman-core/src/storage/layout/archive.rs+++ b/crates/openhuman-core/src/storage/layout/archive.rs@@ -137,13 +137,19 @@ fn write_inner(created_ms,entries: sources.iter()- .map(|s| EntryRecord { path: s.rel.clone(), action: s.action })+ .map(|s| EntryRecord {+ path: s.rel.clone(),+ action: s.action,+ }).collect(),files: Vec::new(),};for source in sources {let root = format!("{ROOT}/{}", source.rel);- for item in WalkDir::new(&source.at).follow_links(false).sort_by_file_name() {+ for item in WalkDir::new(&source.at)+ .follow_links(false)+ .sort_by_file_name()+ {let item = item.map_err(|e| io(e))?;let relative = item.path().strip_prefix(&source.at).map_err(|e| io(e))?;let name = if relative.as_os_str().is_empty() {@@ -227,7 +233,9 @@ fn restrict(path: &Path, mode: u32) {#[cfg(not(unix))]fn restrict(_path: &Path, _mode: u32) {}-fn open_archive(path: &Path) -> Result<tar::Archive<zstd::stream::read::Decoder<'static, BufReader<File>>>, LayoutError> {+fn open_archive(+ path: &Path,+) -> Result<tar::Archive<zstd::stream::read::Decoder<'static, BufReader<File>>>, LayoutError> {let decoder = zstd::stream::read::Decoder::new(File::open(path)?)?;Ok(tar::Archive::new(decoder))}@@ -247,32 +255,52 @@ pub fn verify(archive: &Path) -> Result<Manifest, LayoutError> {let mut manifest: Option<Manifest> = None;for entry in tar.entries().map_err(|e| bad(format!("unreadable: {e}")))? {let mut entry = entry.map_err(|e| bad(format!("unreadable entry: {e}")))?;- let path = entry.path().map_err(|e| bad(e.to_string()))?.to_string_lossy().into_owned();+ let path = entry+ .path()+ .map_err(|e| bad(e.to_string()))?+ .to_string_lossy()+ .into_owned();let kind = entry.header().entry_type();if path == MANIFEST_ENTRY {let mut body = Vec::new();- entry.read_to_end(&mut body).map_err(|e| bad(format!("manifest unreadable: {e}")))?;- manifest = Some(serde_json::from_slice(&body).map_err(|e| bad(format!("manifest damaged: {e}")))?);+ entry+ .read_to_end(&mut body)+ .map_err(|e| bad(format!("manifest unreadable: {e}")))?;+ manifest = Some(+ serde_json::from_slice(&body).map_err(|e| bad(format!("manifest damaged: {e}")))?,+ );} else if kind.is_file() {let mut hasher = Sha256::new();let mut size = 0u64;let mut buf = vec![0u8; 64 * 1024];loop {- let n = entry.read(&mut buf).map_err(|e| bad(format!("{path}: {e}")))?;+ let n = entry+ .read(&mut buf)+ .map_err(|e| bad(format!("{path}: {e}")))?;if n == 0 {break;}hasher.update(&buf[..n]);size += n as u64;}- seen.insert(path, ("file".to_owned(), size, hex::encode(hasher.finalize())));+ seen.insert(+ path,+ ("file".to_owned(), size, hex::encode(hasher.finalize())),+ );} else if kind.is_symlink() {let target = entry.link_name().map_err(|e| bad(e.to_string()))?.map(|t| t.to_string_lossy().into_owned()).unwrap_or_default();- seen.insert(path, ("symlink".to_owned(), 0, hex::encode(Sha256::digest(target.as_bytes()))));+ seen.insert(+ path,+ (+ "symlink".to_owned(),+ 0,+ hex::encode(Sha256::digest(target.as_bytes())),+ ),+ );}}let manifest = manifest.ok_or_else(|| bad("no manifest entry".to_owned()))?;@@ -311,10 +339,16 @@ pub fn restore(archive: &Path, profile_dir: &Path) -> Result<Manifest, LayoutErrcontinue;}if !path.starts_with(ROOT) {- return Err(LayoutError::Verify(format!("{} is outside {ROOT}/", path.display())));+ return Err(LayoutError::Verify(format!(+ "{} is outside {ROOT}/",+ path.display()+ )));}if !entry.unpack_in(profile_dir)? {- return Err(LayoutError::Verify(format!("{} escapes the profile directory", path.display())));+ return Err(LayoutError::Verify(format!(+ "{} escapes the profile directory",+ path.display()+ )));}}Ok(manifest)diff --git a/crates/openhuman-core/src/storage/layout/archive_tests.rs b/crates/openhuman-core/src/storage/layout/archive_tests.rsindex 8cf1a3264f..e596848074 100644--- a/crates/openhuman-core/src/storage/layout/archive_tests.rs+++ b/crates/openhuman-core/src/storage/layout/archive_tests.rs@@ -4,14 +4,25 @@ use tempfile::TempDir;fn sources(dir: &Path) -> Vec<Source> {vec![- Source { rel: "skills".into(), action: Action::Move, at: dir.join("skills") },- Source { rel: "memory/jobs.json".into(), action: Action::Delete, at: dir.join("jobs.json") },+ Source {+ rel: "skills".into(),+ action: Action::Move,+ at: dir.join("skills"),+ },+ Source {+ rel: "memory/jobs.json".into(),+ action: Action::Delete,+ at: dir.join("jobs.json"),+ },]}fn source_tree() -> TempDir {let dir = TempDir::new().unwrap();- put(&dir.path().join("skills/s1/SKILL.md"), "UNIQUE-CONTENT-1234 skill body");+ put(+ &dir.path().join("skills/s1/SKILL.md"),+ "UNIQUE-CONTENT-1234 skill body",+ );put(&dir.path().join("skills/s2/notes.txt"), "second");std::fs::create_dir_all(dir.path().join("skills/empty")).unwrap();put(&dir.path().join("jobs.json"), "{\"a\":1}");@@ -31,10 +42,17 @@ fn an_archive_verifies_against_its_own_manifest() {let paths: Vec<_> = verified.files.iter().map(|f| f.path.as_str()).collect();assert!(paths.contains(&"workspace/skills/s1/SKILL.md"), "{paths:?}");assert!(paths.contains(&"workspace/memory/jobs.json"), "{paths:?}");- let skill = verified.files.iter().find(|f| f.path.ends_with("s1/SKILL.md")).unwrap();+ let skill = verified+ .files+ .iter()+ .find(|f| f.path.ends_with("s1/SKILL.md"))+ .unwrap();assert_eq!(skill.size, "UNIQUE-CONTENT-1234 skill body".len() as u64);assert_eq!(skill.sha256.len(), 64);- assert!(sidecar_path(&archive).is_file(), "the manifest is also written beside the archive");+ assert!(+ sidecar_path(&archive).is_file(),+ "the manifest is also written beside the archive"+ );#[cfg(unix)]assert!(verified.files.iter().any(|f| f.kind == "symlink"));}@@ -55,7 +73,10 @@ fn a_corrupted_entry_fails_verification() {tar_bytes[at] = b'X';std::fs::write(&archive, zstd::encode_all(tar_bytes.as_slice(), 1).unwrap()).unwrap();let error = verify(&archive).unwrap_err().to_string();- assert!(error.contains("SKILL.md") && error.contains("does not match"), "{error}");+ assert!(+ error.contains("SKILL.md") && error.contains("does not match"),+ "{error}"+ );}#[test]@@ -80,8 +101,14 @@ fn restore_puts_every_file_back_under_workspace() {assert_eq!(manifest.entries.len(), 2);let restored = tree(&profile.path().join("workspace"));let original = tree(src.path());- assert_eq!(restored["skills/s1/SKILL.md"], original["skills/s1/SKILL.md"]);- assert_eq!(restored["skills/s2/notes.txt"], original["skills/s2/notes.txt"]);+ assert_eq!(+ restored["skills/s1/SKILL.md"],+ original["skills/s1/SKILL.md"]+ );+ assert_eq!(+ restored["skills/s2/notes.txt"],+ original["skills/s2/notes.txt"]+ );assert_eq!(restored["memory/jobs.json"], original["jobs.json"]);assert!(restored.contains_key("skills/empty"));}@@ -105,7 +132,11 @@ fn restore_of_a_corrupt_archive_extracts_nothing() {fn a_failed_write_leaves_no_partial_archive() {let out = TempDir::new().unwrap();let archive = out.path().join("a.tar.zst");- let missing = vec![Source { rel: "x".into(), action: Action::Delete, at: out.path().join("absent") }];+ let missing = vec![Source {+ rel: "x".into(),+ action: Action::Delete,+ at: out.path().join("absent"),+ }];assert!(write(&archive, "u1", 0, &missing).is_err());assert!(!archive.exists());}diff --git a/crates/openhuman-core/src/storage/layout/db.rs b/crates/openhuman-core/src/storage/layout/db.rsindex 4a7ad09e59..0719bdde1d 100644--- a/crates/openhuman-core/src/storage/layout/db.rs+++ b/crates/openhuman-core/src/storage/layout/db.rs@@ -45,7 +45,9 @@ fn counts_of(conn: &Connection) -> Result<Counts, LayoutError> {let mut stmt = conn.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT LIKE 'sqlite_%' ORDER BY name").map_err(sql)?;- let rows = stmt.query_map([], |row| row.get::<_, String>(0)).map_err(sql)?;+ let rows = stmt+ .query_map([], |row| row.get::<_, String>(0))+ .map_err(sql)?;for row in rows {tables.push(row.map_err(sql)?);}@@ -54,7 +56,9 @@ fn counts_of(conn: &Connection) -> Result<Counts, LayoutError> {for table in tables {let quoted = format!("\"{}\"", table.replace('"', "\"\""));let n: i64 = conn- .query_row(&format!("SELECT COUNT(*) FROM {quoted}"), [], |row| row.get(0))+ .query_row(&format!("SELECT COUNT(*) FROM {quoted}"), [], |row| {+ row.get(0)+ }).map_err(sql)?;counts.insert(table, u64::try_from(n).unwrap_or(0));}@@ -92,26 +96,37 @@ fn mismatch(source: &Counts, copy: &Counts) -> Option<String> {/// [`LayoutError::Verify`] when the copy's counts differ from the source's, or/// an I/O or SQLite error. The source is untouched either way.pub fn copy(source: &Path, dest: &Path) -> Result<DbCopy, LayoutError> {- let conn = Connection::open_with_flags(source, OpenFlags::SQLITE_OPEN_READ_WRITE).map_err(sql)?;+ let conn =+ Connection::open_with_flags(source, OpenFlags::SQLITE_OPEN_READ_WRITE).map_err(sql)?;let source_counts = counts_of(&conn)?;if dest.is_file() {if let Ok(existing) = table_counts(dest) {if existing == source_counts {tracing::debug!(target: "openhuman::storage", dest = %dest.display(), "[layout] storage.db already matches the source; kept");- return Ok(DbCopy { counts: existing, reused: true });+ return Ok(DbCopy {+ counts: existing,+ reused: true,+ });}}}let tmp = tmp_path(dest);- for stale in [tmp.clone(), tmp.with_extension("tmp-wal"), tmp.with_extension("tmp-shm")] {+ for stale in [+ tmp.clone(),+ tmp.with_extension("tmp-wal"),+ tmp.with_extension("tmp-shm"),+ ] {let _ = std::fs::remove_file(stale);}- conn.execute("VACUUM INTO ?1", [tmp.to_string_lossy().as_ref()]).map_err(sql)?;+ conn.execute("VACUUM INTO ?1", [tmp.to_string_lossy().as_ref()])+ .map_err(sql)?;drop(conn);let copy_counts = table_counts(&tmp)?;if let Some(diff) = mismatch(&source_counts, ©_counts) {let _ = std::fs::remove_file(&tmp);- return Err(LayoutError::Verify(format!("the database copy does not match its source ({diff})")));+ return Err(LayoutError::Verify(format!(+ "the database copy does not match its source ({diff})"+ )));}std::fs::File::open(&tmp)?.sync_all()?;std::fs::rename(&tmp, dest)?;@@ -121,7 +136,10 @@ pub fn copy(source: &Path, dest: &Path) -> Result<DbCopy, LayoutError> {rows = copy_counts.values().sum::<u64>(),"[layout] database copied and verified");- Ok(DbCopy { counts: copy_counts, reused: false })+ Ok(DbCopy {+ counts: copy_counts,+ reused: false,+ })}/// Checkpoints and truncates the WAL of `path`, so the file set the archive@@ -132,7 +150,8 @@ pub fn copy(source: &Path, dest: &Path) -> Result<DbCopy, LayoutError> {/// A SQLite error.pub fn checkpoint(path: &Path) -> Result<(), LayoutError> {let conn = Connection::open_with_flags(path, OpenFlags::SQLITE_OPEN_READ_WRITE).map_err(sql)?;- conn.query_row("PRAGMA wal_checkpoint(TRUNCATE)", [], |_| Ok(())).map_err(sql)?;+ conn.query_row("PRAGMA wal_checkpoint(TRUNCATE)", [], |_| Ok(()))+ .map_err(sql)?;Ok(())}diff --git a/crates/openhuman-core/src/storage/layout/db_tests.rs b/crates/openhuman-core/src/storage/layout/db_tests.rsindex f8ca3097aa..607816cccc 100644--- a/crates/openhuman-core/src/storage/layout/db_tests.rs+++ b/crates/openhuman-core/src/storage/layout/db_tests.rs@@ -15,7 +15,11 @@ fn the_copy_has_the_sources_counts_and_leaves_the_source_alone() {assert_eq!(copied.counts, table_counts(&source).unwrap());assert_eq!(copied.counts, table_counts(&dest).unwrap());assert!(!dest.with_file_name("storage.db.tmp").exists());- assert_eq!(std::fs::read(&source).unwrap(), before, "the source is read-only to the copy");+ assert_eq!(+ std::fs::read(&source).unwrap(),+ before,+ "the source is read-only to the copy"+ );assert_eq!(fixture_docs(&dest).len(), 3);}diff --git a/crates/openhuman-core/src/storage/layout/legacy.rs b/crates/openhuman-core/src/storage/layout/legacy.rsindex 0cd4aa5ddc..05636337a0 100644--- a/crates/openhuman-core/src/storage/layout/legacy.rs+++ b/crates/openhuman-core/src/storage/layout/legacy.rs@@ -42,7 +42,13 @@ pub struct ImportSummary {/// The v1 database URL of the profile (`sqlite:<workspace>/storage`).pub fn v1_url(target: &Target) -> String {- format!("sqlite:{}", target.workspace().join(storage::config::DEFAULT_DIR).display())+ format!(+ "sqlite:{}",+ target+ .workspace()+ .join(storage::config::DEFAULT_DIR)+ .display()+ )}/// `<workspace>/storage/storage.db`, the file the URL opens.@@ -71,7 +77,10 @@ pub async fn import(target: &Target, config: &Config) -> Result<ImportSummary, Lreturn Ok(ImportSummary::default());}let backend = open_v1(target).await?;- let config = Config { workspace_dir: workspace.clone(), ..config.clone() };+ let config = Config {+ workspace_dir: workspace.clone(),+ ..config.clone()+ };let summary = tokio::task::spawn_blocking({let backend = Arc::clone(&backend);move || import_blocking(&backend, &config, &workspace)diff --git a/crates/openhuman-core/src/storage/layout/legacy_tests.rs b/crates/openhuman-core/src/storage/layout/legacy_tests.rsindex c1ab0fd4cc..acda5998d6 100644--- a/crates/openhuman-core/src/storage/layout/legacy_tests.rs+++ b/crates/openhuman-core/src/storage/layout/legacy_tests.rs@@ -6,7 +6,10 @@ async fn the_import_brings_legacy_files_into_the_v1_database() {let fx = v1_profile();let summary = import(&fx.target, &fx.config).await.unwrap();assert_eq!(summary.memory_state, vec!["jobs".to_owned()]);- assert!(summary.domains >= 3, "approval, devices, ... ran: {summary:?}");+ assert!(+ summary.domains >= 3,+ "approval, devices, ... ran: {summary:?}"+ );let jobs = crate::storage::layout::test_fixtures::jobs_value(&v1_db(&fx.target));assert_eq!(jobs, Some(serde_json::json!({"jobs": [1, 2, 3]})));@@ -24,14 +27,23 @@ async fn importing_twice_changes_nothing() {let first = super::super::db::table_counts(&v1_db(&fx.target)).unwrap();import(&fx.target, &fx.config).await.unwrap();migrate(&fx.target).await.unwrap();- assert_eq!(super::super::db::table_counts(&v1_db(&fx.target)).unwrap(), first);+ assert_eq!(+ super::super::db::table_counts(&v1_db(&fx.target)).unwrap(),+ first+ );}#[tokio::test(flavor = "multi_thread")]async fn a_damaged_state_file_fails_the_import_before_anything_is_deleted() {let fx = v1_profile();- crate::storage::layout::test_fixtures::write(&fx.workspace().join("memory/broken.json"), "{ not json");- let error = import(&fx.target, &fx.config).await.unwrap_err().to_string();+ crate::storage::layout::test_fixtures::write(+ &fx.workspace().join("memory/broken.json"),+ "{ not json",+ );+ let error = import(&fx.target, &fx.config)+ .await+ .unwrap_err()+ .to_string();assert!(error.contains("nothing was archived or deleted"), "{error}");}@@ -39,7 +51,10 @@ async fn a_damaged_state_file_fails_the_import_before_anything_is_deleted() {async fn no_workspace_means_nothing_to_import() {let dir = tempfile::TempDir::new().unwrap();let target = Target::new(dir.path(), "u1");- assert_eq!(import(&target, &Config::default()).await.unwrap(), ImportSummary::default());+ assert_eq!(+ import(&target, &Config::default()).await.unwrap(),+ ImportSummary::default()+ );migrate(&target).await.unwrap();assert!(!target.workspace().exists());}diff --git a/crates/openhuman-core/src/storage/layout/mod.rs b/crates/openhuman-core/src/storage/layout/mod.rsindex a291109538..2d37451858 100644--- a/crates/openhuman-core/src/storage/layout/mod.rs+++ b/crates/openhuman-core/src/storage/layout/mod.rs@@ -54,7 +54,9 @@ pub use run::{auto_migrate, migrate, restore, Options};pub use state::{LayoutError, Step};pub use status::{status, Status};-use crate::config::schema::profile_layout::{PROFILE_FILES_DIR, PROFILE_STORAGE_FILE, PROFILE_WORKSPACE_DIR};+use crate::config::schema::profile_layout::{+ PROFILE_FILES_DIR, PROFILE_STORAGE_FILE, PROFILE_WORKSPACE_DIR,+};use crate::config::Config;/// Directory under the root that holds the archives.@@ -88,7 +90,9 @@ impl Target {pub fn from_config(config: &Config) -> Option<Self> {let profile_dir = config.config_path.parent()?;let users = profile_dir.parent()?;- if users.file_name()? != std::ffi::OsStr::new(crate::config::schema::profile_layout::USERS_DIR) {+ if users.file_name()?+ != std::ffi::OsStr::new(crate::config::schema::profile_layout::USERS_DIR)+ {return None;}let user_id = profile_dir.file_name()?.to_str()?.to_owned();diff --git a/crates/openhuman-core/src/storage/layout/plan.rs b/crates/openhuman-core/src/storage/layout/plan.rsindex e1b91424a9..ae29c9255e 100644--- a/crates/openhuman-core/src/storage/layout/plan.rs+++ b/crates/openhuman-core/src/storage/layout/plan.rs@@ -205,7 +205,13 @@ fn scan_memory(dir: &Path, entries: &mut Vec<Entry>) -> std::io::Result<()> {let item = item?;let name = item.file_name().to_string_lossy().into_owned();let (action, reason) = classify_memory_child(&name, item.file_type()?.is_dir());- push(entries, format!("memory/{name}"), &item.path(), action, reason);+ push(+ entries,+ format!("memory/{name}"),+ &item.path(),+ action,+ reason,+ );}Ok(())}@@ -223,7 +229,8 @@ fn push(entries: &mut Vec<Entry>, path: String, abs: &Path, action: Action, reas/// The path of a plan entry below `base` (`workspace/` or `files/`).pub fn join(base: &Path, rel: &str) -> PathBuf {- rel.split('/').fold(base.to_path_buf(), |p, part| p.join(part))+ rel.split('/')+ .fold(base.to_path_buf(), |p, part| p.join(part))}#[cfg(test)]diff --git a/crates/openhuman-core/src/storage/layout/plan_tests.rs b/crates/openhuman-core/src/storage/layout/plan_tests.rsindex db0e4b004d..b78fd97b25 100644--- a/crates/openhuman-core/src/storage/layout/plan_tests.rs+++ b/crates/openhuman-core/src/storage/layout/plan_tests.rs@@ -8,14 +8,20 @@ fn user_files_move_and_imported_state_is_deleted() {assert_eq!(classify_top("artifacts").map(|c| c.0), Some(Action::Move));assert_eq!(classify_top("STYLE.md").map(|c| c.0), Some(Action::Move));assert_eq!(classify_top("storage").map(|c| c.0), Some(Action::Delete));- assert_eq!(classify_top("session_raw").map(|c| c.0), Some(Action::Delete));+ assert_eq!(+ classify_top("session_raw").map(|c| c.0),+ Some(Action::Delete)+ );assert_eq!(classify_top("who-knows"), None);}#[test]fn memory_is_split_one_level_down() {assert_eq!(classify_memory_child("jobs.json", false).0, Action::Delete);- assert_eq!(classify_memory_child("conversations", true).0, Action::Delete);+ assert_eq!(+ classify_memory_child("conversations", true).0,+ Action::Delete+ );assert_eq!(classify_memory_child("legacy_claims", true).0, Action::Move);// a directory that merely looks like a state file is not oneassert_eq!(classify_memory_child("x.json", true).0, Action::Move);@@ -25,7 +31,12 @@ fn memory_is_split_one_level_down() {fn scan_classifies_a_v1_workspace_and_totals_it() {let fx = v1_profile();let plan = scan(&fx.workspace()).unwrap();- let by = |p: &str| plan.entries.iter().find(|e| e.path == p).unwrap_or_else(|| panic!("no {p}"));+ let by = |p: &str| {+ plan.entries+ .iter()+ .find(|e| e.path == p)+ .unwrap_or_else(|| panic!("no {p}"))+ };assert_eq!(by("skills").action, Action::Move);assert_eq!(by("state").action, Action::Move);assert_eq!(by("memory/legacy_claims").action, Action::Move);@@ -34,7 +45,10 @@ fn scan_classifies_a_v1_workspace_and_totals_it() {assert_eq!(by("storage").action, Action::Delete);assert_eq!(by("mystery").action, Action::Unknown);assert_eq!(by("notes.tmp").action, Action::Unknown);- assert!(plan.entries.iter().all(|e| e.path != "memory"), "memory is classified by child");+ assert!(+ plan.entries.iter().all(|e| e.path != "memory"),+ "memory is classified by child"+ );let unknown = plan.totals(Action::Unknown);assert_eq!((unknown.entries, unknown.files), (2, 2));assert_eq!(unknown.bytes, "???".len() as u64 + "scratch".len() as u64);@@ -53,7 +67,10 @@ fn scan_classifies_a_v1_workspace_and_totals_it() {#[test]fn a_missing_workspace_is_an_empty_plan() {let dir = tempfile::TempDir::new().unwrap();- assert!(scan(&dir.path().join("workspace")).unwrap().entries.is_empty());+ assert!(scan(&dir.path().join("workspace"))+ .unwrap()+ .entries+ .is_empty());}#[test]@@ -74,5 +91,8 @@ fn measure_counts_files_and_bytes_without_following_symlinks() {#[test]fn join_splits_the_relative_path() {let base = std::path::Path::new("/x/ws");- assert_eq!(join(base, "memory/jobs.json"), base.join("memory").join("jobs.json"));+ assert_eq!(+ join(base, "memory/jobs.json"),+ base.join("memory").join("jobs.json")+ );}diff --git a/crates/openhuman-core/src/storage/layout/run.rs b/crates/openhuman-core/src/storage/layout/run.rsindex 867fe05b6a..af9d5f69d5 100644--- a/crates/openhuman-core/src/storage/layout/run.rs+++ b/crates/openhuman-core/src/storage/layout/run.rs@@ -57,15 +57,19 @@ pub async fn migrate(if !options.dry_run {// The schema migrations are all an explicit backend gets, and// opening it runs them.- crate::storage::open(&url)- .await- .map_err(|e| LayoutError::Other(anyhow::anyhow!("open the configured backend: {e}")))?;+ crate::storage::open(&url).await.map_err(|e| {+ LayoutError::Other(anyhow::anyhow!("open the configured backend: {e}"))+ })?;}- return Ok(Outcome::Noop { reason: Noop::ExplicitUrl });+ return Ok(Outcome::Noop {+ reason: Noop::ExplicitUrl,+ });}let resuming = LayoutState::load(&target.profile_dir)?.is_some();if !resuming && LayoutVersion::detect(&target.profile_dir) == LayoutVersion::V2 {- return Ok(Outcome::Noop { reason: Noop::AlreadyV2 });+ return Ok(Outcome::Noop {+ reason: Noop::AlreadyV2,+ });}if options.dry_run {return dry_run(target, resuming).map(|d| Outcome::DryRun(Box::new(d)));@@ -81,7 +85,9 @@ pub async fn migrate(Some(state) => state,None => {if LayoutVersion::detect(&target.profile_dir) == LayoutVersion::V2 {- return Ok(Outcome::Noop { reason: Noop::AlreadyV2 });+ return Ok(Outcome::Noop {+ reason: Noop::AlreadyV2,+ });}let state = LayoutState::new(&target.user_id, now_ms());state.save(&target.profile_dir)?;@@ -168,10 +174,11 @@ fn live_conflict(target: &Target, installed_url: Option<String>) -> Option<Strin}fn plan_of(state: &LayoutState) -> Result<&Plan, LayoutError> {- state- .plan- .as_ref()- .ok_or_else(|| LayoutError::Other(anyhow::anyhow!("the layout state holds no plan; remove .layout.state to start over")))+ state.plan.as_ref().ok_or_else(|| {+ LayoutError::Other(anyhow::anyhow!(+ "the layout state holds no plan; remove .layout.state to start over"+ ))+ })}fn names(plan: &Plan, action: Action) -> Vec<String> {@@ -184,7 +191,9 @@ fn dry_run(target: &Target, resuming: bool) -> Result<DryRun, LayoutError> {Some(plan) => plan,None => plan::scan(&target.workspace())?,};- let database_bytes = std::fs::metadata(legacy::v1_db(target)).ok().map(|m| m.len());+ let database_bytes = std::fs::metadata(legacy::v1_db(target))+ .ok()+ .map(|m| m.len());Ok(DryRun {archive: scanned.archive_totals(),move_entries: scanned.with(Action::Move).cloned().collect(),@@ -247,7 +256,11 @@ fn move_entry(from: &Path, to: &Path) -> Result<(), LayoutError> {}/// Step 6. Archives, verifies and publishes the archive; returns its file count.-async fn write_archive(target: &Target, state: &LayoutState, plan: &Plan) -> Result<u64, LayoutError> {+async fn write_archive(+ target: &Target,+ state: &LayoutState,+ plan: &Plan,+) -> Result<u64, LayoutError> {let final_path = target.backups().join(&state.archive);if final_path.is_file() {let path = final_path.clone();@@ -267,7 +280,11 @@ async fn write_archive(target: &Target, state: &LayoutState, plan: &Plan) -> Resplan::join(&workspace, &entry.path)};if std::fs::symlink_metadata(&at).is_ok() {- sources.push(Source { rel: entry.path.clone(), action: entry.action, at });+ sources.push(Source {+ rel: entry.path.clone(),+ action: entry.action,+ at,+ });}}// The database about to be deleted must be whole in its `.db` file.@@ -278,15 +295,19 @@ async fn write_archive(target: &Target, state: &LayoutState, plan: &Plan) -> Reslet tmp = final_path.with_file_name(format!("{}.tmp", state.archive));let (user, created) = (target.user_id.clone(), state.started_ms);let written = tmp.clone();- let manifest = tokio::task::spawn_blocking(move || -> Result<archive::Manifest, LayoutError> {- archive::write(&written, &user, created, &sources)?;- archive::verify(&written)- })- .await- .map_err(|e| LayoutError::Other(e.into()))??;+ let manifest =+ tokio::task::spawn_blocking(move || -> Result<archive::Manifest, LayoutError> {+ archive::write(&written, &user, created, &sources)?;+ archive::verify(&written)+ })+ .await+ .map_err(|e| LayoutError::Other(e.into()))??;std::fs::rename(&tmp, &final_path)?;// The sidecar was written beside the temp name; give it the final name.- let _ = std::fs::rename(archive::sidecar_path(&tmp), archive::sidecar_path(&final_path));+ let _ = std::fs::rename(+ archive::sidecar_path(&tmp),+ archive::sidecar_path(&final_path),+ );Ok(manifest.files.len() as u64)}@@ -295,10 +316,14 @@ async fn write_archive(target: &Target, state: &LayoutState, plan: &Plan) -> Resfn finish(target: &Target, state: &LayoutState, plan: &Plan) -> Result<(), LayoutError> {let archive = target.backups().join(&state.archive);if !archive.is_file() || !state.has(Step::Archive) {- return Err(LayoutError::Verify("no verified archive; refusing to delete".to_owned()));+ return Err(LayoutError::Verify(+ "no verified archive; refusing to delete".to_owned(),+ ));}if legacy::v1_db(target).is_file() && !target.storage_db().is_file() {- return Err(LayoutError::Verify("no verified storage.db; refusing to delete".to_owned()));+ return Err(LayoutError::Verify(+ "no verified storage.db; refusing to delete".to_owned(),+ ));}std::fs::create_dir_all(target.files())?;LayoutVersion::mark_v2(&target.profile_dir)?;@@ -322,7 +347,10 @@ fn finish(target: &Target, state: &LayoutState, plan: &Plan) -> Result<(), Layou/// Removes `path`, which must lie below `base`, without following symlinks.fn remove_within(base: &Path, path: &Path) -> Result<(), LayoutError> {if !path.starts_with(base) || path == base {- return Err(LayoutError::Verify(format!("refusing to delete {}", path.display())));+ return Err(LayoutError::Verify(format!(+ "refusing to delete {}",+ path.display()+ )));}match std::fs::symlink_metadata(path) {Ok(meta) if meta.is_dir() => std::fs::remove_dir_all(path)?,@@ -362,7 +390,9 @@ pub async fn restore(target: &Target, archive_path: &Path) -> Result<RestoreRepolet mut set_aside = None;let db = target.storage_db();if db.is_file() {- let aside = target.profile_dir.join(format!("storage.v2-{}.db", now_ms()));+ let aside = target+ .profile_dir+ .join(format!("storage.v2-{}.db", now_ms()));std::fs::rename(&db, &aside)?;for suffix in ["-wal", "-shm"] {let mut name = db.file_name().unwrap_or_default().to_os_string();@@ -408,7 +438,10 @@ pub async fn auto_migrate(config: &Config) -> bool {let Some(target) = Target::from_config(config) else {return false;};- let options = Options { env_url: std::env::var(crate::storage::STORAGE_URL_VAR).ok(), ..Options::default() };+ let options = Options {+ env_url: std::env::var(crate::storage::STORAGE_URL_VAR).ok(),+ ..Options::default()+ };match migrate(&target, config, &options).await {Ok(Outcome::Migrated(report)) => {tracing::info!(diff --git a/crates/openhuman-core/src/storage/layout/run_tests.rs b/crates/openhuman-core/src/storage/layout/run_tests.rsindex e8f0b7d637..7894713703 100644--- a/crates/openhuman-core/src/storage/layout/run_tests.rs+++ b/crates/openhuman-core/src/storage/layout/run_tests.rs@@ -33,29 +33,65 @@ fn exists(path: &Path) -> bool {fn assert_migrated(fx: &Fixture) {let profile = &fx.target.profile_dir;let (ws, files) = (fx.workspace(), fx.target.files());- assert_eq!(std::fs::read_to_string(profile.join(".layout")).unwrap().trim(), "2");- assert!(!exists(&profile.join(STATE_FILE)), "the progress file is removed last");+ assert_eq!(+ std::fs::read_to_string(profile.join(".layout"))+ .unwrap()+ .trim(),+ "2"+ );+ assert!(+ !exists(&profile.join(STATE_FILE)),+ "the progress file is removed last"+ );// the database came acrossassert_eq!(fixture_docs(&fx.target.storage_db()).len(), 3);let jobs = crate::storage::layout::test_fixtures::jobs_value(&fx.target.storage_db());- assert_eq!(jobs, Some(serde_json::json!({"jobs": [1, 2, 3]})), "imported state is in the v2 database");+ assert_eq!(+ jobs,+ Some(serde_json::json!({"jobs": [1, 2, 3]})),+ "imported state is in the v2 database"+ );// user files moved- assert_eq!(std::fs::read_to_string(files.join("skills/s1/SKILL.md")).unwrap(), "# skill one\n");+ assert_eq!(+ std::fs::read_to_string(files.join("skills/s1/SKILL.md")).unwrap(),+ "# skill one\n"+ );assert!(files.join("attachments/photo.jpg").is_file());assert!(files.join("artifacts/a1/plan.md").is_file());- assert_eq!(std::fs::read_to_string(files.join("STYLE.md")).unwrap(), "be brief\n");+ assert_eq!(+ std::fs::read_to_string(files.join("STYLE.md")).unwrap(),+ "be brief\n"+ );assert!(files.join("state/costs.jsonl").is_file());assert!(files.join("memory/legacy_claims/c.json").is_file());- for gone in ["skills", "attachments", "artifacts", "STYLE.md", "SOUL.md", "state"] {+ for gone in [+ "skills",+ "attachments",+ "artifacts",+ "STYLE.md",+ "SOUL.md",+ "state",+ ] {assert!(!exists(&ws.join(gone)), "{gone} left workspace/");}// archived originals deleted- for gone in ["storage", "memory/jobs.json", "memory/conversations", "memory"] {+ for gone in [+ "storage",+ "memory/jobs.json",+ "memory/conversations",+ "memory",+ ] {assert!(!exists(&ws.join(gone)), "{gone} was not deleted");}// unknown entries untouched- assert_eq!(std::fs::read_to_string(ws.join("mystery/data.bin")).unwrap(), "???");- assert_eq!(std::fs::read_to_string(ws.join("notes.tmp")).unwrap(), "scratch");+ assert_eq!(+ std::fs::read_to_string(ws.join("mystery/data.bin")).unwrap(),+ "???"+ );+ assert_eq!(+ std::fs::read_to_string(ws.join("notes.tmp")).unwrap(),+ "scratch"+ );// the archive is whole and holds what was moved and deletedlet found = archives(fx);assert_eq!(found.len(), 1, "{found:?}");@@ -71,10 +107,15 @@ fn assert_migrated(fx: &Fixture) {] {assert!(paths.contains(&want), "{want} not archived: {paths:?}");}- assert!(!paths.iter().any(|p| p.contains("mystery") || p.contains("notes.tmp")));+ assert!(!paths+ .iter()+ .any(|p| p.contains("mystery") || p.contains("notes.tmp")));// the config layer now reads it as v2let layout = crate::config::schema::ProfileLayout::resolve_at(profile.clone());- assert_eq!(layout.version, crate::config::schema::profile_layout::LayoutVersion::V2);+ assert_eq!(+ layout.version,+ crate::config::schema::profile_layout::LayoutVersion::V2+ );assert_eq!(layout.workspace_dir, files);}@@ -82,15 +123,34 @@ fn assert_migrated(fx: &Fixture) {async fn a_dry_run_reports_the_plan_and_writes_nothing() {let fx = v1_profile();let before = tree(fx.root());- let Outcome::DryRun(plan) = go(&fx, &Options { dry_run: true, ..opts() }).await.unwrap() else {+ let Outcome::DryRun(plan) = go(+ &fx,+ &Options {+ dry_run: true,+ ..opts()+ },+ )+ .await+ .unwrap() else {panic!("expected a dry run");};- assert_eq!(tree(fx.root()), before, "a dry run writes nothing, not even a lock file");- let paths = |entries: &[plan::Entry]| entries.iter().map(|e| e.path.clone()).collect::<Vec<_>>();+ assert_eq!(+ tree(fx.root()),+ before,+ "a dry run writes nothing, not even a lock file"+ );+ let paths =+ |entries: &[plan::Entry]| entries.iter().map(|e| e.path.clone()).collect::<Vec<_>>();assert!(paths(&plan.move_entries).contains(&"skills".to_owned()));assert!(paths(&plan.delete_entries).contains(&"memory/jobs.json".to_owned()));- assert_eq!(paths(&plan.unknown_entries), vec!["mystery".to_owned(), "notes.tmp".to_owned()]);- assert_eq!(plan.archive.files, plan.move_totals.files + plan.delete_totals.files);+ assert_eq!(+ paths(&plan.unknown_entries),+ vec!["mystery".to_owned(), "notes.tmp".to_owned()]+ );+ assert_eq!(+ plan.archive.files,+ plan.move_totals.files + plan.delete_totals.files+ );assert!(plan.archive.bytes > 0 && plan.database_bytes.unwrap() > 0);assert_eq!(plan.archive_dir, fx.target.backups());assert!(!plan.resuming);@@ -102,17 +162,28 @@ async fn a_full_run_migrates_the_profile() {let original = tree(&fx.workspace());let report = migrated(&fx).await;assert_eq!(report.steps_run, Step::ALL.to_vec());- assert_eq!(report.unknown, vec!["mystery".to_owned(), "notes.tmp".to_owned()]);- assert!(report.moved.contains(&"skills".to_owned()) && report.deleted.contains(&"storage".to_owned()));+ assert_eq!(+ report.unknown,+ vec!["mystery".to_owned(), "notes.tmp".to_owned()]+ );+ assert!(+ report.moved.contains(&"skills".to_owned())+ && report.deleted.contains(&"storage".to_owned())+ );assert!(report.database_rows.unwrap() > 0 && report.restart_required);assert_eq!(report.archive, archives(&fx)[0]);assert_migrated(&fx);// a profile's workspace never grows files the migration did not account forfor (path, digest) in &original {- let in_archive_or_left = path.starts_with("mystery") || path == "notes.tmp" || path.starts_with("storage");+ let in_archive_or_left =+ path.starts_with("mystery") || path == "notes.tmp" || path.starts_with("storage");let moved = fx.target.files().join(path);if !in_archive_or_left && exists(&moved) {- assert_eq!(&tree(&fx.target.files())[path], digest, "{path} changed in the move");+ assert_eq!(+ &tree(&fx.target.files())[path],+ digest,+ "{path} changed in the move"+ );}}}@@ -122,7 +193,12 @@ async fn a_second_run_after_a_finished_migration_is_a_noop() {let fx = v1_profile();migrated(&fx).await;let before = tree(fx.root());- assert_eq!(go(&fx, &opts()).await.unwrap(), Outcome::Noop { reason: Noop::AlreadyV2 });+ assert_eq!(+ go(&fx, &opts()).await.unwrap(),+ Outcome::Noop {+ reason: Noop::AlreadyV2+ }+ );assert_eq!(tree(fx.root()), before);}@@ -130,20 +206,44 @@ async fn a_second_run_after_a_finished_migration_is_a_noop() {async fn a_crash_at_any_step_resumes_to_the_same_result() {for crashed in Step::ALL {let fx = v1_profile();- let error = go(&fx, &Options { crash_after: Some(crashed), ..opts() }).await.unwrap_err();- assert!(matches!(error, LayoutError::InjectedCrash(s) if s == crashed), "{crashed:?}: {error}");+ let error = go(+ &fx,+ &Options {+ crash_after: Some(crashed),+ ..opts()+ },+ )+ .await+ .unwrap_err();+ assert!(+ matches!(error, LayoutError::InjectedCrash(s) if s == crashed),+ "{crashed:?}: {error}"+ );assert!(fx.target.profile_dir.join(STATE_FILE).is_file(),"{crashed:?}: a crash leaves the progress file for the resume");// dry run during the interruption says it would resume- if let Outcome::DryRun(plan) = go(&fx, &Options { dry_run: true, ..opts() }).await.unwrap() {+ if let Outcome::DryRun(plan) = go(+ &fx,+ &Options {+ dry_run: true,+ ..opts()+ },+ )+ .await+ .unwrap()+ {assert!(plan.resuming, "{crashed:?}");} else {panic!("dry run");}let report = migrated(&fx).await;- assert_eq!(report.steps_run.first(), Some(&crashed), "{crashed:?}: the unrecorded step re-runs");+ assert_eq!(+ report.steps_run.first(),+ Some(&crashed),+ "{crashed:?}: the unrecorded step re-runs"+ );assert_migrated(&fx);}}@@ -152,7 +252,14 @@ async fn a_crash_at_any_step_resumes_to_the_same_result() {async fn repeated_crashes_still_converge() {let fx = v1_profile();for crashed in Step::ALL.iter().take(5) {- let _ = go(&fx, &Options { crash_after: Some(*crashed), ..opts() }).await;+ let _ = go(+ &fx,+ &Options {+ crash_after: Some(*crashed),+ ..opts()+ },+ )+ .await;}migrated(&fx).await;assert_migrated(&fx);@@ -166,7 +273,11 @@ async fn a_second_migrator_is_refused_while_one_holds_the_lock() {let error = go(&fx, &opts()).await.unwrap_err();assert!(matches!(error, LayoutError::Locked(_)), "{error}");assert!(error.to_string().starts_with("LAYOUT_LOCKED"));- assert_eq!(tree(&fx.workspace()), before, "the refused migrator touched nothing");+ assert_eq!(+ tree(&fx.workspace()),+ before,+ "the refused migrator touched nothing"+ );// restore takes the same lockassert!(matches!(restore(&fx.target, Path::new("/nonexistent.tar.zst")).await,@@ -181,19 +292,45 @@ async fn a_second_migrator_is_refused_while_one_holds_the_lock() {async fn an_explicit_url_runs_only_the_schema_migrations() {let fx = v1_profile();let before = tree(fx.root());- let memory = Options { env_url: Some("memory".to_owned()), ..opts() };- assert_eq!(go(&fx, &memory).await.unwrap(), Outcome::Noop { reason: Noop::ExplicitUrl });- assert_eq!(tree(fx.root()), before, "no layout change for an explicit backend");+ let memory = Options {+ env_url: Some("memory".to_owned()),+ ..opts()+ };+ assert_eq!(+ go(&fx, &memory).await.unwrap(),+ Outcome::Noop {+ reason: Noop::ExplicitUrl+ }+ );+ assert_eq!(+ tree(fx.root()),+ before,+ "no layout change for an explicit backend"+ );// MongoDB: a dry run must not even try to connect- let mongo = Options { env_url: Some("mongodb://u:[email protected]/oh".to_owned()), dry_run: true, ..opts() };- assert_eq!(go(&fx, &mongo).await.unwrap(), Outcome::Noop { reason: Noop::ExplicitUrl });+ let mongo = Options {+ env_url: Some("mongodb://u:[email protected]/oh".to_owned()),+ dry_run: true,+ ..opts()+ };+ assert_eq!(+ go(&fx, &mongo).await.unwrap(),+ Outcome::Noop {+ reason: Noop::ExplicitUrl+ }+ );// `[storage] url` counts the same as the environment variablelet mut config = fx.config.clone();config.storage.url = Some("memory".to_owned());let out = migrate(&fx.target, &config, &opts()).await.unwrap();- assert_eq!(out, Outcome::Noop { reason: Noop::ExplicitUrl });+ assert_eq!(+ out,+ Outcome::Noop {+ reason: Noop::ExplicitUrl+ }+ );assert_eq!(tree(fx.root()), before);}@@ -205,7 +342,12 @@ async fn a_new_or_marked_profile_is_already_v2() {config: Config::default(),dir,};- assert_eq!(go(&fx, &opts()).await.unwrap(), Outcome::Noop { reason: Noop::AlreadyV2 });+ assert_eq!(+ go(&fx, &opts()).await.unwrap(),+ Outcome::Noop {+ reason: Noop::AlreadyV2+ }+ );assert!(!fx.target.profile_dir.exists(), "a no-op creates nothing");}@@ -215,9 +357,18 @@ async fn a_moved_entry_never_overwrites_a_file_already_in_files() {write(&fx.target.files().join("STYLE.md"), "already here");let error = go(&fx, &opts()).await.unwrap_err();assert!(matches!(error, LayoutError::Conflict(_)), "{error}");- assert_eq!(std::fs::read_to_string(fx.target.files().join("STYLE.md")).unwrap(), "already here");- assert_eq!(std::fs::read_to_string(fx.workspace().join("STYLE.md")).unwrap(), "be brief\n");- assert!(fx.workspace().join("memory/jobs.json").is_file(), "nothing was deleted");+ assert_eq!(+ std::fs::read_to_string(fx.target.files().join("STYLE.md")).unwrap(),+ "already here"+ );+ assert_eq!(+ std::fs::read_to_string(fx.workspace().join("STYLE.md")).unwrap(),+ "be brief\n"+ );+ assert!(+ fx.workspace().join("memory/jobs.json").is_file(),+ "nothing was deleted"+ );assert!(!fx.target.profile_dir.join(".layout").exists());}@@ -238,7 +389,10 @@ async fn restore_returns_the_profile_to_layout_v1() {let restored = restore(&fx.target, &report.archive).await.unwrap();assert!(restored.restart_required && restored.files > 0);- assert!(restored.v2_database.as_ref().unwrap().is_file(), "the v2 database is set aside, not deleted");+ assert!(+ restored.v2_database.as_ref().unwrap().is_file(),+ "the v2 database is set aside, not deleted"+ );assert!(!fx.target.storage_db().exists());assert!(!fx.target.profile_dir.join(".layout").exists());assert_eq!(@@ -254,7 +408,10 @@ async fn restore_returns_the_profile_to_layout_v1() {}assert!(fx.workspace().join("storage/storage.db").is_file());for moved in ["skills", "STYLE.md", "state"] {- assert!(!exists(&fx.target.files().join(moved)), "{moved} still in files/");+ assert!(+ !exists(&fx.target.files().join(moved)),+ "{moved} still in files/"+ );}// and the v1 database holds the data againassert_eq!(fixture_docs(&legacy::v1_db(&fx.target)).len(), 3);@@ -280,11 +437,25 @@ async fn restore_refuses_a_corrupt_archive_and_a_migration_in_progress() {std::fs::write(&bad, bytes).unwrap();let before = tree(&fx.target.profile_dir);assert!(restore(&fx.target, &bad).await.is_err());- assert_eq!(tree(&fx.target.profile_dir), before, "a failed restore changes nothing");+ assert_eq!(+ tree(&fx.target.profile_dir),+ before,+ "a failed restore changes nothing"+ );let busy = v1_profile();- let _ = go(&busy, &Options { crash_after: Some(Step::Import), ..opts() }).await;- let error = restore(&busy.target, &report.archive).await.unwrap_err().to_string();+ let _ = go(+ &busy,+ &Options {+ crash_after: Some(Step::Import),+ ..opts()+ },+ )+ .await;+ let error = restore(&busy.target, &report.archive)+ .await+ .unwrap_err()+ .to_string();assert!(error.contains("in progress"), "{error}");}@@ -292,8 +463,14 @@ async fn restore_refuses_a_corrupt_archive_and_a_migration_in_progress() {fn a_live_core_on_the_v1_database_is_detected() {let target = Target::new(Path::new("/r"), "u1");let url = legacy::v1_url(&target);- assert_eq!(live_conflict(&target, Some(url)), Some("sqlite:/r/users/u1/workspace/storage".to_owned()));- assert_eq!(live_conflict(&target, Some("sqlite:/elsewhere".to_owned())), None);+ assert_eq!(+ live_conflict(&target, Some(url)),+ Some("sqlite:/r/users/u1/workspace/storage".to_owned())+ );+ assert_eq!(+ live_conflict(&target, Some("sqlite:/elsewhere".to_owned())),+ None+ );assert_eq!(live_conflict(&target, None), None);}diff --git a/crates/openhuman-core/src/storage/layout/schemas.rs b/crates/openhuman-core/src/storage/layout/schemas.rsindex 01e72a504d..566f2c1d8b 100644--- a/crates/openhuman-core/src/storage/layout/schemas.rs+++ b/crates/openhuman-core/src/storage/layout/schemas.rs@@ -18,14 +18,28 @@ pub fn all_controller_schemas() -> Vec<ControllerSchema> {/// The registered controllers.pub fn all_registered_controllers() -> Vec<RegisteredController> {vec![- RegisteredController { schema: schemas("migrate"), handler: handle_migrate },- RegisteredController { schema: schemas("status"), handler: handle_status },- RegisteredController { schema: schemas("restore"), handler: handle_restore },+ RegisteredController {+ schema: schemas("migrate"),+ handler: handle_migrate,+ },+ RegisteredController {+ schema: schemas("status"),+ handler: handle_status,+ },+ RegisteredController {+ schema: schemas("restore"),+ handler: handle_restore,+ },]}fn field(name: &'static str, ty: TypeSchema, comment: &'static str, required: bool) -> FieldSchema {- FieldSchema { name, ty, comment, required }+ FieldSchema {+ name,+ ty,+ comment,+ required,+ }}/// The schema of `function`.@@ -90,8 +104,14 @@ fn handle_migrate(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFutSome(other) => return Err(format!("invalid 'dry_run': expected bool, got {other}")),};let (target, config) = target_of(&ctx).await?;- let options = Options { dry_run, env_url: env_url(), ..Options::default() };- let outcome = migrate(&target, &config, &options).await.map_err(|e| e.to_string())?;+ let options = Options {+ dry_run,+ env_url: env_url(),+ ..Options::default()+ };+ let outcome = migrate(&target, &config, &options)+ .await+ .map_err(|e| e.to_string())?;to_value(&outcome)})}@@ -99,7 +119,9 @@ fn handle_migrate(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFutfn handle_status(ctx: DispatchCtx, _params: Map<String, Value>) -> ControllerFuture {Box::pin(async move {let (target, config) = target_of(&ctx).await?;- let report = status(&target, &config, env_url()).await.map_err(|e| e.to_string())?;+ let report = status(&target, &config, env_url())+ .await+ .map_err(|e| e.to_string())?;to_value(&report)})}@@ -111,7 +133,9 @@ fn handle_restore(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFut.and_then(Value::as_str).ok_or_else(|| "missing required param 'archive'".to_owned())?;let (target, _config) = target_of(&ctx).await?;- let report = restore(&target, std::path::Path::new(archive)).await.map_err(|e| e.to_string())?;+ let report = restore(&target, std::path::Path::new(archive))+ .await+ .map_err(|e| e.to_string())?;to_value(&report)})}diff --git a/crates/openhuman-core/src/storage/layout/schemas_tests.rs b/crates/openhuman-core/src/storage/layout/schemas_tests.rsindex a3836b6cba..94eeda7166 100644--- a/crates/openhuman-core/src/storage/layout/schemas_tests.rs+++ b/crates/openhuman-core/src/storage/layout/schemas_tests.rs@@ -6,9 +6,22 @@ fn the_three_controllers_are_registered_under_storage() {.iter().map(|c| (c.schema.namespace, c.schema.function)).collect();- assert_eq!(names, vec![("storage", "migrate"), ("storage", "status"), ("storage", "restore")]);+ assert_eq!(+ names,+ vec![+ ("storage", "migrate"),+ ("storage", "status"),+ ("storage", "restore")+ ]+ );assert_eq!(all_controller_schemas().len(), 3);- assert!(schemas("restore").inputs.iter().any(|f| f.name == "archive" && f.required));- assert!(schemas("migrate").inputs.iter().any(|f| f.name == "dry_run" && !f.required));+ assert!(schemas("restore")+ .inputs+ .iter()+ .any(|f| f.name == "archive" && f.required));+ assert!(schemas("migrate")+ .inputs+ .iter()+ .any(|f| f.name == "dry_run" && !f.required));assert_eq!(schemas("nope").function, "unknown");}diff --git a/crates/openhuman-core/src/storage/layout/state.rs b/crates/openhuman-core/src/storage/layout/state.rsindex 5a1c7689a2..fd83fb308b 100644--- a/crates/openhuman-core/src/storage/layout/state.rs+++ b/crates/openhuman-core/src/storage/layout/state.rs@@ -169,9 +169,9 @@ impl LayoutState {/// An unreadable or unparsable file: the migration must not guess.pub fn load(profile_dir: &Path) -> Result<Option<Self>, LayoutError> {match std::fs::read(profile_dir.join(STATE_FILE)) {- Ok(bytes) => serde_json::from_slice(&bytes)- .map(Some)- .map_err(|e| LayoutError::Other(anyhow::anyhow!("the layout state file is damaged: {e}"))),+ Ok(bytes) => serde_json::from_slice(&bytes).map(Some).map_err(|e| {+ LayoutError::Other(anyhow::anyhow!("the layout state file is damaged: {e}"))+ }),Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(None),Err(e) => Err(e.into()),}@@ -222,7 +222,13 @@ impl LayoutState {fn sanitize(user: &str) -> String {let clean: String = user.chars()- .map(|c| if c.is_ascii_alphanumeric() || c == '-' || c == '_' { c } else { '_' })+ .map(|c| {+ if c.is_ascii_alphanumeric() || c == '-' || c == '_' {+ c+ } else {+ '_'+ }+ }).collect();if clean.is_empty() {"user".to_owned()diff --git a/crates/openhuman-core/src/storage/layout/state_tests.rs b/crates/openhuman-core/src/storage/layout/state_tests.rsindex f29e3f7242..2fcb30e282 100644--- a/crates/openhuman-core/src/storage/layout/state_tests.rs+++ b/crates/openhuman-core/src/storage/layout/state_tests.rs@@ -16,7 +16,11 @@ fn state_round_trips_and_records_each_step_once() {let dir = TempDir::new().unwrap();assert!(LayoutState::load(dir.path()).unwrap().is_none());let mut state = LayoutState::new("u/1 weird", 1_700_000_000_000);- assert!(state.archive.starts_with("u_1_weird-2023"), "{}", state.archive);+ assert!(+ state.archive.starts_with("u_1_weird-2023"),+ "{}",+ state.archive+ );assert!(state.archive.ends_with(".tar.zst"));state.finish(Step::Import, dir.path()).unwrap();state.finish(Step::Import, dir.path()).unwrap();diff --git a/crates/openhuman-core/src/storage/layout/status.rs b/crates/openhuman-core/src/storage/layout/status.rsindex aa7f906fcf..af57aa609a 100644--- a/crates/openhuman-core/src/storage/layout/status.rs+++ b/crates/openhuman-core/src/storage/layout/status.rs@@ -49,7 +49,11 @@ pub struct Status {////// An unreadable progress file. A database that cannot be read reports no/// versions rather than failing.-pub async fn status(target: &Target, config: &Config, env_url: Option<String>) -> Result<Status, LayoutError> {+pub async fn status(+ target: &Target,+ config: &Config,+ env_url: Option<String>,+) -> Result<Status, LayoutError> {let layout = LayoutVersion::detect(&target.profile_dir);let state = LayoutState::load(&target.profile_dir)?;let database = match layout {@@ -78,7 +82,9 @@ pub async fn status(target: &Target, config: &Config, env_url: Option<String>) -})}-async fn read_versions(db: &std::path::Path) -> Result<(Vec<OwnerVersion>, Option<i64>), LayoutError> {+async fn read_versions(+ db: &std::path::Path,+) -> Result<(Vec<OwnerVersion>, Option<i64>), LayoutError> {use tinystoragedrivers::schema::Progress;use tinystoragedrivers::{DocumentStoreExt, Query, MIGRATIONS_COLLECTION};let url = crate::storage::StorageUrl::parse(&format!("sqlite:{}", db.display()))@@ -107,7 +113,10 @@ async fn read_versions(db: &std::path::Path) -> Result<(Vec<OwnerVersion>, Optio}}Ok((- owners.into_iter().map(|(owner, version)| OwnerVersion { owner, version }).collect(),+ owners+ .into_iter()+ .map(|(owner, version)| OwnerVersion { owner, version })+ .collect(),last,))}diff --git a/crates/openhuman-core/src/storage/layout/test_fixtures.rs b/crates/openhuman-core/src/storage/layout/test_fixtures.rsindex f95cffedad..d7962a16b8 100644--- a/crates/openhuman-core/src/storage/layout/test_fixtures.rs+++ b/crates/openhuman-core/src/storage/layout/test_fixtures.rs@@ -82,14 +82,20 @@ pub fn v1_profile() -> Fixture {config_path: target.profile_dir.join("config.toml"),..Config::default()};- Fixture { dir, target, config }+ Fixture {+ dir,+ target,+ config,+ }}/// Every file under `root` with the digest of its bytes (and `<dir>` markers/// for directories), for before/after comparisons.pub fn tree(root: &Path) -> BTreeMap<String, String> {fn walk(dir: &Path, root: &Path, out: &mut BTreeMap<String, String>) {- let Ok(entries) = std::fs::read_dir(dir) else { return };+ let Ok(entries) = std::fs::read_dir(dir) else {+ return;+ };for entry in entries {let path = entry.unwrap().path();let rel = path.strip_prefix(root).unwrap().display().to_string();@@ -97,7 +103,10 @@ pub fn tree(root: &Path) -> BTreeMap<String, String> {out.insert(rel, "<dir>".to_owned());walk(&path, root, out);} else {- out.insert(rel, hex::encode(sha2::Sha256::digest(std::fs::read(&path).unwrap())));+ out.insert(+ rel,+ hex::encode(sha2::Sha256::digest(std::fs::read(&path).unwrap())),+ );}}}diff --git a/crates/openhuman-core/src/storage/state_kv_tests.rs b/crates/openhuman-core/src/storage/state_kv_tests.rsindex 6a5abbc977..917076c05c 100644--- a/crates/openhuman-core/src/storage/state_kv_tests.rs+++ b/crates/openhuman-core/src/storage/state_kv_tests.rs@@ -74,7 +74,8 @@ fn import_file_copies_a_legacy_file_once_and_leaves_it_in_place() {assert!(legacy.exists(), "the legacy file is not touched");// A later change is not overwritten by a re-import, nor resurrected after a delete.- kv.put("jobs", &BTreeMap::from([("a".to_string(), 9u32)])).unwrap();+ kv.put("jobs", &BTreeMap::from([("a".to_string(), 9u32)]))+ .unwrap();std::fs::write(&legacy, r#"{"a": 5}"#).unwrap();kv.import_file("jobs", &legacy).unwrap();assert_eq!(@@ -101,13 +102,15 @@ fn import_file_does_not_replace_an_existing_value() {fn import_file_records_a_missing_or_corrupt_file_without_failing() {let dir = tempfile::tempdir().unwrap();let kv = state(&MemoryStorage::new(), "local");- kv.import_file("none", &dir.path().join("missing.json")).unwrap();+ kv.import_file("none", &dir.path().join("missing.json"))+ .unwrap();let corrupt = dir.path().join("bad.json");std::fs::write(&corrupt, "{not json").unwrap();kv.import_file("bad", &corrupt).unwrap();assert!(kv.get::<serde_json::Value>("bad").unwrap().is_none());// A file that shows up after the import was recorded is not imported.std::fs::write(dir.path().join("missing.json"), "1").unwrap();- kv.import_file("none", &dir.path().join("missing.json")).unwrap();+ kv.import_file("none", &dir.path().join("missing.json"))+ .unwrap();assert!(kv.get::<u32>("none").unwrap().is_none());}diff --git a/crates/openhuman-rpc/src/session_store/mod.rs b/crates/openhuman-rpc/src/session_store/mod.rsindex 44337136af..b11bb7c814 100644--- a/crates/openhuman-rpc/src/session_store/mod.rs+++ b/crates/openhuman-rpc/src/session_store/mod.rs@@ -100,9 +100,11 @@ async fn configured_storage_url() -> anyhow::Result<Option<String>> {// Boot-time resolution: the host's own context, no turn's.let ctx = crate::core_host::core::runtime::DispatchCtx::host_default();let load = || async {- crate::core_host::config::ops::load_config_in(&ctx).await.map_err(|error| {- anyhow::anyhow!("loading the config to resolve the storage url: {error}")- })+ crate::core_host::config::ops::load_config_in(&ctx)+ .await+ .map_err(|error| {+ anyhow::anyhow!("loading the config to resolve the storage url: {error}")+ })};let mut config = load().await?;// `[storage] auto_migrate_layout`: move a layout-v1 profile to v2 beforediff --git a/tests/storage_layout_migration_e2e.rs b/tests/storage_layout_migration_e2e.rsindex 5403176017..dc0349be97 100644--- a/tests/storage_layout_migration_e2e.rs+++ b/tests/storage_layout_migration_e2e.rs@@ -82,7 +82,11 @@ fn migrate_dry_run_plans_a_v1_profile_and_writes_nothing() {let profile = v1_profile(home.path());let before = digest(&profile);- let plan = call(home.path(), "openhuman.storage_migrate", r#"{"dry_run":true}"#);+ let plan = call(+ home.path(),+ "openhuman.storage_migrate",+ r#"{"dry_run":true}"#,+ );assert_eq!(plan["result"], "dry_run", "{plan}");let paths = |key: &str| -> Vec<String> {plan[key]@@ -98,8 +102,17 @@ fn migrate_dry_run_plans_a_v1_profile_and_writes_nothing() {assert!(plan["archive"]["bytes"].as_u64().unwrap() > 0);assert_eq!(digest(&profile), before, "a dry run writes nothing");assert!(!home.path().join(".openhuman/backups").exists());- for created in [".layout", ".layout.lock", ".layout.state", "storage.db", "files"] {- assert!(!profile.join(created).exists(), "{created} must not exist after a dry run");+ for created in [+ ".layout",+ ".layout.lock",+ ".layout.state",+ "storage.db",+ "files",+ ] {+ assert!(+ !profile.join(created).exists(),+ "{created} must not exist after a dry run"+ );}}