Skip to content

Commit e094a6f

Browse files
author
CodeWhale Bot
committed
test(tui): align image and idle layout fixtures with validated behavior
Use the shared valid PNG for extension-independent image detection and assert that truncated PNG input retains an omission receipt. Keep the ambient-floor boundary test while accounting for the model identity row requested before the first message. Validation: formatting and diff checks passed. npm test passed 66 wrapper, 9 SDK and 446 web tests; check:web passed with 0 errors and 2 existing warnings. Prior clean-head Rust sweep passed 1527 core tests and 15353 workspace tests, with these two fixture failures and 21 skips. Corrected Rust assertions are pending the full sweep at this branch checkpoint; no release-readiness claim.
1 parent 9ff2096 commit e094a6f

2 files changed

Lines changed: 22 additions & 12 deletions

File tree

crates/tui/src/tools/file/tests.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,14 @@ async fn contract_read_uses_magic_not_extension_for_images() {
282282
std::fs::write(temporary.path().join("plain.png"), "ordinary text").expect("text fixture");
283283
std::fs::write(
284284
temporary.path().join("renamed.data"),
285-
[b"\x89PNG\r\n\x1a\n".as_slice(), b"\0\0\0\rIHDR".as_slice()].concat(),
285+
crate::image_attach::tests::PNG_1X1,
286286
)
287287
.expect("image fixture");
288+
std::fs::write(
289+
temporary.path().join("truncated.png"),
290+
[b"\x89PNG\r\n\x1a\n".as_slice(), b"\0\0\0\rIHDR".as_slice()].concat(),
291+
)
292+
.expect("truncated image fixture");
288293
let context = ToolContext::new(temporary.path());
289294

290295
let text = ReadFileTool::execute_contract_read(json!({"path": "plain.png"}), &context)
@@ -300,6 +305,11 @@ async fn contract_read_uses_magic_not_extension_for_images() {
300305
codewhale_tools::ToolResultContentBlock::Image { mime_type, .. }
301306
if mime_type == "image/png"
302307
));
308+
let truncated = ReadFileTool::execute_contract_read(json!({"path": "truncated.png"}), &context)
309+
.await
310+
.expect("invalid image retains an omission receipt");
311+
assert!(truncated.content_blocks.is_empty());
312+
assert!(truncated.content.contains("Image omitted"));
303313
}
304314

305315
#[test]

crates/tui/src/tui/ui/tests.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25855,32 +25855,32 @@ mod work_surface {
2585525855
);
2585625856
}
2585725857

25858-
// 20 rows seats the ocean floor exactly: the fully idle shell hides
25859-
// its metrics row (footer 1 + composer floor 3 + ambient floor 16).
25860-
// 19 rows
25858+
// 21 rows seats the ocean floor exactly: the idle shell keeps model
25859+
// identity visible (model 1 + footer 1 + composer 3 + ambient 16).
25860+
// 20 rows
2586125861
// cannot seat the ocean at any strip height. That is pre-rail
2586225862
// behavior and the yield rule must not pretend otherwise.
2586325863
let mut app = busy_rail_app(panel);
2586425864
assert_eq!(
25865-
strip_height(&mut app, 80, 20),
25865+
strip_height(&mut app, 80, 21),
2586625866
0,
25867-
"80x20 seats the ocean floor but has no spare rows for a strip"
25867+
"80x21 seats the ocean floor but has no spare rows for a strip"
2586825868
);
25869-
let rendered = render_underwater_test_app(&mut app, 80, 20);
25869+
let rendered = render_underwater_test_app(&mut app, 80, 21);
2587025870
assert!(
2587125871
idle_ocean_visible(&app),
25872-
"80x20 is exactly the ocean floor under the idle shell:\n{rendered}"
25872+
"80x21 is exactly the ocean floor under the idle shell:\n{rendered}"
2587325873
);
2587425874
let mut app = busy_rail_app(panel);
2587525875
assert_eq!(
25876-
strip_height(&mut app, 80, 19),
25876+
strip_height(&mut app, 80, 20),
2587725877
0,
25878-
"80x19 has no spare rows for a strip at all"
25878+
"80x20 has no spare rows for a strip at all"
2587925879
);
25880-
let rendered = render_underwater_test_app(&mut app, 80, 19);
25880+
let rendered = render_underwater_test_app(&mut app, 80, 20);
2588125881
assert!(
2588225882
!idle_ocean_visible(&app),
25883-
"80x19 has no room for the ocean even with no strip at all\n{rendered}"
25883+
"80x20 has no room for the ocean even with no strip at all\n{rendered}"
2588425884
);
2588525885
}
2588625886

0 commit comments

Comments
 (0)