Hmbown/CodeWhale · error
expected text, got
Error message
expected text, got {other:?} What it means
Test-only panic in notice_block_names_the_failure_and_forbids_guessing: notice_block returned a block that was not the expected ContentBlock::Text attachment notice, so the failure-notice formatting changed shape or returned an image/other variant.
Solutions
- Keep notice_block returning a single ContentBlock::Text wrapped in <attachment_notice> tags
- Check whether the notice text now fails the contains assertions before the match
- Update the arm if the notice legitimately became a composite block
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at crates/tui/src/image_attach/tests.rs:487 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/1f1023d938a5775a.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/image_attach/tests.rs:487
#[test]
fn text_with_no_attachments_produces_nothing() {
let expanded = expand_attachment_blocks("just a normal question");
assert!(expanded.blocks.is_empty());
assert!(expanded.notices.is_empty());
}
#[test]
fn notice_block_names_the_failure_and_forbids_guessing() {
assert_eq!(notice_block(&[]), None);
let block =
notice_block(&["Cannot attach a.png: the file is empty".to_string()]).expect("block");
match block {
ContentBlock::Text { text, .. } => {
assert!(text.contains("<attachment_notice>"), "{text}");
assert!(text.contains("a.png"), "{text}");
assert!(text.contains("Do not describe"), "{text}");
}
other => panic!("expected text, got {other:?}"),
}
}
#[test]
fn attach_from_path_reports_an_unreadable_file() {
let error = attach_image_from_path(Path::new("/nonexistent/x.png")).expect_err("must fail");
assert!(
matches!(error, ImageAttachError::Unreadable { .. }),
"got {error:?}"
);
}
pub(crate) fn runtime_image_fixture(color: u8) -> codewhale_protocol::runtime::RuntimeImageInput {
let image = image::DynamicImage::ImageRgba8(image::RgbaImage::from_pixel(
2,
2,
image::Rgba([color, 31, 99, 255]),
));View on GitHub (pinned to 433685b202)