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]