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
style(modules): rustfmt the storage importers
Steven Enamakelbb6c8244f15f
diff --git a/crates/openhuman-core/src/modules/import_once_tests.rs b/crates/openhuman-core/src/modules/import_once_tests.rsindex 02e5de4d8a..069b357ab3 100644--- a/crates/openhuman-core/src/modules/import_once_tests.rs+++ b/crates/openhuman-core/src/modules/import_once_tests.rs@@ -88,7 +88,11 @@ async fn the_import_is_keyed_by_the_explicit_contexts_scope_not_the_tasks() {};let dir = std::path::PathBuf::from("/import-once/tenants");let runs = std::sync::atomic::AtomicUsize::new(0);- for ctx in [profile("once-alice"), profile("once-bob"), profile("once-alice")] {+ for ctx in [+ profile("once-alice"),+ profile("once-bob"),+ profile("once-alice"),+ ] {import_once(&ctx, "test-tenants", MODULE_FOR_TEST, &dir, async {runs.fetch_add(1, std::sync::atomic::Ordering::SeqCst);Ok(Done(true))diff --git a/crates/openhuman-core/src/modules/storage_import_support.rs b/crates/openhuman-core/src/modules/storage_import_support.rsindex 9053384430..5475864755 100644--- a/crates/openhuman-core/src/modules/storage_import_support.rs+++ b/crates/openhuman-core/src/modules/storage_import_support.rs@@ -24,7 +24,7 @@ pub(super) fn module_scope(return Ok(None);};let scope = super::storage_host::current_module_scope(ctx, module_id)- .map_err(|error| anyhow!("resolve the module scope: {:?}", error.kind()))?;+ .map_err(|error| anyhow!("resolve the module scope: {:?}", error.kind()))?;let scoped = backend.for_scope(&scope).map_err(|error| anyhow!("open the module scope: {:?}", error.kind()))?;diff --git a/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs b/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rsindex 5dd8de4a9b..f2238fd863 100644--- a/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs@@ -27,8 +27,8 @@ use serde_json::{json, Value};use tinystoragedrivers::{CollectionSpec, ScopedStorage};use super::storage_grant_tinyconnectors::{MODULE_ID, PREFS_COLLECTION, TRIGGER_STREAM_PREFIX};-use crate::core::runtime::DispatchCtx;use super::storage_import_support as support;+use crate::core::runtime::DispatchCtx;const LOG_PREFIX: &str = "[connectors-import]";const PREFS_DIR: &str = "composio-user-scopes";diff --git a/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rs b/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rsindex 3e95b8bf42..96dc6c0a4c 100644--- a/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rs@@ -70,7 +70,9 @@ fn tree_digest(root: &Path) -> Vec<(String, Vec<u8>)> {async fn preferences_and_the_trigger_archive_move_into_the_modules_storage() {let legacy = legacy_state();let scoped = scoped();- let outcome = import_into(&DispatchCtx::host_default(), &scoped, legacy.path()).await.unwrap();+ let outcome = import_into(&DispatchCtx::host_default(), &scoped, legacy.path())+ .await+ .unwrap();// gmail + slack; the corrupt preference, the non-day archive name and the// unparsable archive line are skipped.assert_eq!(@@ -117,7 +119,9 @@ async fn preferences_and_the_trigger_archive_move_into_the_modules_storage() {async fn the_legacy_files_are_left_untouched() {let legacy = legacy_state();let before = tree_digest(legacy.path());- import_into(&DispatchCtx::host_default(), &scoped(), legacy.path()).await.unwrap();+ import_into(&DispatchCtx::host_default(), &scoped(), legacy.path())+ .await+ .unwrap();assert_eq!(tree_digest(legacy.path()), before);}@@ -125,7 +129,9 @@ async fn the_legacy_files_are_left_untouched() {async fn a_second_run_is_a_noop_even_after_the_module_changed_the_data() {let legacy = legacy_state();let scoped = scoped();- import_into(&DispatchCtx::host_default(), &scoped, legacy.path()).await.unwrap();+ import_into(&DispatchCtx::host_default(), &scoped, legacy.path())+ .await+ .unwrap();// The user later deletes a preference; the untouched file must not bring// it back.scoped@@ -134,7 +140,9 @@ async fn a_second_run_is_a_noop_even_after_the_module_changed_the_data() {.await.unwrap();assert_eq!(- import_into(&DispatchCtx::host_default(), &scoped, legacy.path()).await.unwrap(),+ import_into(&DispatchCtx::host_default(), &scoped, legacy.path())+ .await+ .unwrap(),Outcome::AlreadyDone);assert!(scoped@@ -165,7 +173,9 @@ async fn records_the_module_already_wrote_are_never_replaced_or_duplicated() {.await.unwrap();- let outcome = import_into(&DispatchCtx::host_default(), &scoped, legacy.path()).await.unwrap();+ let outcome = import_into(&DispatchCtx::host_default(), &scoped, legacy.path())+ .await+ .unwrap();assert_eq!(outcome,Outcome::Imported {@@ -195,13 +205,17 @@ async fn a_state_directory_without_legacy_files_writes_no_marker() {let empty = tempfile::tempdir().unwrap();let scoped = scoped();assert_eq!(- import_into(&DispatchCtx::host_default(), &scoped, empty.path()).await.unwrap(),+ import_into(&DispatchCtx::host_default(), &scoped, empty.path())+ .await+ .unwrap(),Outcome::NoSource);// Files that show up later (an older build still running) are still taken.let legacy = legacy_state();assert!(matches!(- import_into(&DispatchCtx::host_default(), &scoped, legacy.path()).await.unwrap(),+ import_into(&DispatchCtx::host_default(), &scoped, legacy.path())+ .await+ .unwrap(),Outcome::Imported { .. }));}@@ -216,7 +230,11 @@ async fn an_unreadable_preference_file_is_retried_instead_of_marked_done() {).unwrap();let scoped = scoped();- assert!(import_into(&DispatchCtx::host_default(), &scoped, legacy.path()).await.is_err());+ assert!(+ import_into(&DispatchCtx::host_default(), &scoped, legacy.path())+ .await+ .is_err()+ );assert!(scoped.documents().get(PREFS_COLLECTION, "gmail")@@ -226,7 +244,9 @@ async fn an_unreadable_preference_file_is_retried_instead_of_marked_done() {std::fs::remove_file(legacy.path().join(PREFS_DIR).join("bad.json")).unwrap();assert!(matches!(- import_into(&DispatchCtx::host_default(), &scoped, legacy.path()).await.unwrap(),+ import_into(&DispatchCtx::host_default(), &scoped, legacy.path())+ .await+ .unwrap(),Outcome::Imported { prefs: 2, .. }));}diff --git a/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs b/crates/openhuman-core/src/modules/storage_import_tinyjuice.rsindex 4a4781e56a..75edd9c104 100644--- a/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs@@ -28,8 +28,8 @@ use serde_json::json;use tinystoragedrivers::{Capability, ScopedStorage};use super::storage_grant_tinyjuice::{CCR_BLOB_PREFIX, MODULE_ID};-use crate::core::runtime::DispatchCtx;use super::storage_import_support as support;+use crate::core::runtime::DispatchCtx;const LOG_PREFIX: &str = "[tinyjuice-import]";/// `tinyjuice::cache::store::short_hash`: 16 bytes, hex encoded.diff --git a/crates/openhuman-core/src/modules/storage_import_tinyjuice_tests.rs b/crates/openhuman-core/src/modules/storage_import_tinyjuice_tests.rsindex 442d24a4fc..9302591773 100644--- a/crates/openhuman-core/src/modules/storage_import_tinyjuice_tests.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinyjuice_tests.rs@@ -49,7 +49,8 @@ async fn read(scoped: &ScopedStorage, token: &str) -> Option<String> {async fn originals_within_their_ttl_move_into_the_modules_blobs() {let legacy = legacy_root();let scoped = scoped();- let outcome = import_into(&DispatchCtx::host_default(),+ let outcome = import_into(+ &DispatchCtx::host_default(),&scoped,legacy.path(),Some(Duration::from_secs(3600)),@@ -83,9 +84,15 @@ async fn originals_within_their_ttl_move_into_the_modules_blobs() {async fn without_a_ttl_every_readable_original_is_kept() {let legacy = legacy_root();let scoped = scoped();- let outcome = import_into(&DispatchCtx::host_default(), &scoped, legacy.path(), None, SystemTime::now())- .await- .unwrap();+ let outcome = import_into(+ &DispatchCtx::host_default(),+ &scoped,+ legacy.path(),+ None,+ SystemTime::now(),+ )+ .await+ .unwrap();assert_eq!(outcome,Outcome::Imported {@@ -100,9 +107,15 @@ async fn without_a_ttl_every_readable_original_is_kept() {#[tokio::test]async fn the_legacy_files_are_left_in_place() {let legacy = legacy_root();- import_into(&DispatchCtx::host_default(), &scoped(), legacy.path(), None, SystemTime::now())- .await- .unwrap();+ import_into(+ &DispatchCtx::host_default(),+ &scoped(),+ legacy.path(),+ None,+ SystemTime::now(),+ )+ .await+ .unwrap();assert_eq!(std::fs::read_to_string(legacy.path().join(FRESH)).unwrap(),"fresh original\nline two"@@ -123,9 +136,15 @@ async fn a_second_run_is_a_noop_and_a_blob_already_stored_is_kept() {).await.unwrap();- let first = import_into(&DispatchCtx::host_default(), &scoped, legacy.path(), None, SystemTime::now())- .await- .unwrap();+ let first = import_into(+ &DispatchCtx::host_default(),+ &scoped,+ legacy.path(),+ None,+ SystemTime::now(),+ )+ .await+ .unwrap();assert_eq!(first,Outcome::Imported {@@ -139,9 +158,15 @@ async fn a_second_run_is_a_noop_and_a_blob_already_stored_is_kept() {Some("written by the module"));assert_eq!(- import_into(&DispatchCtx::host_default(), &scoped, legacy.path(), None, SystemTime::now())- .await- .unwrap(),+ import_into(+ &DispatchCtx::host_default(),+ &scoped,+ legacy.path(),+ None,+ SystemTime::now()+ )+ .await+ .unwrap(),Outcome::AlreadyDone);}@@ -152,17 +177,29 @@ async fn a_missing_directory_writes_no_marker() {let missing = dir.path().join("ccr");let scoped = scoped();assert_eq!(- import_into(&DispatchCtx::host_default(), &scoped, &missing, None, SystemTime::now())- .await- .unwrap(),+ import_into(+ &DispatchCtx::host_default(),+ &scoped,+ &missing,+ None,+ SystemTime::now()+ )+ .await+ .unwrap(),Outcome::NoSource);std::fs::create_dir(&missing).unwrap();std::fs::write(missing.join(FRESH), "late").unwrap();assert!(matches!(- import_into(&DispatchCtx::host_default(), &scoped, &missing, None, SystemTime::now())- .await- .unwrap(),+ import_into(+ &DispatchCtx::host_default(),+ &scoped,+ &missing,+ None,+ SystemTime::now()+ )+ .await+ .unwrap(),Outcome::Imported { imported: 1, .. }));}@@ -188,9 +225,15 @@ async fn a_symlinked_token_is_never_followed_into_storage() {let dir = tempfile::tempdir().unwrap();std::os::unix::fs::symlink(outside.path().join("secret"), dir.path().join(FRESH)).unwrap();let scoped = scoped();- let outcome = import_into(&DispatchCtx::host_default(), &scoped, dir.path(), None, SystemTime::now())- .await- .unwrap();+ let outcome = import_into(+ &DispatchCtx::host_default(),+ &scoped,+ dir.path(),+ None,+ SystemTime::now(),+ )+ .await+ .unwrap();assert!(matches!(outcome,Outcome::Imported {diff --git a/crates/openhuman-core/src/modules/storage_import_tinymcp.rs b/crates/openhuman-core/src/modules/storage_import_tinymcp.rsindex b67597bd7a..6bda90c9c6 100644--- a/crates/openhuman-core/src/modules/storage_import_tinymcp.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinymcp.rs@@ -75,7 +75,7 @@ pub(crate) async fn import_legacy(ctx: &DispatchCtx, data_dir: &Path) -> Result<return Ok(Outcome::NoBackend);};let scope = super::storage_host::current_module_scope(ctx, MODULE_ID)- .map_err(|error| anyhow!("resolve the module scope: {:?}", error.kind()))?;+ .map_err(|error| anyhow!("resolve the module scope: {:?}", error.kind()))?;let scoped = backend.for_scope(&scope).map_err(|error| anyhow!("open the module scope: {:?}", error.kind()))?;diff --git a/crates/openhuman-core/src/modules/storage_import_tinymcp_tests.rs b/crates/openhuman-core/src/modules/storage_import_tinymcp_tests.rsindex 2f413b9291..702edbd3b7 100644--- a/crates/openhuman-core/src/modules/storage_import_tinymcp_tests.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinymcp_tests.rs@@ -77,9 +77,14 @@ fn digest(path: &Path) -> Vec<u8> {async fn servers_env_and_audit_rows_move_into_the_modules_storage() {let legacy = legacy_dir();let rig = rig();- let outcome = import_into(&DispatchCtx::host_default(), &rig.scoped, &rig.secrets, legacy.path())- .await- .unwrap();+ let outcome = import_into(+ &DispatchCtx::host_default(),+ &rig.scoped,+ &rig.secrets,+ legacy.path(),+ )+ .await+ .unwrap();assert_eq!(outcome,Outcome::Imported {@@ -141,18 +146,28 @@ async fn servers_env_and_audit_rows_move_into_the_modules_storage() {async fn the_import_runs_once_and_never_resurrects_a_deleted_server() {let legacy = legacy_dir();let rig = rig();- import_into(&DispatchCtx::host_default(), &rig.scoped, &rig.secrets, legacy.path())- .await- .unwrap();+ import_into(+ &DispatchCtx::host_default(),+ &rig.scoped,+ &rig.secrets,+ legacy.path(),+ )+ .await+ .unwrap();let docs = rig.scoped.documents();let held = docs.get(SERVERS, "srv-1").await.unwrap().unwrap();docs.delete(SERVERS, "srv-1", held.unchanged()).await.unwrap();- let again = import_into(&DispatchCtx::host_default(), &rig.scoped, &rig.secrets, legacy.path())- .await- .unwrap();+ let again = import_into(+ &DispatchCtx::host_default(),+ &rig.scoped,+ &rig.secrets,+ legacy.path(),+ )+ .await+ .unwrap();assert_eq!(again, Outcome::AlreadyDone);assert!(docs.get(SERVERS, "srv-1").await.unwrap().is_none());assert_eq!(@@ -167,9 +182,14 @@ async fn the_legacy_files_are_left_untouched() {let legacy = legacy_dir();let before = [CLIENTS_DB, AUDIT_DB].map(|path| digest(&legacy.path().join(path)));let rig = rig();- import_into(&DispatchCtx::host_default(), &rig.scoped, &rig.secrets, legacy.path())- .await- .unwrap();+ import_into(+ &DispatchCtx::host_default(),+ &rig.scoped,+ &rig.secrets,+ legacy.path(),+ )+ .await+ .unwrap();let after = [CLIENTS_DB, AUDIT_DB].map(|path| digest(&legacy.path().join(path)));assert_eq!(before, after);assert!(!legacy@@ -199,9 +219,14 @@ async fn a_record_the_module_already_wrote_is_not_overwritten() {.await.unwrap();- let outcome = import_into(&DispatchCtx::host_default(), &rig.scoped, &rig.secrets, legacy.path())- .await- .unwrap();+ let outcome = import_into(+ &DispatchCtx::host_default(),+ &rig.scoped,+ &rig.secrets,+ legacy.path(),+ )+ .await+ .unwrap();assert_eq!(outcome,Outcome::Imported {@@ -226,9 +251,14 @@ async fn a_data_dir_with_no_legacy_files_is_a_no_op() {let empty = tempfile::tempdir().unwrap();let rig = rig();assert_eq!(- import_into(&DispatchCtx::host_default(), &rig.scoped, &rig.secrets, empty.path())- .await- .unwrap(),+ import_into(+ &DispatchCtx::host_default(),+ &rig.scoped,+ &rig.secrets,+ empty.path()+ )+ .await+ .unwrap(),Outcome::NoSource);}@@ -244,9 +274,14 @@ async fn an_unreadable_file_writes_no_marker_so_the_next_start_retries() {).unwrap();let rig = rig();- assert!(import_into(&DispatchCtx::host_default(), &rig.scoped, &rig.secrets, dir.path())- .await- .is_err());+ assert!(import_into(+ &DispatchCtx::host_default(),+ &rig.scoped,+ &rig.secrets,+ dir.path()+ )+ .await+ .is_err());let marker = rig.scoped.documents()diff --git a/crates/openhuman-core/src/modules/storage_import_tinywallet.rs b/crates/openhuman-core/src/modules/storage_import_tinywallet.rsindex 3f877957ae..faf4e585d4 100644--- a/crates/openhuman-core/src/modules/storage_import_tinywallet.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinywallet.rs@@ -27,8 +27,8 @@ use serde_json::json;use tinystoragedrivers::ScopedStorage;use super::storage_grant_tinywallet::{MODULE_ID, PAYMENTS_STREAM};-use crate::core::runtime::DispatchCtx;use super::storage_import_support as support;+use crate::core::runtime::DispatchCtx;const LOG_PREFIX: &str = "[x402-import]";const LEDGER_FILE: &str = "x402/payments.jsonl";diff --git a/crates/openhuman-core/src/modules/storage_import_tinywallet_tests.rs b/crates/openhuman-core/src/modules/storage_import_tinywallet_tests.rsindex 3f9ef05843..3857958e18 100644--- a/crates/openhuman-core/src/modules/storage_import_tinywallet_tests.rs+++ b/crates/openhuman-core/src/modules/storage_import_tinywallet_tests.rs@@ -41,7 +41,9 @@ fn digest(path: &Path) -> Vec<u8> {async fn the_payment_history_moves_into_the_modules_stream_in_order() {let legacy = legacy_workspace();let scoped = scoped();- let outcome = import_into(&DispatchCtx::host_default(), &scoped, legacy.path()).await.unwrap();+ let outcome = import_into(&DispatchCtx::host_default(), &scoped, legacy.path())+ .await+ .unwrap();assert_eq!(outcome,Outcome::Imported {@@ -77,7 +79,9 @@ async fn the_legacy_ledger_is_left_untouched() {let legacy = legacy_workspace();let file = legacy.path().join(LEDGER_FILE);let before = digest(&file);- import_into(&DispatchCtx::host_default(), &scoped(), legacy.path()).await.unwrap();+ import_into(&DispatchCtx::host_default(), &scoped(), legacy.path())+ .await+ .unwrap();assert_eq!(digest(&file), before);}@@ -85,9 +89,13 @@ async fn the_legacy_ledger_is_left_untouched() {async fn a_second_run_does_not_repeat_the_history() {let legacy = legacy_workspace();let scoped = scoped();- import_into(&DispatchCtx::host_default(), &scoped, legacy.path()).await.unwrap();+ import_into(&DispatchCtx::host_default(), &scoped, legacy.path())+ .await+ .unwrap();assert_eq!(- import_into(&DispatchCtx::host_default(), &scoped, legacy.path()).await.unwrap(),+ import_into(&DispatchCtx::host_default(), &scoped, legacy.path())+ .await+ .unwrap(),Outcome::AlreadyDone);assert_eq!(scoped.streams().len(PAYMENTS_STREAM).await.unwrap(), 3);@@ -106,7 +114,9 @@ async fn a_stream_the_module_already_wrote_is_not_preceded_by_old_records() {.await.unwrap();assert_eq!(- import_into(&DispatchCtx::host_default(), &scoped, legacy.path()).await.unwrap(),+ import_into(&DispatchCtx::host_default(), &scoped, legacy.path())+ .await+ .unwrap(),Outcome::Imported {payments: 0,skipped: 1@@ -120,12 +130,16 @@ async fn a_workspace_without_a_ledger_writes_no_marker() {let empty = tempfile::tempdir().unwrap();let scoped = scoped();assert_eq!(- import_into(&DispatchCtx::host_default(), &scoped, empty.path()).await.unwrap(),+ import_into(&DispatchCtx::host_default(), &scoped, empty.path())+ .await+ .unwrap(),Outcome::NoSource);let legacy = legacy_workspace();assert!(matches!(- import_into(&DispatchCtx::host_default(), &scoped, legacy.path()).await.unwrap(),+ import_into(&DispatchCtx::host_default(), &scoped, legacy.path())+ .await+ .unwrap(),Outcome::Imported { .. }));}@@ -137,12 +151,18 @@ async fn an_unreadable_ledger_is_retried_instead_of_marked_done() {std::fs::create_dir_all(file.parent().unwrap()).unwrap();std::fs::write(&file, [0xff, 0xfe]).unwrap();let scoped = scoped();- assert!(import_into(&DispatchCtx::host_default(), &scoped, dir.path()).await.is_err());+ assert!(+ import_into(&DispatchCtx::host_default(), &scoped, dir.path())+ .await+ .is_err()+ );assert_eq!(scoped.streams().len(PAYMENTS_STREAM).await.unwrap(), 0);std::fs::write(&file, format!("{}\n", record("p1", "settled"))).unwrap();assert_eq!(- import_into(&DispatchCtx::host_default(), &scoped, dir.path()).await.unwrap(),+ import_into(&DispatchCtx::host_default(), &scoped, dir.path())+ .await+ .unwrap(),Outcome::Imported {payments: 1,skipped: 0