forge
Explore
Log in

Don't you dare go Hollow

Give every count-vacuity scanner matcher a positive control

Browse files at this commit

91a96ffd9ccfcd8f95b6c919e2b0a64102b1e62dAhmet Kaan GümüşParent: d9e6745
  • test
    • give every count-vacuity scanner matcher a positive control
Show full message
test(av1): give every count-vacuity scanner matcher a positive control

The wave-3e refutation of the pins5 guard turned up a class the sweep's own
floor could not see: an UNEXERCISED MATCHER IN A SOURCE SCANNER. The floor
(s.len() >= 40) and the unpinned ceiling (43) both catch a LOST shape.
Nothing caught a matcher that has never fired, so the scanner advertised
coverage it did not have.

Measured every matcher in count_vacuity against the real scan target:

  ffmpeg_decode_sequence_444( -- NOT dead, my first read was wrong. It fires
  on five stream.rs gates (7030, 7545, 7735, 8439, 11643) and produces no
  count-vacuity SITE only because all five pass the spec const FRAMES rather
  than a decode-derived .len(). KEPT, with that reason recorded at the const.

  Nine spellings that fire on nothing anywhere in the crate -- DELETED, each
  with grep evidence that the string occurs nowhere outside the matcher table,
  so there is no hypothetical caller to name and no coverage is lost:
    diagnostic                          (probe substring, 0 fns)
    the_chroma_rect_gates, restore_gate,
    cdef_gate, superres_gate,
    grain_gate, sgate                   (encode helpers, 0 fn bodies)
    NFRAMES, frames_expected            (spec bindings, 0 fn bodies)

All tables are now single-sourced pub consts (CALLEES, PROBE_SUBSTRINGS,
ENC_HELPERS, FIXABLE_CANDS, AOMENC_LEAF, DISK_READ_LEAVES, PIN_WINDOW) and
every_scanner_matcher_fires_on_a_known_site iterates those same consts, so a
matcher cannot be added later without a control that has to pass. The brace
walk is extracted from sites() into fn_body_end so the control measures the
EXACT slice the scanner classifies with (control-and-measurement-drift).

Mutation: re-adding "sgate" to ENC_HELPERS reds the control --
  the encode-helper matcher `sgate(` matches NO fn body in stream.rs -- it is
  dead coverage (grep the crate: ...)
Restored, control ok.

The sweep is UNCHANGED, which is the proof the deletions cost nothing:
  count-vacuity sweep: 60 site(s); 17 spec-pinned by a prior assert, 43 not
  test result: ok. 3 passed; 0 failed
crates/ec-av1/src/gate_coverage.rsmodified+267 -89
@@ -2092,50 +2092,176 @@ mod count_vacuity {
2092 pub fixable_from: Option<String>,2092 pub fixable_from: Option<String>,
2093 }2093 }
2094 2094
2095- /// A census/probe/diagnostic gate: it reports, it does not assert a verdict.2095+ /// The scanner's matchers, as SINGLE-SOURCE tables.
2096- fn is_probe(gate: &str) -> bool {2096+ ///
2097- [2097+ /// They are `pub const` rather than inline literals because the sweep's
2098- "census",2098+ /// floor only catches a LOST shape; nothing caught a matcher that has
2099- "probe",2099+ /// never fired, so a dead spelling sat in this list advertising coverage
2100- "sweep",2100+ /// the scan does not have (class: unexercised matcher in a source
2101- "first_diff",2101+ /// scanner). [`count_vacuity_tests::every_scanner_matcher_fires_on_a_known_site`]
2102- "scratch",2102+ /// iterates THESE arrays, so a matcher cannot be added here without a
2103- "rectx",2103+ /// positive control that has to pass.
2104- "diagnostic",2104+
2105- ]2105+ /// Oracle call spellings whose LAST argument is a locally derived count.
2106- .iter()2106+ /// `ffmpeg_decode_sequence_444(` fires on five real `stream.rs` gates
2107- .any(|m| gate.contains(m))2107+ /// (stream.rs:7030/7545/7735/8439/11643) but yields no count-vacuity SITE,
2108- }2108+ /// because every one of those five passes the spec const `FRAMES` rather
2109+ /// than a decode-derived `.len()`. It is live coverage, not a dead
2110+ /// spelling, and the control below measures the spelling, not the site.
2111+ pub const CALLEES: &[&str] = &[
2112+ "ffmpeg_decode_sequence(",
2113+ "ffmpeg_decode_sequence_10bit(",
2114+ "ffmpeg_decode_sequence_444(",
2115+ ];
2116+
2117+ /// Gate-name substrings that mark a census/probe/diagnostic gate: it
2118+ /// reports, it does not assert a verdict. `"diagnostic"` was here and has
2119+ /// no gate in the tree carrying it (and no other occurrence in the crate
2120+ /// outside this list), so it was DELETED rather than kept: there is no
2121+ /// hypothetical caller to name, and a probe that later wants that name
2122+ /// re-adds one line here, where the control then holds it to firing.
2123+ pub const PROBE_SUBSTRINGS: &[&str] =
2124+ &["census", "probe", "sweep", "first_diff", "scratch", "rectx"];
2109 2125
2110 /// Encode helpers a gate can drive INDIRECTLY. The r7 extraction found 21 of2126 /// Encode helpers a gate can drive INDIRECTLY. The r7 extraction found 21 of
2111 /// the 25 bucket-b gates encode through one of these, not through2127 /// the 25 bucket-b gates encode through one of these, not through
2112 /// `aomenc_path()` directly -- which is why a first pass that only looked for2128 /// `aomenc_path()` directly -- which is why a first pass that only looked for
2113 /// `aomenc_path()` classified 6 gates "unclassified" that plainly encode.2129 /// `aomenc_path()` classified 6 gates "unclassified" that plainly encode.
2130+ /// Six further names (`the_chroma_rect_gates`, `restore_gate`,
2131+ /// `cdef_gate`, `superres_gate`, `grain_gate`, `sgate`) were here and
2132+ /// matched no `fn` body in the tree; `grep -rn '\bNAME\b' crates/ec-av1/src`
2133+ /// returns these six and NOTHING ELSE -- no helper, no caller, no comment
2134+ /// naming them -- so they were rot and are DELETED, not kept with a
2135+ /// hypothetical-caller note.
2136+ pub const ENC_HELPERS: &[&str] = &[
2137+ "encode_aomenc_stream",
2138+ "screen_intrabc_stream_at_depth",
2139+ "screen_intrabc_stream_with",
2140+ "libaom_encode_with",
2141+ "libaom_encode",
2142+ "run_multi_tile_gate",
2143+ "edge32_gate",
2144+ "rect_tx_tool_gate",
2145+ "warp_gate",
2146+ ];
2147+
2148+ /// Frame-count bindings that are a SPEC rather than a self-fulfilling
2149+ /// number. `NFRAMES` and `frames_expected` were here, matched no `fn`
2150+ /// body, and appear nowhere else in the crate -- DELETED as rot.
2151+ pub const FIXABLE_CANDS: &[&str] = &["FRAMES", "frame_count"];
2152+
2153+ /// How many lines above a count site an `assert(..)` on the same binding
2154+ /// may sit and still call the count spec-pinned. A single-sourced const so
2155+ /// the control below can hold the WINDOW itself to being the window the
2156+ /// sweep walks (a window widened to EOF would pin sites it never pinned).
2157+ pub const PIN_WINDOW: usize = 14;
2158+
2159+ /// The bucket-(b) leaf: a gate that drives aomenc directly rather than
2160+ /// through [`ENC_HELPERS`].
2161+ pub const AOMENC_LEAF: &str = "aomenc_path()";
2162+
2163+ /// The bucket-(a) leaves: a gate that reads its stream from disk.
2164+ pub const DISK_READ_LEAVES: &[&str] = &["fs::read", "crate_pin"];
2165+
2166+ /// A census/probe/diagnostic gate: it reports, it does not assert a verdict.
2167+ fn is_probe(gate: &str) -> bool {
2168+ PROBE_SUBSTRINGS.iter().any(|m| gate.contains(m))
2169+ }
2170+
2171+ /// Encode helpers a gate can drive INDIRECTLY -- see [`ENC_HELPERS`].
2114 fn enc_helpers(body: &str) -> Vec<&'static str> {2172 fn enc_helpers(body: &str) -> Vec<&'static str> {
2115- const NAMES: &[&str] = &[2173+ ENC_HELPERS
2116- "encode_aomenc_stream",
2117- "screen_intrabc_stream_at_depth",
2118- "screen_intrabc_stream_with",
2119- "libaom_encode_with",
2120- "libaom_encode",
2121- "run_multi_tile_gate",
2122- "edge32_gate",
2123- "rect_tx_tool_gate",
2124- "the_chroma_rect_gates",
2125- "restore_gate",
2126- "cdef_gate",
2127- "warp_gate",
2128- "superres_gate",
2129- "grain_gate",
2130- "sgate",
2131- ];
2132- NAMES
2133 .iter()2174 .iter()
2134 .copied()2175 .copied()
2135 .filter(|n| body.contains(&format!("{n}(")))2176 .filter(|n| body.contains(&format!("{n}(")))
2136 .collect()2177 .collect()
2137 }2178 }
2138 2179
2180+ /// End byte of the `fn` body starting at `fn_start`: a STRING- and
2181+ /// line-comment-aware brace walk (the trap it dodges is recorded at the
2182+ /// call site). Extracted so the matchers' positive-control test walks the
2183+ /// EXACT slice the scanner classifies -- a control that re-implemented the
2184+ /// walk would be measuring a different thing than the guard (class
2185+ /// control-and-measurement-drift).
2186+ pub fn fn_body_end(src: &str, fn_start: usize) -> usize {
2187+ let bytes = src.as_bytes();
2188+ let mut depth = 0i32;
2189+ let mut started = false;
2190+ let mut fn_end = src.len();
2191+ let mut in_str = false;
2192+ let mut in_line_comment = false;
2193+ let mut k = fn_start;
2194+ while k < bytes.len() {
2195+ let c = bytes[k];
2196+ if in_line_comment {
2197+ if c == b'\n' {
2198+ in_line_comment = false;
2199+ }
2200+ k += 1;
2201+ continue;
2202+ }
2203+ if in_str {
2204+ if c == b'\\' {
2205+ k += 2;
2206+ continue;
2207+ }
2208+ if c == b'"' {
2209+ in_str = false;
2210+ }
2211+ k += 1;
2212+ continue;
2213+ }
2214+ match c {
2215+ b'"' => in_str = true,
2216+ b'/' if bytes.get(k + 1) == Some(&b'/') => {
2217+ in_line_comment = true;
2218+ k += 1;
2219+ }
2220+ b'{' => {
2221+ depth += 1;
2222+ started = true;
2223+ }
2224+ b'}' => {
2225+ depth -= 1;
2226+ if started && depth == 0 {
2227+ fn_end = k + 1;
2228+ break;
2229+ }
2230+ }
2231+ _ => {}
2232+ }
2233+ k += 1;
2234+ }
2235+ fn_end
2236+ }
2237+
2238+ /// `(fn name, body slice)` for every top-level `fn` in `src`, attributed
2239+ /// the way [`sites`] attributes a site to its gate.
2240+ pub fn fn_slices(src: &str) -> Vec<(String, &str)> {
2241+ let lines: Vec<&str> = src.lines().collect();
2242+ let mut offsets: Vec<usize> = Vec::with_capacity(lines.len());
2243+ {
2244+ let mut o = 0usize;
2245+ for l in &lines {
2246+ offsets.push(o);
2247+ o += l.len() + 1;
2248+ }
2249+ }
2250+ let mut out: Vec<(String, &str)> = Vec::new();
2251+ for (i, line) in lines.iter().enumerate() {
2252+ let t = line.trim_start();
2253+ let Some(rest) = t.strip_prefix("fn ") else { continue };
2254+ let Some(nm) = rest.split('(').next() else { continue };
2255+ if nm.contains(' ') {
2256+ continue;
2257+ }
2258+ let at = offsets[i];
2259+ let end = fn_body_end(src, at);
2260+ out.push((nm.to_string(), &src[at..end]));
2261+ }
2262+ out
2263+ }
2264+
2139 pub fn sites(src: &str) -> Vec<Site> {2265 pub fn sites(src: &str) -> Vec<Site> {
2140 let mut out = Vec::new();2266 let mut out = Vec::new();
2141 let lines: Vec<&str> = src.lines().collect();2267 let lines: Vec<&str> = src.lines().collect();
@@ -2163,11 +2289,7 @@ mod count_vacuity {
2163 }2289 }
2164 }2290 }
2165 }2291 }
2166- for callee in [2292+ for callee in CALLEES {
2167- "ffmpeg_decode_sequence(",
2168- "ffmpeg_decode_sequence_10bit(",
2169- "ffmpeg_decode_sequence_444(",
2170- ] {
2171 let Some(at) = line.find(callee) else {2293 let Some(at) = line.find(callee) else {
2172 continue;2294 continue;
2173 };2295 };
@@ -2207,7 +2329,7 @@ mod count_vacuity {
2207 // every multi-line spelling and inflated the unpinned count.2329 // every multi-line spelling and inflated the unpinned count.
2208 let want = format!("{binding}.len()");2330 let want = format!("{binding}.len()");
2209 let mut pinned = None;2331 let mut pinned = None;
2210- for back in 1..=14usize {2332+ for back in 1..=PIN_WINDOW {
2211 if i < back {2333 if i < back {
2212 break;2334 break;
2213 }2335 }
@@ -2242,54 +2364,7 @@ mod count_vacuity {
2242 // body and made every compare-detection read false -- the same2364 // body and made every compare-detection read false -- the same
2243 // trap that made stream.rs look 2 braces short in the first2365 // trap that made stream.rs look 2 braces short in the first
2244 // review of this wave.2366 // review of this wave.
2245- let bytes = src.as_bytes();2367+ let fn_end = fn_body_end(src, fn_start);
2246- let mut depth = 0i32;
2247- let mut started = false;
2248- let mut fn_end = src.len();
2249- let mut in_str = false;
2250- let mut in_line_comment = false;
2251- let mut k = fn_start;
2252- while k < bytes.len() {
2253- let c = bytes[k];
2254- if in_line_comment {
2255- if c == b'\n' {
2256- in_line_comment = false;
2257- }
2258- k += 1;
2259- continue;
2260- }
2261- if in_str {
2262- if c == b'\\' {
2263- k += 2;
2264- continue;
2265- }
2266- if c == b'"' {
2267- in_str = false;
2268- }
2269- k += 1;
2270- continue;
2271- }
2272- match c {
2273- b'"' => in_str = true,
2274- b'/' if bytes.get(k + 1) == Some(&b'/') => {
2275- in_line_comment = true;
2276- k += 1;
2277- }
2278- b'{' => {
2279- depth += 1;
2280- started = true;
2281- }
2282- b'}' => {
2283- depth -= 1;
2284- if started && depth == 0 {
2285- fn_end = k + 1;
2286- break;
2287- }
2288- }
2289- _ => {}
2290- }
2291- k += 1;
2292- }
2293 let body = &src[fn_start..fn_end];2368 let body = &src[fn_start..fn_end];
2294 // APPROXIMATE, and known to be so: the body slice is a2369 // APPROXIMATE, and known to be so: the body slice is a
2295 // hand-rolled brace walk, and this crate's compare idioms vary2370 // hand-rolled brace walk, and this crate's compare idioms vary
@@ -2307,7 +2382,7 @@ mod count_vacuity {
2307 || body.contains("vs ffmpeg"));2382 || body.contains("vs ffmpeg"));
2308 // A SPEC already in scope for this gate?2383 // A SPEC already in scope for this gate?
2309 let mut fixable = None;2384 let mut fixable = None;
2310- for cand in ["FRAMES", "frame_count", "NFRAMES", "frames_expected"] {2385+ for cand in FIXABLE_CANDS {
2311 if body.contains(&format!("const {cand}"))2386 if body.contains(&format!("const {cand}"))
2312 || body.contains(&format!("let {cand}"))2387 || body.contains(&format!("let {cand}"))
2313 {2388 {
@@ -2341,12 +2416,12 @@ mod count_vacuity {
2341 Some("c"),2416 Some("c"),
2342 "census/probe: reports, does not assert a verdict".to_string(),2417 "census/probe: reports, does not assert a verdict".to_string(),
2343 )2418 )
2344- } else if body.contains("aomenc_path()") || !enc_helpers(body).is_empty() {2419+ } else if body.contains(AOMENC_LEAF) || !enc_helpers(body).is_empty() {
2345 (2420 (
2346 Some("b"),2421 Some("b"),
2347 "live aomenc encode: count belongs to the encoder".to_string(),2422 "live aomenc encode: count belongs to the encoder".to_string(),
2348 )2423 )
2349- } else if body.contains("fs::read") || body.contains("crate_pin") {2424+ } else if DISK_READ_LEAVES.iter().any(|leaf| body.contains(leaf)) {
2350 (2425 (
2351 Some("a"),2426 Some("a"),
2352 "stream read from disk: count belongs to the pin".to_string(),2427 "stream read from disk: count belongs to the pin".to_string(),
@@ -2374,6 +2449,109 @@ mod count_vacuity {
2374 }2449 }
2375 out2450 out
2376 }2451 }
2452+
2453+ /// Every matcher's POSITIVE CONTROL: each spelling in this module's tables
2454+ /// must fire on at least one real thing in the scanned source, or the
2455+ /// spelling is advertising coverage the scan does not have.
2456+ ///
2457+ /// This is the missing half of the sweep's own floor. `s.len() >= 40` and
2458+ /// the unpinned ceiling both catch a LOST shape; nothing caught a matcher
2459+ /// that never fired -- which is how six encode-helper names, two spec
2460+ /// binding names and one probe substring sat in these tables matching
2461+ /// nothing anywhere in the crate (class: unexercised matcher in a source
2462+ /// scanner). Those nine are deleted. The control reads the SAME `const`
2463+ /// tables the scanner reads, so a matcher added later cannot skip it.
2464+ ///
2465+ /// `fn_slices` walks the same `fn_body_end` the scanner classifies with, so
2466+ /// "fires" means fires on the slice the guard actually reads.
2467+ #[test]
2468+ fn every_scanner_matcher_fires_on_a_known_site() {
2469+ let src = include_str!("stream.rs");
2470+ let lines: Vec<&str> = src.lines().collect();
2471+ let fns = fn_slices(src);
2472+
2473+ // The callee list, as a SPELLING. Not as a produced site: the
2474+ // `_444` spelling fires on five real gates that all pass the spec
2475+ // const `FRAMES`, so it correctly yields no count-vacuity site. A
2476+ // spelling that no `stream.rs` line uses is a spelling that has
2477+ // stopped being written and is now dead weight in the table.
2478+ for callee in CALLEES {
2479+ let hits = lines.iter().filter(|l| l.contains(callee)).count();
2480+ assert!(
2481+ hits > 0,
2482+ "the callee matcher `{callee}` fires on NO line of stream.rs -- it is dead \
2483+ coverage: either a gate stopped using that spelling (drop the entry) or a \
2484+ new one is expected to (add the call site first, not the matcher)"
2485+ );
2486+ }
2487+
2488+ // The gate-name probe substrings, against real fn names.
2489+ for sub in PROBE_SUBSTRINGS {
2490+ let hits = fns.iter().filter(|(g, _)| g.contains(sub)).count();
2491+ assert!(
2492+ hits > 0,
2493+ "the probe substring `{sub}` matches NO fn name in stream.rs -- bucket (c) is \
2494+ unpopulated and the substring is dead weight"
2495+ );
2496+ }
2497+
2498+ // The indirect-encode helpers, against real fn BODIES.
2499+ for helper in ENC_HELPERS {
2500+ let hits = fns
2501+ .iter()
2502+ .filter(|(_, b)| b.contains(&format!("{helper}(")))
2503+ .count();
2504+ assert!(
2505+ hits > 0,
2506+ "the encode-helper matcher `{helper}(` matches NO fn body in stream.rs -- it is \
2507+ dead coverage (grep the crate: if the helper has no caller, delete the entry; if \
2508+ it has a caller outside stream.rs, say so here and name the file)"
2509+ );
2510+ }
2511+
2512+ // The spec-binding candidates, against real fn BODIES.
2513+ for cand in FIXABLE_CANDS {
2514+ let hits = fns
2515+ .iter()
2516+ .filter(|(_, b)| {
2517+ b.contains(&format!("const {cand}")) || b.contains(&format!("let {cand}"))
2518+ })
2519+ .count();
2520+ assert!(
2521+ hits > 0,
2522+ "the spec-binding matcher `{cand}` matches NO fn body in stream.rs -- `fixable_from` \
2523+ can never name it, so it is dead coverage"
2524+ );
2525+ }
2526+
2527+ // The two bucket leaves the classifier short-circuits on.
2528+ assert!(
2529+ fns.iter().any(|(_, b)| b.contains(AOMENC_LEAF)),
2530+ "no fn body in stream.rs calls `{AOMENC_LEAF}`, so the bucket-(b) direct-encode leaf \
2531+ never fires"
2532+ );
2533+ for leaf in DISK_READ_LEAVES {
2534+ let hits = fns.iter().filter(|(_, b)| b.contains(leaf)).count();
2535+ assert!(
2536+ hits > 0,
2537+ "the disk-read leaf `{leaf}` matches NO fn body in stream.rs -- bucket (a) is \
2538+ unpopulated by that spelling"
2539+ );
2540+ }
2541+
2542+ // The pin window is a matcher too: a window so wide it pinned
2543+ // everything, or so narrow it pinned nothing, would leave the
2544+ // ceiling reading a population it no longer describes.
2545+ let s = sites(src);
2546+ let pinned = s.iter().filter(|x| x.pinned_by.is_some()).count();
2547+ assert!(
2548+ PIN_WINDOW > 0 && pinned > 0,
2549+ "PIN_WINDOW={PIN_WINDOW} pins {pinned} of {} site(s) -- the window must be the one \
2550+ the sweep walks and must still pin at least one site",
2551+ s.len()
2552+ );
2553+ }
2554+
2377 }2555 }
2378 2556
2379 #[cfg(test)]2557 #[cfg(test)]
lanes/av1w3erefute.report.mdadded+344 -0
@@ -0,0 +1,344 @@
1+# lanes/av1w3erefute — wave-3e refutation, read-only
2+
3+Worktree `/home/user/.cache/wt/av1w3erefute`, branch `lane-av1w3erefute`, base `3b691e13`
4+(main). `CARGO_TARGET_DIR=/home/user/.cache/wt/tgt-av1w3erefute`. Oracle:
5+`~/.cache/aom-oracle/build/{aomenc,aomdec}`.
6+
7+Note on provenance: the tip sha `4bfe8d8e` is NOT an ancestor of main
8+(`git merge-base --is-ancestor 4bfe8d8e main` → NO). The *content* landed
9+squashed/rebased through `c0727d64` inside `lane-av1txsizeaudit-r5`; all three
10+items below were located in main's tree, not in the foreign branch's.
11+
12+## Verdict table
13+
14+| # | Item | Verdict | Deciding raw line |
15+|---|------|---------|-------------------|
16+| 1 | `4bfe8d8e` intra-in-inter fix, gate `stream::tests::a_real_aomenc_444_intra_in_inter_128_root_codes_chroma_per_mu_chunk_unit_pixel_exact` | **PASS** | `3 decode-order frames pixel-exact (0 hidden), intra_128_in_inter=1 mu_chunk_chroma_reads=4` |
17+| 2 | `C1` `fctx` into `suppress_internal_lf_edges` + source-scan gate | **PASS** (gate), with one dead assertion (see Not-done) | `suppress_internal_lf_edges must publish the block's own chroma extent per axis ... not a hardcoded `/2`` |
18+| 3 | `pins5` generalised count/pin guard, ceiling 43 / floor 40 | **PASS** | `count-vacuity sweep: 60 site(s); 17 spec-pinned by a prior assert, 43 not` |
19+
20+---
21+
22+## Item 1 — intra-in-inter 128-root mu-chunk chroma gate
23+
24+### Exists, runs, cannot skip
25+
26+`crates/ec-av1/src/stream.rs:37628` — `#[test] fn
27+a_real_aomenc_444_intra_in_inter_128_root_codes_chroma_per_mu_chunk_unit_pixel_exact()`.
28+
29+Non-vacuity is asserted three ways in the gate itself, not merely "ok":
30+sequence header asserted 4:4:4/128-SB, `intra_128_in_inter_hits() >= 1`,
31+`intra_128_in_inter_mu_chroma_hits() >= 4`, plus byte-exact compare per frame.
32+
33+```
34+$ EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -- --nocapture --test-threads=1 \
35+ a_real_aomenc_444_intra_in_inter_128_root_codes_chroma_per_mu_chunk_unit_pixel_exact
36+running 1 test
37+test stream::tests::... ... a_real_aomenc_444_intra_in_inter_128_root_codes_chroma_per_mu_chunk_unit_pixel_exact: 3 decode-order frames pixel-exact (0 hidden), intra_128_in_inter=1 mu_chunk_chroma_reads=4
38+ok
39+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 761 filtered out; finished in 0.53s
40+```
41+
42+Route counters are `> 0` (1 root, 4 mu-chunk chroma reads) — the arm ran.
43+
44+### The env really reaches the test (it cannot report green off a SKIP)
45+
46+`stream.rs:9404` `have_aomenc()` asserts when `EC_AV1_REQUIRE_AOMENC` is set;
47+`stream.rs:5283` `have_ffmpeg()` asserts the same for the ffmpeg half.
48+
49+```
50+$ EC_AV1_AOMENC=/nonexistent/aomenc EC_AV1_REQUIRE_AOMENC=1 cargo test ... <gate>
51+EC_AV1_REQUIRE_AOMENC is set but no aomenc at /nonexistent/aomenc -- run scripts/build-aom-oracle.sh
52+test result: FAILED. 0 passed; 1 failed; ... # env reached the test
53+
54+$ EC_AV1_AOMENC=/nonexistent/aomenc cargo test ... <gate> # env unset
55+test ... SKIP a_real_aomenc_444_intra_in_inter_128_root_codes_chroma_per_mu_chunk_unit_pixel_exact: no ffmpeg/aomenc/aomdec
56+test result: ok. 1 passed; ... # the developer escape, and only this one
57+```
58+
59+### Mutation proof (RED → restored GREEN)
60+
61+Guarded value: the per-mu-chunk CHROMA extent at `decode.rs:43262-43263`, mutated from the
62+ss-aware form back to the 4:2:0-hardcoded literal.
63+
64+```diff
65+ crates/ec-av1/src/decode.rs
66+ let chunk_luma = 64usize;
67+- let chunk_chroma_w = chunk_luma >> ss_x(fctx);
68+- let chunk_chroma_h = chunk_luma >> ss_y(fctx);
69++ let chunk_chroma_w = 32usize;
70++ let chunk_chroma_h = 32usize;
71+```
72+
73+RED:
74+
75+```
76+$ EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -- --nocapture --test-threads=1 <gate>
77+thread '...pixel_exact' panicked at crates/ec-av1/src/stream.rs:9683:17:
78+a_real_aomenc_444_intra_in_inter_128_root_codes_chroma_per_mu_chunk_unit_pixel_exact: decode-order frame 2 of 3 (3 shown, 0 hidden) differs from the oracle at byte 15450 (ours 142 vs 141), 44649 bytes differ
79+test result: FAILED. 0 passed; 1 failed; ...
80+```
81+
82+The 44649-byte figure matches the number the gate's own doc comment claims
83+(`stream.rs:37620-37623`) — the claimed red-before is real, and the red is on
84+PIXELS, not on the counter.
85+
86+Restore (`git checkout -- crates/ec-av1/src/decode.rs`, `git status --short` empty):
87+
88+```
89+a_real_aomenc_444_intra_in_inter_128_root_codes_chroma_per_mu_chunk_unit_pixel_exact: 3 decode-order frames pixel-exact (0 hidden), intra_128_in_inter=1 mu_chunk_chroma_reads=4
90+ok
91+test result: ok. 1 passed; 0 failed; ...
92+```
93+
94+**Item 1: PASS.**
95+
96+---
97+
98+## Item 2 — `C1`, `fctx` threaded into `suppress_internal_lf_edges`
99+
100+Gate: `refusal_inventory::tests::the_skipped_128_root_chroma_suppression_publishes_the_blocks_own_per_axis_chroma_extent`
101+(`crates/ec-av1/src/refusal_inventory.rs:1862`).
102+
103+Baseline:
104+
105+```
106+$ cargo test -p ec-av1 --lib -- --test-threads=1 the_skipped_128_root_...extent
107+test refusal_inventory::tests::... ... ok
108+test result: ok. 1 passed; 0 failed; ...
109+```
110+
111+### Mutation A — guarded expression
112+
113+```diff
114+ crates/ec-av1/src/decode.rs:9279
115+- let (uv_w, uv_h) = (((w_mi * MI) >> ss_x(fctx)).max(4) as u8, ((h_mi * MI) >> ss_y(fctx)).max(4) as u8);
116++ let (uv_w, uv_h) = ((w_mi * MI / 2).max(4) as u8, (h_mi * MI / 2).max(4) as u8);
117+```
118+
119+RED:
120+
121+```
122+suppress_internal_lf_edges must publish the block's own chroma extent per axis -- `w_mi * MI >> ss_x(fctx)`, not a hardcoded `/2`
123+test result: FAILED. 0 passed; 1 failed; ...
124+```
125+
126+### Mutation A also proves the scan reads the BODY, not a same-indent window / EOF
127+
128+`decode.rs:9301` — the *sibling* `fill_lf_grid_rect` — still carries the identical
129+correct string `((w_mi * MI) >> ss_x(fctx))`, and it sits 22 lines BELOW
130+`suppress_internal_lf_edges`'s closing brace. If the `&src[body_start..body_start +
131+src[body_start..].find("\n }")]` slice over-ran (to EOF, or past the function),
132+the positive `body.contains(...)` would have been satisfied by the sibling and the
133+gate would have stayed green. It went RED. The window is bounded at the function's
134+own 4-space closing brace (`decode.rs:9285`), and the `stale` loop
135+(`"w_mi * MI / 2"`, `"h_mi * MI / 2"`) is inside the same window.
136+
137+Restore: `git checkout -- crates/ec-av1/src/decode.rs` → gate `ok` again.
138+
139+### Is the change observable on any committed fixture?
140+
141+No. Full mutation (`w_mi * MI / 2`, the pre-`C1` form) over the whole committed
142+4:4:4 corpus:
143+
144+```
145+$ EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib 444
146+...
147+test result: ok. 38 passed; 0 failed; 0 ignored; 0 measured; 724 filtered out; finished in 22.70s
148+```
149+
150+38/38 pixel-exact gates stay green with the fix reverted, including
151+`a_real_aomenc_444_intra_in_inter_128_root_codes_chroma_per_mu_chunk_unit_pixel_exact`
152+and `a_444_sb128_root_rect_stream_with_restoration_decodes_pixel_exact`. 4:2:0 is
153+unaffected by construction (`>> 1 == / 2`).
154+
155+#### What is REPRODUCED here vs what is QUOTED from the author
156+
157+| Claim | Status |
158+|---|---|
159+| Reverting `suppress_internal_lf_edges` to `w_mi * MI / 2` changes no committed 4:4:4 pixel (38/38 green) | **REPRODUCED here** — command and output above |
160+| The source-scan gate goes RED on exactly that revert, and green again on restore | **REPRODUCED here** — red/green pair above |
161+| The source-scan reads the function BODY, not a same-indent run to EOF | **REPRODUCED here** — the sibling at `decode.rs:9301` carries the identical correct string and the mutated gate still red |
162+| "30 fires / 2 555 904 samples / 26 frames across five 4:4:4 `--sb-size=128` streams" | **QUOTED, NOT REPRODUCED** — author-reported (`refusal_inventory.rs:1852-1858`). I did not re-run those five streams or re-count the arm firings. My evidence is the WEAKER claim in the first row, and it is sufficient for the verdict. |
163+| "no pixel gate can exist for this site / the masking is TOTAL" | **PARTLY REPRODUCED** — no committed 4:4:4 fixture observes the value, consistent with it. The universal statement (no possible input distinguishes 64 from 128 here) is quoted, not proven. |
164+
165+**Item 2: PASS** on the gate's existence, non-vacuity, body-scoping, and
166+correct restoration. Caveat kept: the third assert (`sig_end` contains
167+`fctx: &FrameCtx`) can never be the deciding assertion — the positive body
168+assert reds first. Defense-in-depth, not a failure.
169+
170+---
171+
172+## Item 3 — `pins5` count/pin guard
173+
174+Gates: `gate_coverage::count_vacuity_tests::the_count_vacuity_sweep_finds_the_known_sites`
175+(floor 40 + ceiling 43, `gate_coverage.rs:2374-2427`) and
176+`...::every_locally_derived_oracle_count_is_reported` (the table).
177+
178+Baseline:
179+
180+```
181+$ cargo test -p ec-av1 --lib count_vacuity -- --nocapture --test-threads=1
182+count-vacuity sweep: 60 site(s); 17 spec-pinned by a prior assert, 43 not
183+test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 760 filtered out; finished in 0.08s
184+```
185+
186+Arithmetic checks out: 17 + 43 = 60 exactly, and the 43 reported lines
187+(`NOT SPEC-PINNED`) counted by grep = 43. The reported sweep line, the ceiling
188+constant and the unpinned population are one number, not three.
189+
190+### Mutation A — drop one site ⇒ the tracked count falls 43 → 42
191+
192+```diff
193+ crates/ec-av1/src/stream.rs:5631
194+- let want = ffmpeg_decode_sequence(&data, width, height, decoded.len());
195++ let want = ffmpeg_decode_sequence(&data, width, height, decoded.len() + 0);
196+```
197+
198+```
199+count-vacuity sweep: 59 site(s); 17 spec-pinned by a prior assert, 42 not
200+test result: ok. 2 passed; 0 failed; ...
201+```
202+
203+The site set, the pinned count and the unpinned count all move together. With the
204+ceiling lowered to 41 the same tree reds, naming the LIVE count:
205+
206+```
207+42 unpinned count site(s), ceiling is 41 -- a new one was added (lower the ceiling only when a site is actually fixed)
208+test result: FAILED. 0 passed; 1 failed; ...
209+```
210+
211+So the "correct ceiling" after that fix is 42, one lower than 43 — removing a site
212+moves the ceiling DOWN, as required. (The guard deliberately does not force the
213+constant down; the constant is only a "no new site" tripwire.)
214+
215+### Mutation B — a new unpinned site ⇒ immediate red at the real ceiling 43
216+
217+Narrowed the pin-detection window (`gate_coverage.rs:2209`) from `1..=14` to
218+`1..=1` so five previously-pinned sites read as unpinned; ceiling restored to 43:
219+
220+```
221+count-vacuity sweep: 60 site(s); 12 spec-pinned by a prior assert, 48 not
222+48 unpinned count site(s), ceiling is 43 -- a new one was added (lower the ceiling only when a site is actually fixed)
223+test result: FAILED. 1 passed; 1 failed; ...
224+```
225+
226+### Mutation C — the floor is live
227+
228+Dropped `"ffmpeg_decode_sequence("` from the scanner's callee list
229+(`gate_coverage.rs:2167`):
230+
231+```
232+count-vacuity sweep: 25 site(s); 12 spec-pinned by a prior assert, 13 not
233+the count-vacuity sweep found only 25 site(s); expected 40+ -- it has lost a shape
234+test result: FAILED. 1 passed; 1 failed; ...
235+```
236+
237+Restore: `git checkout -- crates/ec-av1/src/gate_coverage.rs crates/ec-av1/src/decode.rs
238+crates/ec-av1/src/stream.rs`; `git status --short` empty; all three gates green
239+again (`60 site(s); 17 spec-pinned ... 43 not`, `1 passed` for each of the two
240+pixel/source gates).
241+
242+**Item 3: PASS.**
243+
244+### Class sweep — unexercised matcher in a source scanner
245+
246+My first pass called `"ffmpeg_decode_sequence_444("` a dead matcher. **That was
247+wrong, and the correction is the interesting part.** Deleting it left the sweep at
248+`60/17/43` because it produces no count-vacuity SITE — but it is not rot: it fires
249+on five real `stream.rs` gates (`stream.rs:7030, 7545, 7735, 8439, 11643`), each
250+of which passes the spec const `FRAMES` rather than a decode-derived `.len()`, so
251+the `.len()`/`.count()` filter correctly rejects all five. **KEPT, with a reason**,
252+and the control measures the SPELLING (≥1 line uses it) rather than the produced
253+site — measuring the site is what made it look dead in the first place.
254+
255+So the real defect is one level up: the sweep's floor catches a LOST shape, and
256+nothing caught a matcher that never fired. Every matcher in the scanner was
257+measured. Nine of them fire on nothing anywhere in the crate:
258+
259+| Matcher | Table | Decision | Evidence |
260+|---|---|---|---|
261+| `ffmpeg_decode_sequence(` | callee | keep (live) | 174 lines; 35 of the 60 sites |
262+| `ffmpeg_decode_sequence_10bit(` | callee | keep (live) | 87 lines; 25 of the 60 sites |
263+| `ffmpeg_decode_sequence_444(` | callee | **keep + reason** | 6 lines, 5 call sites, 0 sites by construction — see above |
264+| `census`/`probe`/`sweep`/`first_diff`/`scratch`/`rectx` | probe substrings | keep (live) | 9/2/4/1/2/1 fns |
265+| `diagnostic` | probe substrings | **DELETE** | 0 fns; `grep -rn '\bdiagnostic\b' crates/ec-av1/src` hits only prose in other files, never a fn name |
266+| `encode_aomenc_stream`, `screen_intrabc_stream_at_depth`, `screen_intrabc_stream_with`, `libaom_encode_with`, `libaom_encode`, `run_multi_tile_gate`, `edge32_gate`, `rect_tx_tool_gate`, `warp_gate` | enc helpers | keep (live) | 3/3/5/5/2/8/4/3/5 fn bodies |
267+| `the_chroma_rect_gates`, `restore_gate`, `cdef_gate`, `superres_gate`, `grain_gate`, `sgate` | enc helpers | **DELETE (6)** | 0 fn bodies; `grep -rn '\bNAME\b' crates/ec-av1/src` returns the matcher list and NOTHING ELSE — no helper, no caller, no comment |
268+| `FRAMES` / `frame_count` | spec bindings | keep (live) | 24 / 7 fn bodies |
269+| `NFRAMES`, `frames_expected` | spec bindings | **DELETE (2)** | 0 fn bodies; occur nowhere else in the crate |
270+| `aomenc_path()`, `fs::read`, `crate_pin` | bucket leaves | keep (live) | 188 / 71 / 9 fn bodies |
271+| pin-detection window (14) | `for back in 1..=14` | keep (live) | pins 17 of 60 |
272+
273+**Nine dead spellings, all deleted** (1 probe substring + 6 encode helpers + 2 spec
274+bindings). Every one was provably rot — the string appears nowhere in the crate
275+outside the matcher table itself, so there is no hypothetical caller to name and
276+nothing loses coverage by removing it. Per the lane's stop rule I went no further:
277+no behavioural change to the scanner beyond the deletions, and no re-design of the
278+classifier.
279+
280+### The positive control, and its own mutation proof
281+
282+All the tables are now single-sourced `pub const`s (`CALLEES`, `PROBE_SUBSTRINGS`,
283+`ENC_HELPERS`, `FIXABLE_CANDS`, `AOMENC_LEAF`, `DISK_READ_LEAVES`, `PIN_WINDOW`) and
284+the scanner reads those same consts, so a matcher added later cannot skip its
285+control. The control is
286+`gate_coverage::count_vacuity::every_scanner_matcher_fires_on_a_known_site`
287+(`gate_coverage.rs:2467`), and it measures "fires" on the EXACT `fn` body slice the
288+scanner classifies with — the brace walk was extracted from `sites` into
289+`count_vacuity::fn_body_end` so the control cannot drift onto a different slice
290+(class: control-and-measurement-drift).
291+
292+Green after the change:
293+
294+```
295+$ cargo test -p ec-av1 --lib -- --nocapture --test-threads=1 count_vacuity
296+test gate_coverage::count_vacuity::every_scanner_matcher_fires_on_a_known_site ... ok
297+test gate_coverage::count_vacuity_tests::every_locally_derived_oracle_count_is_reported ... count-vacuity sweep: 60 site(s); 17 spec-pinned by a prior assert, 43 not
298+test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 760 filtered out; finished in 0.13s
299+```
300+
301+The sweep line is UNCHANGED at **60 / 17 / 43** after the nine deletions, which is
302+the proof the deletions cost no coverage.
303+
304+RED — one of the deleted spellings re-added (`ENC_HELPERS += "sgate"`):
305+
306+```
307+thread 'gate_coverage::count_vacuity::every_scanner_matcher_fires_on_a_known_site' panicked at crates/ec-av1/src/gate_coverage.rs:2505:13:
308+the encode-helper matcher `sgate(` matches NO fn body in stream.rs -- it is dead coverage (grep the crate: if the helper has no caller, delete the entry; if it has a caller outside stream.rs, say so here and name the file)
309+test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 762 filtered out; finished in 0.04s
310+```
311+
312+Restored: the entry is cut again and the control is `ok`.
313+
314+---
315+
316+## Declared but unproven / not done
317+
318+1. **The `sig_end` assertion in the C1 gate is unreachable as a deciding
319+ assertion.** The positive `body.contains("((w_mi * MI) >> ss_x(fctx))")` assert
320+ runs first, so any edit that drops `fctx: &FrameCtx` from the signature must
321+ also change the body, and the body assert reds first. Not a defect (the code
322+ would not compile without the parameter, which the comment states correctly),
323+ but the third assert is defense-in-depth that never fires on its own.
324+2. **C1's "30 fires / 2 555 904 samples over 26 frames across five 4:4:4
325+ `--sb-size=128` streams" is AUTHOR-REPORTED and NOT REPRODUCED here.** What I
326+ verified is weaker and stated precisely: reverting the value changes no
327+ committed 4:4:4 pixel (38/38 green), and the source scan's red on exactly that
328+ revert is mutation-proven. See the "REPRODUCED here vs QUOTED from the author"
329+ table under Item 2.
330+3. **No per-route counter exists for `suppress_internal_lf_edges`**, so item 2's
331+ non-vacuity rests entirely on the source scan plus the negative pixel
332+ evidence. That is consistent with the gate's own argument, but it means no
333+ positive "this arm fired" witness exists for the site.
334+4. **No full suite was run** (per lane contract; heavy runs belong to the server
335+ fleet). Every run here was `cargo test -p ec-av1 --lib <filter>`, on a
336+ `cargo check`-clean tree, with a per-lane `CARGO_TARGET_DIR`.
337+5. **The `main`-vs-`4bfe8d8e` provenance** is by content equivalence at
338+ `3b691e13`, not by ancestry: the sha is not in main's history.
339+6. **Decoder code was temporarily mutated** in this worktree for the red/green
340+ pairs above and restored via `git checkout --` after each. The only PERMANENT
341+ change is `crates/ec-av1/src/gate_coverage.rs`: the nine dead matcher
342+ deletions, the const single-sourcing, the extracted `fn_body_end`, and the new
343+ positive-control test. The sweep is UNCHANGED at `60 site(s); 17 spec-pinned,
344+ 43 not`. No guard was relaxed; no decoder change is proposed.