Skip to content

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

style: apply rustfmt import ordering and assertion wrapping

Steven Enamakele694b213b8b4
diff --git a/crates/openhuman-core/src/cron/bus_host_tests.rs b/crates/openhuman-core/src/cron/bus_host_tests.rs
index 8c26fe0b35..40ac96556e 100644
--- a/crates/openhuman-core/src/cron/bus_host_tests.rs
+++ b/crates/openhuman-core/src/cron/bus_host_tests.rs
@@ -3,13 +3,13 @@ use super::*;
// the contract's `ScheduleHost` interface, against the real (linked) module.
use crate::cron::handlers::{
- JobKindHandler, JobOutcome, JobRunContext, kind_handler, register_kind,
+ kind_handler, register_kind, JobKindHandler, JobOutcome, JobRunContext,
};
use async_trait::async_trait;
use std::sync::atomic::{AtomicUsize, Ordering};
use tempfile::TempDir;
use tinyflows_bus::schedule::types::{DeliveryConfig, DeliveryStatus, Schedule};
-use tinyflows_bus::schedule::{CALLBACK_INTERFACE, DeliveryProjection, callbacks};
+use tinyflows_bus::schedule::{callbacks, DeliveryProjection, CALLBACK_INTERFACE};
pub(super) fn config(tmp: &TempDir) -> Config {
let config = Config {
diff --git a/crates/openhuman-core/src/cron/bus_host_trusted_system_tests.rs b/crates/openhuman-core/src/cron/bus_host_trusted_system_tests.rs
index ff8533c47d..785af91181 100644
--- a/crates/openhuman-core/src/cron/bus_host_trusted_system_tests.rs
+++ b/crates/openhuman-core/src/cron/bus_host_trusted_system_tests.rs
@@ -1,7 +1,7 @@
use super::*;
use std::sync::atomic::{AtomicUsize, Ordering};
use tempfile::TempDir;
-use tinyflows_bus::schedule::{Attempt, CALLBACK_INTERFACE, callbacks};
+use tinyflows_bus::schedule::{callbacks, Attempt, CALLBACK_INTERFACE};
fn config(tmp: &TempDir) -> Config {
let config = Config {
diff --git a/crates/openhuman-core/src/cron/ops.rs b/crates/openhuman-core/src/cron/ops.rs
index 6dd9788566..758fcad9f8 100644
--- a/crates/openhuman-core/src/cron/ops.rs
+++ b/crates/openhuman-core/src/cron/ops.rs
@@ -192,9 +192,10 @@ pub async fn run_job_now(
tinyflows_bus::schedule::RunJobReply::Completed {
success, attempt, ..
} => Ok((success, attempt.output)),
- tinyflows_bus::schedule::RunJobReply::Refused { reason } => {
- Err(format!("cron job '{}' was not admitted: {reason:?}", job.id))
- }
+ tinyflows_bus::schedule::RunJobReply::Refused { reason } => Err(format!(
+ "cron job '{}' was not admitted: {reason:?}",
+ job.id
+ )),
tinyflows_bus::schedule::RunJobReply::Accepted { .. } => {
Err("cron module accepted a synchronous run without completing it".to_string())
}
diff --git a/crates/openhuman-core/src/flows/mod.rs b/crates/openhuman-core/src/flows/mod.rs
index e0b8c4e622..b4051a20cd 100644
--- a/crates/openhuman-core/src/flows/mod.rs
+++ b/crates/openhuman-core/src/flows/mod.rs
@@ -67,6 +67,6 @@ pub use {node_contracts::all_node_kind_contracts, node_contracts::node_kind_cont
// subscriber, `flows_delete` and the tinyflows `memory` node adapter reach the
// same helpers through these re-exports so every caller tags identically.
pub use memory_tools::{
- FLOWS_TAG, cross_flow_filter, flow_filter, flow_key_of, flow_key_tag, flow_meta, flow_tag,
- forget_matching, remember_keyed,
+ cross_flow_filter, flow_filter, flow_key_of, flow_key_tag, flow_meta, flow_tag,
+ forget_matching, remember_keyed, FLOWS_TAG,
};
diff --git a/crates/openhuman-core/src/flows/ops/approval_manifest.rs b/crates/openhuman-core/src/flows/ops/approval_manifest.rs
index 238ec30ec3..50d9ab3d01 100644
--- a/crates/openhuman-core/src/flows/ops/approval_manifest.rs
+++ b/crates/openhuman-core/src/flows/ops/approval_manifest.rs
@@ -38,7 +38,7 @@ pub async fn compute_approval_manifest(config: &Config, graph: &WorkflowGraph) -
use crate::security::{GateDecision, SecurityPolicy};
use tinybox_bus::CommandClass;
use tinyflows_catalog::approval_manifest::{
- ManifestCandidate, ManifestClass, assemble_manifest, manifest_candidates,
+ assemble_manifest, manifest_candidates, ManifestCandidate, ManifestClass,
};
let security =
diff --git a/crates/openhuman-core/src/flows/ops/builder_gates.rs b/crates/openhuman-core/src/flows/ops/builder_gates.rs
index 3f2784ad84..46b90f1ff9 100644
--- a/crates/openhuman-core/src/flows/ops/builder_gates.rs
+++ b/crates/openhuman-core/src/flows/ops/builder_gates.rs
@@ -403,7 +403,7 @@ pub(crate) async fn validate_agent_refs(
) -> Vec<String> {
use crate::agent::harness::host_definition::AgentDefinitionRegistry;
use crate::agent::registry::AgentRegistryEntry;
- use crate::flows::agent_route::{AgentRoute, route_for_agent_ref};
+ use crate::flows::agent_route::{route_for_agent_ref, AgentRoute};
let mut errors = Vec::new();
let mut harness_registry_init_attempted = false;
diff --git a/crates/openhuman-core/src/flows/ops/validation.rs b/crates/openhuman-core/src/flows/ops/validation.rs
index 8e1fb236c8..462893904d 100644
--- a/crates/openhuman-core/src/flows/ops/validation.rs
+++ b/crates/openhuman-core/src/flows/ops/validation.rs
@@ -201,7 +201,7 @@ pub fn flows_import(
graph_json: Value,
format: Option<String>,
) -> Result<Outcome<tinyflows_catalog::FlowImport>, String> {
- use tinyflows_catalog::{FlowImport, import::n8n as n8n_import};
+ use tinyflows_catalog::{import::n8n as n8n_import, FlowImport};
let requested = format
.as_deref()
diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rs
index afc5495086..b1702bc98d 100644
--- a/tests/json_rpc_e2e.rs
+++ b/tests/json_rpc_e2e.rs
@@ -19,17 +19,17 @@ use std::sync::{Arc, Mutex, OnceLock};
use std::time::Duration;
use axum::extract::State;
-use axum::http::{HeaderMap, StatusCode, Uri, header::AUTHORIZATION};
+use axum::http::{header::AUTHORIZATION, HeaderMap, StatusCode, Uri};
use axum::routing::{get, post};
use axum::{Json, Router};
use futures_util::StreamExt;
-use serde_json::{Value, json};
+use serde_json::{json, Value};
use sha2::{Digest, Sha256};
use tempfile::tempdir;
use tinyinference_llm::message::Message;
use tinyinference_llm::model::ModelRequest;
-use openhuman_core::core::auth::{CORE_TOKEN_ENV_VAR, init_rpc_token};
+use openhuman_core::core::auth::{init_rpc_token, CORE_TOKEN_ENV_VAR};
use openhuman_core::platform::connectivity::rpc::pick_listen_port;
use openhuman_rpc::server::build_core_http_router;
@@ -1539,12 +1539,10 @@ async fn json_rpc_tokenjuice_detect_and_cache_stats() {
)
.await;
let stats_result = assert_no_jsonrpc_error(&stats, "tokenjuice_cache_stats");
- assert!(
- stats_result
- .get("entries")
- .and_then(Value::as_u64)
- .is_some()
- );
+ assert!(stats_result
+ .get("entries")
+ .and_then(Value::as_u64)
+ .is_some());
assert!(stats_result.get("bytes").and_then(Value::as_u64).is_some());
rpc_join.abort();
@@ -1569,18 +1567,14 @@ async fn json_rpc_tokenjuice_settings_and_savings() {
let settings = get_result
.get("settings")
.expect("settings_get returns a settings object");
- assert!(
- settings
- .get("router_enabled")
- .and_then(Value::as_bool)
- .is_some()
- );
- assert!(
- settings
- .get("ccr_min_tokens")
- .and_then(Value::as_u64)
- .is_some()
- );
+ assert!(settings
+ .get("router_enabled")
+ .and_then(Value::as_bool)
+ .is_some());
+ assert!(settings
+ .get("ccr_min_tokens")
+ .and_then(Value::as_u64)
+ .is_some());
// settings_update: flip the CCR token threshold and confirm it round-trips.
let updated = post_json_rpc(
@@ -1609,13 +1603,11 @@ async fn json_rpc_tokenjuice_settings_and_savings() {
.await;
let savings_result = assert_no_jsonrpc_error(&savings, "tokenjuice_savings_stats");
assert!(savings_result.get("attributionModel").is_some());
- assert!(
- savings_result
- .get("total")
- .and_then(|t| t.get("tokensSaved"))
- .and_then(Value::as_u64)
- .is_some()
- );
+ assert!(savings_result
+ .get("total")
+ .and_then(|t| t.get("tokensSaved"))
+ .and_then(Value::as_u64)
+ .is_some());
assert!(savings_result.get("cache").is_some());
// savings_reset: zeroes the totals.
@@ -1825,32 +1817,24 @@ async fn json_rpc_agent_registry_manages_defaults_and_custom_agents() {
.iter()
.find(|definition| definition.get("id").and_then(Value::as_str) == Some("critic"))
.expect("safe agent library should include critic");
- assert!(
- memory_agent
- .get("display_name")
- .and_then(Value::as_str)
- .is_some()
- );
- assert!(
- memory_agent
- .get("when_to_use")
- .and_then(Value::as_str)
- .is_some()
- );
+ assert!(memory_agent
+ .get("display_name")
+ .and_then(Value::as_str)
+ .is_some());
+ assert!(memory_agent
+ .get("when_to_use")
+ .and_then(Value::as_str)
+ .is_some());
assert!(memory_agent.get("system_prompt").is_none());
assert!(memory_agent.get("tools").is_some());
- assert!(
- memory_agent
- .get("direct_tool_count")
- .and_then(Value::as_u64)
- .is_some()
- );
- assert!(
- memory_agent
- .get("can_run_as_user_facing_worker")
- .and_then(Value::as_bool)
- .is_some()
- );
+ assert!(memory_agent
+ .get("direct_tool_count")
+ .and_then(Value::as_u64)
+ .is_some());
+ assert!(memory_agent
+ .get("can_run_as_user_facing_worker")
+ .and_then(Value::as_bool)
+ .is_some());
let missing = post_json_rpc(
&rpc_base,
@@ -2737,7 +2721,7 @@ async fn json_rpc_cron_manual_worker_survives_caller_cancel_on_published_tinyflo
cron::system_job_handlers,
};
use tinybus::EventHandler;
- use tokio::sync::{Semaphore, mpsc, oneshot};
+ use tokio::sync::{mpsc, oneshot, Semaphore};
let _env_lock = json_rpc_e2e_env_lock_async().await;
let tmp = tempdir().expect("tempdir");
@@ -3940,12 +3924,10 @@ async fn json_rpc_thread_working_dir_binds_before_the_first_message() {
)
.await;
let cleared = assert_no_jsonrpc_error(&cleared, "threads_update_working_dir clear");
- assert!(
- cleared
- .get("data")
- .and_then(|d| d.get("actionDir"))
- .is_none()
- );
+ assert!(cleared
+ .get("data")
+ .and_then(|d| d.get("actionDir"))
+ .is_none());
// 3. A protected folder is refused.
let ssh = home.join(".ssh");
@@ -4341,13 +4323,11 @@ async fn json_rpc_thread_turn_state_lifecycle() {
)
.await;
let missing_outer = assert_no_jsonrpc_error(&get_turn_missing, "turn_state_get_turn (absent)");
- assert!(
- missing_outer
- .get("data")
- .and_then(|d| d.get("turnState"))
- .map(|v| v.is_null())
- .unwrap_or(true)
- );
+ assert!(missing_outer
+ .get("data")
+ .and_then(|d| d.get("turnState"))
+ .map(|v| v.is_null())
+ .unwrap_or(true));
// clear → cleared:true
let cleared = post_json_rpc(
@@ -4375,13 +4355,11 @@ async fn json_rpc_thread_turn_state_lifecycle() {
)
.await;
let again_outer = assert_no_jsonrpc_error(&got_again, "turn_state_get (after clear)");
- assert!(
- again_outer
- .get("data")
- .and_then(|d| d.get("turnState"))
- .map(|v| v.is_null())
- .unwrap_or(true)
- );
+ assert!(again_outer
+ .get("data")
+ .and_then(|d| d.get("turnState"))
+ .map(|v| v.is_null())
+ .unwrap_or(true));
api_join.abort();
rpc_join.abort();
@@ -7944,14 +7922,12 @@ async fn json_rpc_local_ai_ollama_endpoint_normalizes_bind_address_and_clears()
)
.await;
let clear_result = assert_no_jsonrpc_error(&clear, "clear ollama base_url");
- assert!(
- clear_result
- .get("result")
- .and_then(|value| value.get("config"))
- .and_then(|config| config.get("local_ai"))
- .and_then(|local_ai| local_ai.get("base_url"))
- .is_none_or(Value::is_null)
- );
+ assert!(clear_result
+ .get("result")
+ .and_then(|value| value.get("config"))
+ .and_then(|config| config.get("local_ai"))
+ .and_then(|local_ai| local_ai.get("base_url"))
+ .is_none_or(Value::is_null));
mock_join.abort();
rpc_join.abort();
@@ -8733,12 +8709,10 @@ async fn voice_live_settings_round_trip_over_json_rpc() {
.await;
let tested = assert_no_jsonrpc_error(&tested, "voice_live_test_provider");
assert_eq!(tested["ok"], false);
- assert!(
- tested["error"]
- .as_str()
- .unwrap_or_default()
- .contains("not_configured")
- );
+ assert!(tested["error"]
+ .as_str()
+ .unwrap_or_default()
+ .contains("not_configured"));
mock_join.abort();
rpc_join.abort();
@@ -11022,11 +10996,9 @@ async fn json_rpc_task_sources_crud_and_status() {
.as_array()
.expect("list returns array")
.clone();
- assert!(
- sources
- .iter()
- .any(|s| s.get("id").and_then(Value::as_str) == Some(id.as_str()))
- );
+ assert!(sources
+ .iter()
+ .any(|s| s.get("id").and_then(Value::as_str) == Some(id.as_str())));
// ── get roundtrips ───────────────────────────────────────────────
let get = post_json_rpc(
diff --git a/tests/support/scripted_stack.rs b/tests/support/scripted_stack.rs
index 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> {