merge Agent01-5's report of the census hole (the crate-side prose restore is already in via 0790e90c)
Browse files at this commit1 changed file +309 -0
- lanes/av1fixtureshape.report.md +309 -0
lanes/av1fixtureshape.report.mdadded+309 -0
| @@ -0,0 +1,309 @@ | ||
| 1 | +# lane-av1fixtureshape — the two live code-shape violations in `crates/ec-av1` | |
| 2 | + | |
| 3 | +Branch `lane-av1fixtureshape`, worktree `~/.cache/wt/av1fixtureshape`. | |
| 4 | + | |
| 5 | +| commit | what | | |
| 6 | +|---|---| | |
| 7 | +| `2364d7a7` (merged as `53b851a7`) | the two sites in `crates/ec-av1` | | |
| 8 | +| `0790e90c` (parent `12cae635`) | restores the verbatim literal in the golden7 doc comment | | |
| 9 | + | |
| 10 | +Not pushed. Primary checkout clean. **The branch is rebased onto `12cae635` | |
| 11 | +(`lane-av1fixlib`), so `scripts/verify-fixture-library.sh`, | |
| 12 | +`pin-gate-audit.py`, `gen-fixture-library.sh` and `fixture-library.tsv` are | |
| 13 | +committed in this tree** and every run below is from the committed tree. An | |
| 14 | +earlier revision copied them in untracked; that is superseded. | |
| 15 | + | |
| 16 | +--- | |
| 17 | + | |
| 18 | +## 1. The two sites, as the preflight printed them | |
| 19 | + | |
| 20 | +`EC_REQUIRE_FIXTURES=1 EC_FIXTURE_SHAPE_STRICT=1 | |
| 21 | +EC_FIXTURES=<primary>/fixtures scripts/verify-fixture-library.sh` | |
| 22 | + | |
| 23 | +**Site 1 — invariant 1, quoted:** | |
| 24 | + | |
| 25 | +``` | |
| 26 | +FAIL [invariant 1]: a committed pin is reached through the gitignored root | |
| 27 | + fixtures/ (silent SKIP on every clean checkout and runner): | |
| 28 | + .../crates/ec-av1/src/stream.rs:23980: /// class: a `concat!(env!("CARGO_MANIFEST_DIR"), "/../../fixtures/...")` | |
| 29 | + fix: commit the pin under crates/<crate>/fixtures/ and read it with | |
| 30 | + that crate's pin helper (crate_pin / pin_dir), never /../../fixtures/. | |
| 31 | +``` | |
| 32 | + | |
| 33 | +**Site 2 — invariant 4, quoted:** | |
| 34 | + | |
| 35 | +``` | |
| 36 | +FAIL [invariant 4]: pin-reading gates whose pins are not committed | |
| 37 | + crates/ec-av1/src/stream.rs:31386:pinned_warp_stream_decodes_pixel_exact /../../fixtures bare directory literal feeding 14 runtime name(s): no committed tree satisfies it | |
| 38 | + crates/ec-av1/src/stream.rs:31386:pinned_warp_stream_decodes_pixel_exact concat! 14/14 pin(s) not committed+tracked, e.g. warp-mismatch | |
| 39 | + crates/ec-av1/src/stream.rs:31386:pinned_warp_stream_decodes_pixel_exact /../../fixtures + 14 runtime name(s) | |
| 40 | + fix: commit each pin under crates/<crate>/fixtures/ and read it | |
| 41 | + through that crate's pin helper, not /../../fixtures/. | |
| 42 | +``` | |
| 43 | + | |
| 44 | +### Site 1 was a SCANNER defect, and the report named the wrong gate | |
| 45 | + | |
| 46 | +`lanes/av1fixlib.report.md` §6 attributes site 1 to | |
| 47 | +`pinned_lr_sgr_stream_call_unique_dump` reading | |
| 48 | +`/../../fixtures/lr-sgr-r7.obu` through the gitignored root. **At this base | |
| 49 | +that gate is already correct** — `stream.rs:30519` reads | |
| 50 | +`crate_pin("lr-sgr-r7.obu")` and the pin is committed at | |
| 51 | +`crates/ec-av1/fixtures/lr-sgr-r7.obu`. A direct grep of the invariant-1 | |
| 52 | +pattern over `crates/*/src` and `crates/*/tests` returns exactly one hit, and | |
| 53 | +it is the line quoted above. | |
| 54 | + | |
| 55 | +That one hit is a **doc comment**, in | |
| 56 | +`pinned_golden7_stream_decodes_pixel_exact`, reproducing the forbidden literal | |
| 57 | +verbatim to explain the shape that gate removed: | |
| 58 | + | |
| 59 | +```rust | |
| 60 | + /// LIVE since lane-av1pinslive r3. The old shape was the worst of the | |
| 61 | + /// class: a `concat!(env!("CARGO_MANIFEST_DIR"), "/../../fixtures/...")` | |
| 62 | + /// literal, which points at the GITIGNORED root and can therefore never be | |
| 63 | + /// satisfied by a committed pin, combined with a bare `.expect()`. The | |
| 64 | +``` | |
| 65 | + | |
| 66 | +Invariant 1 was a plain `grep -rn` and could not tell prose from code, so the | |
| 67 | +crate carried an enforced "violation" that was a sentence explaining a fixed | |
| 68 | +bug. The correction is two-sided, and both halves were needed: | |
| 69 | + | |
| 70 | +- **the prose stays.** The sentence is what a reader needs; it is the only | |
| 71 | + record of why that gate's shape was the worst of its class. It is restored | |
| 72 | + verbatim in `0790e90c` after `2364d7a7` had reworded it. | |
| 73 | +- **the scanner is fixed.** `lane-av1fixlib` `12cae635` strips `//` and | |
| 74 | + `/* */` before invariant 1 matches, via a python scan rather than grep, and | |
| 75 | + plants a **positive control** — a known forbidden literal in a scratch `.rs` | |
| 76 | + — that fails loudly if the stripper ever stops matching. That is the floor | |
| 77 | + that makes a comment-stripping bug impossible to mistake for an all-clear. | |
| 78 | + | |
| 79 | +Verified in this tree with the literal present and the shape fatal by default: | |
| 80 | + | |
| 81 | +``` | |
| 82 | + invariant 1: no root-fixture pin path | |
| 83 | + code-shape violations: 0 | |
| 84 | +verify-fixture-library: GREEN (303 rows) exit 0 | |
| 85 | +``` | |
| 86 | + | |
| 87 | +## 2. What each site said before and after | |
| 88 | + | |
| 89 | +### Site 1 — doc comment of `pinned_golden7_stream_decodes_pixel_exact` | |
| 90 | + | |
| 91 | +The text is **unchanged from `0dfdf0c8`**. `2364d7a7` reworded it, `0790e90c` | |
| 92 | +restores it exactly: | |
| 93 | + | |
| 94 | +```rust | |
| 95 | + /// LIVE since lane-av1pinslive r3. The old shape was the worst of the | |
| 96 | + /// class: a `concat!(env!("CARGO_MANIFEST_DIR"), "/../../fixtures/...")` | |
| 97 | + /// literal, which points at the GITIGNORED root and can therefore never be | |
| 98 | + /// satisfied by a committed pin, combined with a bare `.expect()`. The | |
| 99 | + /// bytes are now committed at | |
| 100 | +``` | |
| 101 | + | |
| 102 | +No code changed; the gate's behaviour is untouched. | |
| 103 | + | |
| 104 | +### Site 2 — `stream.rs:31388`, `pinned_warp_stream_decodes_pixel_exact` | |
| 105 | + | |
| 106 | +Before: one directory literal, fourteen runtime names, no committed pin. | |
| 107 | + | |
| 108 | +```rust | |
| 109 | + #[test] | |
| 110 | + #[ignore = "reads pinned fixture paths under the gitignored fixtures dir; run manually"] | |
| 111 | + fn pinned_warp_stream_decodes_pixel_exact() { | |
| 112 | + if !have_ffmpeg() { ... return; } | |
| 113 | + let fixtures = concat!(env!("CARGO_MANIFEST_DIR"), "/../../fixtures"); | |
| 114 | + let paths: Vec<String> = match std::env::var("EC_AV1_GATE_DUMP_PIN") { | |
| 115 | + Ok(p) => vec![p], | |
| 116 | + Err(_) => ["warp-mismatch", "warp-flake-5", "warp-flake-7", | |
| 117 | + "ii-flake-1", "ii-flake-2", "ii-flake-3", "ii-flake-5", | |
| 118 | + "ii-flake-6", "ii-flake-7", "ii-flake-8", "ii-flake-9", | |
| 119 | + "rect-flake-1", "rect-flake-2", "rect-flake-3"] | |
| 120 | + .iter().map(|n| format!("{fixtures}/{n}.obu")).collect(), | |
| 121 | + }; | |
| 122 | + for path in paths { check_pinned_warp_stream(&path); } | |
| 123 | + } | |
| 124 | +``` | |
| 125 | + | |
| 126 | +After: fourteen committed pins, each named by a string literal through | |
| 127 | +`crate_pin` — the spelling `pinned_golden3`, `pinned_golden4`, | |
| 128 | +`pinned_golden7` and `pinned_sbpart` already use, one per pin, no second | |
| 129 | +dialect. The per-pin provenance comments stay in place, each still attached to | |
| 130 | +the pin it describes. | |
| 131 | + | |
| 132 | +```rust | |
| 133 | + #[test] | |
| 134 | + fn pinned_warp_stream_decodes_pixel_exact() { | |
| 135 | + if !have_ffmpeg() { ... return; } | |
| 136 | + let pins = match std::env::var("EC_AV1_GATE_DUMP_PIN") { | |
| 137 | + Ok(p) => vec![std::path::PathBuf::from(p)], | |
| 138 | + Err(_) => vec![ | |
| 139 | + crate_pin("warp-mismatch.obu"), | |
| 140 | + crate_pin("warp-flake-5.obu"), | |
| 141 | + /* ... thirteen more, each its own literal ... */ | |
| 142 | + crate_pin("rect-flake-3.obu"), | |
| 143 | + ], | |
| 144 | + }; | |
| 145 | + for path in pins { check_pinned_warp_stream(&path); } | |
| 146 | + } | |
| 147 | +``` | |
| 148 | + | |
| 149 | +`check_pinned_warp_stream` now takes `&std::path::Path` and reads through | |
| 150 | +`require_pin`, so an absent pin is a hard failure naming the crate-local path | |
| 151 | +rather than a raw io `expect` panic — the helper the sibling gates use. | |
| 152 | + | |
| 153 | +**All fourteen pins were recoverable**, each committed byte-for-byte under | |
| 154 | +`crates/ec-av1/fixtures/`: | |
| 155 | + | |
| 156 | +| pin | sha256 (16) | pin | sha256 (16) | | |
| 157 | +|---|---|---|---| | |
| 158 | +| `warp-mismatch.obu` | `24cca5beb41c1078` | `ii-flake-6.obu` | `84a1f60011dfdb77` | | |
| 159 | +| `warp-flake-5.obu` | `1a99f9e5b257eed0` | `ii-flake-7.obu` | `61ba4d114aa55ebc` | | |
| 160 | +| `warp-flake-7.obu` | `c2f8b93f5a59c56b` | `ii-flake-8.obu` | `f19d3d80ed564850` | | |
| 161 | +| `ii-flake-1.obu` | `700ded3e61e15bc3` | `ii-flake-9.obu` | `0df4874737cc6152` | | |
| 162 | +| `ii-flake-2.obu` | `edc4ad3a6c00c6bc` | `rect-flake-1.obu` | `a3869b5d2bd8a8bc` | | |
| 163 | +| `ii-flake-3.obu` | `994bfbdc952ecef1` | `rect-flake-2.obu` | `c780ddee1adf25cf` | | |
| 164 | +| `ii-flake-5.obu` | `f43fe77ea0e8ddd9` | `rect-flake-3.obu` | `3b23d204549b7bcf` | | |
| 165 | + | |
| 166 | +### The `#[ignore]`, and why it came off | |
| 167 | + | |
| 168 | +The old reason ("reads pinned fixture paths under the gitignored fixtures | |
| 169 | +dir") became factually false with the shape fix. The acceptance was that a | |
| 170 | +plain run must actually execute the gate — a gate un-ignored while its pins | |
| 171 | +are absent is the same no-op with a better excuse. It is not absent, and it is | |
| 172 | +not vacuous: `--nocapture` shows all fourteen paths resolving under | |
| 173 | +`crates/ec-av1/fixtures/` (not the gitignored root) with | |
| 174 | +`warp_selected_hits` carried 0 → 113 across the set. Had any pin been | |
| 175 | +unrecoverable the gate would have stayed `#[ignore]`d with the reason. Cost is | |
| 176 | +1.7 s plus ffmpeg, which `have_ffmpeg()` already gates. | |
| 177 | + | |
| 178 | +## 3. Generalisation — what the tooling cannot see | |
| 179 | + | |
| 180 | +Three findings, all measured. The third is **open and blocks the wave**. | |
| 181 | + | |
| 182 | +**1. A gate can vanish from the census, and the obvious refactor of the code | |
| 183 | +just landed would do it.** The census finds names only through a root literal | |
| 184 | +plus `[..].iter().map(|n| format!("{var}/{n}.obu"))`, and through | |
| 185 | +`crate_pin\(\s*"([^"]+)"` — a **string literal**. The DRY spelling | |
| 186 | +`crate_pin(&format!("{n}.obu"))` matches neither, so the loop hits `continue` | |
| 187 | +and the gate is not counted at all: a green `uncommitted=0` would then mean | |
| 188 | +"this gate is absent from the census", the same silent-SKIP class wearing a | |
| 189 | +census. That is why each pin is spelled out individually. `12cae635` closes | |
| 190 | +this one: the audit now emits a `BADCALL` row and the preflight **fails** on a | |
| 191 | +non-literal `crate_pin` argument, because a gate the census cannot resolve is | |
| 192 | +unproven rather than clean. | |
| 193 | + | |
| 194 | +**2. The census prints one `GATE` row per NAME, not per gate.** The `crate_pin` | |
| 195 | +branch prints inside the name loop, so the 14-pin warp gate prints 14 identical | |
| 196 | +`GATE` lines: measured 21 printed rows for 8 gates at `12cae635`, 20 for 7 | |
| 197 | +once the doc comment below removes one. `COUNT total=` is the real number. | |
| 198 | +`lane-av1fixlib` owns the printing fix; it is cosmetic, not a counting bug. | |
| 199 | + | |
| 200 | +**3. OPEN — `pin-gate-audit.py` strips no comments, and that silently un-counts | |
| 201 | +a gate.** Invariant 1 was fixed for comment-blindness; the census was not. | |
| 202 | +`12cae635` has no strip helper and no `code` variable in the audit at all | |
| 203 | +(`grep -c code` = 1, incidental). `ROOT_RE.search(body)` (line 131), | |
| 204 | +`JOIN_RE.search(body)` (136) and the `crate_pin` singles (146) all run on the | |
| 205 | +raw body; only the name-list branch strips `//`, as before. Measured on | |
| 206 | +`12cae635` itself, both directions: | |
| 207 | + | |
| 208 | +``` | |
| 209 | + 12cae635 pristine -> COUNT total=8 committed=21 uncommitted=0 | |
| 210 | + 12cae635 + the restored doc comment -> COUNT total=7 committed=20 uncommitted=0 | |
| 211 | +``` | |
| 212 | + | |
| 213 | +`pinned_golden4_stream_decodes_pixel_exact` (`stream.rs:23950`) stops being | |
| 214 | +counted entirely — no `GATE` row, no `NAME` row — and `uncommitted=0` still | |
| 215 | +reads clean, so **nothing goes red**. Cause: `fn_bodies` runs a gate's body | |
| 216 | +from its `fn` line to the *next* `fn` line, so golden4's captured body spans | |
| 217 | +23950–23987 and golden7's doc comment (23974–23986) sits inside it. | |
| 218 | +`ROOT_RE` matches the comment, `root_lit` becomes `/../../fixtures/...`, the | |
| 219 | +gate takes the root-literal branch, finds no bracketed list and no | |
| 220 | +`"/fixtures/..."` literal, and hits `continue`. A comment moved a gate out of | |
| 221 | +the census. | |
| 222 | + | |
| 223 | +This is finding 1's failure mode reached through the other door: the gate is | |
| 224 | +not unreadable, it is reclassified into a branch that counts nothing. It also | |
| 225 | +means the site-1 prose is only safe to land once the audit strips comments on | |
| 226 | +all three searches. Reported to `lane-av1fixlib` with both measurements, the | |
| 227 | +mechanism, the one-line shape of the fix, and a request for a census positive | |
| 228 | +control for this specific shape — their existing control only proves the | |
| 229 | +scanner finds a bad literal, and would not have caught this. | |
| 230 | + | |
| 231 | +## 4. Red / green | |
| 232 | + | |
| 233 | +Measured on this branch's own commits, same tree, same committed scripts. | |
| 234 | + | |
| 235 | +**Red — fix reverted** (`git stash push -- crates/ec-av1/src/stream.rs | |
| 236 | +crates/ec-av1/fixtures/`, against the pre-comment-strip tool): | |
| 237 | + | |
| 238 | +``` | |
| 239 | +FAIL [invariant 1]: a committed pin is reached through the gitignored root | |
| 240 | + .../crates/ec-av1/src/stream.rs:23980: /// class: a `concat!(env!("CARGO_MANIFEST_DIR"), "/../../fixtures/...")` | |
| 241 | + pin gates: total=7 committed=6 uncommitted=14 ignored=1 assertless=0 | |
| 242 | +FAIL [invariant 4]: pin-reading gates whose pins are not committed | |
| 243 | + crates/ec-av1/src/stream.rs:31386:pinned_warp_stream_decodes_pixel_exact /../../fixtures bare directory literal feeding 14 runtime name(s): no committed tree satisfies it | |
| 244 | + crates/ec-av1/src/stream.rs:31386:pinned_warp_stream_decodes_pixel_exact concat! 14/14 pin(s) not committed+tracked, e.g. warp-mismatch | |
| 245 | +``` | |
| 246 | + | |
| 247 | +named exactly the two sites, `uncommitted=14`. | |
| 248 | + | |
| 249 | +``` | |
| 250 | +EC_FIXTURE_SHAPE_STRICT=1 -> exit 1 | |
| 251 | +``` | |
| 252 | + | |
| 253 | +**Green — fix applied** (`12cae635` tool, `0790e90c` crate, shape fatal by | |
| 254 | +default): | |
| 255 | + | |
| 256 | +``` | |
| 257 | + invariant 1: no root-fixture pin path | |
| 258 | + invariant 4: every pin-reading gate resolves through committed copies | |
| 259 | + pin gates: total=7 committed=20 uncommitted=0 ignored=0 assertless=0 | |
| 260 | + code-shape violations: 0 | |
| 261 | +verify-fixture-library: GREEN (303 rows) exit 0 | |
| 262 | +``` | |
| 263 | + | |
| 264 | +`total=7` rather than 8 is finding 3 above, not a regression in the fix — the | |
| 265 | +missing gate is golden4, present in the red run's tool and removed from the | |
| 266 | +count by the doc comment the preflight now correctly ignores. It is reported | |
| 267 | +as a defect in the census rather than papered over by re-adding the reword. | |
| 268 | + | |
| 269 | +**Caveat on the exit code, stated not hidden.** The script's exit status is the | |
| 270 | +*LIBRARY* verdict (root present, paths resolve, no manifest drift), not the | |
| 271 | +shape verdict. In this tree the library verdict is clean — `EC_FIXTURES` points | |
| 272 | +at the primary checkout's library and the manifest is regenerated against this | |
| 273 | +tree. The earlier DRIFT reds in this lane's history were the manifest's | |
| 274 | +`required-by file:line` column generated against a different `stream.rs`; | |
| 275 | +rebasing onto `12cae635` resolved them. | |
| 276 | + | |
| 277 | +## 5. Gates | |
| 278 | + | |
| 279 | +Lane-scoped `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-av1fixtureshape` | |
| 280 | +throughout — the shared `$HOME/.cache/cargo-target` was observed serving an | |
| 281 | +`ec_av1` binary built from another worktree of the same package. `stream.rs` | |
| 282 | +`touched` before every run. | |
| 283 | + | |
| 284 | +``` | |
| 285 | +cargo check -p ec-av1 --all-targets | |
| 286 | + Finished `dev` profile in 7.73s (no warnings) | |
| 287 | + | |
| 288 | +cargo test -p ec-av1 --lib -- gate_coverage refusal_inventory | |
| 289 | + ok. 28 passed; 0 failed; 0 ignored; 719 filtered out; 0.91s | |
| 290 | + | |
| 291 | +cargo test -p ec-av1 --lib -- pinned_ golden | |
| 292 | + ok. 19 passed; 0 failed; 2 ignored; 726 filtered out; 1.61s | |
| 293 | + including pinned_lr_sgr_stream_call_unique_dump, pinned_golden7, pinned_sbpart, | |
| 294 | + pinned_warp_stream_decodes_pixel_exact, rect_sizes_pinned_against_libaom | |
| 295 | + | |
| 296 | +cargo test -p ec-av1 --lib -- pinned_golden7 pinned_warp | |
| 297 | + ok. 2 passed; 0 failed; 745 filtered out; 2.02s (after the doc-comment restore) | |
| 298 | +``` | |
| 299 | + | |
| 300 | +Gate bodies touched: exactly two — `pinned_warp_stream_decodes_pixel_exact` | |
| 301 | +(rewritten) and `pinned_golden7_stream_decodes_pixel_exact` (doc comment only, | |
| 302 | +no behaviour). The fourteen new pins are consumed by the warp gate alone, and | |
| 303 | +that gate is in every run above. | |
| 304 | + | |
| 305 | +## 6. Handed over | |
| 306 | + | |
| 307 | +`0790e90c` to `lane-av1fixlib` for the crate half. Nothing open on the fourteen | |
| 308 | +pins. One item open against their branch before it goes to the wave: the | |
| 309 | +census comment-stripping in finding 3. |