From 7ffdf441355cda0972b849bc9b475d3de8f39843 Mon Sep 17 00:00:00 2001 From: asepharyana Date: Thu, 16 Jul 2026 04:39:12 +0700 Subject: [PATCH] fix(plan): perbaiki fixture test array-cutoff squash_json Ditemukan implementer Task 4 (percobaan kedua, lagi-lagi BLOCKED sebelum commit apapun): test sebelumnya memakai string sama yang panjang+entropi-rendah di semua 4 elemen array, jadi elemen index 0-2 pun ikut ter-elide oleh aturan panjang/entropi normal -- tidak benar-benar menguji efek posisi array. Ganti fixture pakai string berbentuk UUID (tanpa spasi, entropi tinggi) yang lolos aturan normal di posisi manapun, supaya index 3 yang di-force-elide walau identifier-shaped benar-benar membuktikan aturan "past index 3 regardless of length/entropy". Co-Authored-By: Claude Sonnet 5 --- .../2026-07-16-context-compaction-overhaul.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/superpowers/plans/2026-07-16-context-compaction-overhaul.md b/docs/superpowers/plans/2026-07-16-context-compaction-overhaul.md index b358f10..d3474a8 100644 --- a/docs/superpowers/plans/2026-07-16-context-compaction-overhaul.md +++ b/docs/superpowers/plans/2026-07-16-context-compaction-overhaul.md @@ -647,9 +647,16 @@ mod tests { #[test] fn json_array_elements_past_third_are_squashed_harder() { - let long_str = "the quick brown fox jumps over the lazy dog again and again ".repeat(8); + // A UUID-shaped value has no internal whitespace and clears the + // entropy threshold, so under the *normal* per-value rule (which + // still applies to array indices 0-2) it survives untouched. + // Padding elsewhere in the object pushes total size over the + // squash floor without affecting which array elements get kept. + let identifier = "550e8400-e29b-41d4-a716-446655440000"; + let padding = "padding text to push this payload past the squash floor so apply() actually dispatches to squash_json ".repeat(20); let value = serde_json::json!({ - "items": [long_str.clone(), long_str.clone(), long_str.clone(), long_str.clone()], + "padding": padding, + "items": [identifier, identifier, identifier, identifier], }); let text = serde_json::to_string(&value).unwrap(); assert!(text.len() > SQUASH_FLOOR_BYTES); @@ -658,8 +665,9 @@ mod tests { let parsed: serde_json::Value = serde_json::from_str(&result).unwrap(); let items = parsed["items"].as_array().unwrap(); - assert_eq!(items[0].as_str().unwrap(), long_str, "first 3 elements keep long values as-is (not high-entropy but under the array cutoff)"); - assert_ne!(items[3].as_str().unwrap(), long_str, "4th element must be elided regardless of content"); + assert_eq!(items[0].as_str().unwrap(), identifier, "index 0 is under the array cutoff and identifier-shaped, so it's kept under the normal rule"); + assert_eq!(items[2].as_str().unwrap(), identifier, "index 2 is still under the cutoff (past-third means index >= 3)"); + assert_ne!(items[3].as_str().unwrap(), identifier, "index 3 must be force-elided even though it's identifier-shaped and would survive at any earlier index"); } #[test]