Skip to content

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

chore: reorder imports and reformat test assertions across multiple test files

Steven Enamakel8438d9180055
diff --git a/crates/openhuman-core/src/agent/learning/prompt_sections_tests_2_tests.rs b/crates/openhuman-core/src/agent/learning/prompt_sections_tests_2_tests.rs
index d6083b2554..3569b299ab 100644
--- a/crates/openhuman-core/src/agent/learning/prompt_sections_tests_2_tests.rs
+++ b/crates/openhuman-core/src/agent/learning/prompt_sections_tests_2_tests.rs
@@ -1,7 +1,7 @@
-use crate::memory::test_support::NoopMemory;
use super::*;
use crate::agent::prompts::LearnedContextData;
-use crate::memory::{Memory};
+use crate::memory::test_support::NoopMemory;
+use crate::memory::Memory;
use async_trait::async_trait;
use std::collections::HashSet;
use std::path::Path;
diff --git a/crates/openhuman-core/src/agent/learning/reflection_tests.rs b/crates/openhuman-core/src/agent/learning/reflection_tests.rs
index 72033a159e..cca50c0c5e 100644
--- a/crates/openhuman-core/src/agent/learning/reflection_tests.rs
+++ b/crates/openhuman-core/src/agent/learning/reflection_tests.rs
@@ -1,6 +1,6 @@
-use crate::memory::test_support::RetainingMemory;
use super::*;
use crate::agent::hooks::{ToolCallRecord, TurnContext};
+use crate::memory::test_support::RetainingMemory;
use crate::memory::{Memory, MemoryCategory};
use std::sync::Arc;
@@ -185,7 +185,13 @@ async fn store_reflection_persists_all_categories() {
.await
.unwrap();
- let keys: Vec<String> = memory_impl.list(None, None, None).await.unwrap().into_iter().map(|e| e.key).collect();
+ let keys: Vec<String> = memory_impl
+ .list(None, None, None)
+ .await
+ .unwrap()
+ .into_iter()
+ .map(|e| e.key)
+ .collect();
assert!(keys.iter().any(|key| key.starts_with("obs/")));
assert!(keys.iter().any(|key| key == "pat/pattern_a"));
assert!(keys.iter().any(|key| key == "pref/pref_a"));
@@ -222,7 +228,13 @@ async fn store_reflection_persists_every_pattern_and_pref_concurrently() {
.await
.unwrap();
- let keys: Vec<String> = memory_impl.list(None, None, None).await.unwrap().into_iter().map(|e| e.key).collect();
+ let keys: Vec<String> = memory_impl
+ .list(None, None, None)
+ .await
+ .unwrap()
+ .into_iter()
+ .map(|e| e.key)
+ .collect();
for expected in [
"pat/pattern_one",
"pat/pattern_two",
@@ -305,7 +317,9 @@ async fn on_turn_complete_dedupes_reflections_across_heuristic_and_llm_paths() {
hook.on_turn_complete(&turn).await.unwrap();
let ref_count = memory_impl
- .list(None, None, None).await.unwrap()
+ .list(None, None, None)
+ .await
+ .unwrap()
.iter()
.filter(|e| e.key.starts_with("ref/"))
.count();
@@ -380,7 +394,13 @@ async fn on_turn_complete_persists_heuristic_reflection_even_when_complexity_low
// even without a provider — only the heuristic should write.
hook.on_turn_complete(&turn).await.unwrap();
- let keys: Vec<String> = memory_impl.list(None, None, None).await.unwrap().into_iter().map(|e| e.key).collect();
+ let keys: Vec<String> = memory_impl
+ .list(None, None, None)
+ .await
+ .unwrap()
+ .into_iter()
+ .map(|e| e.key)
+ .collect();
assert!(
keys.iter().any(|k| k.starts_with("ref/")),
"heuristic capture should persist a reflection without LLM round-trip"
diff --git a/crates/openhuman-core/src/agent/learning/tool_tracker_tests.rs b/crates/openhuman-core/src/agent/learning/tool_tracker_tests.rs
index 92ecee63b6..124df2da04 100644
--- a/crates/openhuman-core/src/agent/learning/tool_tracker_tests.rs
+++ b/crates/openhuman-core/src/agent/learning/tool_tracker_tests.rs
@@ -1,6 +1,6 @@
-use crate::memory::test_support::RetainingMemory;
use super::*;
use crate::agent::hooks::{ToolCallRecord, TurnContext};
+use crate::memory::test_support::RetainingMemory;
use crate::memory::{Memory, MemoryCategory};
use std::sync::Arc;
diff --git a/crates/openhuman-core/src/agent/learning/user_profile_tests.rs b/crates/openhuman-core/src/agent/learning/user_profile_tests.rs
index 5fe744ed2d..32fa36cd58 100644
--- a/crates/openhuman-core/src/agent/learning/user_profile_tests.rs
+++ b/crates/openhuman-core/src/agent/learning/user_profile_tests.rs
@@ -1,6 +1,6 @@
-use crate::memory::test_support::RetainingMemory;
use super::*;
use crate::agent::hooks::TurnContext;
+use crate::memory::test_support::RetainingMemory;
use crate::memory::{Memory, MemoryCategory};
use std::sync::Arc;
@@ -238,7 +238,13 @@ async fn store_preferences_skips_duplicates_and_empty_slugs() {
.await
.unwrap();
- let keys: Vec<String> = memory_impl.list(None, None, None).await.unwrap().into_iter().map(|e| e.key).collect();
+ let keys: Vec<String> = memory_impl
+ .list(None, None, None)
+ .await
+ .unwrap()
+ .into_iter()
+ .map(|e| e.key)
+ .collect();
assert_eq!(keys.len(), 2);
assert!(keys.contains(&"pref/i_prefer_rust".into()));
assert!(keys.contains(&"pref/my_timezone_is_pst".into()));
@@ -274,7 +280,9 @@ async fn on_turn_complete_respects_feature_flags_and_stores_preferences() {
enabled.on_turn_complete(&ctx).await.unwrap();
let values: Vec<String> = memory_impl
- .list(None, None, None).await.unwrap()
+ .list(None, None, None)
+ .await
+ .unwrap()
.iter()
.map(|entry| entry.content.clone())
.collect();
diff --git a/crates/openhuman-core/src/agent/orchestration/ops_tests.rs b/crates/openhuman-core/src/agent/orchestration/ops_tests.rs
index e29c9c5003..436f21377f 100644
--- a/crates/openhuman-core/src/agent/orchestration/ops_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/ops_tests.rs
@@ -1,9 +1,9 @@
-use crate::memory::test_support::NoopMemory;
use super::*;
use crate::agent::harness::definition::AgentDefinitionRegistry;
use crate::agent::harness::fork_context::{with_parent_context, ParentExecutionContext};
use crate::agent::prompts::ToolCallFormat;
use crate::config::AgentConfig;
+use crate::memory::test_support::NoopMemory;
use async_trait::async_trait;
use parking_lot::Mutex;
use std::future::Future;
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/close_subagent_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/close_subagent_tests.rs
index 229f9bac4e..0461fb8912 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/close_subagent_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/close_subagent_tests.rs
@@ -1,8 +1,8 @@
-use crate::memory::test_support::NoopMemory;
use super::*;
use crate::agent::harness::fork_context::ParentExecutionContext;
use crate::agent::prompts::ToolCallFormat;
use crate::config::AgentConfig;
+use crate::memory::test_support::NoopMemory;
use std::collections::HashSet;
use std::path::Path;
use std::sync::Arc;
@@ -131,4 +131,3 @@ fn parent_context(workspace_dir: &Path) -> ParentExecutionContext {
run_queue: None,
}
}
-
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_tests.rs
index ce73714c27..62c3f0eaf8 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_tests.rs
@@ -1,10 +1,10 @@
-use crate::memory::test_support::NoopMemory;
use super::*;
use crate::agent::harness::definition::AgentDefinitionRegistry;
use crate::agent::harness::fork_context::{with_parent_context, ParentExecutionContext};
use crate::agent::prompts::ToolCallFormat;
use crate::config::AgentConfig;
-use crate::memory::{Memory};
+use crate::memory::test_support::NoopMemory;
+use crate::memory::Memory;
use std::collections::HashSet;
use std::path::Path;
use std::sync::Arc;
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs
index 3345ebfe50..d2ebdb2950 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs
@@ -1,4 +1,3 @@
-use crate::memory::test_support::NoopMemory;
use super::*;
use crate::agent::harness::definition::AgentDefinitionRegistry;
use crate::agent::harness::definition::{
@@ -14,7 +13,8 @@ use crate::agent::prompts::ToolCallFormat;
use crate::agent::tinyagents::host::OpenHumanRunContext;
use crate::agent::OpenHumanSessionHost;
use crate::config::AgentConfig;
-use crate::memory::{Memory};
+use crate::memory::test_support::NoopMemory;
+use crate::memory::Memory;
use async_trait::async_trait;
use parking_lot::Mutex;
use serde_json::json;
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
index a4e3ec9ff5..c3c5bdaf78 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
@@ -1,11 +1,11 @@
-use crate::memory::test_support::NoopMemory;
use super::{ArchetypeDelegationTool, DelegationTarget, SpawnSubagentTool, SpawnWorkerThreadTool};
use crate::agent::harness::definition::AgentDefinitionRegistry;
use crate::agent::harness::{with_parent_context, ParentExecutionContext};
use crate::agent::messages::ChatMessage;
use crate::agent::prompts::{ConnectedIntegration, ToolCallFormat};
use crate::memory::conversations;
-use crate::memory::{Memory};
+use crate::memory::test_support::NoopMemory;
+use crate::memory::Memory;
use async_trait::async_trait;
use parking_lot::Mutex;
use serde_json::json;
@@ -501,4 +501,3 @@ fn flatten_messages(messages: &[Message]) -> String {
.collect::<Vec<_>>()
.join("\n")
}
-
diff --git a/crates/openhuman-core/src/agent/prompts/mod_tests_subagent_render_tests.rs b/crates/openhuman-core/src/agent/prompts/mod_tests_subagent_render_tests.rs
index 50a8ef0f42..e4c40bfee7 100644
--- a/crates/openhuman-core/src/agent/prompts/mod_tests_subagent_render_tests.rs
+++ b/crates/openhuman-core/src/agent/prompts/mod_tests_subagent_render_tests.rs
@@ -268,7 +268,10 @@ fn render_subagent_system_prompt_silently_skips_missing_profile_md() {
// "[File not found]" placeholder.
let rendered = render_with_files(&[], only(false, true, false));
assert!(!rendered.contains("### PROFILE.md"), "{rendered}");
- assert!(!rendered.contains("[File not found: PROFILE.md]"), "{rendered}");
+ assert!(
+ !rendered.contains("[File not found: PROFILE.md]"),
+ "{rendered}"
+ );
}
#[test]
@@ -309,7 +312,10 @@ fn render_subagent_system_prompt_frames_memory_md_as_background() {
.find("background — not this conversation")
.unwrap_or_else(|| panic!("missing background frame: {rendered}"));
let heading_at = rendered.find("### MEMORY.md").unwrap();
- assert!(frame_at < heading_at, "frame must precede block: {rendered}");
+ assert!(
+ frame_at < heading_at,
+ "frame must precede block: {rendered}"
+ );
}
#[test]
diff --git a/crates/openhuman-core/src/agent/session_import/live_tests.rs b/crates/openhuman-core/src/agent/session_import/live_tests.rs
index f277a6830f..0bbc419b3d 100644
--- a/crates/openhuman-core/src/agent/session_import/live_tests.rs
+++ b/crates/openhuman-core/src/agent/session_import/live_tests.rs
@@ -19,13 +19,13 @@ use crate::agent::messages::{
attach_chat_tool_failure_metadata, attach_chat_turn_usage_metadata,
transcript_message_from_chat, ChatMessage,
};
-use tinyagents_session::transcript::import::convert::{journal_messages as journal_messages_with};
+use tinyagents_session::transcript::import::convert::journal_messages as journal_messages_with;
use tinyagents_session::transcript::import::live::{
shadow_read_compare as shadow_read_compare_with, write_live_turn as write_live_turn_with,
ShadowReadOutcome,
};
use tinyagents_session::transcript::import::ops::store_root;
-use tinyagents_session::transcript::import::types::{JournalMessage};
+use tinyagents_session::transcript::import::types::JournalMessage;
use tinyagents_session::transcript::{
read_transcript, write_transcript, MessageUsage, SessionTranscript, TranscriptMeta,
TranscriptToolCall, TurnUsage,
diff --git a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs
index 81ca4f7d81..594636e060 100644
--- a/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/use_skill_dispatch_tests.rs
@@ -13,12 +13,12 @@
//! `use_skill`'s registration to `harness.register_tool(adapter)` reproduces
//! that failure and is the fastest way to see these tests fail red.
-use crate::memory::test_support::NoopMemory;
use super::*;
use crate::agent::harness::definition::AgentDefinitionRegistry;
use crate::agent::harness::ParentExecutionContext;
use crate::agent::prompts::ToolCallFormat;
use crate::agent::tinyagents::tools::CanonicalSharedToolAdapter;
+use crate::memory::test_support::NoopMemory;
use async_trait::async_trait;
use serde_json::json;
use std::path::Path;
diff --git a/crates/openhuman-core/src/agent/tools/remember_preference_tests.rs b/crates/openhuman-core/src/agent/tools/remember_preference_tests.rs
index 219a4d2157..1c6a8aedab 100644
--- a/crates/openhuman-core/src/agent/tools/remember_preference_tests.rs
+++ b/crates/openhuman-core/src/agent/tools/remember_preference_tests.rs
@@ -141,7 +141,11 @@ async fn invalid_arguments_return_a_tool_error_naming_the_problem() {
for (args, expected) in cases {
let result = tool.execute(args.clone()).await.unwrap();
assert!(result.is_error, "{args}");
- assert!(result.output().contains(expected), "{args}: {}", result.output());
+ assert!(
+ result.output().contains(expected),
+ "{args}: {}",
+ result.output()
+ );
}
}
diff --git a/crates/openhuman-core/src/channels/runtime/startup_tests.rs b/crates/openhuman-core/src/channels/runtime/startup_tests.rs
index d6b8db77fd..e1b2658508 100644
--- a/crates/openhuman-core/src/channels/runtime/startup_tests.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup_tests.rs
@@ -22,7 +22,10 @@ fn chat_provider_unset_blank_or_sentinel_resolves_to_cloud() {
for value in [None, Some(""), Some("cloud"), Some("openhuman")] {
let config = config_with_chat_provider(value);
assert!(
- matches!(resolve_chat_workload(&config), ChatWorkloadResolution::Cloud),
+ matches!(
+ resolve_chat_workload(&config),
+ ChatWorkloadResolution::Cloud
+ ),
"{value:?} must resolve to cloud"
);
}
@@ -48,7 +51,9 @@ fn chat_provider_local_and_byok_strings_resolve_to_workload() {
assert_eq!(provider_string, configured);
assert_eq!(slug, expected_slug);
}
- ChatWorkloadResolution::Cloud => panic!("expected Workload for {configured}, got Cloud"),
+ ChatWorkloadResolution::Cloud => {
+ panic!("expected Workload for {configured}, got Cloud")
+ }
}
}
}
diff --git a/crates/openhuman-core/src/memory/ops_tests.rs b/crates/openhuman-core/src/memory/ops_tests.rs
index 5f28ffa20d..9b98d18551 100644
--- a/crates/openhuman-core/src/memory/ops_tests.rs
+++ b/crates/openhuman-core/src/memory/ops_tests.rs
@@ -152,8 +152,10 @@ fn format_llm_context_message_includes_entity_types_when_present() {
// ── Pure-helper coverage ───────────────────────────────────────
-use super::{chunk_metadata, extract_entity_type, maybe_retrieval_context, memory_request_id,
- relation_identity, relation_metadata, timestamp_to_rfc3339, validate_memory_relative_path};
+use super::{
+ chunk_metadata, extract_entity_type, maybe_retrieval_context, memory_request_id,
+ relation_identity, relation_metadata, timestamp_to_rfc3339, validate_memory_relative_path,
+};
use crate::core::Outcome;
use crate::memory::{ApiEnvelope, MemoryRetrievalContext};