diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 71349b63..91af85c9 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -4274,6 +4274,10 @@ pub(crate) mod tests { fn a_real_aomenc_segmentation_stream_with_map_inheritance_decodes_pixel_exact() { const NAME: &str = "a_real_aomenc_segmentation_stream_with_map_inheritance_decodes_pixel_exact"; + // lane-av1cmpaudit2: this gate reaches the oracle without the gate + // mutex, so a sibling flipping `EC_AV1_AOMDEC` (the one-byte-wrong + // oracle control) could hand it a tampered oracle mid-compare. + let _gate_lock = lock_gate_counters(); if !have_aomenc() { eprintln!("SKIP {NAME}: no aomenc"); return; @@ -10195,9 +10199,35 @@ pub(crate) mod tests { present } + // lane-av1cmpaudit2: this thread's oracle override, set by + // `set_oracle_path` and consulted by `aomdec_path` ahead of the env var. + // + // It is thread-local for the same reason `FINAL_DUMP_PREFIX` is: the + // control test `every_oracle_comparator_reds_on_a_one_byte_wrong_oracle` + // has to hand the helpers a DELIBERATELY WRONG oracle, and a + // process-global `std::env::set_var` could not do that safely -- the + // crate denies `unsafe_code`, and even where it did not, one test's + // tampered oracle would leak into every sibling test's comparison + // running on another thread. A thread-local override confines the wrong + // oracle to the one thread that asked for it. + thread_local! { + static ORACLE_PATH: std::cell::RefCell> = + const { std::cell::RefCell::new(None) }; + } + + /// Points this thread's oracle helpers at `path`. `None` restores the + /// real `aomdec`. + fn set_oracle_path(path: Option) { + ORACLE_PATH.with(|c| *c.borrow_mut() = path); + } + + /// The instrumented `aomdec` beside the `aomenc` oracle /// (`scripts/build-aom-oracle.sh` + `scripts/instrument-aom-oracle.sh`). fn aomdec_path() -> std::path::PathBuf { + if let Some(p) = ORACLE_PATH.with(|c| c.borrow().clone()) { + return p; + } if let Some(p) = std::env::var_os("EC_AV1_AOMDEC") { return std::path::PathBuf::from(p); } @@ -10385,6 +10415,10 @@ pub(crate) mod tests { #[test] fn the_counting_oracle_diff_reports_a_real_difference() { const NAME: &str = "the_counting_oracle_diff_reports_a_real_difference"; + // lane-av1cmpaudit2: same mutex as every other oracle gate -- this + // one reads `aomdec_path()`, so it must not overlap a sibling's + // tampered-oracle run. + let _gate_lock = lock_gate_counters(); let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) .join("fixtures") .join("420_oddheight_320x232.obu"); @@ -10405,6 +10439,218 @@ pub(crate) mod tests { eprintln!("{NAME}: witness reports Y={wy} U={wu} V={wv}, frames_exact={exact}/{frames}"); } + /// lane-av1cmpaudit2: the permanent CONTROL for the class + /// `comparator-that-never-reads-the-oracle`. + /// + /// The retracted predecessor lane's per-cell counter reported "0 wrong" + /// on 18/18 cells -- including cells that differ from `aomdec + /// --rawvideo` in 17658 samples -- because it packed OUR decoded samples + /// into a buffer and compared that buffer against the same samples. + /// `aomdec`'s output was written, length-checked, and never read. + /// Nothing about that mistake is visible from the outside: the helper's + /// signature, its panic text and its return type are all exactly what a + /// working comparator has, and no amount of reading the source of a + /// healthy-looking helper proves the next one is healthy. + /// + /// So the class is pinned here from the other direction. + /// `EC_AV1_AOMDEC` is already the crate's oracle override, so this test + /// points every oracle helper at a shim that runs the REAL `aomdec` and + /// then corrupts exactly ONE byte of whatever it wrote -- the + /// `--rawvideo` output and the `EC_AV1_FINAL_DUMP` frame 0 -- leaving + /// every other sample a genuine decode. On a pin that IS byte-exact + /// against the real oracle: + /// + /// 1. **arm 1, real oracle: every helper is GREEN.** Without this arm, + /// arm 2's red could just be a stream that was never exact. + /// 2. **arm 2, one-byte-wrong oracle: every helper is RED.** A helper + /// that stays green here is the retracted defect itself: it cannot + /// fail, so its green is worth nothing. + /// + /// One test, five helpers, and it goes red for the exact mistake that + /// was retracted. Measured over this file: the other 62 tests that + /// reach an oracle helper all take `lock_gate_counters()` before their + /// first oracle call, which is what makes the process-global + /// `EC_AV1_AOMDEC` safe to flip here. + #[test] + fn every_oracle_comparator_reds_on_a_one_byte_wrong_oracle() { + const NAME: &str = "every_oracle_comparator_reds_on_a_one_byte_wrong_oracle"; + let _gate_lock = lock_gate_counters(); + if !aomdec_available(NAME) { + return; + } + let pin = crate_pin("420_odd65x65_key.obu"); + let stream = std::fs::read(&pin).unwrap_or_else(|e| { + panic!( + "{NAME}: the control's pin {} is missing ({e}) -- restore the committed copy", + pin.display() + ) + }); + assert_eq!( + stream_bit_depth(&stream, NAME), + 8, + "{NAME}: the control's pin must be the 8-bit cell the shim corrupts" + ); + let plane_samples = { + let frames = decode_stream(&stream).expect("the control's pin must decode"); + let f = &frames[0]; + [f.y.len(), f.u.len(), f.v.len()] + }; + + // ---- arm 1: the real oracle, every comparator green ------------ + { + let obu = std::env::temp_dir().join(format!("{NAME}-arm1.obu")); + std::fs::write(&obu, &stream).expect("writing the pin for arm 1"); + assert_rawvideo_matches(&obu, &stream, "oracle-control-arm1-rawvideo", 1, 8); + let _ = std::fs::remove_file(&obu); + let (frames, hidden) = + decode_all_frames_vs_oracle(&stream, "oracle-control-arm1-alldumps"); + assert_eq!( + (frames, hidden), + (1, 0), + "{NAME}: arm 1 expects one decode-order frame and no hidden frames" + ); + let (wy, wu, wv, n, exact) = + count_rawvideo_diffs(&stream, "oracle-control-arm1-count") + .expect("arm 1: the two sides must be byte-comparable"); + assert_eq!( + (wy, wu, wv), + (0, 0, 0), + "{NAME}: arm 1 runs against the REAL oracle, so every plane must be zero" + ); + assert_eq!( + (n, exact), + (1, 1), + "{NAME}: arm 1 expects one shown frame that is byte-identical" + ); + let (differing, first) = key_frame_diffs(&stream, "oracle-control-arm1-kf"); + assert_eq!( + (differing, first), + (0, None), + "{NAME}: arm 1's key frame must be byte-identical to the oracle's" + ); + let [y, u, v] = + oracle_plane_diffs(&stream, "oracle-control-arm1-planes", plane_samples); + assert_eq!( + [y, u, v], + [0, 0, 0], + "{NAME}: arm 1 must be zero on every plane against the real oracle" + ); + } + + // ---- the one-byte-wrong oracle --------------------------------- + let dir = std::env::temp_dir().join(format!("ec-av1-{NAME}-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + std::fs::create_dir_all(&dir).expect("scratch dir"); + let shim = dir.join("one-byte-wrong-aomdec.sh"); + // The real oracle's path rides in a sibling file rather than inside + // the script, so a path with a quote or a space cannot mangle it and + // the script body needs no `format!` escaping at all. + std::fs::write(dir.join("real-aomdec"), aomdec_path().as_os_str().as_encoded_bytes()) + .expect("recording the real oracle's path for the shim"); + // Byte 7 of both the `--rawvideo` output and the `EC_AV1_FINAL_DUMP` + // frame 0 is inside the Y plane, and its value is rotated by 128 so + // the write always changes it. Nothing else is touched: the stream, + // the geometry, the frame count and every other sample are a genuine + // `aomdec` decode. + let script = r#"#!/bin/sh +REAL=$(cat "$(dirname "$0")/real-aomdec") +rawvideo=0 +out="" +prev="" +for a in "$@"; do + if [ "$a" = "--rawvideo" ]; then rawvideo=1; fi + if [ "$prev" = "-o" ]; then out="$a"; fi + prev="$a" +done +"$REAL" "$@" || exit $? +flip() { + [ -s "$1" ] || return 0 + b=$(od -An -tu1 -j 7 -N 1 "$1" 2>/dev/null | tr -d ' \n') + [ -n "$b" ] || return 0 + esc=$(printf '\\%03o' $(( (b + 128) % 256 ))) + printf "$esc" | dd of="$1" bs=1 seek=7 count=1 conv=notrunc 2>/dev/null + return 0 +} +[ "$rawvideo" = 1 ] && flip "$out" +[ -n "$EC_AV1_FINAL_DUMP" ] && flip "$EC_AV1_FINAL_DUMP.f0" +exit 0 +"#; + std::fs::write(&shim, script).expect("writing the oracle shim"); + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + std::fs::set_permissions(&shim, std::fs::Permissions::from_mode(0o755)) + .expect("the oracle shim must be executable"); + } + + // ---- arm 2: same pin, oracle off by ONE byte ------------------- + // The override is THREAD-LOCAL, so the tampered oracle is confined + // to this thread and no sibling test can see it; it is still cleared + // before any result is asserted, so a red arm cannot leave this + // test's own later work reading a wrong oracle. + let reds: [bool; 5]; + { + set_oracle_path(Some(shim.clone())); + let panicked = |f: &dyn Fn()| { + std::panic::catch_unwind(std::panic::AssertUnwindSafe(f)).is_err() + }; + let rawvideo_red = panicked(&|| { + let obu = std::env::temp_dir().join(format!("{NAME}-arm2.obu")); + std::fs::write(&obu, &stream).expect("writing the pin for arm 2"); + assert_rawvideo_matches(&obu, &stream, "oracle-control-arm2-rawvideo", 1, 8); + }); + let _ = std::fs::remove_file(std::env::temp_dir().join(format!("{NAME}-arm2.obu"))); + let dumps_red = panicked(&|| { + decode_all_frames_vs_oracle(&stream, "oracle-control-arm2-alldumps"); + }); + let count_red = { + let counted = count_rawvideo_diffs(&stream, "oracle-control-arm2-count") + .unwrap_or_else(|| { + panic!( + "{NAME}: a single flipped oracle byte must NOT change the buffer \ + LENGTH -- returning None means the shim corrupted more than the \ + comparison" + ) + }); + counted.0 + counted.1 + counted.2 > 0 && counted.4 < counted.3 + }; + let kf_red = { + let (differing, first) = key_frame_diffs(&stream, "oracle-control-arm2-kf"); + differing > 0 && first.is_some() + }; + let planes_red = { + let [y, u, v] = + oracle_plane_diffs(&stream, "oracle-control-arm2-planes", plane_samples); + y + u + v > 0 + }; + set_oracle_path(None); + let _ = std::fs::remove_dir_all(&dir); + reds = [rawvideo_red, dumps_red, count_red, kf_red, planes_red]; + } + // One assert, naming EVERY comparator that stayed green: a partial + // run would report the first and hide whether the other four are + // covered. + let blind: Vec<&str> = [ + ("assert_rawvideo_matches", reds[0]), + ("decode_all_frames_vs_oracle", reds[1]), + ("count_rawvideo_diffs", reds[2]), + ("key_frame_diffs", reds[3]), + ("oracle_plane_diffs", reds[4]), + ] + .into_iter() + .filter(|(_, red)| !red) + .map(|(what, _)| what) + .collect(); + assert!( + blind.is_empty(), + "{NAME}: {} of 5 oracle comparators stayed GREEN against an oracle that is wrong \ + by exactly one byte -- {blind:?} -- they cannot fail, so their green proves \ + nothing (class `comparator-that-never-reads-the-oracle`)", + blind.len() + ); + eprintln!("{NAME}: all five oracle comparators red on a one-byte-wrong oracle"); + } + /// lane-av1422anom: the odd-frame-HEIGHT 4:2:0 reconstruction defect, /// pinned and ratcheted. /// @@ -10427,6 +10673,8 @@ pub(crate) mod tests { fn the_pinned_420_oddheight_witness_is_pinned_and_ratchets_its_reconstruction_defect() { const NAME: &str = "the_pinned_420_oddheight_witness_is_pinned_and_ratchets_its_reconstruction_defect"; + // lane-av1cmpaudit2: same mutex as every other oracle gate. + let _gate_lock = lock_gate_counters(); const FILE: &str = "420_oddheight_320x232.obu"; const BYTES: usize = 15773; // sha256 6832c3cd867f5fc491b45fd67f77c38453db0ca6d461e7d225e6276f4d0784c8, @@ -38150,6 +38398,9 @@ pub(crate) mod tests { #[test] #[ignore = "lane-sb128 r2 diagnostic: is the frame-6 mismatch sb128-specific?"] fn sb128_r2_control_sb64() { + // lane-av1cmpaudit2: this control reaches the oracle, so it takes + // the gate mutex like every other one. + let _gate_lock = lock_gate_counters(); let (width, height) = (256usize, 192usize); let y4m = Command::new("ffmpeg") .args([ diff --git a/lanes/av1cmpaudit2.report.md b/lanes/av1cmpaudit2.report.md new file mode 100644 index 00000000..f72ee896 --- /dev/null +++ b/lanes/av1cmpaudit2.report.md @@ -0,0 +1,187 @@ +# lane-av1cmpaudit2 — audit of the class `comparator-that-never-reads-the-oracle` + +Base `9d5f7bd9`. Question: which committed gates and which recent lane +reports depend on a comparison that cannot fail? + +**Answer: none in the crate. One report headline was unverifiable, and is +now re-measured. The whole class is now pinned by ONE committed control.** + +## 1. The class + +`lanes/av1422remeasure.report.md` claimed "0 wrong on 18/18 cells, 0 of +2359296". Its per-cell counter packed OUR decoded samples into a buffer and +compared that buffer against the same samples; `aomdec`'s output was written, +length-checked, and never read. Retracted in +`lanes/av1422remeasure.RETRACTION.md`. Cells that differ from `aomdec` in +17658 samples reported zero. + +The reason this class is dangerous is that it is invisible from the outside. +The helper's signature, its panic text and its return type are all exactly +what a working comparator has. "Read the source and check" is not a control, +because the retracted counter's source read fine too. + +## 2. Per-helper table — the crate's own comparators + +Every comparator in `crates/ec-av1/src/stream.rs` that reads an external +oracle. Line numbers are this branch's tip (`277327e3`), which adds the +control test of §6 and the thread-local oracle override. Method: located every `std::fs::read` of an oracle-written buffer in +the crate (16 `ref_raw`/`want`/`aom_dump` bindings), then read each +comparison loop. Class is LIVE only if the oracle buffer is the operand of a +content comparison, not just of a length check. + +| # | comparator | location | reads oracle bytes at | classification | +|---|---|---|---|---| +| 1 | `assert_rawvideo_matches` | `stream.rs:5536` | reads `ref_raw` at 5568, compares `ours.iter().zip(&ref_raw)` at 5588 + 5595 | **LIVE** | +| 2 | `decode_all_frames_vs_oracle` | `stream.rs:10250` | reads `aom.f{i}` into `want` at 10301, `ours.f{i}` into `got` at 10302, `got.iter().zip(&want)` at 10310 | **LIVE** | +| 3 | `count_rawvideo_diffs` | `stream.rs:10345` | reads aomdec rawvideo into `want` at 10369, `ours.iter().zip(&want)` at 10386 | **LIVE** | +| 4 | `key_frame_diffs` | `stream.rs:48354` | reads `aomkf.f0` into `want` at 48384, `got.iter().zip(&want)` at 48398 | **LIVE** | +| 5 | `oracle_plane_diffs` | `stream.rs:49392` | reads `aom.f{i}` into `want` at 49440, `got[a..b].zip(&want[a..b])` at 49452 | **LIVE** | + +Plus 13 gates that inline the same two-buffer comparison rather than calling a +helper — 7 rawvideo sites (`stream.rs` 7505, 8019, 8208, 9009, 9154, 9291, +9718; each does `let want = &ref_raw[…]` then `plane.iter().zip(want).filter(|&(&a, &b)| a as u8 != b)`) +and 6 final-dump sites (50415, 50551, 50674, 50783, 50935, 51054; each does +`our_dump[at..at+PLANE] == aom_dump[at..at+PLANE]`). All **LIVE**. + +There is no `assert_final_dump_matches` in the crate under that or any other +name; searched by name and by role (every `std::fs::read` of an aomdec-written +path). `encode.rs`'s `ffmpeg_decode` / `ffmpeg_decode_sequence` / +`ffmpeg_decode_sequence_10bit` all spawn `ffmpeg` and take its stdout +(`encode.rs:16503`, `18587`; `stream.rs:5797`, `5888`) — **LIVE**, and their +comparators `first_difference` (`encode.rs:17906`) and `first_plane_mismatch` +(`encode.rs:20744`) zip two independent `Picture`s — **LIVE**. + +Swept outside `ec-av1` too: `crates/ec-vp8`, `ec-h264`, `ec-h265`, `ec-hw` +all reach ffmpeg through a real `Command::output()` and compare the stdout; +no self-compare found. + +## 3. Per-report table + +| report | headline | comparator | reads oracle? | non-vacuity control | verdict | +|---|---|---|---|---|---| +| `av1chromarect-r3` | "TOTAL 0 wrong from 2359296" (§1) | a temporary probe test, **removed before commit, no path quoted** — UNKNOWN by its own admission | not inspectable | §3 mutation (`chroma_window`'s `cn_cols == 1 && cn_rows == 1` → `if true`) reproduces **79969 wrong**, and both committed gates go FAILED with the gate's own panic text | **LIVE by proxy; headline RE-DERIVED, see §4** | +| `av1dcunit` | "0 wrong … 0 of 2359296" (§2) | `~/.cache/cmp444.py`, quoted in §2, **present on disk** | YES — reads `aom.f{f}` and `ours.f{f}` separately, `o[at+s] != a[at+s]` | §5 M1 (unit readers back to block `reach`) → RED, "U … 130 samples wrong", the committed gate's own panic text | **LIVE** | +| `av1dcunit` | "f0: Y 0 / U 130 / V 30 of 65536" (§5) | "my own script", **no path quoted**; the surviving `cmp444.py` hardcodes `W = H = 512` and 3 frames, so it cannot be it | not inspectable | the committed gate covering the same witness reproduces **U = 130** under the lane's own M1 | **LIVE by proxy; V = 30 not independently reproduced** | +| `av1ibcfork` | "fully byte-exact", 0 of 307200 per plane (§7/§8) | committed gate `a_444_intrabc_rect4_witness_is_byte_exact_after_the_skip_arm_footprint` (`stream.rs:50613`): 4:2:0 arm calls `decode_all_frames_vs_oracle` at 50639, 4:4:4 arm reads `aom_dump`/`our_dump` at 50674/50675 and compares them inline at 50686/50690 | YES, both arms | feature-reach assert `hits > 0` at 50669; §8 mutation of `(bw >> ss_x, …)` → `(bw/2, …)` reds at sample 51360 (x=160, y=80) | **LIVE** | +| `av1loss444` | "EXACT 6/6, 0 wrong luma/U/V"; "0 across all 36 frame-dumps" | `cmp_final.py`, quoted verbatim in §9 as `~/.cache/loss444/cmp_final.py`, **present on disk** | YES — `sa` = oracle plane, `sb` = ours, `bad = [j for j in range(len(sa)) if sa[j] != sb[j]]`, with a length guard | §4 two bit-flip controls on the real dumps: "Y 2 / U 2 / V 2, first (110,26)" and "U 1 wrong with Y 0, V 0" | **LIVE** | +| `av1txctxband` | "37229 / 37229, zero divergence"; "99/99 exact-entropy" | `~/.cache/sb128fork/cmp444.py` (present) for pixels; `hunt5.py` (present) for the entropy ladder | YES — both scripts read their two trace/dump sets independently | mutation of the RECT reader's four lines → FAILED 0 passed; 1 failed | **LIVE** | +| `av1txctxband` | the gate's primary arm is a counter comparing two of OUR OWN models (`decode.rs:28536`, `28635`) | oracle-free by design | n/a | it is a mutation detector, not an exactness claim, and the gate additionally calls `decode_all_frames_vs_oracle` | **LIVE (not a pixel claim)** | +| `av1sb128fork` | entropy fork table | `hunt4.py`, present, reads both traces | YES | stated | **LIVE** | +| `av1sb128fork` | §1 pixel table "841/1295/1372", "56986/55974/56442" | **no comparator named anywhere in the report, and no committed gate at all** | not inspectable | none stated | **UNKNOWN — treat as unverified, see §5** | +| `av1422anom` | "17658 wrong chroma of 593920" on 320x232 | `count_rawvideo_diffs` (`stream.rs:10345`) | YES | `the_counting_oracle_diff_reports_a_real_difference` decodes a witness KNOWN to differ and asserts non-zero | **LIVE** | +| `av1422remeasure` | "0 wrong on 18/18" | the retracted throwaway counter | **NO** | none — that is why it was retracted | **TAUTOLOGICAL (already retracted)** | + +## 4. Re-measured headline + +`av1chromarect-r3`'s headline comparator was deleted, so I re-derived the +number with an independently written comparator that reads two separately +produced dump sets: `aomdec --codec=av1` with `EC_AV1_FINAL_DUMP` for the +oracle, and the crate's own `examples/dump_yuv.rs` for ours, on the committed +`crates/ec-av1/fixtures/r512.obu` (6948 bytes, 3 frames, 4:4:4 512x512, +262144 samples per plane). + +``` +f0: Y=0 U=0 V=0 +f1: Y=0 U=0 V=0 +f2: Y=0 U=0 V=0 +TOTAL wrong: 0 of 2359296 +``` + +**The headline survives.** `av1dcunit` §5's "V 30" was not reproduced (its +U = 130 is reproduced by the committed gate under the lane's own M1); its §2 +headline is directly re-checkable and is LIVE. + +## 5. Claims that must be treated as unverified + +1. `av1sb128fork` §1's pixel table — "Y 841 / U 1295 / V 1372 of 65536" and + "Y 56986 / U 55974 / V 56442" — names no comparator and commits no gate. + **Unverified.** Its entropy-fork table is separately LIVE. +2. `av1ibcfork` §5's by-hand red-before numbers (`U 72945`, `V 64865`). + Produced by an off-repo manual diff through `decode_probe`, which is not a + comparator. The committed claim on the same fixture is LIVE and + independently re-runnable; the by-hand figures are not. +3. `av1dcunit` §5's `V 30 wrong` (the U = 130 half is reproduced by the + committed gate's own panic under mutation M1). +4. `av1chromarect-r3` §1's probe script itself — deleted, unpathed, + unrecoverable. The NUMBER is re-derived above and the two committed gates + are LIVE. + +## 6. The control this lane landed + +`stream.rs` — `every_oracle_comparator_reds_on_a_one_byte_wrong_oracle`. + +`aomdec_path()` grows a thread-local override (same shape as the existing +`FINAL_DUMP_PREFIX`, and thread-local because the crate denies `unsafe_code` +and a process-global env var would leak one test's tampered oracle into every +sibling's comparison on another thread). The test points that override at a +shim which runs the REAL `aomdec` and then rotates byte 7 of the +`--rawvideo` output and of `EC_AV1_FINAL_DUMP` frame 0 — one byte, inside the +Y plane, everything else a genuine decode. On the byte-exact +`420_odd65x65_key.obu` pin: + +``` +arm 1, real oracle -> all five comparators green +arm 2, one-byte-wrong -> all five comparators red +``` + +All five helpers named in §2 are covered by that one test. Four gates that +reached the oracle without `lock_gate_counters()` now take it +(`a_real_aomenc_segmentation_stream_with_map_inheritance_decodes_pixel_exact`, +`the_counting_oracle_diff_reports_a_real_difference`, +`the_pinned_420_oddheight_witness_is_pinned_and_ratchets_its_reconstruction_defect`, +`sb128_r2_control_sb64`). + +### Mutation proof (the control bites) + +All five comparators mutated to the retracted defect — each zipping our +buffer against itself instead of the oracle: + +- `assert_rawvideo_matches` 5588 `.zip(&ref_raw)` → `.zip(&ours)` +- `decode_all_frames_vs_oracle` 10310 `.zip(&want)` → `.zip(&got)` +- `count_rawvideo_diffs` 10386 `.zip(&want)` → `.zip(&ours)` +- `key_frame_diffs` 48398 `.zip(&want)` → `.zip(&got)` +- `oracle_plane_diffs` 49452 `.zip(&want[a..b])` → `.zip(&got[a..b])` + +Result: + +``` +every_oracle_comparator_reds_on_a_one_byte_wrong_oracle: 5 of 5 oracle +comparators stayed GREEN against an oracle that is wrong by exactly one +byte -- ["assert_rawvideo_matches", "decode_all_frames_vs_oracle", +"count_rawvideo_diffs", "key_frame_diffs", "oracle_plane_diffs"] +test result: FAILED. 0 passed; 1 failed +``` + +**Arm 1 passed under the same mutation.** That is the point: the mutants are +invisible to all 60-odd existing pixel-exact gates and to every other +assertion in this crate. Only this control sees them. Mutations reverted; +`cargo check -p ec-av1 --all-targets` clean, no warnings. + +## 7. Gates run + +``` +cargo test -p ec-av1 --lib -- every_oracle_comparator_reds_on_a_one_byte_wrong_oracle \ + the_counting_oracle_diff_reports_a_real_difference \ + the_pinned_420_oddheight_witness_is_pinned_and_ratchets_its_reconstruction_defect \ + the_rawvideo_helper_compares_real_samples_at_the_streams_own_bit_depth \ + a_real_aomenc_segmentation_stream_with_map_inheritance_decodes_pixel_exact +→ 5 passed; 0 failed +``` + +`EC_AV1_REQUIRE_AOMDEC=1 EC_AV1_REQUIRE_AOMENC=1 EC_AV1_REQUIRE_FIXTURES=1`, +oracle `~/.cache/aom-oracle/build/aomdec`. + +## 8. not_done + +1. `av1sb128fork` §1's pixel numbers were **not** re-derived. They are + red-before mutation figures whose comparator was never recorded; deriving + them means reconstructing the lane's mutation, which is not identifiable + from the report. Left as unverified rather than guessed. +2. `av1dcunit` §5's `V 30` was not independently reproduced (U = 130 was). +3. No full `ec-av1` suite run — per the wave's rules, scoped tests only. The + lock added to `sb128_r2_control_sb64` is inside an `#[ignore]`d + diagnostic, so it is compile-verified but not executed. +4. The entropy-ladder comparators (`hunt4.py`, `hunt5.py`, `align.py`) were + classified LIVE by reading, not by a control; the class audited here is the + sample/pixel comparator, and a byte-vs-trace-field variant of the same + control would be a separate lane.