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: apply rustfmt formatting across tests and storage code
Steven Enamakel0e4b6a830d8d
diff --git a/crates/openhuman-app/Cargo.lock b/crates/openhuman-app/Cargo.lockindex f1d8ac8812..3656cf4149 100644--- a/crates/openhuman-app/Cargo.lock+++ b/crates/openhuman-app/Cargo.lock@@ -7886,7 +7886,7 @@ dependencies = [[[package]]name = "tinychannels-bus"-version = "0.1.40"+version = "0.1.42"dependencies = ["anyhow","async-trait",diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle_storage_adoption_tests.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle_storage_adoption_tests.rsindex 6e7bc4733b..18c7e0d645 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle_storage_adoption_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle_storage_adoption_tests.rs@@ -264,9 +264,10 @@ async fn a_detached_driver_uses_its_carried_actor_for_lifecycle_commits() {.unwrap().expect("detached lifecycle write committed in its carried actor scope");assert_eq!(durable.output, "detached actor result");- let bob_dispatch =- CoreContext::scope(bob.clone(), async { crate::core::runtime::DispatchCtx::ambient() })- .await;+ let bob_dispatch = CoreContext::scope(bob.clone(), async {+ crate::core::runtime::DispatchCtx::ambient()+ })+ .await;let other = super::super::persistence::OpenHumanPersistence::new(checkpoints).with_dispatch(bob_dispatch);assert!(other.load_terminal(&key).await.unwrap().is_none());diff --git a/crates/openhuman-core/src/cron/scheduler_headless_descendants_tests.rs b/crates/openhuman-core/src/cron/scheduler_headless_descendants_tests.rsindex bb317a2923..20ed69d89f 100644--- a/crates/openhuman-core/src/cron/scheduler_headless_descendants_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_headless_descendants_tests.rs@@ -38,7 +38,10 @@ impl CronChildModel {async fn wait_for_release(&self) {loop {let notified = self.child_release.notified();- if self.child_released.load(std::sync::atomic::Ordering::SeqCst) {+ if self+ .child_released+ .load(std::sync::atomic::Ordering::SeqCst)+ {return;}notified.await;@@ -355,7 +358,8 @@ async fn scheduled_agent_timeout_cancels_its_blocked_child_before_history_settle});let _model =crate::inference::provider::factory::test_provider_override::install_model(model.clone());- let (_temp, _storage, _storage_guard, config, core, dispatch, job) = scheduled_agent_fixture(15);+ let (_temp, _storage, _storage_guard, config, core, dispatch, job) =+ scheduled_agent_fixture(15);let inspect_dispatch = dispatch.clone();let (child_started_tx, child_started_rx) = tokio::sync::oneshot::channel();*model.child_started.lock().unwrap() = Some(child_started_tx);diff --git a/crates/openhuman-core/src/modules/storage_host_cdylib_stream_tests.rs b/crates/openhuman-core/src/modules/storage_host_cdylib_stream_tests.rsindex caede353ee..2b7dc40865 100644--- a/crates/openhuman-core/src/modules/storage_host_cdylib_stream_tests.rs+++ b/crates/openhuman-core/src/modules/storage_host_cdylib_stream_tests.rs@@ -31,9 +31,7 @@ async fn a_blob_over_the_bus_frame_round_trips_through_a_peer_bound_stream() {let rig = rig("tinyjuice").await;// 20 MiB: over the 16 MiB frame no inline call could carry.let len = 20 * MIB;- let stored = rig- .member("StreamPut", ("juice/ccr/streamed", len))- .await;+ let stored = rig.member("StreamPut", ("juice/ccr/streamed", len)).await;assert_eq!(stored["ok"]["len"], len, "{stored}");// It is in the module's own scope, byte for byte.let handle = rig.backend.for_scope(&rig.scope("tinyjuice")).unwrap();@@ -91,9 +89,7 @@ async fn a_streamed_blob_is_still_bound_by_the_grant_and_the_length() {"{denied_get}");// The module keeps working after a refusal.- let after = rig- .member("StreamPut", ("juice/ccr/after", 3 * MIB))- .await;+ let after = rig.member("StreamPut", ("juice/ccr/after", 3 * MIB)).await;assert_eq!(after["ok"]["len"], 3 * MIB, "{after}");}@@ -123,9 +119,7 @@ async fn an_inline_blob_no_frame_can_carry_fails_fast_instead_of_hanging() {.await.unwrap().is_none());- let after: Value = rig- .member("PutBlob", ("juice/ccr/after", 2048usize))- .await;+ let after: Value = rig.member("PutBlob", ("juice/ccr/after", 2048usize)).await;assert!(after.get("ok").is_some(),"the module keeps working: {after}"@@ -247,10 +241,7 @@ async fn a_second_module_cannot_read_or_take_the_first_modules_streams() {.peer_proxy(0, "Blobs").call("PutStream",- (- json!({"key": "juice/ccr/hijacked", "len": MIB}),- reference,- ),+ (json!({"key": "juice/ccr/hijacked", "len": MIB}), reference),).await;assert!(diff --git a/crates/openhuman-core/src/platform/connectivity/rpc_tests.rs b/crates/openhuman-core/src/platform/connectivity/rpc_tests.rsindex 0ef181b4ca..0a1d0792be 100644--- a/crates/openhuman-core/src/platform/connectivity/rpc_tests.rs+++ b/crates/openhuman-core/src/platform/connectivity/rpc_tests.rs@@ -15,8 +15,8 @@ async fn spawn_openhuman_probe_listener(listener.set_nonblocking(true).expect("set probe listener non-blocking");- let listener = tokio::net::TcpListener::from_std(listener)- .expect("adopt reserved probe listener");+ let listener =+ tokio::net::TcpListener::from_std(listener).expect("adopt reserved probe listener");let (shutdown_tx, mut shutdown_rx) = tokio::sync::oneshot::channel::<()>();let task = tokio::spawn(async move {diff --git a/crates/openhuman-core/src/profiles/host.rs b/crates/openhuman-core/src/profiles/host.rsindex e31346f722..5bd8daabd5 100644--- a/crates/openhuman-core/src/profiles/host.rs+++ b/crates/openhuman-core/src/profiles/host.rs@@ -34,9 +34,9 @@ use super::registry::ProfileRegistry;use super::types::{ProfileId, ProfileMeta, ProfileSummary};use crate::config::Config;use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet, SaasConfig};-use crate::storage::StorageBackend;use crate::storage::fence::{FenceRegistry, LeaseFence};use crate::storage::lease::{LeaseGrant, LeaseStore};+use crate::storage::StorageBackend;use crate::tools::toolpacks::ToolGroups;/// One open profile.diff --git a/crates/openhuman-core/src/profiles/host_storage_tests.rs b/crates/openhuman-core/src/profiles/host_storage_tests.rsindex 76bf4cfa44..a3414c2040 100644--- a/crates/openhuman-core/src/profiles/host_storage_tests.rs+++ b/crates/openhuman-core/src/profiles/host_storage_tests.rs@@ -37,11 +37,9 @@ async fn assert_supplied_backend_owns_the_cap_and_fence(crate::cron::client::store_in::<crate::cron::CronJob>(&config, &query_scope, agent_add()).await;let error = second.expect_err("the cap must be installed in the supplied backend");- assert!(- error- .to_string()- .contains("Failed to insert cron agent job")- );+ assert!(error+ .to_string()+ .contains("Failed to insert cron agent job"));let _opened = host.open(id).await.unwrap();let lease_ttl = host.saas().lease_ttl();diff --git a/crates/openhuman-core/src/storage/layout/run_tests.rs b/crates/openhuman-core/src/storage/layout/run_tests.rsindex a88f0db2e7..708a197870 100644--- a/crates/openhuman-core/src/storage/layout/run_tests.rs+++ b/crates/openhuman-core/src/storage/layout/run_tests.rs@@ -11,13 +11,10 @@ async fn go(fx: &Fixture, options: &Options) -> Result<Outcome, LayoutError> {}async fn migrated(fx: &Fixture) -> Box<Report> {- match go(fx, &opts())- .await- .unwrap_or_else(|error| {- eprintln!("layout migration failed: {error:#}");- panic!("layout migration did not complete")- })- {+ match go(fx, &opts()).await.unwrap_or_else(|error| {+ eprintln!("layout migration failed: {error:#}");+ panic!("layout migration did not complete")+ }) {Outcome::Migrated(report) => report,other => panic!("expected a migration, got {other:?}"),}diff --git a/crates/openhuman-core/src/storage/scope_move_boot.rs b/crates/openhuman-core/src/storage/scope_move_boot.rsindex 2731f77657..a1d1db5573 100644--- a/crates/openhuman-core/src/storage/scope_move_boot.rs+++ b/crates/openhuman-core/src/storage/scope_move_boot.rs@@ -279,7 +279,10 @@ fn backend_for_target_scope(source_path: &Path,) -> anyhow::Result<BackendForScope> {let parsed = target_scope.parsed()?;- if matches!(parsed.tenant, crate::storage::Tenant::Local | crate::storage::Tenant::Cluster) {+ if matches!(+ parsed.tenant,+ crate::storage::Tenant::Local | crate::storage::Tenant::Cluster+ ) {return Ok((Arc::clone(backend), None));}let crate::storage::Tenant::User(_) = parsed.tenant else {diff --git a/tests/agent_harness_e2e.rs b/tests/agent_harness_e2e.rsindex a6cd22515f..2fe054a311 100644--- a/tests/agent_harness_e2e.rs+++ b/tests/agent_harness_e2e.rs@@ -301,8 +301,7 @@ static PARENT_FIRST_LIMIT: std::sync::atomic::AtomicUsize = std::sync::atomic::Astatic PARENT_ANSWERED: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);static CHILD_RESPONSES_REQUIRED: std::sync::atomic::AtomicUsize =std::sync::atomic::AtomicUsize::new(0);-static CHILD_RESPONSES: std::sync::atomic::AtomicUsize =- std::sync::atomic::AtomicUsize::new(0);+static CHILD_RESPONSES: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);fn serialize_children_after_parent(parent_requests: usize, child_responses: usize) {PARENT_ANSWERED.store(0, std::sync::atomic::Ordering::SeqCst);@@ -363,15 +362,20 @@ async fn scripted_chat_completions(let parent_first = PARENT_FIRST_LIMIT.load(std::sync::atomic::Ordering::SeqCst);let is_orchestrator = parent_first > 0 && body_is_orchestrator(&body);- let child_responses_required = CHILD_RESPONSES_REQUIRED.load(std::sync::atomic::Ordering::SeqCst);+ let child_responses_required =+ CHILD_RESPONSES_REQUIRED.load(std::sync::atomic::Ordering::SeqCst);if parent_first > 0 {let deadline = std::time::Instant::now() + Duration::from_secs(15);while std::time::Instant::now() < deadline {- let parent_ready = PARENT_ANSWERED.load(std::sync::atomic::Ordering::SeqCst)- >= parent_first;+ let parent_ready =+ PARENT_ANSWERED.load(std::sync::atomic::Ordering::SeqCst) >= parent_first;let child_ready = CHILD_RESPONSES.load(std::sync::atomic::Ordering::SeqCst)>= child_responses_required;- if if is_orchestrator { parent_ready && child_ready } else { parent_ready } {+ if if is_orchestrator {+ parent_ready && child_ready+ } else {+ parent_ready+ } {break;}tokio::time::sleep(Duration::from_millis(10)).await;diff --git a/tests/json_rpc_agent_team_e2e.rs b/tests/json_rpc_agent_team_e2e.rsindex f471688eb9..5b1161bedc 100644--- a/tests/json_rpc_agent_team_e2e.rs+++ b/tests/json_rpc_agent_team_e2e.rs@@ -789,7 +789,11 @@ async fn removed_agent_work_and_team_methods_are_not_registered() {let error = assert_jsonrpc_error(&response, method);assert_eq!(error.get("code").and_then(Value::as_i64), Some(-32000));assert!(- error.get("message").and_then(Value::as_str).unwrap_or_default().contains("unknown method"),+ error+ .get("message")+ .and_then(Value::as_str)+ .unwrap_or_default()+ .contains("unknown method"),"retired method should remain unavailable: {error}");}diff --git a/tests/json_rpc_config_e2e.rs b/tests/json_rpc_config_e2e.rsindex 36d2b40a17..aaabcf95d2 100644--- a/tests/json_rpc_config_e2e.rs+++ b/tests/json_rpc_config_e2e.rs@@ -3,9 +3,7 @@#[path = "support/rpc_e2e_harness.rs"]mod harness;use harness::*;-use openhuman_core::platform::connectivity::rpc::{- pick_listen_port_for_host_with, OccupiedByCore,-};+use openhuman_core::platform::connectivity::rpc::{pick_listen_port_for_host_with, OccupiedByCore};#[tokio::test]async fn json_rpc_legacy_provider_type_preserves_default_endpoint() {@@ -560,13 +558,10 @@ async fn port_conflict_recovery_core_starts_on_fallback_port_e2e() {.collect();// ── 2. pick_listen_port should fall back to a neighbouring port ───────- let pick_result = pick_listen_port_for_host_with(- "127.0.0.1",- preferred,- OccupiedByCore::Fallback,- )- .await- .expect("pick_listen_port must succeed when port is occupied by non-OpenHuman process");+ let pick_result =+ pick_listen_port_for_host_with("127.0.0.1", preferred, OccupiedByCore::Fallback)+ .await+ .expect("pick_listen_port must succeed when port is occupied by non-OpenHuman process");assert!(pick_result.fallback_from.is_some(),"expected fallback_from to be Some({preferred}) when preferred port is occupied, got None"@@ -624,13 +619,10 @@ async fn port_conflict_recovery_core_starts_on_fallback_port_e2e() {// ── 5. drop blocker — verify the preferred port is now free ──────────drop(blocker);- let after_drop = pick_listen_port_for_host_with(- "127.0.0.1",- preferred,- OccupiedByCore::Fallback,- )- .await- .expect("pick_listen_port should succeed with 7788 free");+ let after_drop =+ pick_listen_port_for_host_with("127.0.0.1", preferred, OccupiedByCore::Fallback)+ .await+ .expect("pick_listen_port should succeed with 7788 free");assert_eq!(after_drop.port, preferred,"after releasing the blocker, pick_listen_port should bind directly on the preferred port"diff --git a/tests/mcp_stdio_integration.rs b/tests/mcp_stdio_integration.rsindex 27c932e298..f1a1c9d282 100644--- a/tests/mcp_stdio_integration.rs+++ b/tests/mcp_stdio_integration.rs@@ -6,7 +6,7 @@#![cfg(feature = "mcp")]-use serde_json::{Value, json};+use serde_json::{json, Value};use std::io::{BufRead, BufReader, Write};use std::process::{Command, Stdio};use std::sync::mpsc::{self, Receiver};diff --git a/tests/saas_mode/delivery_recovery.rs b/tests/saas_mode/delivery_recovery.rsindex 6c794ea0b8..5a107dbfcc 100644--- a/tests/saas_mode/delivery_recovery.rs+++ b/tests/saas_mode/delivery_recovery.rs@@ -155,11 +155,9 @@ fn leave_undelivered_result(d: &Deployment, user: &str) {store.put_fenced(&record, THREAD, &gate).expect("write the pending record under the parent gate");- assert!(- store- .release_parent_gate(THREAD, &gate)- .expect("release the fixture's parent gate")- );+ assert!(store+ .release_parent_gate(THREAD, &gate)+ .expect("release the fixture's parent gate"));}#[test]diff --git a/tests/saas_mode/memory.rs b/tests/saas_mode/memory.rsindex 2a49284ae7..d3b6043da9 100644--- a/tests/saas_mode/memory.rs+++ b/tests/saas_mode/memory.rs@@ -11,7 +11,7 @@use std::path::PathBuf;-use super::mock_memory::{MemoryRequest, MockMemory, credential_id};+use super::mock_memory::{credential_id, MemoryRequest, MockMemory};use super::*;const USERS: [&str; 3] = ["ann", "anna", "bob"];diff --git a/tests/saas_mode/mock_llm.rs b/tests/saas_mode/mock_llm.rsindex 39ebcb232f..192eca4c89 100644--- a/tests/saas_mode/mock_llm.rs+++ b/tests/saas_mode/mock_llm.rs@@ -20,7 +20,7 @@ use std::io::{BufRead, BufReader, Read, Write};use std::net::TcpStream;use std::sync::{Arc, Mutex};-use serde_json::{Value, json};+use serde_json::{json, Value};/// Marks a user message whose turn must stay in flight.pub const HANG: &str = "HANG-TURN";diff --git a/tests/saas_mode/mock_memory.rs b/tests/saas_mode/mock_memory.rsindex 5b91fd2fb0..28a293bd42 100644--- a/tests/saas_mode/mock_memory.rs+++ b/tests/saas_mode/mock_memory.rs@@ -20,7 +20,7 @@ use std::io::{BufRead, BufReader, Read, Write};use std::net::{TcpListener, TcpStream};use std::sync::{Arc, Mutex, PoisonError};-use serde_json::{Value, json};+use serde_json::{json, Value};/// One request the mock served.#[derive(Debug, Clone)]diff --git a/tests/saas_mode/node.rs b/tests/saas_mode/node.rsindex 3756a15b29..07856d9605 100644--- a/tests/saas_mode/node.rs+++ b/tests/saas_mode/node.rs@@ -6,7 +6,7 @@ use std::path::PathBuf;use std::process::{Command, Stdio};use std::time::{Duration, Instant};-use serde_json::{Value, json};+use serde_json::{json, Value};use super::*;@@ -156,7 +156,7 @@ pub fn client() -> reqwest::blocking::Client {/// POST /rpc for `user` on `node`: status, `X-OpenHuman-Profile-Owner`, body.pub fn call(node: &Node, user: &str, method: &str, params: Value) -> (u16, Option<String>, Value) {- use openhuman_core::profiles::gateway::{USER_HEADER, USER_SIG_HEADER, sign};+ use openhuman_core::profiles::gateway::{sign, USER_HEADER, USER_SIG_HEADER};let response = client().post(format!("{}/rpc", node.base)).bearer_auth(BEARER)diff --git a/tests/saas_mode/support.rs b/tests/saas_mode/support.rsindex 5b1d661338..4b91c4f592 100644--- a/tests/saas_mode/support.rs+++ b/tests/saas_mode/support.rs@@ -9,7 +9,7 @@ use std::path::{Path, PathBuf};use std::process::{Child, Command, Stdio};use std::time::{Duration, Instant};-use serde_json::{Value, json};+use serde_json::{json, Value};pub const BEARER: &str = "saas-e2e-gateway-bearer-0123456789abcdef";pub const TEST_MASTER_KEY: &str =@@ -261,7 +261,7 @@ pub fn user_rpc_with(method: &str,params: Value,) -> (u16, Value) {- use openhuman_core::profiles::gateway::{USER_HEADER, USER_SIG_HEADER, sign};+ use openhuman_core::profiles::gateway::{sign, USER_HEADER, USER_SIG_HEADER};let signature = sig.map(str::to_owned).unwrap_or_else(|| sign(BEARER, user, now()));@@ -307,7 +307,7 @@ pub fn thread_ids(body: &Value) -> Vec<String> {/// Open `/events?client_id=` for `user` and forward each SSE `data:` line.pub fn user_events(base: &str, user: &str, client_id: &str) -> std::sync::mpsc::Receiver<String> {- use openhuman_core::profiles::gateway::{USER_HEADER, USER_SIG_HEADER, sign};+ use openhuman_core::profiles::gateway::{sign, USER_HEADER, USER_SIG_HEADER};use std::io::BufRead;let (tx, rx) = std::sync::mpsc::channel();let url = format!("{base}/events?client_id={client_id}");diff --git a/tests/saas_mode_e2e.rs b/tests/saas_mode_e2e.rsindex f7c634b7bf..27adac3037 100644--- a/tests/saas_mode_e2e.rs+++ b/tests/saas_mode_e2e.rs@@ -7,7 +7,7 @@use std::process::{Command, Stdio};use std::time::{Duration, Instant};-use serde_json::{Value, json};+use serde_json::{json, Value};#[path = "saas_mode/support.rs"]mod support;@@ -132,13 +132,12 @@ fn a_safe_deployment_serves_core_and_the_operator_plane_behind_the_gateway_beare"a user id outside the raw charset maps to its deterministic hash");assert!(!body.to_string().contains("alice"), "{body}");- assert!(- d.root- .join("users")- .join(&profile_id)- .join("workspace")- .is_dir()- );+ assert!(d+ .root+ .join("users")+ .join(&profile_id)+ .join("workspace")+ .is_dir());let (_, body) = rpc(&client, &base, Some(BEARER), "openhuman.profiles_list");assert!(body.to_string().contains(&profile_id), "{body}");@@ -270,7 +269,7 @@ fn gateway_requests_run_under_the_named_users_profile() {assert_eq!(status, 403, "bob is not provisioned: {body}");// A repeated signature header is refused, not resolved to the first value.{- use openhuman_core::profiles::gateway::{USER_HEADER, USER_SIG_HEADER, sign};+ use openhuman_core::profiles::gateway::{sign, USER_HEADER, USER_SIG_HEADER};let response = client.post(format!("{base}/rpc")).bearer_auth(BEARER)diff --git a/tests/storage_desktop_upgrade_e2e.rs b/tests/storage_desktop_upgrade_e2e.rsindex 043dafd62c..6b5a4aed33 100644--- a/tests/storage_desktop_upgrade_e2e.rs+++ b/tests/storage_desktop_upgrade_e2e.rs@@ -437,12 +437,7 @@ async fn import_modules(workspace: &Path) {#[cfg(feature = "web3")]assert!(modules::import_legacy_x402(&ctx, workspace).await);modules::import_legacy_tinybox(&ctx, workspace).await;- modules::import_legacy_tinyjuice(- &ctx,- &workspace.join("ccr"),- None,- )- .await;+ modules::import_legacy_tinyjuice(&ctx, &workspace.join("ccr"), None).await;}#[tokio::test(flavor = "multi_thread", worker_threads = 2)]diff --git a/tests/support/local_mcp_http.rs b/tests/support/local_mcp_http.rsindex 284b25336a..4f251cf87a 100644--- a/tests/support/local_mcp_http.rs+++ b/tests/support/local_mcp_http.rs@@ -8,7 +8,7 @@ use axum::extract::State;use axum::http::StatusCode;use axum::routing::post;use axum::{Json, Router};-use serde_json::{Value, json};+use serde_json::{json, Value};use std::sync::{Arc, Mutex};use tokio::task::JoinHandle;diff --git a/tests/support/rpc_harness.rs b/tests/support/rpc_harness.rsindex efeec7426d..094ed0c449 100644--- a/tests/support/rpc_harness.rs+++ b/tests/support/rpc_harness.rs@@ -136,5 +136,6 @@ embedding_strict = falsecfg.to_string()};std::fs::write(openhuman_dir.join("config.toml"), &cfg).expect("write config.toml");- let _: openhuman_core::config::Config = toml::from_str(&cfg).expect("test config must match schema");+ let _: openhuman_core::config::Config =+ toml::from_str(&cfg).expect("test config must match schema");}diff --git a/tests/support/scripted_stack.rs b/tests/support/scripted_stack.rsindex 0371c76ffd..d5126d5470 100644--- a/tests/support/scripted_stack.rs+++ b/tests/support/scripted_stack.rs@@ -13,9 +13,9 @@use std::sync::{Mutex, MutexGuard};-use axum::Json;use axum::http::HeaderMap;-use serde_json::{Value, json};+use axum::Json;+use serde_json::{json, Value};/// Lock `m`, recovering the data when a panicking test poisoned it.pub fn lock_or_recover<T>(m: &Mutex<T>) -> MutexGuard<'_, T> {