forge
Explore
Log in

Don't you dare go Hollow

Merge lane-av1pinspec2: the count-vacuity scan is comment-aware and the SVT site is wire-derived

Browse files at this commit

20621b03b15996088e86815cc33a8938b5db12c5Ahmet Kaan GümüşParent: f82a1139341fe5
Sweep: 58 site(s); 58 spec-pinned by a prior assert, 0 not (ceiling 2 -> 1 -> 0, each step tied to
its commit's measured population, each with its own red-before). The SVT split-transform gate now
runs on a COMMITTED pin (svt1-split-tx-pin.obu, 1838 B, sha256 c9d9c0ae... - a replay of two
independent SVT-AV1 v3.1.2 encodes) instead of an env-named stream, and derives its frame count off
the wire with Av1Parser, asserting the show_existing_frame case impossible on this pin rather than
arguing it. Non-vacuity: runs unset on a stock box with no SKIP, and mutating the arm counter reds.
crates/ec-av1/fixtures/svt1-split-tx-pin.obuadded+0 -0

Binary file changed

crates/ec-av1/src/gate_coverage.rsmodified+115 -18
@@ -2250,8 +2250,12 @@ mod count_vacuity {
2250 let mut out: Vec<(String, &str)> = Vec::new();2250 let mut out: Vec<(String, &str)> = Vec::new();
2251 for (i, line) in lines.iter().enumerate() {2251 for (i, line) in lines.iter().enumerate() {
2252 let t = line.trim_start();2252 let t = line.trim_start();
2253- let Some(rest) = t.strip_prefix("fn ") else { continue };2253+ let Some(rest) = t.strip_prefix("fn ") else {
2254- let Some(nm) = rest.split('(').next() else { continue };2254+ continue;
2255+ };
2256+ let Some(nm) = rest.split('(').next() else {
2257+ continue;
2258+ };
2255 if nm.contains(' ') {2259 if nm.contains(' ') {
2256 continue;2260 continue;
2257 }2261 }
@@ -2289,6 +2293,21 @@ mod count_vacuity {
2289 }2293 }
2290 }2294 }
2291 }2295 }
2296+ // A DOC COMMENT is prose about code, not code. One row in the ledger
2297+ // was a `///` line quoting a gate's pre-fix body (`stream.rs:30924`,
2298+ // inside `pinned_lr_sgr_stream_call_unique_dump`) and the sweep
2299+ // counted it as an unpinned count site for a whole round: the gate
2300+ // it describes already spends `FRAMES` and asserts
2301+ // `pics.len() == FRAMES`. Skipping comment lines is not cosmetic --
2302+ // without it the ledger carries a row no reader can act on, and the
2303+ // ceiling can never reach 0.
2304+ //
2305+ // Only the SITE scan skips comments. The pin-window walk further
2306+ // down still sees every line, because a `//`-led line there is a
2307+ // comment BETWEEN the assert and the call, not a site.
2308+ if t.starts_with("//") {
2309+ continue;
2310+ }
2292 for callee in CALLEES {2311 for callee in CALLEES {
2293 let Some(at) = line.find(callee) else {2312 let Some(at) = line.find(callee) else {
2294 continue;2313 continue;
@@ -2551,7 +2570,6 @@ mod count_vacuity {
2551 s.len()2570 s.len()
2552 );2571 );
2553 }2572 }
2554-
2555 }2573 }
2556 2574
2557 #[cfg(test)]2575 #[cfg(test)]
@@ -2598,23 +2616,30 @@ mod count_vacuity_tests {
2598 // call (`-frames:v 1` / `-vframes 1` / `--limit=N` / a helper's `frames`2616 // call (`-frames:v 1` / `-vframes 1` / `--limit=N` / a helper's `frames`
2599 // parameter / the arm tuple's `frame_count` / the wire's own OBU frame2617 // parameter / the arm tuple's `frame_count` / the wire's own OBU frame
2600 // headers), so the count handed to the oracle is a value already proven2618 // headers), so the count handed to the oracle is a value already proven
2601- // against the encode instead of read off our decode. The two that remain2619+ // against the encode instead of read off our decode. Two rows survived
2602- // are the two that are not a count to fix:2620+ // that round; lane-av1pinspec2 closed both, so the ceiling is now 0.
2621+ //
2622+ // lane-av1pinspec2: 2 -> 0, in two steps.
2603 // * `an_svt_screen_palette_block_with_a_split_transform_decodes_exactly`2623 // * `an_svt_screen_palette_block_with_a_split_transform_decodes_exactly`
2604- // reads the path `EC_AV1_SVT1_STREAM` names, and that crop is not2624+ // was handed forward because the count was underivable: the stream
2605- // committed to `fixtures/`, so no `--limit`, no `-frames:v` and no2625+ // came from `EC_AV1_SVT1_STREAM`, was never committed, and the gate
2606- // frame count exists anywhere in the tree for it. The doc comment's2626+ // SKIPped on a stock box -- so a wire-derived assert would have been
2607- // "12-frame stream" is prose about one capture and the env var2627+ // an unexercised assert wearing a pin's clothes. The crop is now
2608- // accepts any file, so asserting 12 would pin a number nothing can2628+ // COMMITTED (`fixtures/svt1-split-tx-pin.obu`, a byte-reproducible
2609- // check. Counting the stream's own OBU frame headers with2629+ // replay of a `-frames:v 1` libsvtav1 encode), the gate reads it, and
2610- // `Av1Parser` would derive one, and is left on the table2630+ // its count comes from the stream's own OBU frame headers with
2611- // deliberately: the gate SKIPs on any box without that env var, so2631+ // `show_existing_frame` asserted false so a header count cannot
2612- // such an assert would ship unexercised.2632+ // over-count. The gate runs on a stock box, so the assert executes.
2613- // * a `///` DOC COMMENT quoting the pre-r4 body of2633+ // * the other row was a `///` DOC COMMENT quoting the pre-r4 body of
2614 // `pinned_lr_sgr_stream_call_unique_dump`, which this line-based2634 // `pinned_lr_sgr_stream_call_unique_dump`, which this line-based
2615- // scan cannot tell from code. The gate it describes already spends2635+ // scan could not tell from code. `sites()` now skips comment lines,
2616- // `FRAMES` and asserts `pics.len() == FRAMES`.2636+ // so the row is no longer a site at all.
2617- const UNPINNED_CEILING: usize = 2;2637+ //
2638+ // RED-BEFORE for the comment skip, which is a coverage change and not a
2639+ // cosmetic one: with the `t.starts_with("//")` guard removed and this
2640+ // ceiling at 0, the doc-comment row comes BACK as an unpinned site and
2641+ // reds with "1 unpinned count site(s), ceiling is 0".
2642+ const UNPINNED_CEILING: usize = 0;
2618 let unpinned = s.iter().filter(|x| x.pinned_by.is_none()).count();2643 let unpinned = s.iter().filter(|x| x.pinned_by.is_none()).count();
2619 assert!(2644 assert!(
2620 unpinned <= UNPINNED_CEILING,2645 unpinned <= UNPINNED_CEILING,
@@ -2677,4 +2702,76 @@ mod count_vacuity_tests {
2677 "a site has no owning gate -- the sweep's gate attribution is broken"2702 "a site has no owning gate -- the sweep's gate attribution is broken"
2678 );2703 );
2679 }2704 }
2705+
2706+ /// The comment skip is a COVERAGE change, so it is held to the same shape
2707+ /// the `pin_inventory` capability tests use: a SYNTHETIC source, not the
2708+ /// live tree, with BOTH halves. Run against the live tree instead, a fix
2709+ /// to the very gate that motivated it would delete the row that proves the
2710+ /// scanner still works -- the failure mode `pin_inventory` already records
2711+ /// as "a scanner that cannot see this shape is how 14 pins survived three
2712+ /// rounds".
2713+ ///
2714+ /// Half one: a count call that lives INSIDE a doc comment must not be a
2715+ /// site. That is the real `stream.rs:30924` row, which spent a whole round
2716+ /// in the ledger as an unpinned count no reader could act on -- the gate it
2717+ /// quotes already spends `FRAMES` and asserts `pics.len() == FRAMES`.
2718+ ///
2719+ /// Half two, the control: the SAME call as real code must still be a site,
2720+ /// and must still be pinned by an assert above it. A scanner that skips
2721+ /// comments by skipping the wrong thing looks identical on half one, and a
2722+ /// ceiling of 0 is exactly the state where an over-broad skip would go
2723+ /// unnoticed.
2724+ #[test]
2725+ fn a_doc_commented_count_call_is_not_a_site_but_real_code_still_is() {
2726+ let commented = r#"
2727+ /// The old body passed the wrong count to the oracle:
2728+ /// let reference = ffmpeg_decode_sequence(&stream, 192, 128, pics.len());
2729+ /// so a decoder that emitted zero frames asked ffmpeg for zero frames.
2730+ fn a_gate_whose_doc_comment_quotes_the_old_body() {
2731+ let pics = decode_stream(&data).unwrap();
2732+ }
2733+"#;
2734+ let commented_sites = sites(commented);
2735+ assert!(
2736+ commented_sites.is_empty(),
2737+ "a count call inside a `///` doc comment was counted as a site: {:?} -- a line-based \
2738+ scan cannot tell prose from code, and this row is why it now skips comment lines",
2739+ commented_sites
2740+ .iter()
2741+ .map(|x| (x.line, x.count_expr.clone()))
2742+ .collect::<Vec<_>>()
2743+ );
2744+
2745+ let real = r#"
2746+ fn a_gate_that_really_spends_its_own_decode_length() {
2747+ let pics = decode_stream(&data).unwrap();
2748+ assert_eq!(pics.len(), 7, "{NAME}: expected seven key frames");
2749+ let reference = ffmpeg_decode_sequence(&stream, 192, 128, pics.len());
2750+ }
2751+"#;
2752+ let found = sites(real);
2753+ assert_eq!(
2754+ found.len(),
2755+ 1,
2756+ "the control did not find its one real site: {:?} -- the comment skip is over-broad \
2757+ if the same call is skipped as code",
2758+ found
2759+ .iter()
2760+ .map(|x| (x.line, x.count_expr.clone(), x.gate.clone()))
2761+ .collect::<Vec<_>>()
2762+ );
2763+ assert_eq!(
2764+ found[0].count_expr, "pics.len()",
2765+ "control: wrong count expr"
2766+ );
2767+ assert_eq!(
2768+ found[0].gate, "a_gate_that_really_spends_its_own_decode_length",
2769+ "control: wrong gate attribution"
2770+ );
2771+ assert!(
2772+ found[0].pinned_by.is_some(),
2773+ "the control's site is UNPINNED: the comment skip changed the pin window too, \
2774+ because a `//` line between an assert and its call is still walked"
2775+ );
2776+ }
2680 }2777 }
crates/ec-av1/src/stream.rsmodified+97 -30
@@ -5599,23 +5599,52 @@ pub(crate) mod tests {
5599 }5599 }
5600 }5600 }
5601 5601
5602- /// lane-svt1: an SVT-AV1 (v3.1.2, `-preset 8 -crf 35`) screen key frame5602+ /// lane-svt1: an SVT-AV1 (v3.1.2, `-preset 8`) screen key frame codes 16x16
5603- /// codes 16x16 PALETTE blocks with `skip == 1` whose `tx_depth` split the5603+ /// PALETTE blocks with `skip == 1` whose `tx_depth` split the luma
5604- /// luma transform. [`crate::decode::decode_block`] armed the palette5604+ /// transform. [`crate::decode::decode_block`] armed the palette prediction
5605- /// prediction only when the transform covered the whole block, so that one5605+ /// only when the transform covered the whole block, so that one block
5606- /// block predicted DC off its own edges instead: the right symbols (the5606+ /// predicted DC off its own edges instead: the right symbols (the whole mode
5607- /// whole mode ladder diffs clean against an instrumented aomdec) and the5607+ /// ladder diffs clean against an instrumented aomdec) and the wrong pixels
5608- /// wrong pixels -- 812 luma samples in frame 0, carried by the V_PRED5608+ /// -- 812 luma samples in frame 0, carried by the V_PRED blocks under it to
5609- /// blocks under it to 10122 samples over the 12-frame stream.5609+ /// 10122 samples over the 12-frame stream the defect was found on.
5610- ///5610+ ///
5611- /// No lavfi recipe witnesses it in a stream this decoder otherwise decodes:5611+ /// lane-av1pinspec2: the gate used to RIDE an external crop named by
5612- /// 6 sources x 5 sizes x 6 crf values through `libsvtav1 -preset 85612+ /// `EC_AV1_SVT1_STREAM` and SKIP when that was unset, so it never ran on a
5613- /// -svtav1-params screen-content-mode=1` produced 8 streams that reach the5613+ /// stock box -- which is exactly why its oracle count could not be pinned
5614- /// path, and every one of them either refuses on an unrelated Golomb tail5614+ /// (an assert on a gate that never executes is an unexercised assert wearing
5615- /// or misses by ~200k samples on unrelated inter-frame defects (both5615+ /// a pin's clothes). It now runs on the COMMITTED pin
5616- /// recorded in `lanes/svt1.report.md`). So the gate rides the kept stream5616+ /// `crates/ec-av1/fixtures/svt1-split-tx-pin.obu`.
5617- /// named by `EC_AV1_SVT1_STREAM` and SKIPs when it is unset -- the screen5617+ ///
5618- /// crop itself is never committed to `fixtures/`.5618+ /// The pin is a REPLAY, not a fresh capture, and the recipe is recorded
5619+ /// because it reproduces the bytes exactly (two independent encodes on this
5620+ /// box, SVT-AV1 v3.1.2, both sha256
5621+ /// `c9d9c0ae934fba72fc9a9374bc36853f290796a8a4d6442140e239669e0b341f`,
5622+ /// 1838 bytes):
5623+ ///
5624+ /// ffmpeg -v error -f lavfi \
5625+ /// -i "smptehdbars=s=192x152:r=12,drawgrid=w=8:h=8:t=1:c=black" \
5626+ /// -frames:v 1 -c:v libsvtav1 -preset 8 -crf 50 \
5627+ /// -svtav1-params "lp=1:screen-content-mode=1" -g 12 -f obu out.obu
5628+ ///
5629+ /// `-frames:v 1` is the part lane-svt1's search lacked: its 6x5x6 sweep ran
5630+ /// FOUR frames per stream, and the ~200k-sample misses that killed every
5631+ /// candidate were on the INTER frames (`lanes/svt1.report.md`). One key
5632+ /// frame has no inter frames, and this one reaches the fixed arm
5633+ /// (`skip_split_tx_override_hits == 1`) and is pixel-exact.
5634+ ///
5635+ /// THE COUNT, and why it is derived from the wire rather than from a
5636+ /// literal. The oracle is handed the number of frame OBUs this stream
5637+ /// actually codes, counted with `Av1Parser` below -- never our decode's
5638+ /// length, which is the thing under test. A header count would OVER-count
5639+ /// a stream carrying `show_existing_frame` (spec 5.9.5: it codes no pixels,
5640+ /// so the header count is larger than the shown-frame count), so that case
5641+ /// is asserted impossible on this pin rather than assumed: the loop refuses
5642+ /// any frame header with `show_existing_frame` set, which is what makes
5643+ /// "one header == one shown frame" a checked fact here instead of an
5644+ /// argument.
5645+ ///
5646+ /// `EC_AV1_SVT1_STREAM` still overrides the pin, so a re-capture is one env
5647+ /// var away; `crate_pin` falls back to `pin_dir()` for the same reason.
5619 ///5648 ///
5620 /// `skip_split_tx_override_hits` is asserted non-zero so the row cannot5649 /// `skip_split_tx_override_hits` is asserted non-zero so the row cannot
5621 /// pass on a stream that never reaches the fixed arm (class5650 /// pass on a stream that never reaches the fixed arm (class
@@ -5623,29 +5652,67 @@ pub(crate) mod tests {
5623 #[test]5652 #[test]
5624 fn an_svt_screen_palette_block_with_a_split_transform_decodes_exactly() {5653 fn an_svt_screen_palette_block_with_a_split_transform_decodes_exactly() {
5625 const NAME: &str = "an_svt_screen_palette_block_with_a_split_transform_decodes_exactly";5654 const NAME: &str = "an_svt_screen_palette_block_with_a_split_transform_decodes_exactly";
5626- let Ok(path) = std::env::var("EC_AV1_SVT1_STREAM") else {5655+ const PIN: &str = "svt1-split-tx-pin.obu";
5627- eprintln!("SKIP {NAME}: EC_AV1_SVT1_STREAM names no stream");
5628- return;
5629- };
5630 if !have_ffmpeg() {5656 if !have_ffmpeg() {
5631 eprintln!("SKIP {NAME}: no ffmpeg");5657 eprintln!("SKIP {NAME}: no ffmpeg");
5632 return;5658 return;
5633 }5659 }
5634- let data = match std::fs::read(&path) {5660+ let path = match std::env::var("EC_AV1_SVT1_STREAM") {
5635- Ok(data) => data,5661+ Ok(p) => std::path::PathBuf::from(p),
5636- Err(e) => {5662+ // The name is spelled as a LITERAL here even though `PIN` is right
5637- eprintln!("SKIP {NAME}: {path}: {e}");5663+ // above, on purpose: `gate_coverage::pin_inventory` matches a pin
5638- return;5664+ // read by the quote that follows the callee name, so a const
5639- }5665+ // argument would leave this pin outside the "every pin a gate reads
5666+ // is a committed crate-local copy" invariant. The dup is the
5667+ // coverage -- and it is also why this comment must NOT quote that
5668+ // spelling: the scanner reads prose too, and a quoted spelling here
5669+ // parses as a pin called " and would not see a const argument, ...".
5670+ Err(_) => crate_pin("svt1-split-tx-pin.obu"),
5640 };5671 };
5672+ let data = require_pin(&path, PIN);
5673+ // The ENCODE's frame count, read off the WIRE: parse this stream's own
5674+ // OBUs and count the frame headers. `show_existing_frame` is refused
5675+ // here on purpose -- such a header codes no pixels, so counting it
5676+ // would make this count larger than the frames the oracle can decode.
5677+ let mut parser = Av1Parser::new();
5678+ let mut pos = 0usize;
5679+ let mut frame_headers = 0usize;
5680+ while pos < data.len() {
5681+ let Ok(obu) = parser.parse_obu(&data[pos..]) else {
5682+ break;
5683+ };
5684+ pos += obu.total_size.max(1);
5685+ let header = match &obu.kind {
5686+ ObuKind::Frame(h, _) | ObuKind::FrameHeader(h) => h,
5687+ _ => continue,
5688+ };
5689+ assert!(
5690+ !header.show_existing_frame,
5691+ "{NAME}: frame header {frame_headers} sets show_existing_frame, so the header \
5692+ count is not the shown-frame count and this gate's oracle budget would be wrong"
5693+ );
5694+ frame_headers += 1;
5695+ }
5696+ assert!(
5697+ frame_headers > 0,
5698+ "{NAME}: {} carries no frame header at all",
5699+ path.display()
5700+ );
5641 crate::decode::reset_skip_split_tx_override_hits();5701 crate::decode::reset_skip_split_tx_override_hits();
5642- let decoded = decode_stream(&data).expect("the kept SVT-AV1 screen stream decodes");5702+ let decoded = decode_stream(&data).expect("the pinned SVT-AV1 screen stream decodes");
5643 assert!(5703 assert!(
5644 crate::decode::skip_split_tx_override_hits() > 0,5704 crate::decode::skip_split_tx_override_hits() > 0,
5645- "{NAME}: no skipped split-transform palette block in {path} -- the gate would pass blind"5705+ "{NAME}: no skipped split-transform palette block in {} -- the gate would pass blind",
5706+ path.display()
5707+ );
5708+ assert_eq!(
5709+ decoded.len(),
5710+ frame_headers,
5711+ "{NAME}: the stream codes {frame_headers} frame(s), the decode showed {}",
5712+ decoded.len()
5646 );5713 );
5647 let (width, height) = (decoded[0].width, decoded[0].height);5714 let (width, height) = (decoded[0].width, decoded[0].height);
5648- let want = ffmpeg_decode_sequence(&data, width, height, decoded.len());5715+ let want = ffmpeg_decode_sequence(&data, width, height, frame_headers);
5649 for (i, (got, want)) in decoded.iter().zip(&want).enumerate() {5716 for (i, (got, want)) in decoded.iter().zip(&want).enumerate() {
5650 assert_eq!(got.y, want.y, "frame {i} luma vs ffmpeg");5717 assert_eq!(got.y, want.y, "frame {i} luma vs ffmpeg");
5651 assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg");5718 assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg");
lanes/av1pinspec2.report.mdadded+222 -0
@@ -0,0 +1,222 @@
1+# lane-av1pinspec2 — commit the SVT crop, count off the wire, and make the sweep comment-aware
2+
3+Branch `lane-av1pinspec2`, worktree `~/.cache/wt/av1pinspec2`, base `2c3d3b78` (main
4+with lane-av1pinspec merged). **Two commits, and the ledger is empty.**
5+
6+```
7+e923b420 gate_coverage: make the count-vacuity scan comment-aware, ceiling 1 -> 0
8+37059b34 stream: run the SVT split-transform gate on a committed pin, count off the wire
9+```
10+
11+**Outcome (a) on the branch point Main asked me to decide: the SVT crop IS
12+committable, and it is committed.** A bounded search found a byte-reproducible
13+`-frames:v 1` libsvtav1 encode that reaches the fixed arm and is pixel-exact, so
14+the gate now runs on a stock box and its count is derived from the wire. The
15+alternative (leave the site, name it as an exception) was not needed.
16+
17+## 0. The sweep line, before and after
18+
19+```
20+before: count-vacuity sweep: 59 site(s); 58 spec-pinned by a prior assert, 1 not
21+after: count-vacuity sweep: 58 site(s); 58 spec-pinned by a prior assert, 0 not
22+```
23+
24+`59 -> 58` is the SVT gate leaving the population: it no longer spends a
25+decode-derived `.len()` at all, so it is not a site. `1 -> 0` is the doc-comment
26+row ceasing to be a site. Ceiling `2 -> 1 -> 0`, tied to each commit's measured
27+population.
28+
29+## 1. Commit 1 — the SVT crop is committable, and here it is
30+
31+### 1a. Why lane-svt1's own search missed, and the one parameter that fixes it
32+
33+`lanes/svt1.report.md` records a 6 sources x 5 sizes x 6 crf sweep that produced 8
34+streams reaching the fixed arm, and killed every one of them: 2 refused on an
35+unrelated Golomb tail, 6 missed by ~200k-245k samples **on unrelated inter-frame
36+defects**. That search ran **FOUR frames per stream**. A single key frame has no
37+inter frames, which is the entire difference.
38+
39+The search here: 7 sources x 6 sizes x 6 crf, `-frames:v 1`, `r=12`,
40+`screen-content-mode=1`, measuring for each candidate that reached the fixed arm
41+(`skip_split_tx_override_hits > 0`) whether it also decoded and compared exact:
42+
43+```
44+SEARCH DONE: 1 stream(s) reached the fixed arm, 1 exact
45+CANDIDATE hits=1 frames=1 192x152 crf=50 bad=0 bytes=1838 :: smptehdbars=s={w}x{h}:r=12,drawgrid=w=8:h=8:t=1:c=black
46+*** EXACT WINNER
47+```
48+
49+The six `crf=70` cells are the one dead spot in the sweep and are recorded here
50+rather than hidden: `libsvtav1` rejects it (`Value 70.000000 for parameter 'crf'
51+out of range [0 - 63]`).
52+
53+### 1b. The pin, and its provenance
54+
55+| path | sha256 | size |
56+|---|---|---|
57+| `crates/ec-av1/fixtures/svt1-split-tx-pin.obu` | `c9d9c0ae934fba72fc9a9374bc36853f290796a8a4d6442140e239669e0b341f` | 1838 B |
58+
59+**A REPLAY, not a fresh capture**, and that is the stronger property: two
60+independent encodes of
61+
62+```
63+ffmpeg -v error -f lavfi \
64+ -i "smptehdbars=s=192x152:r=12,drawgrid=w=8:h=8:t=1:c=black" \
65+ -frames:v 1 -c:v libsvtav1 -preset 8 -crf 50 \
66+ -svtav1-params "lp=1:screen-content-mode=1" -g 12 -f obu out.obu
67+```
68+
69+(SVT-AV1 v3.1.2) produce those exact bytes:
70+
71+```
72+c9d9c0ae934fba72fc9a9374bc36853f290796a8a4d6442140e239669e0b341f /tmp/svt1-repro1.obu
73+c9d9c0ae934fba72fc9a9374bc36853f290796a8a4d6442140e239669e0b341f /tmp/svt1-repro2.obu
74+c9d9c0ae934fba72fc9a9374bc36853f290796a8a4d6442140e239669e0b341f /tmp/svt1-win-192x152-crf50.obu
75+```
76+
77+Committed with `git add -f` — `.gitignore:2` is a bare `fixtures`, which git
78+matches at any depth, so the crate's own fixture directory is ignored too.
79+
80+### 1c. The count, and the `show_existing_frame` question answered with evidence
81+
82+The gate parses the pin's own OBUs with `Av1Parser` and asserts
83+`decoded.len() == frame_headers` **before** handing that number to the oracle —
84+the same wire-derived shape lane-av1pinspec used at `stream.rs:13267` for the
85+cdf-update gate, so there is now one idiom for "the count belongs to the wire"
86+rather than two.
87+
88+A header count would **over-count** a stream carrying `show_existing_frame`
89+(spec 5.9.5: it codes no pixels, so the header count exceeds the shown-frame
90+count), which is exactly the objection that made this a hand-forward last round.
91+It is settled by assertion rather than by argument — the loop **refuses** any
92+frame header with `show_existing_frame` set:
93+
94+```rust
95+assert!(
96+ !header.show_existing_frame,
97+ "{NAME}: frame header {frame_headers} sets show_existing_frame, so the header \
98+ count is not the shown-frame count and this gate's oracle budget would be wrong"
99+);
100+```
101+
102+so "one header == one shown frame" is a checked fact on this pin, and a future
103+pin that does carry one reds with the reason instead of silently skewing the
104+oracle budget.
105+
106+### 1d. Non-vacuity, measured, not asserted
107+
108+* The gate **runs on a stock box** — `EC_AV1_SVT1_STREAM` unset, `ok` in 0.18 s,
109+ **no SKIP line**. That was the whole reason for the hand-forward.
110+* The premise bites: `skip_split_tx_override_hits() > 0` mutated to `> 1` reds,
111+ so the fixed arm fires **exactly once** on this pin and the gate cannot pass
112+ blind.
113+
114+```
115+$ cargo test -p ec-av1 --lib -- an_svt_screen_palette_block_with_a_split_transform_decodes_exactly
116+an_svt_...: no skipped split-transform palette block in
117+ .../crates/ec-av1/fixtures/svt1-split-tx-pin.obu -- the gate would pass blind
118+test result: FAILED. 0 passed; 1 failed
119+```
120+
121+### 1e. Red-before for the commit
122+
123+Revert `stream.rs`, keep the new ceiling of 1:
124+
125+```
126+$ git checkout HEAD -- crates/ec-av1/src/stream.rs
127+$ cargo test -p ec-av1 --lib -- count_vacuity_tests
128+2 unpinned count site(s), ceiling is 1 -- a new one was added (lower the ceiling only when a site is actually fixed)
129+test result: FAILED. 1 passed; 1 failed
130+```
131+
132+And the new assert bites:
133+
134+```
135+$ # frame_headers -> frame_headers + 1
136+assertion `left == right` failed: an_svt_...: the stream codes 1 frame(s), the decode showed 1
137+ left: 1
138+ right: 2
139+test result: FAILED. 0 passed; 1 failed
140+```
141+
142+The "decode showed 1" is the proof the wire count and the decode agree on this
143+pin, not merely that an assert exists.
144+
145+## 2. Commit 2 — the sweep is comment-aware
146+
147+The last unpinned row was not a count. It was a `///` doc comment quoting the
148+pre-r4 body of `pinned_lr_sgr_stream_call_unique_dump` — prose about code,
149+sitting inside the gate the prose describes, which already spends `FRAMES` and
150+asserts `pics.len() == FRAMES`. A line-based scan cannot tell the two apart.
151+
152+`sites()` now skips lines whose trimmed start is `//`. **Only the SITE scan
153+skips them**: the pin-window walk still sees every line, because a `//`-led line
154+there is a comment *between* an assert and its call, not a site.
155+
156+### 2a. The capability test, both halves
157+
158+`count_vacuity_tests::a_doc_commented_count_call_is_not_a_site_but_real_code_still_is`,
159+over a **SYNTHETIC** source rather than the live tree — a fix to the very gate
160+that motivated this would otherwise delete the row that proves the scanner works,
161+which is the failure mode `pin_inventory` already records as "a scanner that
162+cannot see this shape is how 14 pins survived three rounds".
163+
164+* **half one** — a count call inside a `///` doc comment is NOT a site. This is
165+ the real row this change removes.
166+* **half two, the control** — the *same call as real code* IS still a site, is
167+ attributed to the right gate, and is still **pinned** by an assert above it.
168+ This is the half that matters: a scanner that skips comments by skipping the
169+ wrong thing looks identical on half one, and a ceiling of 0 is exactly the
170+ state where an over-broad skip would go unnoticed.
171+
172+### 2b. Red-before for the commit
173+
174+The `t.starts_with("//")` guard removed, ceiling at 0 — **both halves red**:
175+
176+```
177+$ cargo test -p ec-av1 --lib -- count_vacuity_tests
178+test ...::a_doc_commented_count_call_is_not_a_site_but_real_code_still_is ... FAILED
179+test ...::the_count_vacuity_sweep_finds_the_known_sites ... FAILED
180+1 unpinned count site(s), ceiling is 0 -- a new one was added (lower the ceiling only when a site is actually fixed)
181+test result: FAILED. 1 passed; 2 failed
182+```
183+
184+The first half reds because the doc-comment site is counted again; the second
185+because the population is 1 above a ceiling of 0. Neither half can be reverted
186+silently.
187+
188+## 3. Green
189+
190+```
191+$ cargo check -p ec-av1 --all-targets
192+ Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.71s
193+
194+$ cargo test -p ec-av1 --lib -- gate_coverage pin_inventory count_vacuity
195+test result: ok. 20 passed; 0 failed; 0 ignored; 0 measured; 744 filtered out; finished in 0.96s
196+
197+$ cargo test -p ec-av1 --lib -- count_vacuity_tests::every_locally_derived_oracle_count_is_reported --nocapture
198+count-vacuity sweep: 58 site(s); 58 spec-pinned by a prior assert, 0 not
199+```
200+
201+`every_pin_a_gate_reads_is_committed_under_the_crate` passes **with the new pin in
202+its scope**: `crate_pin` is called with a string **literal** on purpose, because
203+the pin inventory matches a pin read by the quote that follows the callee name —
204+a `const PIN` argument would have left this pin outside that invariant. That
205+call is also why the comment above it must not quote the spelling: the scanner
206+reads prose too, and a quoted spelling there parsed as a pin called
207+`` ` and would not see a const argument, ... `` and failed the invariant. Both
208+halves of that were found by running the invariant, not by reading the code.
209+
210+## 4. Not done / deferred
211+
212+Nothing is deferred. The ledger is empty (`0 not`), and the two rows lane-av1pinspec
213+handed forward are both closed — one by committing the crop, one by teaching the
214+scanner what prose is.
215+- No full `cargo test -p ec-av1` run — project-wide validation is Main's.
216+- The `crf=70` column of the search is out of `libsvtav1`'s range and is recorded
217+ as a dead cell rather than dropped; it does not affect the winner, which is
218+ `crf=50`.
219+- The committed pin is 8-bit 4:2:0 at 192x152. It is a **key frame only**, so this
220+ gate says nothing about SVT's inter-frame coding — that is the defect surface
221+ `lanes/svt1.report.md` measured and this crate still does not decode, and it is
222+ untouched by this lane.