Skip to content

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

chore: reformat long function calls and assertions for readability

Steven Enamakelee2ce76b0674
diff --git a/crates/openhuman-core/src/threads/ops/edit_tests.rs b/crates/openhuman-core/src/threads/ops/edit_tests.rs
index 1e8e73e0e4..36a4309f3e 100644
--- a/crates/openhuman-core/src/threads/ops/edit_tests.rs
+++ b/crates/openhuman-core/src/threads/ops/edit_tests.rs
@@ -75,16 +75,30 @@ fn write_two_turn_transcript(workspace: &Path, thread_id: &str) -> (PathBuf, Str
];
let mut turn1_meta = meta.clone();
turn1_meta.turn_count = 1;
- append_transcript_turn(&path, &[], &turn1, &turn1_meta, Some(&turn_usage()), Some(&req1))
- .expect("append turn 1");
+ append_transcript_turn(
+ &path,
+ &[],
+ &turn1,
+ &turn1_meta,
+ Some(&turn_usage()),
+ Some(&req1),
+ )
+ .expect("append turn 1");
let mut turn2 = turn1.clone();
turn2.push(TranscriptMessage::new("user", "user prompt 2"));
turn2.push(TranscriptMessage::assistant("answer 2"));
let mut turn2_meta = meta.clone();
turn2_meta.turn_count = 2;
- append_transcript_turn(&path, &turn1, &turn2, &turn2_meta, Some(&turn_usage()), Some(&req2))
- .expect("append turn 2");
+ append_transcript_turn(
+ &path,
+ &turn1,
+ &turn2,
+ &turn2_meta,
+ Some(&turn_usage()),
+ Some(&req2),
+ )
+ .expect("append turn 2");
(path, req1, req2)
}
@@ -172,9 +186,7 @@ fn truncate_transcript_for_regenerate_targets_specific_turn() {
assert_eq!(last.role, "user");
assert_eq!(last.content, "user prompt 2");
assert!(
- head.messages
- .iter()
- .all(|m| m.content != "answer 2"),
+ head.messages.iter().all(|m| m.content != "answer 2"),
"turn 2's answer must be dropped: {:?}",
head.messages
);
@@ -201,7 +213,6 @@ fn truncate_transcript_for_regenerate_returns_none_when_no_turn_exists() {
let thread_id = "thread-no-turns";
write_turnless_transcript(dir.path(), thread_id);
- let result =
- truncate_transcript_for_regenerate(dir.path(), thread_id, None).expect("truncate");
+ let result = truncate_transcript_for_regenerate(dir.path(), thread_id, None).expect("truncate");
assert_eq!(result, None, "no user/assistant turn to regenerate");
}
diff --git a/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs b/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs
index 3711992080..69841611f6 100644
--- a/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs
+++ b/crates/openhuman-core/src/threads/ops/edit_turn_state_tests.rs
@@ -39,8 +39,8 @@ async fn clear_dropped_turn_states_drops_cut_turn_and_every_later_turn() {
clear_dropped_turn_states(dir.path(), thread_id, "req-2").await;
- let remaining = turn_state_store::list_thread(dir.path().to_path_buf(), thread_id)
- .expect("list_thread");
+ let remaining =
+ turn_state_store::list_thread(dir.path().to_path_buf(), thread_id).expect("list_thread");
let remaining_ids: Vec<&str> = remaining.iter().map(|t| t.request_id.as_str()).collect();
assert_eq!(
remaining_ids,
@@ -71,8 +71,8 @@ async fn clear_dropped_turn_states_is_best_effort_when_cut_turn_never_got_a_snap
// be left alone.
clear_dropped_turn_states(dir.path(), thread_id, "req-2").await;
- let remaining = turn_state_store::list_thread(dir.path().to_path_buf(), thread_id)
- .expect("list_thread");
+ let remaining =
+ turn_state_store::list_thread(dir.path().to_path_buf(), thread_id).expect("list_thread");
let mut remaining_ids: Vec<&str> = remaining.iter().map(|t| t.request_id.as_str()).collect();
remaining_ids.sort();
assert_eq!(
@@ -122,11 +122,7 @@ async fn seed_message_log(dir: &std::path::Path, thread_id: &str) {
conversations::blocking::append_message(
dir.to_path_buf(),
thread_id.to_string(),
- message(
- &run_reply_message_id("turn-1"),
- "first answer",
- "assistant",
- ),
+ message(&run_reply_message_id("turn-1"), "first answer", "assistant"),
)
.await
.expect("append reply for turn-1");
@@ -172,7 +168,10 @@ async fn next_reply_request_id_after_none_when_message_is_the_log_tail() {
let found = next_reply_request_id_after(dir.path(), thread_id, &last_reply_id)
.await
.expect("lookup");
- assert_eq!(found, None, "the last message in the log has no reply after it");
+ assert_eq!(
+ found, None,
+ "the last message in the log has no reply after it"
+ );
}
#[tokio::test]
diff --git a/crates/openhuman-core/src/web_chat/ops/start_chat_tests.rs b/crates/openhuman-core/src/web_chat/ops/start_chat_tests.rs
index 74be191f8d..c657bb4e34 100644
--- a/crates/openhuman-core/src/web_chat/ops/start_chat_tests.rs
+++ b/crates/openhuman-core/src/web_chat/ops/start_chat_tests.rs
@@ -13,7 +13,9 @@ fn is_guardrail_error_message_matches_only_the_sentinel() {
assert!(!is_guardrail_error_message(""));
// A message that merely mentions the word must not match — only the
// leading sentinel counts.
- assert!(!is_guardrail_error_message("this GUARDRAIL: is not at the start"));
+ assert!(!is_guardrail_error_message(
+ "this GUARDRAIL: is not at the start"
+ ));
}
/// `From<StartChatError> for String` on the `Other` variant passes the
diff --git a/crates/openhuman-core/src/web_chat/turn_timing_tests.rs b/crates/openhuman-core/src/web_chat/turn_timing_tests.rs
index f557305060..663c22e964 100644
--- a/crates/openhuman-core/src/web_chat/turn_timing_tests.rs
+++ b/crates/openhuman-core/src/web_chat/turn_timing_tests.rs
@@ -40,7 +40,9 @@ fn turn_cost_throttle_emits_again_after_interval_elapses() {
// Fast-forward past the throttle window by backdating `last_emit`
// directly rather than sleeping the test for 750ms.
throttle.last_emit = Some(
- std::time::Instant::now() - TURN_COST_EMIT_MIN_INTERVAL - std::time::Duration::from_millis(1),
+ std::time::Instant::now()
+ - TURN_COST_EMIT_MIN_INTERVAL
+ - std::time::Duration::from_millis(1),
);
assert!(
throttle.should_emit(),
diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rs
index a78452189b..4cfd1400e6 100644
--- a/tests/json_rpc_e2e.rs
+++ b/tests/json_rpc_e2e.rs
@@ -14647,7 +14647,9 @@ async fn json_rpc_threads_regenerate_truncates_and_restarts_turn() {
.get("result")
.and_then(|v| v.get("request_id"))
.and_then(Value::as_str)
- .unwrap_or_else(|| panic!("expected request_id in channel_web_chat response: {turn1_result}"))
+ .unwrap_or_else(|| {
+ panic!("expected request_id in channel_web_chat response: {turn1_result}")
+ })
.to_string();
let sse_event_1 = sse_task_1.await.expect("sse task 1 join should succeed");
assert_eq!(