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 formatting in tests

Steven Enamakel9896ee555494
diff --git a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs
index 5c3d41b7a1..fc212faae8 100644
--- a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs
+++ b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs
@@ -1,6 +1,6 @@
use super::super::channel::CHANNEL_OUTBOUND_EVENT;
use super::*;
-use crate::agent::bus::{mock_agent_run_turn, AgentTurnRequest, AgentTurnResponse};
+use crate::agent::bus::{AgentTurnRequest, AgentTurnResponse, mock_agent_run_turn};
use crate::agent::turn_origin::AgentTurnOrigin;
use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet};
use std::sync::Mutex;
@@ -211,12 +211,16 @@ async fn a_relayed_turn_runs_as_an_external_channel_and_keeps_its_thread() {
}
}
assert_eq!(outbound.len(), 2, "one channel_outbound per reply");
- assert!(outbound
- .iter()
- .all(|event| event.event_name() == CHANNEL_OUTBOUND_EVENT));
- assert!(outbound
- .iter()
- .all(|event| event.context().thread_id == thread));
+ assert!(
+ outbound
+ .iter()
+ .all(|event| event.event_name() == CHANNEL_OUTBOUND_EVENT)
+ );
+ assert!(
+ outbound
+ .iter()
+ .all(|event| event.context().thread_id == thread)
+ );
assert_eq!(outbound[0].context().request_id, "req-m1");
assert!(matches!(
outbound[0].wire_event(),
diff --git a/crates/openhuman-core/src/core/runtime/subscribers_tests.rs b/crates/openhuman-core/src/core/runtime/subscribers_tests.rs
index 51a78d423b..8d3d159be5 100644
--- a/crates/openhuman-core/src/core/runtime/subscribers_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/subscribers_tests.rs
@@ -1,4 +1,4 @@
-use super::{group_first_time_when_bus_ready, DomainSubscriberPlan};
+use super::{DomainSubscriberPlan, group_first_time_when_bus_ready};
use crate::config::test_env::EnvVarGuard;
// ---- domain-subscriber gating (#4796 DoD item 3) ----------------------------
@@ -285,8 +285,7 @@ fn proactive_message_reaches_web_on_channelless_core_boot() {
#[test]
fn proactive_message_is_scoped_to_originating_saas_profile() {
const CHILD: &str = "OPENHUMAN_PROACTIVE_SUBSCRIBER_TEST_CHILD";
- const TEST_NAME: &str =
- "core::runtime::subscribers::tests::proactive_message_is_scoped_to_originating_saas_profile";
+ const TEST_NAME: &str = "core::runtime::subscribers::tests::proactive_message_is_scoped_to_originating_saas_profile";
if std::env::var(CHILD).as_deref() == Ok("1") {
tokio::runtime::Builder::new_current_thread()
diff --git a/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs b/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs
index 7d7e0db82c..585445385f 100644
--- a/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_builder_repair_tests.rs
@@ -5,8 +5,9 @@ use crate::{
flows::{
agents::workflow_builder::builder_prompt::{BuildMode, BuilderRequest},
ops::{
+ FlowStreamTarget,
builder::{backend_repair_message, is_backend_or_infrastructure_failure},
- flows_build_with_extra_hidden_tools, FlowStreamTarget,
+ flows_build_with_extra_hidden_tools,
},
},
};
@@ -76,10 +77,12 @@ fn repair_backend_failure_returns_no_proposal_before_starting_the_builder() {
assert_eq!(outcome.value["proposal"], Value::Null);
assert_eq!(outcome.value["error"], Value::Null);
- assert!(outcome.value["assistant_text"]
- .as_str()
- .expect("assistant text")
- .contains("workflow was not changed"));
+ assert!(
+ outcome.value["assistant_text"]
+ .as_str()
+ .expect("assistant text")
+ .contains("workflow was not changed")
+ );
let request_id = format!("backend-repair-{}", uuid::Uuid::new_v4());
let stream = FlowStreamTarget {
diff --git a/crates/openhuman-embed/tests/facades.rs b/crates/openhuman-embed/tests/facades.rs
index ab69389ac0..c12f281ada 100644
--- a/crates/openhuman-embed/tests/facades.rs
+++ b/crates/openhuman-embed/tests/facades.rs
@@ -5,12 +5,12 @@
use std::time::Duration;
use openhuman_embed::artifacts::{
- create_artifact, finalize_artifact, resolve_ready_file, ArtifactKind, ArtifactStatus, FileRoots,
+ ArtifactKind, ArtifactStatus, FileRoots, create_artifact, finalize_artifact, resolve_ready_file,
};
use openhuman_embed::chat_surface::{
- publish_web_channel_event, subscribe_web_channel_events, WebChannelEvent, WebEventContext,
+ WebChannelEvent, WebEventContext, publish_web_channel_event, subscribe_web_channel_events,
};
-use openhuman_embed::identity::{peek_credential_user_identity, UserIdentity};
+use openhuman_embed::identity::{UserIdentity, peek_credential_user_identity};
#[tokio::test]
async fn an_artifact_resolves_only_once_ready_and_only_under_its_roots() {
@@ -106,11 +106,13 @@ async fn web_channel_events_reach_a_subscriber_with_a_timestamp() {
fn identity_is_empty_when_nobody_is_signed_in() {
assert!(peek_credential_user_identity().is_none());
assert!(UserIdentity::default().is_empty());
- assert!(!UserIdentity {
- id: Some("u1".into()),
- ..UserIdentity::default()
- }
- .is_empty());
+ assert!(
+ !UserIdentity {
+ id: Some("u1".into()),
+ ..UserIdentity::default()
+ }
+ .is_empty()
+ );
}
#[test]
diff --git a/crates/openhuman-embed/tests/profile_host_capabilities.rs b/crates/openhuman-embed/tests/profile_host_capabilities.rs
index 3abcfcc83a..7a5e397218 100644
--- a/crates/openhuman-embed/tests/profile_host_capabilities.rs
+++ b/crates/openhuman-embed/tests/profile_host_capabilities.rs
@@ -7,8 +7,8 @@ use std::sync::{Arc, Mutex};
use std::time::Duration;
use common::{
- chat_completion, chat_requests, runtime_without_master_key, tool_call_completion, tool_names,
- PointedTransport,
+ PointedTransport, chat_completion, chat_requests, runtime_without_master_key,
+ tool_call_completion, tool_names,
};
use openhuman_embed::memory::api::conformance::ReferenceEngine;
use openhuman_embed::memory::api::{LearningKind, MemoryEngine, MemoryMeta, StoreItem};
@@ -18,7 +18,7 @@ use openhuman_embed::{
HostTurnTools, PermissionLevel, ProfileRuntime, RelayMessage, SaasConfig, Tool, ToolResult,
ToolScopeSpec,
};
-use serde_json::{json, Value};
+use serde_json::{Value, json};
use wiremock::{Mock, Request, Respond, ResponseTemplate};
struct TenantTool {
@@ -390,10 +390,12 @@ async fn scenario() {
.await,
ToolHookDecision::Proceed
));
- assert!(handles[1]
- .scope(alice_hook.before_tool_decision(&hook_context))
- .await
- .is_deny());
+ assert!(
+ handles[1]
+ .scope(alice_hook.before_tool_decision(&hook_context))
+ .await
+ .is_deny()
+ );
for name in [
"hidden",
"shell",
@@ -433,10 +435,12 @@ async fn scenario() {
})
.await;
let closed_hook = no_callback.hook(handles[0].id(), alice_profile.lease_fence().clone());
- assert!(handles[0]
- .scope(closed_hook.before_tool_decision(&hook_context))
- .await
- .is_deny());
+ assert!(
+ handles[0]
+ .scope(closed_hook.before_tool_decision(&hook_context))
+ .await
+ .is_deny()
+ );
// Closing really releases the old lease; reopening must install the same
// immutable belt and engine on a fresh profile context, without pinning it.
drop(alice_profile);
@@ -457,12 +461,14 @@ async fn scenario() {
.await
.expect("completed turns leave the profile releasable");
let reopened = runtime.open("alice").await.unwrap();
- assert!(reopened
- .threads()
- .await
- .unwrap()
- .iter()
- .any(|thread| thread.id == "t1"));
+ assert!(
+ reopened
+ .threads()
+ .await
+ .unwrap()
+ .iter()
+ .any(|thread| thread.id == "t1")
+ );
reopened
.chat("t1", "alice: call tenant_probe after reopening")
.await
@@ -532,9 +538,11 @@ async fn scenario() {
ToolHookDecision::Proceed
));
let requests = chat_requests(&inference).await;
- assert!(requests
- .iter()
- .any(|request| !tool_names(request).is_empty()));
+ assert!(
+ requests
+ .iter()
+ .any(|request| !tool_names(request).is_empty())
+ );
for request in requests {
let mut names = tool_names(&request);
names.sort();
@@ -667,9 +675,11 @@ async fn scenario() {
.await,
"a latched profile must not resolve the shared engine"
);
- assert!(handles[0]
- .scope(alice_hook.before_tool_decision(&hook_context))
- .await
- .is_deny());
+ assert!(
+ handles[0]
+ .scope(alice_hook.before_tool_decision(&hook_context))
+ .await
+ .is_deny()
+ );
runtime.shutdown().await;
}
diff --git a/crates/openhuman-embed/tests/saas_profiles.rs b/crates/openhuman-embed/tests/saas_profiles.rs
index 0f7ed214d1..c6aa8633d7 100644
--- a/crates/openhuman-embed/tests/saas_profiles.rs
+++ b/crates/openhuman-embed/tests/saas_profiles.rs
@@ -11,8 +11,8 @@ mod common;
use std::time::Duration;
use common::{
- chat_requests, echo_inference, last_user_message, runtime_without_master_key as runtime,
- PointedTransport,
+ PointedTransport, chat_requests, echo_inference, last_user_message,
+ runtime_without_master_key as runtime,
};
use openhuman_embed::profiles::ProfileCredentialKind;
use openhuman_embed::{
@@ -160,20 +160,24 @@ async fn scenario() {
Err(e) => panic!("alice never went idle: {e}"),
}
}
- assert!(!profiles
- .list()
- .await
- .unwrap()
- .iter()
- .any(|s| s.open && s.profile_id == alice.profile_id));
+ assert!(
+ !profiles
+ .list()
+ .await
+ .unwrap()
+ .iter()
+ .any(|s| s.open && s.profile_id == alice.profile_id)
+ );
// Reopening picks the same thread back up.
let alice_h = profiles.open("alice").await.expect("reopen alice");
- assert!(alice_h
- .threads()
- .await
- .unwrap()
- .iter()
- .any(|t| t.id == "t1"));
+ assert!(
+ alice_h
+ .threads()
+ .await
+ .unwrap()
+ .iter()
+ .any(|t| t.id == "t1")
+ );
// ── a relayed platform message ──────────────────────────────────────
let mut bob_events = bob_h.events();
@@ -224,24 +228,32 @@ async fn scenario() {
again.duplicate,
"a retried delivery runs nothing: {again:?}"
);
- assert!(bob_h
- .threads()
- .await
- .unwrap()
- .iter()
- .any(|t| t.id == relayed.thread_id));
- assert!(!alice_h
- .threads()
- .await
- .unwrap()
- .iter()
- .any(|t| t.id == relayed.thread_id));
+ assert!(
+ bob_h
+ .threads()
+ .await
+ .unwrap()
+ .iter()
+ .any(|t| t.id == relayed.thread_id)
+ );
+ assert!(
+ !alice_h
+ .threads()
+ .await
+ .unwrap()
+ .iter()
+ .any(|t| t.id == relayed.thread_id)
+ );
// Nothing of bob's relay reached alice's stream.
tokio::time::sleep(Duration::from_millis(300)).await;
while let Ok(Some(event)) =
tokio::time::timeout(Duration::from_millis(50), alice_events.recv()).await
{
- assert_ne!(event.context().thread_id, relayed.thread_id, "leaked: {event:?}");
+ assert_ne!(
+ event.context().thread_id,
+ relayed.thread_id,
+ "leaked: {event:?}"
+ );
}
// ── the process is locked to SaaS ───────────────────────────────────