forge
Explore
Log in

Don't you dare go Hollow

refusal_inventory: normalise whitespace in the 128-root cfl anchor + mutation-prove it

Browse files at this commit

a460dca390642c1303605d2fd52b69e42bf4654bAhmet Kaan GümüşParent: 72eb746
The anchor was a 3-line literal carrying 12-space indentation while the
anchored call site (decode.rs read_intra_mode_rect at the 128 root) sits at
8 spaces, so the guard counted 0 matches and went RED. ATTRIBUTION (measured
by an independent review pass): the guard was ALREADY red at the wave's own
common base 4155c7c7 -- the dedent happened in an ancestor of that base, so
the wave inherited a pre-existing red rather than causing it. The invariant
it guards was intact: the call site still passes cfl=false.

Fix: whitespace-normalised match (squash_ws on both sides), keeping the
semantic anchor (both comment lines + the false, argument) and count() == 1.
Mutation-proved: cfl=true turns it RED, revert turns it green.

Class swept: no other source-scan anchor in the crate embeds indentation
(21 include_str! guards checked); the rule is recorded in
skill://reformat-breaks-source-scan-anchors.
crates/ec-av1/src/refusal_inventory.rsmodified+13 -3
@@ -1690,10 +1690,20 @@ mod tests {
1690 // The 128-root call site's own `cfl` argument, with the comment that1690 // The 128-root call site's own `cfl` argument, with the comment that
1691 // explains it -- the two lines are matched together so that reordering1691 // explains it -- the two lines are matched together so that reordering
1692 // the arguments cannot leave this test pointing at another `false`.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 \1693+ //
1694- // 13-symbol no-CFL CDF here, never the 14-symbol one.\n false,";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 assert_eq!(1705 assert_eq!(
1696- src.matches(CFL_OFF_AT_128).count(),1706+ squash_ws(src).matches(&squash_ws(CFL_OFF_AT_128)).count(),
1697 1,1707 1,
1698 "the 128-root call site no longer passes cfl=false -- a CfL alpha can reach the \1708 "the 128-root call site no longer passes cfl=false -- a CfL alpha can reach the \
1699 guard, so this enumeration proves nothing"1709 guard, so this enumeration proves nothing"