refusal_inventory: normalise whitespace in the 128-root cfl anchor + mutation-prove it
Browse files at this commita460dca390642c1303605d2fd52b69e42bf4654bParent: 72eb7461 changed file +13 -3
crates/ec-av1/src/refusal_inventory.rsmodified+13 -3
| @@ -1690,10 +1690,20 @@ mod tests { | ||
| 1690 | 1690 | // The 128-root call site's own `cfl` argument, with the comment that |
| 1691 | 1691 | // explains it -- the two lines are matched together so that reordering |
| 1692 | 1692 | // the arguments cannot leave this test pointing at another `false`. |
| 1693 | - const CFL_OFF_AT_128: &str = " // `is_cfl_allowed` caps CFL at 32x32: `uv_mode` comes off the\n \ | |
| 1694 | - // 13-symbol no-CFL CDF here, never the 14-symbol one.\n false,"; | |
| 1693 | + // | |
| 1694 | + // Whitespace-normalised (2026-09-28): the anchor used to be matched with | |
| 1695 | + // its exact indentation, so any dedent or reformat of the call site -- | |
| 1696 | + // the wave merge dedented it by four spaces -- turned this enumeration | |
| 1697 | + // red without the invariant it guards changing at all. Collapsing runs | |
| 1698 | + // of whitespace keeps the SEMANTIC anchor (both comment lines plus the | |
| 1699 | + // `false,` argument, in order) asserted while removing that fragility. | |
| 1700 | + const CFL_OFF_AT_128: &str = "// `is_cfl_allowed` caps CFL at 32x32: `uv_mode` comes off the \ | |
| 1701 | + // 13-symbol no-CFL CDF here, never the 14-symbol one. false,"; | |
| 1702 | + fn squash_ws(s: &str) -> String { | |
| 1703 | + s.split_whitespace().collect::<Vec<_>>().join(" ") | |
| 1704 | + } | |
| 1695 | 1705 | assert_eq!( |
| 1696 | - src.matches(CFL_OFF_AT_128).count(), | |
| 1706 | + squash_ws(src).matches(&squash_ws(CFL_OFF_AT_128)).count(), | |
| 1697 | 1707 | 1, |
| 1698 | 1708 | "the 128-root call site no longer passes cfl=false -- a CfL alpha can reach the \ |
| 1699 | 1709 | guard, so this enumeration proves nothing" |