Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

style: apply rustfmt formatting to storage modules

Steven Enamakel34d21c249835
diff --git a/crates/openhuman-core/src/modules/storage_host_linked.rs b/crates/openhuman-core/src/modules/storage_host_linked.rs
index ae65b8a944..f61a438111 100644
--- a/crates/openhuman-core/src/modules/storage_host_linked.rs
+++ b/crates/openhuman-core/src/modules/storage_host_linked.rs
@@ -64,9 +64,8 @@ pub(super) async fn attach(
connection: &tinybus::Connection,
host: Arc<StorageHost>,
) -> tinybus::Result<()> {
- *PENDING
- .lock()
- .unwrap_or_else(|poison| poison.into_inner()) = Some((host, tokio::runtime::Handle::current()));
+ *PENDING.lock().unwrap_or_else(|poison| poison.into_inner()) =
+ Some((host, tokio::runtime::Handle::current()));
modules.attach_linked_with_config(export::linked_module()?, serde_json::json!({}))?;
let name = STORAGE_INTERFACE;
let deadline = tokio::time::Instant::now() + READY_DEADLINE;
diff --git a/crates/openhuman-core/src/modules/storage_host_linked_tests.rs b/crates/openhuman-core/src/modules/storage_host_linked_tests.rs
index eddbad0bfc..579151667f 100644
--- a/crates/openhuman-core/src/modules/storage_host_linked_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_host_linked_tests.rs
@@ -159,11 +159,11 @@ async fn a_secret_outside_the_modules_grant_is_still_refused() {
let _turn = TURN.lock().await;
let bus = boot(Arc::new(MemoryStorage::new())).await;
let refused = bus.set_secret("someone_elses/key", b"x").await;
- assert!(refused.is_err(), "grant must be enforced behind attestation");
- assert!(!matches!(
- refused,
- Err(tinybus::Error::NotAttested { .. })
- ));
+ assert!(
+ refused.is_err(),
+ "grant must be enforced behind attestation"
+ );
+ assert!(!matches!(refused, Err(tinybus::Error::NotAttested { .. })));
}
#[tokio::test(flavor = "multi_thread")]
diff --git a/crates/openhuman-core/src/modules/storage_import_tinymcp.rs b/crates/openhuman-core/src/modules/storage_import_tinymcp.rs
index 06b7efa506..46ebceff10 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinymcp.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinymcp.rs
@@ -185,7 +185,9 @@ async fn import_into(
Err(error) if matches!(error.kind(), ErrorKind::Conflict | ErrorKind::AlreadyExists) => {}
Err(error) => return Err(anyhow!("write the marker: {:?}", error.kind())),
}
- tracing::info!("{LOG_PREFIX} imported servers={servers} secrets={secret_count} audit={audited}");
+ tracing::info!(
+ "{LOG_PREFIX} imported servers={servers} secrets={secret_count} audit={audited}"
+ );
Ok(Outcome::Imported {
servers,
secrets: secret_count,
diff --git a/crates/openhuman-core/src/modules/storage_import_tinymcp_tests.rs b/crates/openhuman-core/src/modules/storage_import_tinymcp_tests.rs
index 8773d92dec..d43da434e4 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinymcp_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinymcp_tests.rs
@@ -44,7 +44,10 @@ fn legacy_dir() -> tempfile::TempDir {
for (path, schema) in [(CLIENTS_DB, OLD_CLIENTS), (AUDIT_DB, AUDIT)] {
let file = dir.path().join(path);
std::fs::create_dir_all(file.parent().unwrap()).unwrap();
- Connection::open(file).unwrap().execute_batch(schema).unwrap();
+ Connection::open(file)
+ .unwrap()
+ .execute_batch(schema)
+ .unwrap();
}
dir
}
@@ -110,11 +113,15 @@ async fn servers_env_and_audit_rows_move_into_the_modules_storage() {
.await
.unwrap()
.expect("env secret");
- let env: std::collections::BTreeMap<String, String> =
- serde_json::from_slice(&stored).unwrap();
+ let env: std::collections::BTreeMap<String, String> = serde_json::from_slice(&stored).unwrap();
assert_eq!(env["API_KEY"], "sk-secret");
assert_eq!(env["REGION"], "eu");
- assert!(rig.secrets.get("mcp_client_env/srv-2").await.unwrap().is_none());
+ assert!(rig
+ .secrets
+ .get("mcp_client_env/srv-2")
+ .await
+ .unwrap()
+ .is_none());
let audit = rig
.scoped
@@ -139,7 +146,9 @@ async fn the_import_runs_once_and_never_resurrects_a_deleted_server() {
.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();
+ docs.delete(SERVERS, "srv-1", held.unchanged())
+ .await
+ .unwrap();
let again = import_into(&rig.scoped, &rig.secrets, legacy.path())
.await
@@ -163,7 +172,10 @@ async fn the_legacy_files_are_left_untouched() {
.unwrap();
let after = [CLIENTS_DB, AUDIT_DB].map(|path| digest(&legacy.path().join(path)));
assert_eq!(before, after);
- assert!(!legacy.path().join("mcp_clients/mcp_clients.db-wal").exists());
+ assert!(!legacy
+ .path()
+ .join("mcp_clients/mcp_clients.db-wal")
+ .exists());
}
#[tokio::test]
@@ -174,9 +186,14 @@ async fn a_record_the_module_already_wrote_is_not_overwritten() {
docs.ensure_collection(&CollectionSpec::new(SERVERS))
.await
.unwrap();
- docs.put(SERVERS, "srv-1", json!({"server_id": "srv-1", "newer": true}), Precondition::Absent)
- .await
- .unwrap();
+ docs.put(
+ SERVERS,
+ "srv-1",
+ json!({"server_id": "srv-1", "newer": true}),
+ Precondition::Absent,
+ )
+ .await
+ .unwrap();
rig.secrets
.set("mcp_client_env/srv-1", b"{\"API_KEY\":\"rotated\"}")
.await
@@ -195,7 +212,12 @@ async fn a_record_the_module_already_wrote_is_not_overwritten() {
);
let kept = docs.get(SERVERS, "srv-1").await.unwrap().unwrap();
assert_eq!(kept.doc["newer"], true);
- let secret = rig.secrets.get("mcp_client_env/srv-1").await.unwrap().unwrap();
+ let secret = rig
+ .secrets
+ .get("mcp_client_env/srv-1")
+ .await
+ .unwrap()
+ .unwrap();
assert_eq!(&secret[..], b"{\"API_KEY\":\"rotated\"}");
}
@@ -216,9 +238,15 @@ async fn an_unreadable_file_writes_no_marker_so_the_next_start_retries() {
let dir = tempfile::tempdir().unwrap();
let file = dir.path().join(CLIENTS_DB);
std::fs::create_dir_all(file.parent().unwrap()).unwrap();
- std::fs::write(&file, b"this is not a sqlite database at all, just text padding").unwrap();
+ std::fs::write(
+ &file,
+ b"this is not a sqlite database at all, just text padding",
+ )
+ .unwrap();
let rig = rig();
- assert!(import_into(&rig.scoped, &rig.secrets, dir.path()).await.is_err());
+ assert!(import_into(&rig.scoped, &rig.secrets, dir.path())
+ .await
+ .is_err());
let marker = rig
.scoped
.documents()