From 29ea66cd4e6c00603c3ba0be229188b0d7bb9263 Mon Sep 17 00:00:00 2001 From: KenM76 Date: Wed, 4 Nov 2026 15:54:28 -0500 Subject: [PATCH] M3: the clip text-cap test is bounded, so it fails without the cap The test pushed until the builder refused; with the cap removed it never stopped. It now pushes at most two chunks past the cap and checks the cap stopped it. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9 --- crates/export/src/clip.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/export/src/clip.rs b/crates/export/src/clip.rs index 65a25c17a1..a782f27a18 100644 --- a/crates/export/src/clip.rs +++ b/crates/export/src/clip.rs @@ -335,7 +335,9 @@ mod tests { // One style: the text cap stops it. let mut b = ClipBuilder::new(); let chunk = "y".repeat(1 << 16); - while b.push(&chunk, &a) {} + // Bounded, so the test fails rather than runs on when the cap is gone. + let pushes = (0..MAX_CLIP_TEXT_BYTES / chunk.len() + 2).take_while(|_| b.push(&chunk, &a)).count(); + assert!(pushes <= MAX_CLIP_TEXT_BYTES / chunk.len(), "the cap stopped it: {pushes}"); let clip = b.finish(); assert!(clip.truncated); assert!(clip.paragraphs.iter().flatten().map(|s| s.text.len()).sum::() <= MAX_CLIP_TEXT_BYTES);