Skip to content

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

style(channels): reorder imports and collapse test assertions

Steven Enamakelba5b12032f2b
diff --git a/crates/openhuman-core/src/channels/routes.rs b/crates/openhuman-core/src/channels/routes.rs
index 12d44dc440..a384744da8 100644
--- a/crates/openhuman-core/src/channels/routes.rs
+++ b/crates/openhuman-core/src/channels/routes.rs
@@ -1,8 +1,8 @@
//! Per-sender routing and runtime command handling.
-use super::SendMessage;
use super::context::{ChannelRouteSelection, ChannelRuntimeContext};
use super::runtime::ChannelHandle;
+use super::SendMessage;
use crate::inference::provider;
use std::sync::Arc;
use tinychannels_bus as traits;
diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rs
index 0a6eda5369..0ecf5e6515 100644
--- a/crates/openhuman-core/src/channels/routes_tests.rs
+++ b/crates/openhuman-core/src/channels/routes_tests.rs
@@ -1,6 +1,6 @@
use super::*;
use crate::channels::context::{
- ChannelRuntimeContext, RouteSelectionMap, TurnModelSourceCacheMap, conversation_history_key,
+ conversation_history_key, ChannelRuntimeContext, RouteSelectionMap, TurnModelSourceCacheMap,
};
use crate::channels::host::ChannelTurnStateSubscriber;
use crate::core::events::DomainEvent;
@@ -430,11 +430,9 @@ async fn handle_runtime_command_unknown_provider_sends_helpful_error() {
let sent = channel_state.sent.lock().unwrap();
assert_eq!(sent.len(), 1);
- assert!(
- sent[0]
- .content
- .contains("Unknown provider `definitely-not-a-provider`")
- );
+ assert!(sent[0]
+ .content
+ .contains("Unknown provider `definitely-not-a-provider`"));
assert_eq!(sent[0].thread_ts.as_deref(), Some("thread-1"));
}
@@ -616,11 +614,9 @@ async fn handle_runtime_command_telegram_help_replies_with_remote_command_list()
assert!(sent[0].content.contains("`/status`"));
assert!(sent[0].content.contains("`/sessions`"));
assert!(sent[0].content.contains("`/new`"));
- assert!(
- sent[0]
- .content
- .contains("Model routing: `/model`, `/models`")
- );
+ assert!(sent[0]
+ .content
+ .contains("Model routing: `/model`, `/models`"));
}
#[tokio::test]
@@ -649,11 +645,9 @@ async fn handle_runtime_command_telegram_sessions_reports_empty_store() {
let sent = channel_state.sent.lock().unwrap();
assert_eq!(sent.len(), 1);
- assert!(
- sent[0]
- .content
- .contains("No conversation threads yet. Send `/new` to create one.")
- );
+ assert!(sent[0]
+ .content
+ .contains("No conversation threads yet. Send `/new` to create one."));
assert_eq!(sent[0].topic_id.as_deref(), Some("42"));
}
diff --git a/crates/openhuman-core/src/channels/routes_tests_telegram.rs b/crates/openhuman-core/src/channels/routes_tests_telegram.rs
index e99211bf6f..c8fc5a98bc 100644
--- a/crates/openhuman-core/src/channels/routes_tests_telegram.rs
+++ b/crates/openhuman-core/src/channels/routes_tests_telegram.rs
@@ -80,11 +80,9 @@ async fn handle_runtime_command_telegram_new_status_and_sessions_round_trip() {
let sent = channel_state.sent.lock().unwrap();
assert_eq!(sent.len(), 3);
assert!(sent[0].content.contains("Started new session"));
- assert!(
- sent[0]
- .content
- .contains("Durable conversation history reset for this chat.")
- );
+ assert!(sent[0]
+ .content
+ .contains("Durable conversation history reset for this chat."));
assert!(sent[1].content.contains("**Status**"));
assert!(sent[1].content.contains("Thread: `Telegram"));
@@ -95,10 +93,9 @@ async fn handle_runtime_command_telegram_new_status_and_sessions_round_trip() {
assert!(sent[2].content.contains("**Recent sessions**"));
assert!(sent[2].content.contains("→ `Telegram"));
- assert!(
- sent.iter()
- .all(|message| message.topic_id.as_deref() == Some("42"))
- );
+ assert!(sent
+ .iter()
+ .all(|message| message.topic_id.as_deref() == Some("42")));
}
#[tokio::test]
@@ -151,18 +148,14 @@ async fn handle_runtime_command_telegram_new_uses_module_storage() {
assert_eq!(sent[0]["chat_id"], "-200");
assert_eq!(sent[0]["message_thread_id"], "42");
assert_eq!(sent[0]["reply_to_message_id"], 100);
- assert!(
- sent[0]["text"]
- .as_str()
- .unwrap()
- .contains("Started new session")
- );
- assert!(
- sent[0]["text"]
- .as_str()
- .unwrap()
- .contains("Durable conversation history reset")
- );
+ assert!(sent[0]["text"]
+ .as_str()
+ .unwrap()
+ .contains("Started new session"));
+ assert!(sent[0]["text"]
+ .as_str()
+ .unwrap()
+ .contains("Durable conversation history reset"));
assert_eq!(sent[1]["chat_id"], "-200");
assert_eq!(sent[1]["message_thread_id"], "42");
assert!(sent[1].get("reply_to_message_id").is_none());
diff --git a/crates/openhuman-core/src/channels/runtime/test_support.rs b/crates/openhuman-core/src/channels/runtime/test_support.rs
index 4d852782a6..8bb01aac51 100644
--- a/crates/openhuman-core/src/channels/runtime/test_support.rs
+++ b/crates/openhuman-core/src/channels/runtime/test_support.rs
@@ -3,10 +3,10 @@
#[allow(unused_imports)] // Used by tests/raw_coverage outside the core unit-test crate.
pub use super::dispatch::test_support::build_channel_context_block_for_test;
use super::dispatch::{
- RuntimeChannelMessage, process_channel_message, process_channel_runtime_message,
+ process_channel_message, process_channel_runtime_message, RuntimeChannelMessage,
};
-use crate::channels::ChannelSystemPrompt;
use crate::channels::context::ChannelRuntimeContext;
+use crate::channels::ChannelSystemPrompt;
use crate::config::{MultimodalConfig, MultimodalFileConfig, ReliabilityConfig};
use crate::core::events::DomainEvent;
use crate::inference::provider::ProviderRuntimeOptions;
@@ -17,8 +17,8 @@ use std::path::PathBuf;
use std::sync::atomic::Ordering;
use std::sync::{Arc, Mutex};
use std::time::Duration;
-use tinychannels_bus::CHANNEL_MESSAGE_TIMEOUT_SECS;
use tinychannels_bus::ChannelMessage;
+use tinychannels_bus::CHANNEL_MESSAGE_TIMEOUT_SECS;
use tinyinference_llm::model::{ChatModel, ModelRequest, ModelResponse};
use tinytools::{Tool, ToolResult};
use wiremock::matchers::{method, path};
diff --git a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
index bcbd893abe..74b02545e2 100644
--- a/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
+++ b/crates/openhuman-core/src/channels/tests/runtime_dispatch.rs
@@ -1,12 +1,12 @@
-use super::super::context::{CHANNEL_MESSAGE_TIMEOUT_SECS, ChannelRuntimeContext};
+use super::super::context::{ChannelRuntimeContext, CHANNEL_MESSAGE_TIMEOUT_SECS};
use super::super::runtime::test_support::{
- DispatchHarnessOptions, linked_telegram_runtime, run_dispatch_harness,
+ linked_telegram_runtime, run_dispatch_harness, DispatchHarnessOptions,
};
use super::super::runtime::{
- RuntimeChannelMessage, process_channel_message, run_message_dispatch_loop,
+ process_channel_message, run_message_dispatch_loop, RuntimeChannelMessage,
};
-use super::common::{RecordingChannel, SlowModel, use_real_agent_handler};
-use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, mock_agent_run_turn};
+use super::common::{use_real_agent_handler, RecordingChannel, SlowModel};
+use crate::agent::bus::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponse};
use crate::channels::runtime::ChannelHandle;
use crate::core::events::DomainEvent;
use crate::inference::provider;
diff --git a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs
index ed539045e3..3abbc577f2 100644
--- a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs
+++ b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs
@@ -1,6 +1,6 @@
use super::super::context::{
- CHANNEL_MESSAGE_TIMEOUT_SECS, ChannelRouteSelection, ChannelRuntimeContext,
- conversation_history_key,
+ conversation_history_key, ChannelRouteSelection, ChannelRuntimeContext,
+ CHANNEL_MESSAGE_TIMEOUT_SECS,
};
use super::super::runtime::process_channel_message;
use super::super::runtime::test_support::linked_telegram_runtime;