forge
Explore
Log in

Don't you dare go Hollow

Merge lane-av1oracleskip @ 7bf95961 — one aomdec_available() for 18 guard sites, 7 redundant else skip-arms deleted

Browse files at this commit

f94e32d45a20eb90cb945f5c3ddfa989aae089daAhmet Kaan GümüşParent: b628d0d1f8005c
# Conflicts:
#	crates/ec-av1/src/stream.rs
crates/ec-av1/src/stream.rsmodified+92 -100
@@ -6883,7 +6883,7 @@ pub(crate) mod tests {
68836883 }
68846884
68856885 // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames.
6886- if aomdec_path().is_file() {
6886+ if aomdec_available(NAME) {
68876887 let dir = std::env::temp_dir().join(format!("ec-av1-ll444-{}", std::process::id()));
68886888 let _ = std::fs::remove_dir_all(&dir);
68896889 std::fs::create_dir_all(&dir).expect("scratch dir");
@@ -6932,11 +6932,6 @@ pub(crate) mod tests {
69326932 );
69336933 }
69346934 }
6935- } else {
6936- eprintln!(
6937- "SKIP {NAME} aomdec arm: no oracle aomdec at {}",
6938- aomdec_path().display()
6939- );
69406935 }
69416936
69426937 // ffmpeg's decoder: same frames, full-resolution chroma.
@@ -7067,13 +7062,8 @@ pub(crate) mod tests {
70677062 );
70687063 let _ = decode_stream(&ctrl_stream)
70697064 .unwrap_or_else(|e| panic!("{NAME}: the control arm no longer decodes cleanly: {e}"));
7070- if aomdec_path().is_file() {
7065+ if aomdec_available(NAME) {
70717066 assert_rawvideo_matches(&ctrl, &ctrl_stream, NAME, FRAMES, 10);
7072- } else {
7073- eprintln!(
7074- "SKIP {NAME} control aomdec arm: no oracle aomdec at {}",
7075- aomdec_path().display()
7076- );
70777067 }
70787068 }
70797069
@@ -7161,13 +7151,8 @@ pub(crate) mod tests {
71617151 for f in &frames {
71627152 assert_eq!((f.width, f.height), (W, H), "{NAME}: dimensions");
71637153 }
7164- if aomdec_path().is_file() {
7154+ if aomdec_available(NAME) {
71657155 assert_rawvideo_matches(&obu, &stream, NAME, FRAMES, 10);
7166- } else {
7167- eprintln!(
7168- "SKIP {NAME} aomdec arm: no oracle aomdec at {}",
7169- aomdec_path().display()
7170- );
71717156 }
71727157
71737158 // Control: a stream whose roots all fit must not clip at all.
@@ -7257,7 +7242,7 @@ pub(crate) mod tests {
72577242 }
72587243
72597244 // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames.
7260- if aomdec_path().is_file() {
7245+ if aomdec_available(NAME) {
72617246 let dir = std::env::temp_dir().join(format!("ec-av1-llminp8-{}", std::process::id()));
72627247 let _ = std::fs::remove_dir_all(&dir);
72637248 std::fs::create_dir_all(&dir).expect("scratch dir");
@@ -7307,11 +7292,6 @@ pub(crate) mod tests {
73077292 );
73087293 }
73097294 }
7310- } else {
7311- eprintln!(
7312- "SKIP {NAME} aomdec arm: no oracle aomdec at {}",
7313- aomdec_path().display()
7314- );
73157295 }
73167296
73177297 // ffmpeg's decoder: same frames, full-resolution chroma.
@@ -7451,7 +7431,7 @@ pub(crate) mod tests {
74517431 // was a stage-ladder mixup, refuted in lane-av1lrflush r3.
74527432
74537433 // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames.
7454- if aomdec_path().is_file() {
7434+ if aomdec_available(NAME) {
74557435 let dir = std::env::temp_dir().join(format!("ec-av1-444sb-{}", std::process::id()));
74567436 let _ = std::fs::remove_dir_all(&dir);
74577437 std::fs::create_dir_all(&dir).expect("scratch dir");
@@ -7501,11 +7481,6 @@ pub(crate) mod tests {
75017481 );
75027482 }
75037483 }
7504- } else {
7505- eprintln!(
7506- "SKIP {NAME} aomdec arm: no oracle aomdec at {}",
7507- aomdec_path().display()
7508- );
75097484 }
75107485
75117486 // ffmpeg's decoder: same frames, full-resolution chroma. Same
@@ -7623,14 +7598,12 @@ pub(crate) mod tests {
76237598 f.u.len()
76247599 );
76257600 }
7626- if aomdec_path().is_file() {
7601+ if aomdec_available(NAME) {
76277602 let (decoded, _hidden) = decode_all_frames_vs_oracle(&stream, NAME);
76287603 eprintln!(
76297604 "{NAME}: {decoded} frame(s) byte-exact vs aomdec, {own_chroma} \
76307605 own-extent 1:4 chroma gather(s)"
76317606 );
7632- } else {
7633- eprintln!("{NAME}: no oracle aomdec, pixel arm skipped");
76347607 }
76357608
76367609 // The specificity arm: the SAME source, flags and 1:4 partitions at
@@ -7713,7 +7686,7 @@ pub(crate) mod tests {
77137686 // The identity half: the fix adds an arm gated on `ss_x == 0`, so a
77147687 // 4:2:0 stream must stay byte-exact through it. This is the arm that
77157688 // would go red if the new arm were ever widened past ss_x 0.
7716- if aomdec_path().is_file() {
7689+ if aomdec_available(NAME) {
77177690 decode_all_frames_vs_oracle(&out.stdout, &format!("{NAME}-420"));
77187691 }
77197692 eprintln!("{NAME}: 4:2:0 control {h4} HORZ_4 / {v4} VERT_4 strips, 0 own-extent gathers");
@@ -7745,13 +7718,24 @@ pub(crate) mod tests {
77457718 /// in [`decode_inter_block`]'s `around_c` (a 4:2:0 stream of the same
77467719 /// content leaves it at 0), and a counter at 0 would mean the gate
77477720 /// measured a different route than it names.
7748- fn encode_444_lossy_live(name: &str, w: usize, h: usize) -> Vec<u8> {
7721+ /// The guard is [`have_aomenc`], which probes first and asserts LAST with
7722+ /// the env escape: with `EC_AV1_REQUIRE_AOMENC` set, a missing oracle is
7723+ /// a hard failure naming the path it looked for, and a batch run cannot
7724+ /// report green off three skipped gates. With it unset the `None` below is
7725+ /// a developer-only convenience for a checkout without an oracle -- it is
7726+ /// the ONLY way this gate can return without measuring, and it announces
7727+ /// itself on stderr naming the env var that would make it a failure.
7728+ /// (It used to return an empty `Vec` that the caller turned into a silent
7729+ /// early `return`: the same green, reached through a second exit nobody
7730+ /// was reading.)
7731+ fn encode_444_lossy_live(name: &str, w: usize, h: usize) -> Option<Vec<u8>> {
77497732 if !have_aomenc() {
77507733 eprintln!(
7751- "SKIP {name}: no aomenc oracle at {} -- run scripts/build-aom-oracle.sh",
7734+ "SKIP {name}: no aomenc oracle at {} -- set EC_AV1_REQUIRE_AOMENC=1 to make this \
7735+ a failure, or run scripts/build-aom-oracle.sh",
77527736 aomenc_path().display()
77537737 );
7754- return Vec::new();
7738+ return None;
77557739 }
77567740 let source = format!("testsrc2=size={w}x{h}:rate=25");
77577741 let y4m = Command::new("ffmpeg")
@@ -7810,7 +7794,7 @@ pub(crate) mod tests {
78107794 "{name}: aomenc produced no OBU for {w}x{h} -- a zero-length stream would \
78117795 decode to nothing and the compare below would compare nothing"
78127796 );
7813- out.stdout
7797+ Some(out.stdout)
78147798 }
78157799
78167800 /// The body every 4:4:4 lossy live gate runs: assert the oracle compare
@@ -7819,19 +7803,20 @@ pub(crate) mod tests {
78197803 /// own-extent route really ran, then compare every frame in decode order
78207804 /// against the oracle aomdec with the length asserted first.
78217805 ///
7822- /// The aomdec assert is deliberately a HARD failure, not the
7823- /// `if aomdec_path().is_file()` skip the older gates use: a gate that
7824- /// measures exactness and then quietly skips the compare reports green
7825- /// for a decoder it never looked at (class gate-blind-to-the-arm). It
7826- /// fires only when the gate is actually running, i.e. the oracle aomenc
7827- /// resolved -- and aomenc and aomdec ship in the same build directory,
7828- /// so an aomdec that is missing while aomenc is present is a broken
7829- /// oracle, not a checkout without one.
7806+ /// The aomdec arm is a HARD failure, not a skip: these three gates encode
7807+ /// LIVE, so reaching this point means the oracle aomenc resolved, and
7808+ /// aomenc and aomdec ship in the same build directory -- an aomdec that is
7809+ /// missing beside a present aomenc is a broken oracle, not a checkout
7810+ /// without one. (The older shape, `if aomdec_path().is_file()`, let the
7811+ /// compare vanish with no env escape at all; that is what
7812+ /// [`aomdec_available`] replaced for the pinned gates, and it cannot be
7813+ /// used here because these gates have no stream to compare without one.)
78307814 fn gate_444_lossy_live_exact(name: &str, w: usize, h: usize) {
7831- let stream = encode_444_lossy_live(name, w, h);
7832- if stream.is_empty() {
7833- return; // no oracle at all: the SKIP above already said so
7834- }
7815+ // The ONLY way out without measuring, and it has already printed a
7816+ // SKIP naming the env var that would turn it into a failure.
7817+ let Some(stream) = encode_444_lossy_live(name, w, h) else {
7818+ return;
7819+ };
78357820 assert!(
78367821 aomdec_path().is_file(),
78377822 "{name}: the oracle aomenc resolved to {} but no aomdec sits beside it at {} -- \
@@ -8024,7 +8009,7 @@ pub(crate) mod tests {
80248009 // lengths match before it compares anything -- the check whose absence
80258010 // turned an out-of-window divergence into a reported EXACT in this
80268011 // lane's own round 1.
8027- if aomdec_path().is_file() {
8012+ if aomdec_available(NAME) {
80288013 decode_all_frames_vs_oracle(&stream420, &format!("{NAME}-420"));
80298014 crate::decode::reset_intrabc_rect4_own_chroma444_hits();
80308015 decode_stream(&stream420)
@@ -8052,8 +8037,6 @@ pub(crate) mod tests {
80528037 (U/V first wrong at index 20532, entropy fork read 12465 at \
80538038 mi (90,108)) -- see lanes/av1444rect.report.md \u{00a7}6"
80548039 );
8055- } else {
8056- eprintln!("{NAME}: no oracle aomdec, pixel arm skipped");
80578040 }
80588041 }
80598042
@@ -8155,7 +8138,7 @@ pub(crate) mod tests {
81558138 }
81568139
81578140 // Frames 0/1 through the PIPELINE, byte-exact vs both oracles.
8158- if aomdec_path().is_file() {
8141+ if aomdec_available(NAME) {
81598142 let dir = std::env::temp_dir().join(format!("ec-av1-lrflush-{}", std::process::id()));
81608143 let _ = std::fs::remove_dir_all(&dir);
81618144 std::fs::create_dir_all(&dir).expect("scratch dir");
@@ -8205,11 +8188,6 @@ pub(crate) mod tests {
82058188 );
82068189 }
82078190 }
8208- } else {
8209- eprintln!(
8210- "SKIP {NAME} aomdec arm: no oracle aomdec at {}",
8211- aomdec_path().display()
8212- );
82138191 }
82148192 if have_ffmpeg() {
82158193 let refs = ffmpeg_decode_sequence_444(&stream, W, H, FRAMES);
@@ -8305,7 +8283,7 @@ pub(crate) mod tests {
83058283 );
83068284
83078285 // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames.
8308- if aomdec_path().is_file() {
8286+ if aomdec_available(NAME) {
83098287 let dir = std::env::temp_dir().join(format!("ec-av1-ll444dp-{}", std::process::id()));
83108288 let _ = std::fs::remove_dir_all(&dir);
83118289 std::fs::create_dir_all(&dir).expect("scratch dir");
@@ -8346,11 +8324,6 @@ pub(crate) mod tests {
83468324 );
83478325 }
83488326 }
8349- } else {
8350- eprintln!(
8351- "SKIP {NAME} aomdec arm: no oracle aomdec at {}",
8352- aomdec_path().display()
8353- );
83548327 }
83558328 }
83568329
@@ -8447,7 +8420,7 @@ pub(crate) mod tests {
84478420 }
84488421
84498422 // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames.
8450- if aomdec_path().is_file() {
8423+ if aomdec_available(NAME) {
84518424 let dir = std::env::temp_dir().join(format!("ec-av1-leaf8oob-{}", std::process::id()));
84528425 let _ = std::fs::remove_dir_all(&dir);
84538426 std::fs::create_dir_all(&dir).expect("scratch dir");
@@ -8474,11 +8447,6 @@ pub(crate) mod tests {
84748447 0x3821_0bcb_f572_973c,
84758448 "{NAME}: aomdec raw fingerprint moved"
84768449 );
8477- } else {
8478- eprintln!(
8479- "SKIP {NAME} aomdec arm: no oracle aomdec at {}",
8480- aomdec_path().display()
8481- );
84828450 }
84838451 }
84848452 /// lane-lossless128: a LOSSLESS key frame that codes a 128-axis
@@ -8879,7 +8847,7 @@ pub(crate) mod tests {
88798847 );
88808848
88818849 // The oracle aomdec, rawvideo out: one concatenated yuv444p frame.
8882- if aomdec_path().is_file() {
8850+ if aomdec_available(NAME) {
88838851 let dir = std::env::temp_dir().join(format!("ec-av1-ibcskip2-{}", std::process::id()));
88848852 let _ = std::fs::remove_dir_all(&dir);
88858853 std::fs::create_dir_all(&dir).expect("scratch dir");
@@ -8920,11 +8888,6 @@ pub(crate) mod tests {
89208888 predictor or the rect walk"
89218889 );
89228890 }
8923- } else {
8924- eprintln!(
8925- "SKIP {NAME} aomdec arm: no oracle aomdec at {}",
8926- aomdec_path().display()
8927- );
89288891 }
89298892 eprintln!(
89308893 "{NAME}: frame sample-exact vs oracle aomdec; {luma}+{chroma} rect \
@@ -9345,6 +9308,48 @@ pub(crate) mod tests {
93459308 present
93469309 }
93479310
9311+ /// lane-av1oracleskip: the probe for the ORACLE COMPARER, in the same
9312+ /// shape as [`have_ffmpeg`] -- probe first, then `assert!` LAST, with the
9313+ /// env escape -- and it prints its own SKIP so a caller cannot skip the
9314+ /// compare silently.
9315+ ///
9316+ /// Why this exists: thirteen gates wrapped their oracle arm in a bare
9317+ /// `if aomdec_path().is_file()`, and that shape had NO env escape at all.
9318+ /// An oracle build with `aomenc` but no `aomdec` beside it (or an
9319+ /// `EC_AV1_AOMDEC` override pointing at a moved path) made the gate
9320+ /// encode, decode, assert its geometry and its counters, and then quietly
9321+ /// never compare -- green having measured nothing, with no line in the
9322+ /// output to notice. Nine of the thirteen printed a SKIP in an `else` and
9323+ /// four printed nothing at all; both are the same defect, and both are
9324+ /// closed by one probe.
9325+ ///
9326+ /// With `EC_AV1_REQUIRE_AOMENC` (or the aomdec-specific
9327+ /// `EC_AV1_REQUIRE_AOMDEC`) set, the absence is a HARD failure naming the
9328+ /// path that was looked for -- that is the batch-run guarantee, and it is
9329+ /// what the bare `is_file()` could not give. With it unset the SKIP below
9330+ /// is printed and the gate still passes: that remains a developer-only
9331+ /// convenience for a checkout without an oracle, never evidence.
9332+ fn aomdec_available(name: &str) -> bool {
9333+ let present = aomdec_path().is_file();
9334+ let require = std::env::var_os("EC_AV1_REQUIRE_AOMDEC").is_some()
9335+ || std::env::var_os("EC_AV1_REQUIRE_AOMENC").is_some();
9336+ assert!(
9337+ present || !require,
9338+ "{name}: no oracle aomdec at {} -- the pixel compare this gate exists for would be \
9339+ skipped, and EC_AV1_REQUIRE_AOMDEC/EC_AV1_REQUIRE_AOMENC is set. Build the oracle \
9340+ with scripts/build-aom-oracle.sh, or point EC_AV1_AOMDEC at a real aomdec.",
9341+ aomdec_path().display()
9342+ );
9343+ if !present {
9344+ eprintln!(
9345+ "SKIP {name}: no oracle aomdec at {} -- the pixel compare is NOT running (set \
9346+ EC_AV1_REQUIRE_AOMDEC=1 to make this a failure)",
9347+ aomdec_path().display()
9348+ );
9349+ }
9350+ present
9351+ }
9352+
93489353 /// The instrumented `aomdec` beside the `aomenc` oracle
93499354 /// (`scripts/build-aom-oracle.sh` + `scripts/instrument-aom-oracle.sh`).
93509355 fn aomdec_path() -> std::path::PathBuf {
@@ -11378,18 +11383,13 @@ pub(crate) mod tests {
1137811383 // The oracle, DECODE order, every frame including hidden alt-ref
1137911384 // frames. This is the arm that proves the repair against aomdec's
1138011385 // own reconstruction, not just ffmpeg's.
11381- if aomdec_path().is_file() {
11386+ if aomdec_available(NAME) {
1138211387 let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, NAME);
1138311388 assert!(
1138411389 decoded >= FRAMES,
1138511390 "{NAME}: oracle decoded {decoded} frames, expected at least {FRAMES}"
1138611391 );
1138711392 let _ = hidden;
11388- } else {
11389- eprintln!(
11390- "SKIP {NAME} aomdec arm: no oracle aomdec at {}",
11391- aomdec_path().display()
11392- );
1139311393 }
1139411394
1139511395 // ffmpeg's decoder: DISPLAY order, full-resolution chroma.
@@ -14396,7 +14396,7 @@ pub(crate) mod tests {
1439614396 );
1439714397 }
1439814398 }
14399- if aomdec_path().is_file() {
14399+ if aomdec_available(name) {
1440014400 let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, name);
1440114401 eprintln!(
1440214402 "{name}: {decoded} decode-order frame(s) ({hidden} hidden) byte-exact vs aomdec \
@@ -14404,8 +14404,6 @@ pub(crate) mod tests {
1440414404 width) per frame, {scaled_up} upscale(s), {scaled_mc} scaled MC block(s); \
1440514405 fixture sha256 {fixture_sha}"
1440614406 );
14407- } else {
14408- eprintln!("{name}: no oracle aomdec, pixel arm skipped");
1440914407 }
1441014408 heads
1441114409 }
@@ -46603,12 +46601,12 @@ pub(crate) mod tests {
4660346601 );
4660446602 assert_eq!(frames.len(), FRAMES, "{NAME}: frame count");
4660546603
46606- if !aomdec_path().is_file() {
46604+ // The probe decides; its own SKIP (and its assert under
46605+ // EC_AV1_REQUIRE_AOMDEC / EC_AV1_REQUIRE_AOMENC) has already been said.
46606+ if !aomdec_available(NAME) {
4660746607 eprintln!(
46608- "{NAME}: {chroma4} lossless rect intra-BC block(s) walked 4x4 chroma \
46609- units, {wht} WHT units, 0 split; no oracle aomdec at {}, pixel arm \
46610- skipped",
46611- aomdec_path().display()
46608+ "{NAME}: {chroma4} lossless rect intra-BC block(s) walked 4x4 chroma units, \
46609+ {wht} WHT units, 0 split"
4661246610 );
4661346611 return;
4661446612 }
@@ -46826,15 +46824,13 @@ pub(crate) mod tests {
4682646824 f.u.len()
4682746825 );
4682846826 }
46829- if aomdec_path().is_file() {
46827+ if aomdec_available(NAME) {
4683046828 let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, NAME);
4683146829 eprintln!(
4683246830 "{NAME}: {fixture} {decoded} decode-order frame(s) \
4683346831 ({hidden} hidden) byte-exact vs aomdec, {own_chroma} own-extent \
4683446832 1:4 chroma gather(s), {strips} 1:4 inter strip(s)"
4683546833 );
46836- } else {
46837- eprintln!("{NAME}: {fixture}: no oracle aomdec, pixel arm skipped");
4683846834 }
4683946835 }
4684046836 }
@@ -47055,7 +47051,7 @@ pub(crate) mod tests {
4705547051 f.v.len()
4705647052 );
4705747053 }
47058- if aomdec_path().is_file() {
47054+ if aomdec_available(NAME) {
4705947055 let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, NAME);
4706047056 eprintln!(
4706147057 "{NAME}: {decoded} decode-order frame(s) ({hidden} hidden) byte-exact vs \
@@ -47063,8 +47059,6 @@ pub(crate) mod tests {
4706347059 {scaled_up} upscale(s), {scaled_mc} scaled MC block(s); fixture sha256 \
4706447060 {FIXTURE_SHA256}"
4706547061 );
47066- } else {
47067- eprintln!("{NAME}: no oracle aomdec, pixel arm skipped");
4706847062 }
4706947063 }
4707047064
@@ -47243,7 +47237,7 @@ pub(crate) mod tests {
4724347237 );
4724447238 }
4724547239 }
47246- if aomdec_path().is_file() {
47240+ if aomdec_available(name) {
4724747241 let (decoded, hidden) = decode_all_frames_vs_oracle(&stream, name);
4724847242 eprintln!(
4724947243 "{name}: {decoded} decode-order frame(s) ({hidden} hidden) byte-exact vs \
@@ -47251,8 +47245,6 @@ pub(crate) mod tests {
4725147245 width) per frame, {scaled_up} upscale(s), {scaled_mc} scaled MC block(s); \
4725247246 fixture sha256 {fixture_sha}"
4725347247 );
47254- } else {
47255- eprintln!("{name}: no oracle aomdec, pixel arm skipped");
4725647248 }
4725747249 heads
4725847250 }
lanes/av1oracleSkip.report.mdadded+266 -0
@@ -0,0 +1,266 @@
1+# lane-av1oracleskip — gate-honesty: the oracle SKIP class
2+
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`).
10+
11+**Scope.** (1) the three `lane-av1gates444` gates that reported green having
12+measured nothing on a host without the oracle; (2) the class sweep behind it,
13+one row per site for every site this commit touches and per shape for the rest.
14+
15+---
16+
17+## 1. What was wrong, exactly
18+
19+`encode_444_lossy_live` (the helper all three gates call) opened with
20+
21+```rust
22+if !have_aomenc() {
23+ eprintln!("SKIP {name}: no aomenc oracle at {path} -- run scripts/build-aom-oracle.sh");
24+ return Vec::new();
25+}
26+```
27+
28+and `gate_444_lossy_live_exact` then did
29+
30+```rust
31+let stream = encode_444_lossy_live(name, w, h);
32+if stream.is_empty() {
33+ return; // no oracle at all: the SKIP above already said so
34+}
35+```
36+
37+Two exits, the second one silent, and — the part that matters for a batch — the
38+empty `Vec` is indistinguishable at the call site from a stream aomenc
39+produced and then lost. The gates
40+`a_444_lossy_odd_66x66_stream_decodes_pixel_exact`,
41+`a_444_lossy_odd_130x122_stream_decodes_pixel_exact` and
42+`a_444_lossy_256x128_stream_decodes_pixel_exact` inherit that shape: without the
43+oracle they assert nothing, encode nothing, compare nothing, and report
44+**passed**.
45+
46+The escape hatch already existed and was already correct in the probe:
47+`have_aomenc()` asserts when `EC_AV1_REQUIRE_AOMENC` is set, naming the path it
48+looked for. So the fix is not a new mechanism — it is to stop putting a second,
49+silent exit in the gate, and to make the SKIP say what it is.
50+
51+## 2. The class sweep
52+
53+`grep -c` over the crate's three test-bearing files (there is no `tests/`
54+directory; the crate's tests live in `src/*.rs`):
55+
56+| file:line | gate(s) | shape | fixed or reported |
57+|---|---|---|---|
58+| `stream.rs:7422` (`encode_444_lossy_live`), `stream.rs:7505` (`gate_444_lossy_live_exact`) | `a_444_lossy_odd_66x66_stream_decodes_pixel_exact`, `a_444_lossy_odd_130x122_stream_decodes_pixel_exact`, `a_444_lossy_256x128_stream_decodes_pixel_exact` | **C** — `if !have_aomenc() { SKIP; return Vec::new() }` + a silent `if stream.is_empty() { return; }` in the caller | **FIXED** |
59+| `stream.rs:6692` | `a_lossless_444_min_partition64_inter_stream_decodes_pixel_exact` | **B** — bare `if aomdec_path().is_file() { …compare… }`, no else, no env escape | **FIXED** |
60+| `stream.rs:6871` | `a_lossless_444_128_root_lossless_stream_reads_chunks_chunk_major` | B (had an `else` SKIP, still no env escape) | **FIXED** |
61+| `stream.rs:6934` | `a_lossless_444_min_partition8_inter_stream_decodes_sample_exact` | B (else SKIP) | **FIXED** |
62+| `stream.rs:7123` | `a_444_sb128_root_rect_stream_with_restoration_decodes_pixel_exact` | B (no else) | **FIXED** |
63+| `stream.rs:7290` | `a_444_lossy_rect4_inter_stream_decodes_pixel_exact` | B (no else) | **FIXED** |
64+| `stream.rs:7380` | `a_444_lossy_rect4_inter_stream_decodes_pixel_exact` (4:2:0 control arm) | B (no else) | **FIXED** |
65+| `stream.rs:7703` | `a_444_intrabc_rect4_reads_its_own_chroma_plane_block` | B (no else) | **FIXED** |
66+| `stream.rs:7834` | `a_444_sb128_witness_lr_pipeline_flushes_ru_row_0_pixel_exact` | B (else SKIP) | **FIXED** |
67+| `stream.rs:7979` | `a_lossless_444_defaultp_inter_strip_stream_decodes_byte_exact` | B (else SKIP) | **FIXED** |
68+| `stream.rs:8116` | `an_intrabc_8x8_leaf_chroma_frame_copy_at_444_decodes_without_the_oob` | B (else SKIP) | **FIXED** |
69+| `stream.rs:8543` | `a_lossless_444_intrabc_rect_leaf_walks_per_4x4_units` | B (else SKIP) | **FIXED** |
70+| `stream.rs:11063` | `a_lossless_444_rect16x4_chroma_reach_is_ss_aware` | B (else SKIP) | **FIXED** |
71+| `stream.rs:14076` | the superres/upscaled-bit-depth helper (`name: &str`) | B (no else) | **FIXED** |
72+| `stream.rs` — 153 sites | (the `aomenc`-live gates) | **A** — `if !have_aomenc() { eprintln!("SKIP …"); return; }` | REPORTED, not changed |
73+| `stream.rs` — 218 sites, `decode.rs` — 4, `encode.rs` — 43 | (the ffmpeg-backed gates) | **A** — `if !have_ffmpeg() { …; return; }` | REPORTED, not changed |
74+| `stream.rs` — 26, `decode.rs` — 1, `encode.rs` — 1 | (compound guards) | **A** — `if !have_ffmpeg() \|\| !have_aomenc() { … }` | REPORTED, not changed |
75+| `stream.rs:7511` | the three live 4:4:4 gates | **D** — a hard `assert!(aomdec_path().is_file(), …)` | REPORTED, kept: these gates encode LIVE, so reaching that point means aomenc resolved, and an aomdec missing beside a present aomenc is a broken oracle, not a checkout without one |
76+
77+**Why shape A is reported and not changed.** Both probes (`have_ffmpeg`,
78+`have_aomenc`) already have the correct shape — probe, then `assert!` last,
79+with the env escape — and `have_ffmpeg`'s doc comment already records the
80+earlier version's short-circuit bug. Every shape-A site therefore already FAILS
81+under `EC_AV1_REQUIRE_AOMENC=1` / `EC_AV1_REQUIRE_FFMPEG=1` and prints a SKIP
82+when those are unset. Changing 445 call sites would restate a convention the
83+probe already enforces; the honest statement is that a batch run MUST set the
84+env var, and this commit does not change that.
85+
86+**Shape B is the part the sweep found that nobody had named**, and it is worse
87+than the three gates Main pointed at: those three fail loudly in REQUIRE mode
88+(through `have_aomenc`), while all thirteen B sites had **no env escape at
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,
92+decoded, asserted their geometry and counters, skipped the compare, and
93+reported green. Four of the thirteen printed nothing at all.
94+
95+## 3. The fix
96+
97+1. New probe `aomdec_available(name)` beside `have_aomenc`, in the
98+ `have_ffmpeg` shape: probe `aomdec_path().is_file()`, then `assert!` **last**
99+ that the absence is a hard failure when `EC_AV1_REQUIRE_AOMDEC` or
100+ `EC_AV1_REQUIRE_AOMENC` is set (the message names the path looked for and
101+ how to fix it), then print a SKIP naming the env var when the flag is unset
102+ and return the bool. All thirteen sites now call it; the nine `else { … }`
103+ SKIP branches they carried are deleted, so the skip notice comes from one
104+ place and cannot drift from the assert.
105+2. `encode_444_lossy_live` returns `Option<Vec<u8>>` and
106+ `gate_444_lossy_live_exact` takes it with `let Some(stream) = … else { return }`
107+ — one exit instead of two, and the empty-`Vec` sentinel that made "no
108+ oracle" look like "aomenc produced nothing" is gone. Nothing about what the
109+ gates measure changed: they still encode live, still assert the parsed
110+ geometry, the frame count, the full-resolution chroma extent and
111+ `rect4_inter_own_chroma444_hits()`, and still compare every decode-order
112+ frame against `aomdec` through `decode_all_frames_vs_oracle`.
113+
114+## 4. Proof, all six directions
115+
116+Absence is simulated the way the crate's own path resolution allows: the
117+`EC_AV1_AOMENC` / `EC_AV1_AOMDEC` env overrides point at
118+`/nonexistent/oracle/aomenc` and `/nonexistent/oracle/aomdec`, so
119+`aomenc_path()` / `aomdec_path()` resolve to files that are not there.
120+
121+| # | condition | before this commit | after |
122+|---|---|---|---|
123+| a | oracle present, `EC_AV1_REQUIRE_AOMENC=1` | 3 passed | 3 passed, each printing its line: `66x66 … 13 own-extent 1:4 chroma gather(s)`, `130x122 … 12 …`, `256x128 … 24 …` |
124+| a2 | oracle present, the 11 re-routed pinned gates | 11 passed | **11 passed** (no behaviour change with the oracle there) |
125+| b | aomenc absent + `EC_AV1_REQUIRE_AOMENC=1` | 3 passed (green, measured nothing) | **3 FAILED**: `EC_AV1_REQUIRE_AOMENC is set but no aomenc at /nonexistent/oracle/aomenc -- run scripts/build-aom-oracle.sh` |
126+| b2 | aomdec absent + `EC_AV1_REQUIRE_AOMENC=1` | **3 passed, silently** — one of the three printed no SKIP line at all | **3 FAILED**: `<gate>: 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.` |
127+| c | aomenc absent, env unset | 3 passed, one SKIP line per gate | 3 passed, `SKIP <gate>: no aomenc oracle at /nonexistent/oracle/aomenc -- set EC_AV1_REQUIRE_AOMENC=1 to make this a failure, or run scripts/build-aom-oracle.sh` |
128+| c2 | aomdec absent, env unset | 3 passed, 2 SKIP lines, 1 silent | 3 passed, 3 SKIP lines naming the gate and the path |
129+
130+**(b2) is the red-before for the class fix**: the same command on the parent
131+commit printed `test result: ok. 3 passed` with the compare never running, and
132+prints `3 failed` here. `(c)` and `(c2)` remain a **developer-only
133+convenience** — a checkout without an oracle still runs the rest of the suite
134+green, and the SKIP line now says which env var turns that into a failure. No
135+batch run may rely on it: `EC_AV1_REQUIRE_AOMENC=1` (or the aomdec-specific
136+`EC_AV1_REQUIRE_AOMDEC=1`) is what makes a missing oracle red, and that is
137+stated in the SKIP text itself.
138+
139+## 5. Pre-existing red on this base, NOT this lane's
140+
141+`gate_coverage::tests::never_exercised_{8,10}bit_matches_the_gate_recipes` are
142+RED on base `7f8817cb` before any edit of mine (`the 8-bit list still names
143+["enable-rect-tx"], but a 8-bit gate now passes '=1' for them`). Reproduced on
144+the stashed, unmodified tree. A gate merged in `7f8817cb` spells
145+`--enable-rect-tx=1`, so the `enable-rect-tx` entries in
146+`NEVER_EXERCISED_8BIT` / `NEVER_EXERCISED_10BIT` are stale and the rule is to
147+delete them in the same commit as the gate that closes the hole — that gate is
148+not mine, and `crates/ec-av1/src/gate_coverage.rs` is one of the files the
149+in-flight merge on the primary checkout has staged as modified, so editing it
150+here would collide. **Reported, not touched.** The fix is deleting the
151+`("enable-rect-tx", …)` entry from both lists.
152+
153+## 6. One more thing this lane does not change
154+
155+`aomdec_available` deliberately keeps a SKIP (rather than the hard assert shape
156+D uses) because those thirteen gates decode a **pinned fixture** and their
157+oracle arm is one assertion among several; the live-encode gates have no
158+fixture to fall back on, so a missing aomdec there really is a broken oracle
159+and stays a hard failure. If the house wants the pinned gates to fail
160+unconditionally too, that is a one-line change per site and a policy call, not
161+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.