Skip to content

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

style(tests): reorder imports and fix formatting

Steven Enamakelf24273271f9e
diff --git a/tests/agent_harness_e2e.rs b/tests/agent_harness_e2e.rs
index 0709ded6ba..931648f0a2 100644
--- a/tests/agent_harness_e2e.rs
+++ b/tests/agent_harness_e2e.rs
@@ -40,15 +40,15 @@ use std::time::Duration;
/// Prevents `ApprovalGate` from writing `./approval/approval.db` into the repo root.
static GATE_WORKSPACE: OnceLock<tempfile::TempDir> = OnceLock::new();
-use axum::http::{header::AUTHORIZATION, HeaderMap, StatusCode, Uri};
+use axum::http::{HeaderMap, StatusCode, Uri, header::AUTHORIZATION};
use axum::routing::{get, post};
use axum::{Json, Router};
use futures_util::StreamExt;
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use tempfile::tempdir;
use openhuman_core::agent_registry::host_definition::AgentDefinitionRegistry;
-use openhuman_core::core::auth::{init_rpc_token, CORE_TOKEN_ENV_VAR};
+use openhuman_core::core::auth::{CORE_TOKEN_ENV_VAR, init_rpc_token};
use openhuman_rpc::server::build_core_http_router;
const TEST_RPC_TOKEN: &str = "json-rpc-e2e-local-token";
@@ -3324,8 +3324,8 @@ async fn streaming_tool_call_accumulation() {
use openhuman_core::progress::AgentProgress;
use std::sync::Mutex;
use streaming_support::{
- agent_with_s, native_tool_response_s, text_response_s, workspace_s, EchoTool,
- ScriptedProvider,
+ EchoTool, ScriptedProvider, agent_with_s, native_tool_response_s, text_response_s,
+ workspace_s,
};
use tinyinference_llm::model::{ModelProfile, ModelStreamItem};
use tinyinference_llm::tool::ToolDelta;
diff --git a/tests/mcp_stdio_integration.rs b/tests/mcp_stdio_integration.rs
index b35973e5de..82ec7fe701 100644
--- a/tests/mcp_stdio_integration.rs
+++ b/tests/mcp_stdio_integration.rs
@@ -6,7 +6,7 @@
#![cfg(feature = "mcp")]
-use serde_json::{json, Value};
+use serde_json::{Value, json};
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.rs
index 708a8e124c..4b483a1d61 100644
--- a/tests/saas_mode/delivery_recovery.rs
+++ b/tests/saas_mode/delivery_recovery.rs
@@ -155,9 +155,11 @@ 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.rs
index d3b6043da9..2a49284ae7 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::{credential_id, MemoryRequest, MockMemory};
+use super::mock_memory::{MemoryRequest, MockMemory, credential_id};
use super::*;
const USERS: [&str; 3] = ["ann", "anna", "bob"];
diff --git a/tests/saas_mode/mock_llm.rs b/tests/saas_mode/mock_llm.rs
index 192eca4c89..39ebcb232f 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::{json, Value};
+use serde_json::{Value, json};
/// 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.rs
index d49e9076cc..5b91fd2fb0 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::{json, Value};
+use serde_json::{Value, json};
/// One request the mock served.
#[derive(Debug, Clone)]
@@ -545,7 +545,7 @@ fn forget(store: &mut Store, body: &Value) -> (u16, Value) {
let cascade = body["cascade"].as_str().unwrap_or("derived_only");
match cascade {
"derived_only" => {
- return ok(json!({ "deleted": { "events": 0 }, "requested": ids.len(), "matched": 0 }))
+ return ok(json!({ "deleted": { "events": 0 }, "requested": ids.len(), "matched": 0 }));
}
"redact_events" => {}
_ => return fail(400, "INVALID_CASCADE"),
diff --git a/tests/saas_mode/node.rs b/tests/saas_mode/node.rs
index 07856d9605..3756a15b29 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::{json, Value};
+use serde_json::{Value, json};
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::{sign, USER_HEADER, USER_SIG_HEADER};
+ use openhuman_core::profiles::gateway::{USER_HEADER, USER_SIG_HEADER, sign};
let response = client()
.post(format!("{}/rpc", node.base))
.bearer_auth(BEARER)
diff --git a/tests/saas_mode/support.rs b/tests/saas_mode/support.rs
index 4b91c4f592..5b1d661338 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::{json, Value};
+use serde_json::{Value, json};
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::{sign, USER_HEADER, USER_SIG_HEADER};
+ use openhuman_core::profiles::gateway::{USER_HEADER, USER_SIG_HEADER, sign};
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::{sign, USER_HEADER, USER_SIG_HEADER};
+ use openhuman_core::profiles::gateway::{USER_HEADER, USER_SIG_HEADER, sign};
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.rs
index 27adac3037..f7c634b7bf 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::{json, Value};
+use serde_json::{Value, json};
#[path = "saas_mode/support.rs"]
mod support;
@@ -132,12 +132,13 @@ 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}");
@@ -269,7 +270,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::{sign, USER_HEADER, USER_SIG_HEADER};
+ use openhuman_core::profiles::gateway::{USER_HEADER, USER_SIG_HEADER, sign};
let response = client
.post(format!("{base}/rpc"))
.bearer_auth(BEARER)
diff --git a/tests/support/local_mcp_http.rs b/tests/support/local_mcp_http.rs
index 4f251cf87a..284b25336a 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::{json, Value};
+use serde_json::{Value, json};
use std::sync::{Arc, Mutex};
use tokio::task::JoinHandle;
diff --git a/tests/support/scripted_stack.rs b/tests/support/scripted_stack.rs
index d5126d5470..0371c76ffd 100644
--- a/tests/support/scripted_stack.rs
+++ b/tests/support/scripted_stack.rs
@@ -13,9 +13,9 @@
use std::sync::{Mutex, MutexGuard};
-use axum::http::HeaderMap;
use axum::Json;
-use serde_json::{json, Value};
+use axum::http::HeaderMap;
+use serde_json::{Value, json};
/// Lock `m`, recovering the data when a panicking test poisoned it.
pub fn lock_or_recover<T>(m: &Mutex<T>) -> MutexGuard<'_, T> {