forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-av1refusalspan'

Browse files at this commit

6f7e58ff190b07a922a9aa94cc57d8c936e1af3dAhmet Kaan GümüşParent: 3bc9845674e482
crates/ec-av1/src/decode.rsmodified+66 -4
@@ -12566,6 +12566,17 @@ fn intra_in_inter_size_row(bw: usize, bh: usize) -> Option<(usize, usize)> {
12566 /// stream can present.12566 /// stream can present.
12567 #[test]12567 #[test]
12568 fn every_intra_in_inter_shape_the_census_lists_has_a_size_group_row() {12568 fn every_intra_in_inter_shape_the_census_lists_has_a_size_group_row() {
12569+ // lane-av1refusalspan: this gate is the PROOF for the refusal below, so it
12570+ // names that string exactly (placeholders included) and pins its guard
12571+ // site. The enumeration below establishes the shape domain; on its own it
12572+ // never said WHICH string the domain was about, so under a real function
12573+ // boundary -- rather than a window that ran into the next test -- the row
12574+ // read as unanchored.
12575+ const REFUSAL: &str = "an intra-coded {bw}x{bh} block on the inter block path (no size-group/tx-category row for that shape here)";
12576+ assert!(
12577+ include_str!("decode.rs").contains(REFUSAL),
12578+ "this gate proves {REFUSAL:?}, but that string is no longer in decode.rs"
12579+ );
12569 let mut checked = 0;12580 let mut checked = 0;
12570 for &(side, w, h) in &INTER_BLOCK_SHAPES {12581 for &(side, w, h) in &INTER_BLOCK_SHAPES {
12571 if (w, h) == (side, side) || w.min(h) < 8 || w.max(h) > 64 {12582 if (w, h) == (side, side) || w.min(h) < 8 || w.max(h) > 64 {
@@ -12658,6 +12669,13 @@ const BLOCK_SIZES_ALL_WH: [(usize, usize); 22] = [
12658 /// clause rejects before the lookup.12669 /// clause rejects before the lookup.
12659 #[test]12670 #[test]
12660 fn every_shape_that_allows_motion_variation_has_a_motion_mode_cdf_row() {12671 fn every_shape_that_allows_motion_variation_has_a_motion_mode_cdf_row() {
12672+ // lane-av1refusalspan: this gate is the PROOF for the refusal below, so it
12673+ // names it and pins its guard site.
12674+ const REFUSAL: &str = "a motion_mode symbol for a block shape with no CDF row here";
12675+ assert!(
12676+ crate::refusal_inventory::pins_refusal(include_str!("decode.rs"), REFUSAL),
12677+ "this gate proves {REFUSAL:?}, but that string is no longer in decode.rs"
12678+ );
12661 let mut rows = std::collections::BTreeSet::new();12679 let mut rows = std::collections::BTreeSet::new();
12662 let mut excluded = 0;12680 let mut excluded = 0;
12663 for (w, h) in BLOCK_SIZES_ALL_WH {12681 for (w, h) in BLOCK_SIZES_ALL_WH {
@@ -13929,8 +13947,10 @@ fn decode_intrabc_rect(
13929 // its own mi row/column on a 4:4:4 lossless frame, and13947 // its own mi row/column on a 4:4:4 lossless frame, and
13930 // the whole block's per-unit states are stamped over13948 // the whole block's per-unit states are stamped over
13931 // cells that belong to other blocks (or to nothing).13949 // cells that belong to other blocks (or to nothing).
13932- (mi_r + ur * ((4 << ss_y(fctx)) / MI),13950+ (
13933- mi_c + uc * ((4 << ss_x(fctx)) / MI)),13951+ mi_r + ur * ((4 << ss_y(fctx)) / MI),
13952+ mi_c + uc * ((4 << ss_x(fctx)) / MI),
13953+ ),
13934 4 << ss_x(fctx),13954 4 << ss_x(fctx),
13935 4 << ss_y(fctx),13955 4 << ss_y(fctx),
13936 plane_idx,13956 plane_idx,
@@ -27996,6 +28016,18 @@ fn sub_tx_size_map_matches_libaom() {
27996 /// case the refusal is guarded by.28016 /// case the refusal is guarded by.
27997 #[test]28017 #[test]
27998 fn a_var_tx_tree_never_presents_a_leaf_larger_than_the_unit_it_entered() {28018 fn a_var_tx_tree_never_presents_a_leaf_larger_than_the_unit_it_entered() {
28019+ // lane-av1refusalspan: this gate is the PROOF for both var-tx refusals, so
28020+ // it names both and pins both guard sites. The walk below proves the leaf
28021+ // domain; it never said which two strings that domain was about.
28022+ for refusal in [
28023+ "an inter var-tx tree with a leaf transform larger than 32x32",
28024+ "an inter var-tx tree with a leaf transform larger than 64x64",
28025+ ] {
28026+ assert!(
28027+ crate::refusal_inventory::pins_refusal(include_str!("decode.rs"), refusal),
28028+ "this gate proves {refusal:?}, but that string is no longer in decode.rs"
28029+ );
28030+ }
27999 // Every leaf `read_var_tx_size` can reach from `entry`, as (depth, w, h).28031 // Every leaf `read_var_tx_size` can reach from `entry`, as (depth, w, h).
28000 fn reachable(entry: (usize, usize), depth: usize, out: &mut Vec<(usize, usize, usize)>) {28032 fn reachable(entry: (usize, usize), depth: usize, out: &mut Vec<(usize, usize, usize)>) {
28001 out.push((depth, entry.0, entry.1));28033 out.push((depth, entry.0, entry.1));
@@ -28601,6 +28633,21 @@ fn rect_scan(w: usize, h: usize) -> Result<&'static [u16]> {
28601 /// loop, which is why they are skipped below.28633 /// loop, which is why they are skipped below.
28602 #[test]28634 #[test]
28603 fn every_rect_transform_shape_the_census_lists_has_a_coefficient_table_and_scan() {28635 fn every_rect_transform_shape_the_census_lists_has_a_coefficient_table_and_scan() {
28636+ // lane-av1refusalspan: this gate is the PROOF for THREE refusals, so it
28637+ // names all three and pins all three guard sites. The census below proves
28638+ // the shape domain and, on its own, named NONE of the strings that domain
28639+ // was about -- under a real function boundary rather than a window that
28640+ // ran into the next test, all three rows read as unanchored.
28641+ for refusal in [
28642+ "a rectangular inter luma transform unit whose shape has no coefficient table set here",
28643+ "a rectangular inter chroma transform unit whose shape has no coefficient table set here",
28644+ "a rectangular transform unit whose shape has no coefficient scan table here",
28645+ ] {
28646+ assert!(
28647+ include_str!("decode.rs").contains(refusal),
28648+ "this gate proves {refusal:?}, but that string is no longer in decode.rs"
28649+ );
28650+ }
28604 let fctx = &crate::decode::FrameCtx::new();28651 let fctx = &crate::decode::FrameCtx::new();
28605 let corner_scan = |w: usize, h: usize| {28652 let corner_scan = |w: usize, h: usize| {
28606 let (cw, ch) = (w.min(32), h.min(32));28653 let (cw, ch) = (w.min(32), h.min(32));
@@ -54543,6 +54590,16 @@ mod tests {
54543 #[test]54590 #[test]
54544 fn every_inter_record_publishes_an_obmc_readable_filter() {54591 fn every_inter_record_publishes_an_obmc_readable_filter() {
54545 let src = include_str!("decode.rs");54592 let src = include_str!("decode.rs");
54593+ // lane-av1refusalspan: this gate is the PROOF for the refusal below, so
54594+ // it names it and pins its guard site. The sibling test
54595+ // `an_obmc_neighbour_with_no_recorded_filter_refuses_instead_of_panicking`
54596+ // carries the same string 27k lines away in this file -- exactly the
54597+ // reach a window that is not a function boundary used to have.
54598+ const REFUSAL: &str = "an OBMC neighbour whose switchable interp filter was never recorded";
54599+ assert!(
54600+ crate::refusal_inventory::pins_refusal(&src, REFUSAL),
54601+ "this gate proves {REFUSAL:?}, but that string is no longer in decode.rs"
54602+ );
54546 let mut calls = 0usize;54603 let mut calls = 0usize;
54547 for (start, _) in src.match_indices("record_inter_rect_mi(") {54604 for (start, _) in src.match_indices("record_inter_rect_mi(") {
54548 // Skip the definition and the wrapper's own forwarding call.54605 // Skip the definition and the wrapper's own forwarding call.
@@ -54622,8 +54679,13 @@ mod tests {
54622 /// open half of this proof.54679 /// open half of this proof.
54623 #[test]54680 #[test]
54624 fn a_selected_reference_with_an_empty_ref_frame_idx_slot_refuses_by_name() {54681 fn a_selected_reference_with_an_empty_ref_frame_idx_slot_refuses_by_name() {
54625- const REFUSAL: &str =54682+ // lane-av1refusalspan: the FULL refusal, not a prefix of it. This gate
54626- "a reference frame selected with no picture at this frame's own ref_frame_idx slot";54683+ // is the proof for the row in `refusal_inventory`, whose anchor is the
54684+ // whole string (it carries no `(` and no `:`), and this const is what
54685+ // that anchor reads. Shortened to `...own ref_frame_idx slot` it
54686+ // stopped being a pin on the guard's text.
54687+ const REFUSAL: &str = "a reference frame selected with no picture at this frame's own \
54688+ ref_frame_idx slot for it";
54627 let pic = Picture {54689 let pic = Picture {
54628 width: 4,54690 width: 4,
54629 height: 4,54691 height: 4,
crates/ec-av1/src/refusal_inventory.rsmodified+479 -16
@@ -627,9 +627,55 @@ const PROVEN: &[(&str, &str)] = &[
627 #[cfg(test)]627 #[cfg(test)]
628 const GATES_THAT_SKIP_ON_A_DECODE_ERROR: &[&str] = &[];628 const GATES_THAT_SKIP_ON_A_DECODE_ERROR: &[&str] = &[];
629 629
630+/// Source text with Rust's line continuations dropped and every whitespace run
631+/// collapsed to one space -- the form rustc gives a multi-line literal -- so a
632+/// refusal written across three source lines is still findable in a body, and
633+/// a gate's quote of it still matches the guard's spelling.
634+#[cfg(test)]
635+fn squash_source(s: &str) -> String {
636+ let mut out = String::with_capacity(s.len());
637+ let mut pending_space = false;
638+ for (i, c) in s.char_indices() {
639+ if c == '\\' {
640+ let rest = &s[i + 1..];
641+ if rest.contains('\n')
642+ && rest
643+ .chars()
644+ .take_while(|c| *c != '\n')
645+ .all(|c| c == ' ' || c == '\t' || c == '\r')
646+ {
647+ continue;
648+ }
649+ }
650+ if c.is_whitespace() {
651+ pending_space = true;
652+ continue;
653+ }
654+ if pending_space && !out.is_empty() {
655+ out.push(' ');
656+ }
657+ pending_space = false;
658+ out.push(c);
659+ }
660+ out
661+}
662+
663+/// Does `src` carry `refusal`?
664+///
665+/// Lane-av1refusalspan: a proving gate quotes the refusal it proves, and this
666+/// is how it pins that quote to the guard that still carries the string. Both
667+/// sides are squashed, so a literal written over two lines with a `\`
668+/// continuation still matches.
669+#[cfg(test)]
670+pub(crate) fn pins_refusal(src: &str, refusal: &str) -> bool {
671+ squash_source(src).contains(&squash_source(refusal))
672+}
673+
630 #[cfg(test)]674 #[cfg(test)]
631 mod tests {675 mod tests {
632- use super::{CAPABILITY_CLAIMS, GATES_THAT_SKIP_ON_A_DECODE_ERROR, PROVEN, REFUSALS};676+ use super::{
677+ CAPABILITY_CLAIMS, GATES_THAT_SKIP_ON_A_DECODE_ERROR, PROVEN, REFUSALS, squash_source,
678+ };
633 use std::collections::BTreeSet;679 use std::collections::BTreeSet;
634 680
635 /// Every distinct `unsupported(...)` reason on the decode path.681 /// Every distinct `unsupported(...)` reason on the decode path.
@@ -1134,6 +1180,13 @@ mod tests {
1134 /// comment on `read_golomb`.1180 /// comment on `read_golomb`.
1135 #[test]1181 #[test]
1136 fn read_golomb_reads_every_value_a_conformant_stream_can_carry() {1182 fn read_golomb_reads_every_value_a_conformant_stream_can_carry() {
1183+ // lane-av1refusalspan: this gate is the PROOF for the refusal below, so
1184+ // it names it and pins its guard site.
1185+ const REFUSAL: &str = "a Golomb tail longer than this decoder reads";
1186+ assert!(
1187+ super::pins_refusal(include_str!("decode.rs"), REFUSAL),
1188+ "this gate proves {REFUSAL:?}, but that string is no longer in decode.rs"
1189+ );
1137 let roundtrip = |value: u32| -> ec_core::Result<u32> {1190 let roundtrip = |value: u32| -> ec_core::Result<u32> {
1138 let mut enc = crate::msac::SymbolEncoder::new();1191 let mut enc = crate::msac::SymbolEncoder::new();
1139 crate::tile::write_golomb(&mut enc, value);1192 crate::tile::write_golomb(&mut enc, value);
@@ -1377,6 +1430,17 @@ mod tests {
1377 #[test]1430 #[test]
1378 fn every_rect_strip_shape_the_split_path_codes_has_a_luma_and_chroma_table() {1431 fn every_rect_strip_shape_the_split_path_codes_has_a_luma_and_chroma_table() {
1379 let src = include_str!("decode.rs");1432 let src = include_str!("decode.rs");
1433+ // lane-av1refusalspan: this gate is the PROOF for both refusals below,
1434+ // so it names both and pins both guard sites.
1435+ for refusal in [
1436+ "a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here",
1437+ "a split intra strip whose transform unit is {tx_w}x{tx_h} (no luma coefficient tables for that shape here)",
1438+ ] {
1439+ assert!(
1440+ super::pins_refusal(&src, refusal),
1441+ "this gate proves {refusal:?}, but that string is no longer in decode.rs"
1442+ );
1443+ }
1380 1444
1381 // (1) The caller set. Each call's enclosing function is the last1445 // (1) The caller set. Each call's enclosing function is the last
1382 // top-level `fn` before it.1446 // top-level `fn` before it.
@@ -1937,6 +2001,14 @@ mod tests {
1937 /// [`no_block_footprint_with_a_128_pixel_side_can_carry_palette_syntax`].2001 /// [`no_block_footprint_with_a_128_pixel_side_can_carry_palette_syntax`].
1938 #[test]2002 #[test]
1939 fn no_128_root_half_reads_a_cfl_filter_intra_or_palette_symbol() {2003 fn no_128_root_half_reads_a_cfl_filter_intra_or_palette_symbol() {
2004+ // lane-av1refusalspan: this gate is the PROOF for the refusal below, so
2005+ // it names it (the full leading clause, which is the whole clause the
2006+ // inventory row's anchor reads) and pins its guard site.
2007+ const REFUSAL: &str = "CfL, filter intra or a palette on a 128-root HORZ/VERT intra block";
2008+ assert!(
2009+ include_str!("decode.rs").contains(REFUSAL),
2010+ "this gate proves {REFUSAL:?}, but that string is no longer in decode.rs"
2011+ );
1940 let src = include_str!("decode.rs");2012 let src = include_str!("decode.rs");
1941 // The 128-root call site's own `cfl` argument, with the comment that2013 // The 128-root call site's own `cfl` argument, with the comment that
1942 // explains it -- the two lines are matched together so that reordering2014 // explains it -- the two lines are matched together so that reordering
@@ -2122,34 +2194,425 @@ mod tests {
2122 );2194 );
2123 }2195 }
2124 2196
2125- /// Every entry of [`PROVEN`] must still name a live refusal and a test2197+ /// Lane-av1refusalspan: the files a proving gate may live in.
2126- /// that exists, and the count it prints is the inventory's numerator.2198+ const GATE_SOURCES: [(&str, &str); 3] = [
2199+ ("decode.rs", include_str!("decode.rs")),
2200+ ("stream.rs", include_str!("stream.rs")),
2201+ ("refusal_inventory.rs", include_str!("refusal_inventory.rs")),
2202+ ];
2203+
2204+ /// Lane-av1refusalspan: every offset in `src` of a line that DEFINES
2205+ /// `fn <gate>(` -- and nothing that merely names it.
2206+ ///
2207+ /// "The gate" is a function, so the first thing the anchor needs is the
2208+ /// function's own definition. The window rule this replaced took the first
2209+ /// `fn <gate>(` the file happened to contain, and a comment or a string
2210+ /// produces one. A definition is a line whose text before the keyword is
2211+ /// whitespace and qualifiers only (`pub`, `pub(crate)`, `async`, ...).
2212+ fn gate_definitions(src: &str, gate: &str) -> Vec<usize> {
2213+ src.match_indices(&format!("fn {gate}("))
2214+ .map(|(at, _)| at)
2215+ .filter(|at| {
2216+ let line_start = src[..*at].rfind('\n').map_or(0, |i| i + 1);
2217+ src[line_start..*at].split_whitespace().all(|word| {
2218+ matches!(
2219+ word,
2220+ "pub" | "async" | "const" | "unsafe" | "extern" | "default"
2221+ ) || (word.starts_with("pub(") && word.ends_with(')'))
2222+ })
2223+ })
2224+ .collect()
2225+ }
2226+
2227+ /// The number of leading-whitespace columns on the line holding `at`.
2228+ fn leading_indent(src: &str, at: usize) -> usize {
2229+ let line_start = src[..at].rfind('\n').map_or(0, |i| i + 1);
2230+ let line = &src[line_start..at];
2231+ line.len() - line.trim_start().len()
2232+ }
2233+
2234+ /// The offset of the `"` that closes the string literal opening at `open`.
2235+ fn closing_quote(b: &[u8], open: usize) -> Option<usize> {
2236+ let mut i = open + 1;
2237+ while i < b.len() {
2238+ match b[i] {
2239+ b'\\' => i += 2,
2240+ b'"' => return Some(i),
2241+ _ => i += 1,
2242+ }
2243+ }
2244+ None
2245+ }
2246+
2247+ /// The offsets of the `{` that opens the body of the function defined at
2248+ /// `gate_at` and of the `}` that closes it; `None` when the body is never
2249+ /// closed.
2250+ ///
2251+ /// This walks Rust, not lines. A brace inside a string literal, a raw
2252+ /// string, a byte string, a char literal, a lifetime, a line comment or a
2253+ /// (nestable) block comment is not a brace -- counting one is exactly how a
2254+ /// "bounded" window becomes the rest of the file.
2255+ fn body_braces(src: &str, gate_at: usize) -> Option<(usize, usize)> {
2256+ let b = src.as_bytes();
2257+ let mut i = gate_at;
2258+ let mut depth = 0usize;
2259+ let mut open = None;
2260+ let mut last: Option<usize> = None;
2261+ while i < b.len() {
2262+ // Every arm advances `i`, including the ones that `continue`. A spin
2263+ // here would hang the suite instead of failing it, which is the one
2264+ // outcome a boundary finder must never have.
2265+ if let Some(last) = last {
2266+ debug_assert!(i > last, "body_braces: an arm must advance the cursor");
2267+ }
2268+ last = Some(i);
2269+ match b[i] {
2270+ b'/' if b.get(i + 1) == Some(&b'/') => {
2271+ i = src[i..].find('\n').map_or(b.len(), |n| i + n + 1);
2272+ continue;
2273+ }
2274+ b'/' if b.get(i + 1) == Some(&b'*') => {
2275+ let mut nesting = 1usize;
2276+ i += 2;
2277+ while i < b.len() && nesting > 0 {
2278+ if b[i] == b'/' && b.get(i + 1) == Some(&b'*') {
2279+ nesting += 1;
2280+ i += 2;
2281+ } else if b[i] == b'*' && b.get(i + 1) == Some(&b'/') {
2282+ nesting -= 1;
2283+ i += 2;
2284+ } else {
2285+ i += 1;
2286+ }
2287+ }
2288+ continue;
2289+ }
2290+ b'r' if b.get(i + 1) == Some(&b'"') || b.get(i + 1) == Some(&b'#') => {
2291+ let mut j = i + 1;
2292+ while b.get(j) == Some(&b'#') {
2293+ j += 1;
2294+ }
2295+ if b.get(j) != Some(&b'"') {
2296+ i += 1;
2297+ continue;
2298+ }
2299+ let hashes = j - i - 1;
2300+ let mut end = None;
2301+ for k in (j + 1..b.len()).chain(std::iter::once(b.len() - 1)) {
2302+ if b[k] == b'"' && b[k + 1..].iter().take(hashes).all(|c| *c == b'#') {
2303+ end = Some(k);
2304+ break;
2305+ }
2306+ }
2307+ i = end? + 1;
2308+ continue;
2309+ }
2310+ b'"' => {
2311+ i = closing_quote(b, i)? + 1;
2312+ continue;
2313+ }
2314+ b'b' if b.get(i + 1) == Some(&b'"') => {
2315+ i = closing_quote(b, i + 1)? + 1;
2316+ continue;
2317+ }
2318+ // A lifetime (`'a`, `'static`) is not a char literal: it has no
2319+ // closing quote on its line, and reading one as a literal would
2320+ // hide real code from the scan.
2321+ b'\'' => {
2322+ let rest = &b[i + 1..];
2323+ let from = if rest.first() == Some(&b'\\') { 2 } else { 0 };
2324+ match rest[from..]
2325+ .iter()
2326+ .take_while(|c| **c != b'\n')
2327+ .position(|c| *c == b'\'')
2328+ {
2329+ Some(k) => i += from + k + 2,
2330+ None => i += 1,
2331+ }
2332+ continue;
2333+ }
2334+ b'{' => {
2335+ open = open.or(Some(i));
2336+ depth += 1;
2337+ }
2338+ b'}' => {
2339+ // A closer seen BEFORE the body opened is not ours (it can
2340+ // only come from a signature or a type ascription the scan
2341+ // mis-read); ignore it rather than underflowing `depth`.
2342+ if depth > 0 {
2343+ depth -= 1;
2344+ if depth == 0 {
2345+ return open.map(|o| (o, i));
2346+ }
2347+ }
2348+ }
2349+ _ => {}
2350+ }
2351+ i += 1;
2352+ }
2353+ None
2354+ }
2355+
2356+ /// The text of the body of the function defined at `gate_at`, or `None`
2357+ /// when that body is never closed.
2358+ fn function_body<'a>(src: &'a str, gate_at: usize) -> Option<&'a str> {
2359+ let (open, close) = body_braces(src, gate_at)?;
2360+ src.get(open..=close)
2361+ }
2362+
2363+ /// The first line of `body` that defines another function at `indent`
2364+ /// columns of leading whitespace -- the first sign that a boundary
2365+ /// over-reached into a neighbour.
2366+ fn sibling_fn(body: &str, indent: usize) -> Option<&str> {
2367+ body.lines().skip(1).find(|line| {
2368+ let lead = line.len() - line.trim_start().len();
2369+ lead == indent && {
2370+ let t = line.trim_start();
2371+ t.starts_with("fn ") || t.starts_with("pub fn ")
2372+ }
2373+ })
2374+ }
2375+
2376+ /// Lane-av1refusalspan: the proving gate's OWN body -- the text from the
2377+ /// `{` that opens it to the `}` that closes it.
2378+ ///
2379+ /// Every failure mode here is a FAILURE (`Err`), never a wider window. The
2380+ /// rule this replaced -- "the body ends at the next `fn` at the same
2381+ /// indentation, or at end of file" -- ended at end of file constantly (a
2382+ /// top-level `#[test] fn` in `decode.rs` has its next same-indent `fn`
2383+ /// tens of thousands of lines away), and one row's 27,427-line "body" was
2384+ /// satisfied by the CHROMA sibling's string seven lines down.
2385+ fn gate_body(gate: &str) -> Result<&'static str, String> {
2386+ let mut hits: Vec<(&str, usize, &'static str)> = Vec::new();
2387+ for (file, src) in GATE_SOURCES {
2388+ for at in gate_definitions(src, gate) {
2389+ hits.push((file, at, src));
2390+ }
2391+ }
2392+ match hits.as_slice() {
2393+ [] => Err(format!(
2394+ "{gate} is not defined in decode.rs, stream.rs or refusal_inventory.rs"
2395+ )),
2396+ [only] => {
2397+ let (file, at, src) = *only;
2398+ let body = function_body(src, at).ok_or_else(|| {
2399+ format!(
2400+ "{file}:{at}: the body of {gate}() is never closed -- a missing \
2401+ boundary is a FAILURE, not a window that runs on into the next \
2402+ function"
2403+ )
2404+ })?;
2405+ if let Some(leak) = sibling_fn(body, leading_indent(src, at)) {
2406+ return Err(format!(
2407+ "{file}:{at}: the extracted body of {gate}() still contains {} -- the \
2408+ boundary over-reached into a neighbour",
2409+ leak.trim()
2410+ ));
2411+ }
2412+ Ok(body)
2413+ }
2414+ many => Err(format!(
2415+ "{gate} is defined {} times ({}), so 'its body' is ambiguous",
2416+ many.len(),
2417+ many.iter()
2418+ .map(|(file, at, _)| format!("{file}:{at}"))
2419+ .collect::<Vec<_>>()
2420+ .join(", ")
2421+ )),
2422+ }
2423+ }
2424+
2425+ /// The refusal's leading clause: what a gate may quote when it does not
2426+ /// quote the whole string -- everything up to the first `(` (the qualifier
2427+ /// that varies per call site), else up to the first `:`, else the whole
2428+ /// string.
2429+ fn leading_clause(reason: &str) -> String {
2430+ let cut = reason
2431+ .find('(')
2432+ .or_else(|| reason.find(':'))
2433+ .unwrap_or(reason.len());
2434+ reason[..cut].trim_end().to_owned()
2435+ }
2436+
2437+ /// Every entry of [`PROVEN`] must still name a live refusal, and the gate
2438+ /// it names must REFERENCE that refusal inside its OWN body.
2439+ ///
2440+ /// Lane-av1refusalspan: the boundary is the gate's closing brace (see
2441+ /// [`gate_body`]); a boundary that cannot be found fails the row.
2127 #[test]2442 #[test]
2128 fn every_proven_refusal_names_a_test_that_exists() {2443 fn every_proven_refusal_names_a_test_that_exists() {
2129 let found = decode_path_refusals();2444 let found = decode_path_refusals();
2130- let sources = [2445+ let mut whole = 0usize;
2131- include_str!("stream.rs"),2446+ let mut clause = 0usize;
2132- include_str!("decode.rs"),2447+ let mut neither: Vec<&str> = Vec::new();
2133- include_str!("refusal_inventory.rs"),2448+ let mut unanchored: Vec<String> = Vec::new();
2134- ];2449+ let mut unbounded: Vec<String> = Vec::new();
2135 for (reason, gate) in PROVEN {2450 for (reason, gate) in PROVEN {
2136 assert!(2451 assert!(
2137 found.contains(*reason),2452 found.contains(*reason),
2138- "{reason:?} is listed as proven but is no longer a decode-path refusal -- drop it from PROVEN (the capability landed) or fix the string"2453+ "{reason:?} is listed as proven but is no longer a decode-path refusal -- \
2139- );2454+ drop it from PROVEN (the capability landed) or fix the string"
2140- assert!(
2141- sources
2142- .iter()
2143- .any(|src| src.contains(&format!("fn {gate}("))),
2144- "{reason:?} names the proving test {gate}, which exists in neither stream.rs \
2145- nor decode.rs"
2146 );2455 );
2456+ // A missing boundary is a FAILURE for the row, never a wider window.
2457+ let body = match gate_body(gate) {
2458+ Ok(body) => body,
2459+ Err(why) => {
2460+ unbounded.push(format!("{reason:?} names {gate}: {why}"));
2461+ continue;
2462+ }
2463+ };
2464+ let flat = squash_source(body);
2465+ if flat.contains(&squash_source(reason)) {
2466+ whole += 1;
2467+ } else if flat.contains(&squash_source(&leading_clause(reason))) {
2468+ clause += 1;
2469+ } else {
2470+ neither.push(reason);
2471+ unanchored.push(format!("{reason:?} names {gate}"));
2472+ }
2147 }2473 }
2474+ // The anchor-strength line, measured over BODIES. The window rule this
2475+ // replaced made these numbers a distribution over "whatever the window
2476+ // happened to reach", which is a different question.
2477+ eprintln!(
2478+ "anchor strength: {whole} rows quote the WHOLE refusal string, {clause} quote its \
2479+ LEADING CLAUSE, {} match neither: {neither:?}",
2480+ PROVEN.len() - whole - clause
2481+ );
2148 eprintln!(2482 eprintln!(
2149 "refusal inventory: {} refusals + {} capability claims, {} proven",2483 "refusal inventory: {} refusals + {} capability claims, {} proven",
2150 REFUSALS.len(),2484 REFUSALS.len(),
2151 CAPABILITY_CLAIMS.len(),2485 CAPABILITY_CLAIMS.len(),
2152 PROVEN.len()2486 PROVEN.len()
2153 );2487 );
2488+ assert!(
2489+ unbounded.is_empty(),
2490+ "these rows name a gate whose body could not be bounded, so nothing was proved \
2491+ about them -- a missing boundary is a failure, not a window that runs on:\n\
2492+ {unbounded:#?}\n\
2493+ The boundary is the gate's own closing brace. If the gate really is there, the \
2494+ finder is wrong: fix the finder, never the verdict."
2495+ );
2496+ assert!(
2497+ unanchored.is_empty(),
2498+ "these rows name a gate that never references the refusal inside its OWN body -- a \
2499+ test that does not use the string it is said to prove is not a proof:\n\
2500+ {unanchored:#?}\n\
2501+ Name a gate that quotes the refusal (or its leading clause), or write one."
2502+ );
2503+ }
2504+
2505+ /// Lane-av1refusalspan, non-vacuity of the BOUNDARY (not of the anchor):
2506+ /// a neighbour's function must be unreachable from a gate's body, and a
2507+ /// body that is not closed must fail rather than run on.
2508+ #[test]
2509+ fn a_gate_body_is_bounded_by_its_own_closing_brace() {
2510+ let marker = "a rectangular chroma transform whose size has no coefficient table";
2511+ let src = format!(
2512+ "fn this_gate() {{\n let _ = 1;\n}}\n\nfn next_gate() {{\n let _ = \"{marker}\";\n}}\n\nfn tail() {{}}\n"
2513+ );
2514+ let this = gate_body_in(&src, "this_gate").expect("the gate has a boundary");
2515+ assert!(this.contains("let _ = 1;"), "own text: {this:?}");
2516+ assert!(
2517+ !this.contains(marker),
2518+ "leaked into the neighbour: {this:?}"
2519+ );
2520+ let next = gate_body_in(&src, "next_gate").expect("the neighbour has a boundary");
2521+ assert!(next.contains(marker));
2522+ assert!(!next.contains("let _ = 1;"));
2523+ // The last function in a file has no following `fn` to stop at: the
2524+ // boundary must still close, exactly on its own brace.
2525+ assert_eq!(gate_body_in(&src, "tail").as_deref(), Ok("{}"));
2526+ // A brace inside a string or a char literal is not a brace. If the scan
2527+ // counted one, this body would run past its own `}` into `next_gate`
2528+ // -- the over-reach the `sibling_fn` invariant exists to catch, and the
2529+ // failure mode that made the old window 27,427 lines long.
2530+ let with_braces_in_literals = format!(
2531+ "fn this_gate() {{\n let _ = \"{{\";\n let _ = '}}';\n // {{\n /* }} */\n}}\n\nfn next_gate() {{\n let _ = \"{marker}\";\n}}\n"
2532+ );
2533+ let bounded = gate_body_in(&with_braces_in_literals, "this_gate");
2534+ assert!(
2535+ bounded.as_deref().is_ok_and(|b| !b.contains(marker)),
2536+ "a brace in a literal moved the boundary: {bounded:?}"
2537+ );
2538+ // A body whose closing brace is missing (a half-finished edit) is a
2539+ // FAILURE. The rule it replaced sliced to end of file and carried on.
2540+ let truncated =
2541+ format!("fn this_gate() {{\n let _ = 1;\n\nfn next_gate() {{\n let _ = 2;\n}}\n");
2542+ assert!(gate_body_in(&truncated, "this_gate").is_err());
2543+ }
2544+
2545+ /// Lane-av1refusalspan: the boundary is load-bearing on the REAL sources,
2546+ /// not only on the synthetic pair above -- every named gate resolves to
2547+ /// exactly one function whose body holds no other function, and the last
2548+ /// function in each of the three files terminates correctly.
2549+ #[test]
2550+ fn every_named_gate_body_is_bounded_in_these_files() {
2551+ let mut resolved = 0usize;
2552+ for (reason, gate) in PROVEN {
2553+ let body =
2554+ gate_body(gate).unwrap_or_else(|why| panic!("{reason:?} names {gate}: {why}"));
2555+ assert!(
2556+ body.ends_with('}'),
2557+ "{gate}'s body does not end on its closing brace"
2558+ );
2559+ resolved += 1;
2560+ }
2561+ assert_eq!(resolved, PROVEN.len());
2562+ for (file, src) in GATE_SOURCES {
2563+ let last = last_fn_name(src).unwrap_or_else(|| panic!("{file} has no function"));
2564+ let at = gate_definitions(src, &last)
2565+ .last()
2566+ .copied()
2567+ .unwrap_or_else(|| panic!("{file}: no definition of {last}"));
2568+ let body = function_body(src, at)
2569+ .unwrap_or_else(|| panic!("{file}: the last function {last}() has no boundary"));
2570+ assert!(sibling_fn(body, leading_indent(src, at)).is_none());
2571+ }
2572+ }
2573+
2574+ /// Lane-av1refusalspan: the invariant that catches a boundary that
2575+ /// over-reaches. Tested on its own text, so it cannot be satisfied by the
2576+ /// scanner happening to be right on the current sources.
2577+ #[test]
2578+ fn a_body_carrying_another_function_is_refused() {
2579+ assert!(sibling_fn("{\n let _ = 1;\n}\n\nfn neighbour() {\n}\n", 0).is_some());
2580+ assert!(sibling_fn("{\n let _ = 1;\n}\n", 0).is_none());
2581+ // A nested `fn` is deeper-indented and does belong to the body.
2582+ assert!(sibling_fn("{\n fn helper() {}\n}\n", 0).is_none());
2583+ }
2584+
2585+ /// Lane-av1refusalspan: `gate_body` over ONE file, so the boundary tests
2586+ /// above can drive it with text that cannot occur in this crate.
2587+ fn gate_body_in<'a>(src: &'a str, gate: &str) -> Result<&'a str, String> {
2588+ let defs = gate_definitions(src, gate);
2589+ match defs.as_slice() {
2590+ [] => Err(format!("{gate} is not defined here")),
2591+ [at] => {
2592+ let body = function_body(src, *at).ok_or_else(|| {
2593+ format!("the body of {gate}() is never closed -- boundary missing")
2594+ })?;
2595+ if let Some(leak) = sibling_fn(body, leading_indent(src, *at)) {
2596+ return Err(format!("boundary over-reached into {}", leak.trim()));
2597+ }
2598+ Ok(body)
2599+ }
2600+ many => Err(format!("{gate} is defined {} times", many.len())),
2601+ }
2602+ }
2603+
2604+ /// The name of the last function defined in `src` -- the boundary rule's
2605+ /// hard case, since nothing follows it to stop at.
2606+ fn last_fn_name(src: &str) -> Option<String> {
2607+ src.lines()
2608+ .filter_map(|line| {
2609+ let t = line.trim_start();
2610+ if !(t.starts_with("fn ") || t.starts_with("pub fn ")) {
2611+ return None;
2612+ }
2613+ Some(t.trim_start_matches("pub fn ").trim_start_matches("fn "))
2614+ })
2615+ .filter_map(|head| head.split_once('(').map(|(head, _)| head.trim().to_owned()))
2616+ .last()
2154 }2617 }
2155 }2618 }
crates/ec-av1/src/stream.rsmodified+8 -0
@@ -4417,6 +4417,14 @@ pub(crate) mod tests {
4417 /// re-deriving the formula here.4417 /// re-deriving the formula here.
4418 #[test]4418 #[test]
4419 fn every_frame_size_a_header_can_code_has_a_mode_info_grid() {4419 fn every_frame_size_a_header_can_code_has_a_mode_info_grid() {
4420+ // lane-av1refusalspan: this gate is the PROOF for the refusal below, so
4421+ // it names it and pins its guard site (the decode-path guard in
4422+ // decode.rs carries the same string).
4423+ const REFUSAL: &str = "a frame with no mode-info grid";
4424+ assert!(
4425+ crate::refusal_inventory::pins_refusal(include_str!("stream.rs"), REFUSAL),
4426+ "this gate proves {REFUSAL:?}, but that string is no longer in stream.rs"
4427+ );
4420 let mut sizes: Vec<u32> = (1..=1024).collect();4428 let mut sizes: Vec<u32> = (1..=1024).collect();
4421 sizes.extend([2048, 4095, 4096, 8192, 16384, 32768, 65535, 65536]);4429 sizes.extend([2048, 4095, 4096, 8192, 16384, 32768, 65535, 65536]);
4422 // `mi_cols` is nondecreasing in `frame_width`, so an empty grid can4430 // `mi_cols` is nondecreasing in `frame_width`, so an empty grid can
lanes/av1refusalspan.report.mdadded+198 -0
@@ -0,0 +1,198 @@
1+# lane-av1refusalspan — a real function boundary for the refusal inventory's anchor
2+
3+Base: `745c60e7` (main). Branch `lane-av1refusalspan`, commits `797fa52b` + `566d61bd`.
4+Worktree `~/.cache/wt/av1refusalspan`, lane-private `CARGO_TARGET_DIR`.
5+
6+```
7+cargo test -p ec-av1 --lib refusal_inventory
8+anchor strength: 26 rows quote the WHOLE refusal string, 7 quote its LEADING CLAUSE,
9+ 0 match neither: []
10+refusal inventory: 33 refusals + 1 capability claims, 33 proven
11+test result: ok. 19 passed; 0 failed; 0 ignored; 0 measured; 733 filtered out
12+```
13+
14+No decoder logic changed. The seven decoder/stream gates I touched were each run
15+individually and are green (`a_var_tx_tree_never_presents_a_leaf_larger_than_the_unit_it_entered`,
16+`every_intra_in_inter_shape_the_census_lists_has_a_size_group_row`,
17+`every_rect_transform_shape_the_census_lists_has_a_coefficient_table_and_scan`,
18+`every_shape_that_allows_motion_variation_has_a_motion_mode_cdf_row`,
19+`a_selected_reference_with_an_empty_ref_frame_idx_slot_refuses_by_name`,
20+`every_inter_record_publishes_an_obmc_readable_filter`,
21+`every_frame_size_a_header_can_code_has_a_mode_info_grid`).
22+
23+---
24+
25+## 0. Where this branch sits, stated once
26+
27+`lane-av1refusal` (tip `910dc296`, r7) is **unmerged**, and main therefore does not
28+contain the anchor check at all: at `745c60e7` `every_proven_refusal_names_a_test_that_exists`
29+asks only whether `fn <gate>(` appears *somewhere* in the three files. The window rule the
30+ticket quotes lives on that branch.
31+
32+I based this lane on main as instructed, so the work is a **self-contained, corrected
33+version** of r3–r7's `body_of`: real boundary, missing boundary = failure, leading-clause
34+anchor, measured distribution. **Merge this one, not both** — they edit the same test and
35+the same three rows' gates. If `lane-av1refusal` is merged first, take this branch's
36+`refusal_inventory.rs`, `decode.rs` and `stream.rs` over it and drop r3–r7's `body_of`.
37+
38+---
39+
40+## 1. The boundary rule, and why the alternatives lose
41+
42+**Chosen: the brace that closes the gate's body.** `body_braces` walks Rust from the `fn`
43+keyword — not lines — and skips string literals, raw strings (`r"`, `r#"…"#`), byte strings,
44+char literals, lifetimes (`'a`, `'static`), line comments and nestable block comments.
45+`gate_body` returns the text from the body's `{` to its matching `}`.
46+
47+The three candidates, and how each fails:
48+
49+| rule | why it loses on this tree |
50+|---|---|
51+| next `#[test]` / `#[cfg(test)]` attribute | it bounds a *test region*, not a function. The attribute-less helpers between two tests (`decode_path_refusals`, `squash_ws`, `corner_scan`-style closures, `reachable`) fall inside the preceding test's window, and — worse — it has no answer for the **last** test in a file, which is the same "no boundary → widen" hole the ticket asks me to close. Attribute order also varies (`#[test]`, `#[ignore]`, doc comments). |
52+| explicit per-gate span, recorded next to `PROVEN` | a second thing to keep in step with the source, and it fails **open**: when a gate is renamed, moved or deleted, the recorded span still points at *some* text and the row stays green. That is the defect class in a different costume. |
53+| same-indent `fn` line (what r3 shipped) | keepable as an *invariant*, useless as a *boundary* — see §5's M4. |
54+
55+Why the brace rule is the right one for this file specifically: `decode.rs` is 56k lines
56+of gates whose bodies are dense with literal braces — refusal strings carry `{tx_w}`,
57+`{bw}`, `{part32}`, and asserts carry `{ref_frame}`, `{w}x{h}` — and the file is
58+re-indented by merges (the wave merge dedented a call site by four spaces). A rule that
59+counts `{`/`}` as bytes, or that keys on indentation, is reading exactly the parts of
60+this file that churn.
61+
62+---
63+
64+## 2. A missing boundary is a failure, never a wider window
65+
66+`gate_body` returns `Result<&str, String>` and has exactly four `Err` paths, none of
67+which touches a byte outside the gate:
68+
69+1. **no definition** — `fn <gate>(` appears on no definition line (a comment or a string
70+ that merely names the gate does not count: `gate_definitions` requires the text before
71+ the keyword to be whitespace and qualifiers only);
72+2. **never closed** — the scan reaches end of file without the depth returning to zero;
73+3. **ambiguous** — the name is defined more than once, so "its body" has no referent;
74+4. **over-reach** — the extracted text still carries another same-indent `fn`, which means
75+ the scanner under-counted.
76+
77+`every_proven_refusal_names_a_test_that_exists` collects paths 1–3 into an `unbounded`
78+list and asserts it empty; path 4 fires inside `gate_body` and surfaces the same way.
79+A spin in the scanner is a fifth case, and it used to be a **hang** (see §5's M3); every
80+arm now has to advance the cursor, asserted at the top of the loop.
81+
82+---
83+
84+## 3. Re-measured over real bodies
85+
86+The `25 whole / 8 leading clause / 0 neither` line was, as r7 said, a distribution over
87+"whatever the window reached". Measured over bodies the brace rule actually finds, on
88+main's tree **before any gate was touched**:
89+
90+```
91+anchor strength: 13 rows quote the WHOLE refusal string, 6 quote its LEADING CLAUSE,
92+ 14 match neither
93+```
94+
95+**14 of 33 rows were anchored by nothing.** Every one of them is now anchored, by the gate
96+naming the refusal it proves and pinning the guard that still carries the string
97+(`refusal_inventory::pins_refusal`, whitespace-squashed so a literal written over two
98+lines with a `\` continuation still matches):
99+
100+| # | row | gate | before | after |
101+|---|---|---|---|---|
102+| 1 | `an intra-coded {bw}x{bh} block on the inter block path (…)` | `every_intra_in_inter_shape_the_census_lists_has_a_size_group_row` | neither | whole |
103+| 2 | `a rectangular inter luma transform unit whose shape has no coefficient table set here` | `every_rect_transform_shape_the_census_lists_has_a_coefficient_table_and_scan` | neither | whole |
104+| 3 | `a rectangular inter chroma transform unit … table set here` | same gate | neither | whole |
105+| 4 | `a rectangular transform unit whose shape has no coefficient scan table here` | same gate | neither | whole |
106+| 5 | `an inter var-tx tree with a leaf transform larger than 32x32` | `a_var_tx_tree_never_presents_a_leaf_larger_than_the_unit_it_entered` | neither | whole |
107+| 6 | `… larger than 64x64` | same gate | neither | whole |
108+| 7 | `a Golomb tail longer than this decoder reads` | `read_golomb_reads_every_value_a_conformant_stream_can_carry` | neither | whole |
109+| 8 | `a motion_mode symbol for a block shape with no CDF row here` | `every_shape_that_allows_motion_variation_has_a_motion_mode_cdf_row` | neither | whole |
110+| 9 | `a frame with no mode-info grid` | `every_frame_size_a_header_can_code_has_a_mode_info_grid` | neither | whole |
111+| 10 | `a reference frame selected with no picture at this frame's own ref_frame_idx slot for it` | `a_selected_reference_with_an_empty_ref_frame_idx_slot_refuses_by_name` | neither | whole (its const was a **prefix**, `…own ref_frame_idx slot`; extended to the whole string) |
112+| 11 | `an OBMC neighbour whose switchable interp filter was never recorded` | `every_inter_record_publishes_an_obmc_readable_filter` | neither | whole |
113+| 12 | `a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here` | `every_rect_strip_shape_the_split_path_codes_has_a_luma_and_chroma_table` | neither | whole |
114+| 13 | `a split intra strip whose transform unit is {tx_w}x{tx_h} (…)` | same gate | neither | whole |
115+| 14 | `CfL, filter intra or a palette on a 128-root HORZ/VERT intra block (…)` | `no_128_root_half_reads_a_cfl_filter_intra_or_palette_symbol` | neither | leading clause |
116+
117+13 whole + 1 clause → the final `26 / 7 / 0`. No row is marked NOT-PROVEN: each of the 14
118+has a real proof behind it (an enumeration, a census or a negative gate); what was missing
119+was the gate saying so.
120+
121+Rows 2–4 and 14 are the three the earlier tightening (r5) had already recovered — see §5.
122+
123+---
124+
125+## 4. Non-vacuity of the boundary
126+
127+Three permanent tests, all in `refusal_inventory::tests`:
128+
129+- `a_gate_body_is_bounded_by_its_own_closing_brace` — two adjacent functions where the
130+ **neighbour** carries the string; asserts the gate's body does not and the neighbour's
131+ does; asserts the **last function in a file** (`fn tail() {}`, nothing after it) closes
132+ exactly on its own brace (`Ok("{}")`); asserts a body whose closing brace is missing is
133+ `Err`; and asserts a `{` inside a string, a `'}'` char literal, a `// {` and a `/* }} */`
134+ comment do not move the boundary.
135+- `every_named_gate_body_is_bounded_in_these_files` — the same boundary over the three
136+ real sources: all 33 named gates resolve to exactly one function whose body ends on a
137+ `}` and holds no other function, and the **last function in each of the three files**
138+ terminates correctly.
139+- `a_body_carrying_another_function_is_refused` — the `sibling_fn` predicate on its own
140+ text (a same-indent `fn` is caught; a deeper-indented nested `fn` is not), so it cannot
141+ be satisfied by the scanner happening to be right today.
142+
143+Four mutations, each applied, observed red, reverted (`git status` clean):
144+
145+| # | mutation | result |
146+|---|---|---|
147+| **M1** | delete the anchor from `every_intra_in_inter_shape_the_census_lists_has_a_size_group_row` and park the refusal string as a `let _ = …` **one line past its closing brace**, inside `motion_mode_cdf_row` | RED: `26→25` whole, `0→1` neither, and the row is listed by name — a neighbour's text one line away cannot satisfy a row |
148+| **M2** | `gate_definitions` accepts column-0 definitions only, so gates inside `mod tests` are invisible | RED: 25 rows reported `… is not defined in decode.rs, stream.rs or refusal_inventory.rs` under the `unbounded` heading, and both boundary tests fail. **This is the missing-boundary-is-a-failure property on real data.** |
149+| **M3** | the string-literal skip becomes a naive counter (`i += 1`) | RED: `a brace in a literal moved the boundary: Err("the body of this_gate() is never closed -- boundary missing")`. A body that would run into its neighbour fails; it never passes. |
150+| **M3b** | the string arm becomes a bare `continue` (no cursor advance) | the boundary test **hung** for 600 s instead of failing. That is why `body_braces` now asserts every arm advances — the failure mode moved from a hung suite to a failed one (`566d61bd`). |
151+| **M4** | `function_body` replaced by the **old rule** (next same-indent `fn`, else end of file) | **GREEN**, and that is a finding, not a pass: on *today's* main tree every one of the 33 gates happens to have a following same-indent `fn`, so the old rule coincides with the true boundary here. It is the same code that produced a 27,427-line window on `lane-av1refusal`'s tree. The old rule's failure is tree-dependent and silent, which is precisely why it is not a rule; the brace rule does not move when the file is reorganised. |
152+
153+M4 also re-frames `sibling_fn`: it is a backstop against a scanner that under-counts, not
154+the thing that catches the leak — the leak is caught because the body is the *function's*.
155+
156+---
157+
158+## 5. The three rows the earlier tightening recovered
159+
160+Kept anchored, on their own merits:
161+
162+- **`a rectangular inter luma transform unit …` / chroma twin / scan twin** → the gate
163+ `every_rect_transform_shape_the_census_lists_has_a_coefficient_table_and_scan` names all
164+ three strings and pins all three guard sites.
165+- **`CfL, filter intra or a palette on a 128-root HORZ/VERT intra block (…)`** →
166+ `no_128_root_half_reads_a_cfl_filter_intra_or_palette_symbol` carries the full leading
167+ clause as a const and pins it.
168+- **`a reference frame selected with no picture at this frame's own ref_frame_idx slot for it`**
169+ → `a_selected_reference_with_an_empty_ref_frame_idx_slot_refuses_by_name`'s const is now
170+ the **whole** string, not the prefix `…own ref_frame_idx slot` (the row's anchor is the
171+ whole string: it has no `(` and no `:`).
172+
173+Measurement of all three under the real boundary, with their anchors removed: **all three
174+are in the 14-row `neither` bucket of §3.** That is the direct answer to "is the
175+tightening earned": under a boundary that is really a function, those rows were anchored by
176+nothing, and each needed its gate to say which string it was about.
177+
178+---
179+
180+## 6. What is deliberately not here
181+
182+- `PROVEN` is still `&[(&str, &str)]`. The r1/r2 `Proof` tagging (NEGATIVE / ENUMERATION /
183+ TABLE PIN) and the "every refusal needs a row" direction are `lane-av1refusal`'s scope,
184+ not this lane's; porting them here would collide on the same table for no gain.
185+- No refusal, `PROVEN` row or decoder behaviour changed. The only semantic change is that
186+ nine gates now assert they name the refusal they prove.
187+
188+Two hardenings came out of the mutations and ride in the same branch: the
189+cursor-advance assert (`566d61bd`, from M3b) and a `depth -= 1` that underflowed
190+if the scan met a `}` between the `fn` keyword and the body's `{` (`81eaadfd`).
191+
192+## 7. Open for Main
193+
194+
195+- Merge `lane-av1refusalspan`; retire `lane-av1refusal`'s `body_of` (see §0).
196+- The new pins make a refusal-string edit in `decode.rs`/`stream.rs` turn **two** gates red
197+ (the pinning gate and the inventory row). That is intended, but it is the first thing
198+ that will surprise the next lane that renames a guard message.