diff --git a/hive-agent/src/stream_enrich.rs b/hive-agent/src/stream_enrich.rs index 866f2569..9f972a97 100644 --- a/hive-agent/src/stream_enrich.rs +++ b/hive-agent/src/stream_enrich.rs @@ -1283,6 +1283,24 @@ mod tests { }) } + /// `classify_tool_result` has its **own** `<= 120`, separate from the one + /// in `summarize_tool_result`, and the two have to agree: one picks the + /// summary text, the other picks icon-vs-body. A result that summarises as + /// short but renders with a body is the inconsistency this pins. + /// Added because mutation testing found the gap — the case below uses 2 + /// and 500 characters, so neither arm goes near the boundary and moving it + /// to 119 changed nothing. + #[test] + fn the_icon_or_body_choice_turns_on_the_same_120_boundary() { + let at = one(&tool_result(&"a".repeat(120), false, "t1")); + assert_eq!(at.icon.as_deref(), Some("←"), "120 chars is still short"); + assert!(at.body.is_none()); + + let over = one(&tool_result(&"a".repeat(121), false, "t1")); + assert!(over.icon.is_none(), "121 chars stops being short"); + assert_eq!(over.body.as_deref().map(str::len), Some(121)); + } + #[test] fn a_short_result_gets_an_icon_and_a_long_one_gets_a_body() { let short = one(&tool_result("ok", false, "t1"));