report: lane-av1cmpaudit2 audit of comparator-that-never-reads-the-oracle
Browse files at this commit0053620f1f04c74b4b26658009e3531224e05779Parent: ec9aa3f1 changed file +187 -0
- lanes/av1cmpaudit2.report.md +187 -0
lanes/av1cmpaudit2.report.mdadded+187 -0
| @@ -0,0 +1,187 @@ | |||
| 1 | +# lane-av1cmpaudit2 — audit of the class `comparator-that-never-reads-the-oracle` | ||
| 2 | + | ||
| 3 | +Base `9d5f7bd9`. Question: which committed gates and which recent lane | ||
| 4 | +reports depend on a comparison that cannot fail? | ||
| 5 | + | ||
| 6 | +**Answer: none in the crate. One report headline was unverifiable, and is | ||
| 7 | +now re-measured. The whole class is now pinned by ONE committed control.** | ||
| 8 | + | ||
| 9 | +## 1. The class | ||
| 10 | + | ||
| 11 | +`lanes/av1422remeasure.report.md` claimed "0 wrong on 18/18 cells, 0 of | ||
| 12 | +2359296". Its per-cell counter packed OUR decoded samples into a buffer and | ||
| 13 | +compared that buffer against the same samples; `aomdec`'s output was written, | ||
| 14 | +length-checked, and never read. Retracted in | ||
| 15 | +`lanes/av1422remeasure.RETRACTION.md`. Cells that differ from `aomdec` in | ||
| 16 | +17658 samples reported zero. | ||
| 17 | + | ||
| 18 | +The reason this class is dangerous is that it is invisible from the outside. | ||
| 19 | +The helper's signature, its panic text and its return type are all exactly | ||
| 20 | +what a working comparator has. "Read the source and check" is not a control, | ||
| 21 | +because the retracted counter's source read fine too. | ||
| 22 | + | ||
| 23 | +## 2. Per-helper table — the crate's own comparators | ||
| 24 | + | ||
| 25 | +Every comparator in `crates/ec-av1/src/stream.rs` that reads an external | ||
| 26 | +oracle. Line numbers are this branch's tip (`277327e3`), which adds the | ||
| 27 | +control test of §6 and the thread-local oracle override. Method: located every `std::fs::read` of an oracle-written buffer in | ||
| 28 | +the crate (16 `ref_raw`/`want`/`aom_dump` bindings), then read each | ||
| 29 | +comparison loop. Class is LIVE only if the oracle buffer is the operand of a | ||
| 30 | +content comparison, not just of a length check. | ||
| 31 | + | ||
| 32 | +| # | comparator | location | reads oracle bytes at | classification | | ||
| 33 | +|---|---|---|---|---| | ||
| 34 | +| 1 | `assert_rawvideo_matches` | `stream.rs:5536` | reads `ref_raw` at 5568, compares `ours.iter().zip(&ref_raw)` at 5588 + 5595 | **LIVE** | | ||
| 35 | +| 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** | | ||
| 36 | +| 3 | `count_rawvideo_diffs` | `stream.rs:10345` | reads aomdec rawvideo into `want` at 10369, `ours.iter().zip(&want)` at 10386 | **LIVE** | | ||
| 37 | +| 4 | `key_frame_diffs` | `stream.rs:48354` | reads `aomkf.f0` into `want` at 48384, `got.iter().zip(&want)` at 48398 | **LIVE** | | ||
| 38 | +| 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** | | ||
| 39 | + | ||
| 40 | +Plus 13 gates that inline the same two-buffer comparison rather than calling a | ||
| 41 | +helper — 7 rawvideo sites (`stream.rs` 7505, 8019, 8208, 9009, 9154, 9291, | ||
| 42 | +9718; each does `let want = &ref_raw[…]` then `plane.iter().zip(want).filter(|&(&a, &b)| a as u8 != b)`) | ||
| 43 | +and 6 final-dump sites (50415, 50551, 50674, 50783, 50935, 51054; each does | ||
| 44 | +`our_dump[at..at+PLANE] == aom_dump[at..at+PLANE]`). All **LIVE**. | ||
| 45 | + | ||
| 46 | +There is no `assert_final_dump_matches` in the crate under that or any other | ||
| 47 | +name; searched by name and by role (every `std::fs::read` of an aomdec-written | ||
| 48 | +path). `encode.rs`'s `ffmpeg_decode` / `ffmpeg_decode_sequence` / | ||
| 49 | +`ffmpeg_decode_sequence_10bit` all spawn `ffmpeg` and take its stdout | ||
| 50 | +(`encode.rs:16503`, `18587`; `stream.rs:5797`, `5888`) — **LIVE**, and their | ||
| 51 | +comparators `first_difference` (`encode.rs:17906`) and `first_plane_mismatch` | ||
| 52 | +(`encode.rs:20744`) zip two independent `Picture`s — **LIVE**. | ||
| 53 | + | ||
| 54 | +Swept outside `ec-av1` too: `crates/ec-vp8`, `ec-h264`, `ec-h265`, `ec-hw` | ||
| 55 | +all reach ffmpeg through a real `Command::output()` and compare the stdout; | ||
| 56 | +no self-compare found. | ||
| 57 | + | ||
| 58 | +## 3. Per-report table | ||
| 59 | + | ||
| 60 | +| report | headline | comparator | reads oracle? | non-vacuity control | verdict | | ||
| 61 | +|---|---|---|---|---|---| | ||
| 62 | +| `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** | | ||
| 63 | +| `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** | | ||
| 64 | +| `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** | | ||
| 65 | +| `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** | | ||
| 66 | +| `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** | | ||
| 67 | +| `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** | | ||
| 68 | +| `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)** | | ||
| 69 | +| `av1sb128fork` | entropy fork table | `hunt4.py`, present, reads both traces | YES | stated | **LIVE** | | ||
| 70 | +| `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** | | ||
| 71 | +| `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** | | ||
| 72 | +| `av1422remeasure` | "0 wrong on 18/18" | the retracted throwaway counter | **NO** | none — that is why it was retracted | **TAUTOLOGICAL (already retracted)** | | ||
| 73 | + | ||
| 74 | +## 4. Re-measured headline | ||
| 75 | + | ||
| 76 | +`av1chromarect-r3`'s headline comparator was deleted, so I re-derived the | ||
| 77 | +number with an independently written comparator that reads two separately | ||
| 78 | +produced dump sets: `aomdec --codec=av1` with `EC_AV1_FINAL_DUMP` for the | ||
| 79 | +oracle, and the crate's own `examples/dump_yuv.rs` for ours, on the committed | ||
| 80 | +`crates/ec-av1/fixtures/r512.obu` (6948 bytes, 3 frames, 4:4:4 512x512, | ||
| 81 | +262144 samples per plane). | ||
| 82 | + | ||
| 83 | +``` | ||
| 84 | +f0: Y=0 U=0 V=0 | ||
| 85 | +f1: Y=0 U=0 V=0 | ||
| 86 | +f2: Y=0 U=0 V=0 | ||
| 87 | +TOTAL wrong: 0 of 2359296 | ||
| 88 | +``` | ||
| 89 | + | ||
| 90 | +**The headline survives.** `av1dcunit` §5's "V 30" was not reproduced (its | ||
| 91 | +U = 130 is reproduced by the committed gate under the lane's own M1); its §2 | ||
| 92 | +headline is directly re-checkable and is LIVE. | ||
| 93 | + | ||
| 94 | +## 5. Claims that must be treated as unverified | ||
| 95 | + | ||
| 96 | +1. `av1sb128fork` §1's pixel table — "Y 841 / U 1295 / V 1372 of 65536" and | ||
| 97 | + "Y 56986 / U 55974 / V 56442" — names no comparator and commits no gate. | ||
| 98 | + **Unverified.** Its entropy-fork table is separately LIVE. | ||
| 99 | +2. `av1ibcfork` §5's by-hand red-before numbers (`U 72945`, `V 64865`). | ||
| 100 | + Produced by an off-repo manual diff through `decode_probe`, which is not a | ||
| 101 | + comparator. The committed claim on the same fixture is LIVE and | ||
| 102 | + independently re-runnable; the by-hand figures are not. | ||
| 103 | +3. `av1dcunit` §5's `V 30 wrong` (the U = 130 half is reproduced by the | ||
| 104 | + committed gate's own panic under mutation M1). | ||
| 105 | +4. `av1chromarect-r3` §1's probe script itself — deleted, unpathed, | ||
| 106 | + unrecoverable. The NUMBER is re-derived above and the two committed gates | ||
| 107 | + are LIVE. | ||
| 108 | + | ||
| 109 | +## 6. The control this lane landed | ||
| 110 | + | ||
| 111 | +`stream.rs` — `every_oracle_comparator_reds_on_a_one_byte_wrong_oracle`. | ||
| 112 | + | ||
| 113 | +`aomdec_path()` grows a thread-local override (same shape as the existing | ||
| 114 | +`FINAL_DUMP_PREFIX`, and thread-local because the crate denies `unsafe_code` | ||
| 115 | +and a process-global env var would leak one test's tampered oracle into every | ||
| 116 | +sibling's comparison on another thread). The test points that override at a | ||
| 117 | +shim which runs the REAL `aomdec` and then rotates byte 7 of the | ||
| 118 | +`--rawvideo` output and of `EC_AV1_FINAL_DUMP` frame 0 — one byte, inside the | ||
| 119 | +Y plane, everything else a genuine decode. On the byte-exact | ||
| 120 | +`420_odd65x65_key.obu` pin: | ||
| 121 | + | ||
| 122 | +``` | ||
| 123 | +arm 1, real oracle -> all five comparators green | ||
| 124 | +arm 2, one-byte-wrong -> all five comparators red | ||
| 125 | +``` | ||
| 126 | + | ||
| 127 | +All five helpers named in §2 are covered by that one test. Four gates that | ||
| 128 | +reached the oracle without `lock_gate_counters()` now take it | ||
| 129 | +(`a_real_aomenc_segmentation_stream_with_map_inheritance_decodes_pixel_exact`, | ||
| 130 | +`the_counting_oracle_diff_reports_a_real_difference`, | ||
| 131 | +`the_pinned_420_oddheight_witness_is_pinned_and_ratchets_its_reconstruction_defect`, | ||
| 132 | +`sb128_r2_control_sb64`). | ||
| 133 | + | ||
| 134 | +### Mutation proof (the control bites) | ||
| 135 | + | ||
| 136 | +All five comparators mutated to the retracted defect — each zipping our | ||
| 137 | +buffer against itself instead of the oracle: | ||
| 138 | + | ||
| 139 | +- `assert_rawvideo_matches` 5588 `.zip(&ref_raw)` → `.zip(&ours)` | ||
| 140 | +- `decode_all_frames_vs_oracle` 10310 `.zip(&want)` → `.zip(&got)` | ||
| 141 | +- `count_rawvideo_diffs` 10386 `.zip(&want)` → `.zip(&ours)` | ||
| 142 | +- `key_frame_diffs` 48398 `.zip(&want)` → `.zip(&got)` | ||
| 143 | +- `oracle_plane_diffs` 49452 `.zip(&want[a..b])` → `.zip(&got[a..b])` | ||
| 144 | + | ||
| 145 | +Result: | ||
| 146 | + | ||
| 147 | +``` | ||
| 148 | +every_oracle_comparator_reds_on_a_one_byte_wrong_oracle: 5 of 5 oracle | ||
| 149 | +comparators stayed GREEN against an oracle that is wrong by exactly one | ||
| 150 | +byte -- ["assert_rawvideo_matches", "decode_all_frames_vs_oracle", | ||
| 151 | +"count_rawvideo_diffs", "key_frame_diffs", "oracle_plane_diffs"] | ||
| 152 | +test result: FAILED. 0 passed; 1 failed | ||
| 153 | +``` | ||
| 154 | + | ||
| 155 | +**Arm 1 passed under the same mutation.** That is the point: the mutants are | ||
| 156 | +invisible to all 60-odd existing pixel-exact gates and to every other | ||
| 157 | +assertion in this crate. Only this control sees them. Mutations reverted; | ||
| 158 | +`cargo check -p ec-av1 --all-targets` clean, no warnings. | ||
| 159 | + | ||
| 160 | +## 7. Gates run | ||
| 161 | + | ||
| 162 | +``` | ||
| 163 | +cargo test -p ec-av1 --lib -- every_oracle_comparator_reds_on_a_one_byte_wrong_oracle \ | ||
| 164 | + the_counting_oracle_diff_reports_a_real_difference \ | ||
| 165 | + the_pinned_420_oddheight_witness_is_pinned_and_ratchets_its_reconstruction_defect \ | ||
| 166 | + the_rawvideo_helper_compares_real_samples_at_the_streams_own_bit_depth \ | ||
| 167 | + a_real_aomenc_segmentation_stream_with_map_inheritance_decodes_pixel_exact | ||
| 168 | +→ 5 passed; 0 failed | ||
| 169 | +``` | ||
| 170 | + | ||
| 171 | +`EC_AV1_REQUIRE_AOMDEC=1 EC_AV1_REQUIRE_AOMENC=1 EC_AV1_REQUIRE_FIXTURES=1`, | ||
| 172 | +oracle `~/.cache/aom-oracle/build/aomdec`. | ||
| 173 | + | ||
| 174 | +## 8. not_done | ||
| 175 | + | ||
| 176 | +1. `av1sb128fork` §1's pixel numbers were **not** re-derived. They are | ||
| 177 | + red-before mutation figures whose comparator was never recorded; deriving | ||
| 178 | + them means reconstructing the lane's mutation, which is not identifiable | ||
| 179 | + from the report. Left as unverified rather than guessed. | ||
| 180 | +2. `av1dcunit` §5's `V 30` was not independently reproduced (U = 130 was). | ||
| 181 | +3. No full `ec-av1` suite run — per the wave's rules, scoped tests only. The | ||
| 182 | + lock added to `sb128_r2_control_sb64` is inside an `#[ignore]`d | ||
| 183 | + diagnostic, so it is compile-verified but not executed. | ||
| 184 | +4. The entropy-ladder comparators (`hunt4.py`, `hunt5.py`, `align.py`) were | ||
| 185 | + classified LIVE by reading, not by a control; the class audited here is the | ||
| 186 | + sample/pixel comparator, and a byte-vs-trace-field variant of the same | ||
| 187 | + control would be a separate lane. | ||