Skip to content

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

test(web_chat): update web test assertions

Steven Enamakel685d50951490
diff --git a/crates/openhuman-core/src/web_chat/web_tests.rs b/crates/openhuman-core/src/web_chat/web_tests.rs
index 88f9ce1ff2..8513a81d24 100644
--- a/crates/openhuman-core/src/web_chat/web_tests.rs
+++ b/crates/openhuman-core/src/web_chat/web_tests.rs
@@ -1,4 +1,5 @@
use super::{
+ ChatRequestMetadata, ClassifiedError, StartChatError, TestRunChatTaskBlock, WebChatParams,
all_web_channel_controller_schemas, all_web_channel_registered_controllers, cancel_chat_scoped,
channel_web_cancel, channel_web_queue_clear, channel_web_queue_remove,
channel_web_queue_status, classify_inference_error, drain_queued_turns_for_test,
@@ -7,14 +8,13 @@ use super::{
locale_reply_directive, normalize_model_override, parallel_in_flight_entries_for_test,
provider_role_for_model_override, schemas, sentry_suppression_reason,
set_test_forced_run_chat_task_error, set_test_run_chat_task_block, start_chat,
- subscribe_web_channel_events, ChatRequestMetadata, ClassifiedError, StartChatError,
- TestRunChatTaskBlock, WebChatParams,
+ subscribe_web_channel_events,
};
use crate::core::TypeSchema;
-use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
+use std::sync::atomic::{AtomicBool, Ordering};
use tinyagents_harness::run_queue::QueueLane;
-use tokio::time::{timeout, Duration};
+use tokio::time::{Duration, timeout};
// Serializes every test that drives `start_chat` with the process-global
// `run_chat_task` test hooks (forced error / forced block) or the
diff --git a/crates/openhuman-core/src/web_chat/web_tests_error_code_classification_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_error_code_classification_tests.rs
index 3b9cd1161e..309e1d9783 100644
--- a/crates/openhuman-core/src/web_chat/web_tests_error_code_classification_tests.rs
+++ b/crates/openhuman-core/src/web_chat/web_tests_error_code_classification_tests.rs
@@ -465,14 +465,16 @@ fn chat_schema_requires_client_thread_message() {
assert!(required.contains(&"thread_id"));
assert!(required.contains(&"message"));
// model_override and temperature must be optional.
- assert!(s
- .inputs
- .iter()
- .any(|f| f.name == "model_override" && !f.required));
- assert!(s
- .inputs
- .iter()
- .any(|f| f.name == "temperature" && !f.required));
+ assert!(
+ s.inputs
+ .iter()
+ .any(|f| f.name == "model_override" && !f.required)
+ );
+ assert!(
+ s.inputs
+ .iter()
+ .any(|f| f.name == "temperature" && !f.required)
+ );
}
#[test]
diff --git a/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs
index 88d760b201..087660f585 100644
--- a/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs
+++ b/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs
@@ -8,7 +8,7 @@
//! (web_chat regex list, triage whole-word list, loop-guard billing list).
use super::*;
-use crate::agent::triage::evaluator::{classify_error, ArmError};
+use crate::agent::triage::evaluator::{ArmError, classify_error};
use regex::Regex;
/// `(case, input, error_type, source, retryable, retry_after_ms, provider,
@@ -652,8 +652,9 @@ fn shared_budget_matcher_reproduces_each_legacy_matcher_on_the_corpus() {
#[test]
fn loop_guard_halt_summaries_are_byte_identical() {
use crate::inference::failure_copy::{
- recoverable_identical_halt_summary, recoverable_no_progress_halt_summary,
- terminal_inference_halt_summary, user_actionable_escalation, TerminalInferenceFailure,
+ TerminalInferenceFailure, recoverable_identical_halt_summary,
+ recoverable_no_progress_halt_summary, terminal_inference_halt_summary,
+ user_actionable_escalation,
};
assert_eq!(
terminal_inference_halt_summary(
diff --git a/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rs
index 8350175e26..e17f01b11d 100644
--- a/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rs
+++ b/crates/openhuman-core/src/web_chat/web_tests_queue_acceptance_tests.rs
@@ -169,9 +169,11 @@ async fn terminal_turn_dispatches_followup_as_a_fresh_host_turn() {
.any(|(key, request_id)| key == thread_id && request_id != &primary_request_id)
})
.await;
- assert!(entries
- .iter()
- .any(|(key, request_id)| key == thread_id && request_id != &primary_request_id));
+ assert!(
+ entries
+ .iter()
+ .any(|(key, request_id)| key == thread_id && request_id != &primary_request_id)
+ );
cancel_parked_turn(thread_id, &block).await;
}
@@ -233,27 +235,33 @@ async fn cancellation_discards_pending_lanes_before_a_replacement_turn() {
.await
.expect("replacement queue status should be available");
assert_eq!(replacement.value["total"], 0);
- assert!(drain_queued_turns_for_test(
- &crate::core::runtime::DispatchCtx::ambient(),
- thread_id,
- QueueLane::Followup
- )
- .await
- .is_empty());
- assert!(drain_queued_turns_for_test(
- &crate::core::runtime::DispatchCtx::ambient(),
- thread_id,
- QueueLane::Steer
- )
- .await
- .is_empty());
- assert!(drain_queued_turns_for_test(
- &crate::core::runtime::DispatchCtx::ambient(),
- thread_id,
- QueueLane::Collect
- )
- .await
- .is_empty());
+ assert!(
+ drain_queued_turns_for_test(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ thread_id,
+ QueueLane::Followup
+ )
+ .await
+ .is_empty()
+ );
+ assert!(
+ drain_queued_turns_for_test(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ thread_id,
+ QueueLane::Steer
+ )
+ .await
+ .is_empty()
+ );
+ assert!(
+ drain_queued_turns_for_test(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ thread_id,
+ QueueLane::Collect
+ )
+ .await
+ .is_empty()
+ );
cancel_parked_turn(thread_id, &replacement_block).await;
}
@@ -314,10 +322,12 @@ async fn web_queue_status_wire_shape_and_clear_cleanup_remain_stable() {
assert_eq!(lanes, ["collect", "followup", "steer"]);
for item in items {
assert!(!item["id"].as_str().expect("id").is_empty());
- assert!(item["text_preview"]
- .as_str()
- .expect("text_preview")
- .ends_with("payload"));
+ assert!(
+ item["text_preview"]
+ .as_str()
+ .expect("text_preview")
+ .ends_with("payload")
+ );
}
let cleared = channel_web_queue_clear(&DispatchCtx::ambient(), thread_id)