forge
Explore
Log in

Don't you dare go Hollow

ec-av1: r2 — route the five guards that merged in after r1, close the class

Browse files at this commit

1f8005ce452ab2ecc3bd278641b79c6b3c56a06aAhmet Kaan GümüşParent: 1f09dc0
The merge review measured the CURRENT tree (9b2f6c9d), not r1's base: 21
`aomdec_path().is_file()` occurrences there, of which 18 were bare guard
sites. Six gates that merged after r1 branched were added with the same silent
shape and reported GREEN with the compare skipped under EC_AV1_REQUIRE_AOMENC=1.
The lesson is the stale base: a class sweep run against a base that is still
moving is a snapshot of the past, so the fix has to leave the decision in ONE
place rather than in thirteen.

All five remaining guards now call `aomdec_available`, including the inverted
`if !aomdec_path().is_file() { … return; }` in
a_444_lossless_sb64_intrabc_rect_chroma_walks_4x4_units. Seven redundant
`else { eprintln!("… pixel arm skipped") }` arms are deleted (six scripted,
one found by running the gates and seeing two SKIP lines for one skip), so a
skip prints exactly one line, from the probe. 18 bare guard sites -> 0; the
presence check survives in the probe, two hard asserts and two doc comments.

Red-before re-proven on the current tree (r2 reverted, r1 as rebased) with
EC_AV1_AOMDEC=/nonexistent/oracle/aomdec EC_AV1_REQUIRE_AOMENC=1:
  before: ok. 3 passed — a_444_lossless_sb64_intrabc… "no oracle aomdec at
          /nonexistent/oracle/aomdec, pixel arm skipped",
          a_lossless_block_clips_its_transform_grid… SKIP, and the rect4-strip
          gate printing one skip per pinned fixture
  after:  FAILED. 0 passed; 3 failed — each naming the gate, the missing path
          and the env that should have caught it.
Oracle present: the six plus the two superres-mode gates that share
a_444_superres_arm pass (7 passed). Absent with the env unset: one SKIP per
gate, developer-only convenience, unchanged.
Acceptance: cargo test -p ec-av1 --lib -- gate_coverage refusal_inventory ->
26 passed, 0 failed (the enable-rect-tx staleness r1 reported is retired
upstream).

Report corrections in the same commit: the r1 header cited commit ee4f2d55,
which does not exist (git cat-file: fatal) — replaced with 644bdbb8, the real
rebased commit; and "thirteen gates" is thirteen CALL SITES across twelve
distinct gates (a_444_lossy_rect4_inter_stream_decodes_pixel_exact calls the
probe twice, for its 4:4:4 stream and its 4:2:0 control).
crates/ec-av1/src/stream.rsmodified+37 -39
@@ -6969,13 +6969,8 @@ pub(crate) mod tests {
69696969 for f in &frames {
69706970 assert_eq!((f.width, f.height), (W, H), "{NAME}: dimensions");
69716971 }
6972- if aomdec_path().is_file() {
6972+ if aomdec_available(NAME) {
69736973 assert_rawvideo_matches(&obu, &stream, NAME, FRAMES);
6974- } else {
6975- eprintln!(
6976- "SKIP {NAME} aomdec arm: no oracle aomdec at {}",
6977- aomdec_path().display()
6978- );
69796974 }
69806975
69816976 // Control: a stream whose roots all fit must not clip at all.
@@ -7427,8 +7422,6 @@ pub(crate) mod tests {
74277422 "{NAME}: {decoded} frame(s) byte-exact vs aomdec, {own_chroma} \
74287423 own-extent 1:4 chroma gather(s)"
74297424 );
7430- } else {
7431- eprintln!("{NAME}: no oracle aomdec, pixel arm skipped");
74327425 }
74337426
74347427 // The specificity arm: the SAME source, flags and 1:4 partitions at
@@ -7862,8 +7855,6 @@ pub(crate) mod tests {
78627855 (U/V first wrong at index 20532, entropy fork read 12465 at \
78637856 mi (90,108)) -- see lanes/av1444rect.report.md \u{00a7}6"
78647857 );
7865- } else {
7866- eprintln!("{NAME}: no oracle aomdec, pixel arm skipped");
78677858 }
78687859 }
78697860
@@ -14215,8 +14206,6 @@ pub(crate) mod tests {
1421514206 width) per frame, {scaled_up} upscale(s), {scaled_mc} scaled MC block(s); \
1421614207 fixture sha256 {fixture_sha}"
1421714208 );
14218- } else {
14219- eprintln!("{name}: no oracle aomdec, pixel arm skipped");
1422014209 }
1422114210 heads
1422214211 }
@@ -46059,7 +46048,9 @@ pub(crate) mod tests {
4605946048 let mut parser = Av1Parser::new();
4606046049 let mut pos = 0usize;
4606146050 while pos < stream.len() {
46062- let obu = parser.parse_obu(&stream[pos..]).expect("parsing our own OBUs");
46051+ let obu = parser
46052+ .parse_obu(&stream[pos..])
46053+ .expect("parsing our own OBUs");
4606346054 pos += obu.total_size;
4606446055 }
4606546056 parser
@@ -46243,12 +46234,12 @@ pub(crate) mod tests {
4624346234 );
4624446235 assert_eq!(frames.len(), FRAMES, "{NAME}: frame count");
4624546236
46246- if !aomdec_path().is_file() {
46237+ // The probe decides; its own SKIP (and its assert under
46238+ // EC_AV1_REQUIRE_AOMDEC / EC_AV1_REQUIRE_AOMENC) has already been said.
46239+ if !aomdec_available(NAME) {
4624746240 eprintln!(
46248- "{NAME}: {chroma4} lossless rect intra-BC block(s) walked 4x4 chroma \
46249- units, {wht} WHT units, 0 split; no oracle aomdec at {}, pixel arm \
46250- skipped",
46251- aomdec_path().display()
46241+ "{NAME}: {chroma4} lossless rect intra-BC block(s) walked 4x4 chroma units, \
46242+ {wht} WHT units, 0 split"
4625246243 );
4625346244 return;
4625446245 }
@@ -46428,9 +46419,8 @@ pub(crate) mod tests {
4642846419 h + v
4642946420 };
4643046421 crate::decode::reset_rect4_inter_own_chroma444_hits();
46431- let frames = decode_stream(&stream).unwrap_or_else(|e| {
46432- panic!("{NAME}: {fixture} no longer decodes cleanly: {e}")
46433- });
46422+ let frames = decode_stream(&stream)
46423+ .unwrap_or_else(|e| panic!("{NAME}: {fixture} no longer decodes cleanly: {e}"));
4643446424 let own_chroma = crate::decode::rect4_inter_own_chroma444_hits();
4643546425 let strips = {
4643646426 let (h, v, _, _) = crate::decode::inter16_rect4_counters();
@@ -46467,15 +46457,13 @@ pub(crate) mod tests {
4646746457 f.u.len()
4646846458 );
4646946459 }
46470- if aomdec_path().is_file() {
46460+ if aomdec_available(NAME) {
4647146461 let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, NAME);
4647246462 eprintln!(
4647346463 "{NAME}: {fixture} {decoded} decode-order frame(s) \
4647446464 ({hidden} hidden) byte-exact vs aomdec, {own_chroma} own-extent \
4647546465 1:4 chroma gather(s), {strips} 1:4 inter strip(s)"
4647646466 );
46477- } else {
46478- eprintln!("{NAME}: {fixture}: no oracle aomdec, pixel arm skipped");
4647946467 }
4648046468 }
4648146469 }
@@ -46696,7 +46684,7 @@ pub(crate) mod tests {
4669646684 f.v.len()
4669746685 );
4669846686 }
46699- if aomdec_path().is_file() {
46687+ if aomdec_available(NAME) {
4670046688 let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, NAME);
4670146689 eprintln!(
4670246690 "{NAME}: {decoded} decode-order frame(s) ({hidden} hidden) byte-exact vs \
@@ -46704,8 +46692,6 @@ pub(crate) mod tests {
4670446692 {scaled_up} upscale(s), {scaled_mc} scaled MC block(s); fixture sha256 \
4670546693 {FIXTURE_SHA256}"
4670646694 );
46707- } else {
46708- eprintln!("{NAME}: no oracle aomdec, pixel arm skipped");
4670946695 }
4671046696 }
4671146697
@@ -46842,8 +46828,9 @@ pub(crate) mod tests {
4684246828 let _guard = lock_gate_counters();
4684346829 let before_sr = crate::superres::superres_hits();
4684446830 let before_scaled = crate::mc::predict_scaled_hits();
46845- let frames = decode_stream(&stream)
46846- .unwrap_or_else(|e| panic!("{name}: the pinned 4:4:4 superres stream was refused: {e}"));
46831+ let frames = decode_stream(&stream).unwrap_or_else(|e| {
46832+ panic!("{name}: the pinned 4:4:4 superres stream was refused: {e}")
46833+ });
4684746834 let scaled_up = crate::superres::superres_hits() - before_sr;
4684846835 let scaled_mc = crate::mc::predict_scaled_hits() - before_scaled;
4684946836 assert!(
@@ -46883,7 +46870,7 @@ pub(crate) mod tests {
4688346870 );
4688446871 }
4688546872 }
46886- if aomdec_path().is_file() {
46873+ if aomdec_available(name) {
4688746874 let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, name);
4688846875 eprintln!(
4688946876 "{name}: {decoded} decode-order frame(s) ({hidden} hidden) byte-exact vs \
@@ -46891,8 +46878,6 @@ pub(crate) mod tests {
4689146878 width) per frame, {scaled_up} upscale(s), {scaled_mc} scaled MC block(s); \
4689246879 fixture sha256 {fixture_sha}"
4689346880 );
46894- } else {
46895- eprintln!("{name}: no oracle aomdec, pixel arm skipped");
4689646881 }
4689746882 heads
4689846883 }
@@ -47009,9 +46994,21 @@ pub(crate) mod tests {
4700946994 }
4701046995 let y4m = Command::new("ffmpeg")
4701146996 .args([
47012- "-v", "error", "-f", "lavfi", "-i", "testsrc2=size=256x128:rate=25",
47013- "-frames:v", "4", "-pix_fmt", "yuv444p", "-strict", "-1", "-f",
47014- "yuv4mpegpipe", "-",
46997+ "-v",
46998+ "error",
46999+ "-f",
47000+ "lavfi",
47001+ "-i",
47002+ "testsrc2=size=256x128:rate=25",
47003+ "-frames:v",
47004+ "4",
47005+ "-pix_fmt",
47006+ "yuv444p",
47007+ "-strict",
47008+ "-1",
47009+ "-f",
47010+ "yuv4mpegpipe",
47011+ "-",
4701547012 ])
4701647013 .stdin(Stdio::null())
4701747014 .stdout(Stdio::piped())
@@ -47023,10 +47020,11 @@ pub(crate) mod tests {
4702347020 "{NAME}: ffmpeg refused to generate the y4m source: {}",
4702447021 String::from_utf8_lossy(&y4m.stderr)
4702547022 );
47026- let pinned =
47027- std::fs::read(std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
47028- .join("fixtures/444_lossy_superres_mode2_256x128.obu"))
47029- .expect("pinned fixture disappeared between the two reads");
47023+ let pinned = std::fs::read(
47024+ std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
47025+ .join("fixtures/444_lossy_superres_mode2_256x128.obu"),
47026+ )
47027+ .expect("pinned fixture disappeared between the two reads");
4703047028 for extra in [
4703147029 vec![],
4703247030 vec!["--superres-denominator=9"],
lanes/av1oracleSkip.report.mdmodified+115 -8
@@ -1,12 +1,12 @@
11 # lane-av1oracleskip — gate-honesty: the oracle SKIP class
22
3-**Tree.** `lane-av1oracleskip` off **main `7f8817cb`** ("Merge lane-av1pins @
4-44a05b40"), worktree `~/.cache/wt/av1oracleskip`, branch
5-`lane-av1oracleskip`. Commit `ee4f2d55` (see §5). The primary checkout was
6-mid-merge when this lane started (`UU crates/ec-av1/src/stream.rs` in its
7-index), so this worktree is pinned to the last merge commit rather than to a
8-moving HEAD. Built in a lane-private `CARGO_TARGET_DIR`
9-(`~/.cache/cargo-target-av1oracleskip`).
3+**Tree.** `lane-av1oracleskip`, worktree `~/.cache/wt/av1oracleskip`. r1 was
4+cut from main `7f8817cb` ("Merge lane-av1pins @ 44a05b40") and is commit
5+`644bdbb8` after the r2 rebase onto `9b2f6c9d` ("Merge lane-av1dumpyuv @
6+60a7788a"). The r1 text of this report was written when the primary checkout
7+was mid-merge (`UU crates/ec-av1/src/stream.rs` in its index), so the worktree
8+was pinned to a merge commit rather than to a moving HEAD. Built in a
9+lane-private `CARGO_TARGET_DIR` (`~/.cache/cargo-target-av1oracleskip`).
1010
1111 **Scope.** (1) the three `lane-av1gates444` gates that reported green having
1212 measured nothing on a host without the oracle; (2) the class sweep behind it,
@@ -86,7 +86,9 @@ env var, and this commit does not change that.
8686 **Shape B is the part the sweep found that nobody had named**, and it is worse
8787 than the three gates Main pointed at: those three fail loudly in REQUIRE mode
8888 (through `have_aomenc`), while all thirteen B sites had **no env escape at
89-all** — with `EC_AV1_REQUIRE_AOMENC=1` set and aomdec absent, they encoded,
89+all** (r2 correction: thirteen CALL SITES across **twelve** distinct gates —
90+`a_444_lossy_rect4_inter_stream_decodes_pixel_exact` calls the probe twice,
91+once for the 4:4:4 stream and once for its 4:2:0 control) — with `EC_AV1_REQUIRE_AOMENC=1` set and aomdec absent, they encoded,
9092 decoded, asserted their geometry and counters, skipped the compare, and
9193 reported green. Four of the thirteen printed nothing at all.
9294
@@ -157,3 +159,108 @@ fixture to fall back on, so a missing aomdec there really is a broken oracle
157159 and stays a hard failure. If the house wants the pinned gates to fail
158160 unconditionally too, that is a one-line change per site and a policy call, not
159161 a bug.
162+
163+---
164+
165+# r2 — the class was NOT closed: a stale base
166+
167+r1 fixed thirteen call sites found on base `7f8817cb`. The merge review then
168+measured the CURRENT tree and found **21** bare `aomdec_path().is_file()`
169+occurrences there, not 13: six gates that merged after r1 branched were added
170+with the same silent shape, and under `EC_AV1_REQUIRE_AOMENC=1` with aomdec
171+absent all six reported GREEN with the compare skipped. **The lesson is bigger
172+than the fix: a class sweep run against a base that is still moving is a
173+snapshot of the past.** A lane that merges into main while others are
174+measuring will reopen the class behind your back unless the probe is the only
175+place the decision is made — which is why r2 leaves exactly one.
176+
177+## 7. The sweep, re-run on the current tree
178+
179+Current main at the r2 rebase: `9b2f6c9d`. `grep -c 'aomdec_path().is_file()'`
180+over `crates/ec-av1/src/stream.rs` gives **21**, which decomposes exactly:
181+
182+| kind | count on main | what r2 did |
183+|---|---|---|
184+| bare `if aomdec_path().is_file() { …compare… }` guards (17 positive + 1 inverted `if !…`) | **18** | **all 18 routed through `aomdec_available()`** — 13 in r1, 5 in r2 |
185+| `assert!(aomdec_path().is_file(), …)` — a deliberate hard failure | 2 | kept (they are the strict form) |
186+| a doc comment naming the old shape | 1 | kept (it documents the defect) |
187+| the presence check inside `aomdec_available` itself | 0 (it did not exist) | **the one place the decision is made** |
188+
189+**Before/after: 18 bare guard sites -> 0. The presence check now exists in
190+exactly one place** (`aomdec_available`, `stream.rs:9131-9160`), called from
191+**18 call sites**. Two of those sites sit in shared helpers, so the 18 sites
192+serve **20 tests**: `a_444_hbd_superres_arm` (site 14201) is called by
193+`a_444_lossy_superres_{10bit_d12,12bit_d12,12bit_d9}_stream_decodes_pixel_exact`
194+and `a_444_superres_arm` (site 46871) by
195+`a_444_lossy_superres_mode1_den9_stream_decodes_pixel_exact` (and the
196+`mode2_random_denom` gate, which calls the same helper through a second
197+path). Counting direct `NAME`-bearing tests only: **16 gates**, plus four more
198+reaching the same probe through a shared helper. The
199+`aomdec_path().is_file()` string now survives only in two doc comments, two
200+hard asserts, and the probe's own body.
201+
202+### The six gates the review named, routed in r2
203+
204+| gate | r2 site (post-rebase line) | shape it had | now |
205+|---|---|---|---|
206+| `a_444_lossless_sb64_intrabc_rect_chroma_walks_4x4_units` | `stream.rs:46246` | **inverted** `if !aomdec_path().is_file() { eprintln!(… "pixel arm skipped"); return; }` | `if !aomdec_available(NAME) { …; return; }` — the probe has already said SKIP or failed |
207+| `a_lossless_block_clips_its_transform_grid_at_the_frame_edge` | `stream.rs:6972` | `if aomdec_path().is_file() { … } else { eprintln!("SKIP … aomdec arm: no oracle aomdec at {}") }` | `if aomdec_available(NAME) { … }`, else arm deleted |
208+| `a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries` | `stream.rs:46470` | nested `if aomdec_path().is_file()`, else arm deleted in r2 | `if aomdec_available(NAME) { … }` |
209+| `a_444_lossy_superres_stream_decodes_pixel_exact` | `stream.rs:46699` | `if aomdec_path().is_file() { … } else { eprintln!("… pixel arm skipped") }` | `if aomdec_available(NAME) { … }` |
210+| `a_444_superres_arm` (shared helper; reached by `a_444_lossy_superres_mode1_den9_stream_decodes_pixel_exact` and `a_444_lossy_superres_mode2_random_denom_stream_decodes_pixel_exact`) | `stream.rs:46886` | `if aomdec_path().is_file() { … } else { eprintln!("… pixel arm skipped") }` | `if aomdec_available(name) { … }` |
211+| `a_distance_weighted_compound_stream_decodes_pixel_exact` | routed in **r1** (one of the 13) | bare guard, no env escape | `if aomdec_available(NAME) { … }` |
212+
213+**Redundant `else { eprintln!("… pixel arm skipped") }` arms deleted: 7** (6 in
214+the scripted pass, 1 found afterwards by running the gates and reading the
215+output — `a_lossless_block_clips_its_transform_grid_at_the_frame_edge` printed
216+TWO skip lines for one skip, which is how the survivor was located). After
217+that, a skip prints exactly one line, from the probe.
218+
219+## 8. Red-before, re-proven on the CURRENT tree
220+
221+Base for this proof is **r1 as rebased** (r2's edits reverted by
222+`git checkout --`, i.e. exactly what main `9b2f6c9d` would give with r1
223+applied) — the point is that a lane merging AFTER r1 branched reintroduces the
224+class, so the proof has to stand on the tree the six gates actually live in.
225+
226+`EC_AV1_AOMDEC=/nonexistent/oracle/aomdec EC_AV1_REQUIRE_AOMENC=1`:
227+
228+| gate | before r2 | after r2 |
229+|---|---|---|
230+| `a_444_lossless_sb64_intrabc_rect_chroma_walks_4x4_units` | `… 0 split; no oracle aomdec at /nonexistent/oracle/aomdec, pixel arm skipped` | **FAILED**: `no oracle aomdec at /nonexistent/oracle/aomdec -- the pixel compare this gate exists for would be skipped, and EC_AV1_REQUIRE_AOMDEC/EC_AV1_REQUIRE_AOMENC is set.` |
231+| `a_lossless_block_clips_its_transform_grid_at_the_frame_edge` | `SKIP … aomdec arm: no oracle aomdec at /nonexistent/oracle/aomdec` | **FAILED**, same message |
232+| `a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries` | two `…: no oracle aomdec, pixel arm skipped` lines (one per pinned fixture) | **FAILED**, same message |
233+
234+`test result: ok. 3 passed` before, **`test result: FAILED. 0 passed; 3
235+failed`** after — with `EC_AV1_REQUIRE_AOMENC=1` set, i.e. exactly the mode a
236+batch run is supposed to be in.
237+
238+## 9. The other two directions, on the current tree
239+
240+* **Oracle present** — the six (plus the two superres-mode gates that share
241+ `a_444_superres_arm`) run and pass: `a_444_lossy_superres_mode1_den9… 4
242+ decode-order frame(s) byte-exact vs aomdec at (256,128) upscaled from
243+ [(9,228)…]`, `a_444_lossy_rect4_strip… 12 / 24 own-extent 1:4 chroma
244+ gather(s)`, `a_444_lossless_sb64_intrabc… 4 lossless rect intra-BC block(s)
245+ walked 4x4 chroma units, 24576 WHT units`. **7 passed, 0 failed.**
246+* **Absent, env unset** — one SKIP line per gate, from the probe, naming the
247+ path and the escape hatch; the gates still pass. Developer-only
248+ convenience, unchanged from r1 and now impossible to print twice.
249+
250+Acceptance: `cargo test -p ec-av1 --lib -- gate_coverage refusal_inventory` ->
251+**26 passed, 0 failed** on the rebased tree (the `enable-rect-tx` staleness
252+r1 reported is gone — lane-av1toolgates' entries were retired upstream).
253+
254+## 10. What is still open after r2
255+
256+* **Shape A stays.** ~445 `if !have_aomenc()` / `if !have_ffmpeg()` early
257+ returns, plus `have_affine_aomenc` (which does have the assert-last shape).
258+ They fail under the REQUIRE vars because their probes assert; a future lane
259+ adding a NEW guard must call a probe rather than re-derive `.is_file()`.
260+* **The anti-regression is procedural, not enforced.** A guard written as
261+ `aomdec_path().is_file()` compiles, passes review and re-opens the class. The
262+ mechanical guard is a source-scan test ("no `aomdec_path().is_file()` outside
263+ `aomdec_available` and the two documented asserts"); it was NOT added here
264+ because the source-scan pattern for a whole-file assertion is itself a new
265+ piece of machinery, and this lane's charter is the probe. It is the obvious
266+ next step and it is small.