lanes: av1clipprobe report
Browse files at this commita5188cbc899427c729e5c759e018f92174131eb4Parent: 1f91edd1 changed file +279 -0
- lanes/av1clipprobe.report.md +279 -0
lanes/av1clipprobe.report.mdadded+279 -0
| @@ -0,0 +1,279 @@ | ||
| 1 | +# lane-av1clipprobe — the clip-gate silent skip, and the two roots | |
| 2 | + | |
| 3 | +Branch `lane-av1clipprobe` off `f33b9d41`. Commit `502c18ce`. | |
| 4 | + | |
| 5 | +## 1. Reproduction (before the fix) | |
| 6 | + | |
| 7 | +Lane worktree `/home/user/Documents/Code/Rust/wt-av1clipprobe`, root `fixtures/` | |
| 8 | +absent (it is `.gitignore:2`, so `git worktree add` never produces it): | |
| 9 | + | |
| 10 | +``` | |
| 11 | +$ ls -d fixtures | |
| 12 | +ls: cannot access 'fixtures': No such file or directory | |
| 13 | + | |
| 14 | +$ EC_AV1_REQUIRE_FFMPEG=1 EC_AV1_REQUIRE_AOMENC=1 \ | |
| 15 | + cargo test -p ec-av1 --release \ | |
| 16 | + a_1080p_multi_tile_stream_decodes_sample_exact_through_both_decoders -- --nocapture | |
| 17 | +running 1 test | |
| 18 | +SKIP the 1080p tile round trip: no fixture | |
| 19 | +test encoder::tests::a_1080p_multi_tile_stream_decodes_sample_exact_through_both_decoders ... ok | |
| 20 | + | |
| 21 | +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 752 filtered out; finished in 0.11s | |
| 22 | +EXIT=0 | |
| 23 | +``` | |
| 24 | + | |
| 25 | +Both halves of the report: the `SKIP` line, and libtest's `ok`. The two | |
| 26 | +`EC_AV1_REQUIRE_*` flags were set for that run, and the gate still reported | |
| 27 | +green — the flags govern *ffmpeg/aomenc* absence, never the clip's. | |
| 28 | + | |
| 29 | +## 2. Route | |
| 30 | + | |
| 31 | +`crates/ec-av1/src/library_fixture.rs` (new, `#[cfg(test)] mod`) owns two things. | |
| 32 | + | |
| 33 | +**The resolver** — `root()` reads `EC_FIXTURES` first, else | |
| 34 | +`CARGO_MANIFEST_DIR/../../fixtures`. | |
| 35 | + | |
| 36 | +**The one presence probe** — `require(rel, what)` / `require_at(path, what)`: | |
| 37 | + | |
| 38 | +* file present → `Some(path)`; | |
| 39 | +* absent **and** `EC_REQUIRE_FIXTURES` / `EC_AV1_REQUIRE_FFMPEG` / | |
| 40 | + `EC_AV1_REQUIRE_AOMENC` set → `assert!` panics, naming the resolved path and | |
| 41 | + the three ways to fix the tree (RED); | |
| 42 | +* absent and no require env → prints **one** `SKIP` line naming the resolved | |
| 43 | + path and the same three ways out, returns `None` (documented skip). | |
| 44 | + | |
| 45 | +This is the crate's *existing* shape, not a new one: the | |
| 46 | +assert-under-require / print-one-line-otherwise probe is what | |
| 47 | +`crates/ec-h264/tests/conformance.rs::require_fixtures` and the per-crate | |
| 48 | +`require_fixture` helpers do, and the file's own presence check lives inside | |
| 49 | +the probe that owns it — the shape the `no_tool_presence_check_outside_its_probe` | |
| 50 | +scan in `gate_coverage.rs` demands. No bare `is_file()` / `exists()` was added at | |
| 51 | +any call site. | |
| 52 | + | |
| 53 | +`h264_clip_frames` already had the right probe shape for ffmpeg but its CALLERS | |
| 54 | +owned the absence silently; the fix is in the callers plus the one added clip | |
| 55 | +check. `h264_clip_frames` now takes the calling gate's name (`what`) so both of | |
| 56 | +its exits print exactly one line and callers `return` on `None` without printing | |
| 57 | +a second — the two "no fixture" lines per gate were the noise that hid this. | |
| 58 | + | |
| 59 | +## 3. Class sweep | |
| 60 | + | |
| 61 | +Every site in `crates/ec-av1` that resolved a fixture through | |
| 62 | +`CARGO_MANIFEST_DIR/../../fixtures` (i.e. outside the crate-local committed | |
| 63 | +pins, which `crate_pin` already handles with an unconditional `panic!`). | |
| 64 | +14 sites, 5 in `encoder.rs`, 8 in `encode.rs`, 2 in `stream.rs` — of which | |
| 65 | +**11 could report a green suite having asserted nothing** (non-`#[ignore]`d | |
| 66 | +`#[test]`). | |
| 67 | + | |
| 68 | +| # | site (file:line at `f33b9d41`) | gate | mechanism | status | | |
| 69 | +|---|---|---|---|---| | |
| 70 | +| 1 | `encoder.rs:3263` in `h264_clip_frames` | 10 callers (below) | `clip.exists()` → `None` → each caller's own `SKIP` → `return`; **no env escape** | probe; one line per gate | | |
| 71 | +| 2 | `encoder.rs:6119` | `a_1080p_multi_tile_stream_decodes_sample_exact_through_both_decoders` | via (1) | **RED under require** | | |
| 72 | +| 3 | `encoder.rs:3316` | `bytes_per_frame_target_settles_within_20_percent` | via (1) | **RED** | | |
| 73 | +| 4 | `encoder.rs:3367` | `bitrate_target_lands_within_5_percent_over_48_frames` | via (1) | **RED** | | |
| 74 | +| 5 | `encoder.rs:3460` | `bytes_per_frame_controller_never_oscillates_past_its_clamp` | via (1) | **RED** | | |
| 75 | +| 6 | `encoder.rs:5576` | `tile_wall_table_at_1080p` (`#[ignore]`, probe) | via (1) | probe | | |
| 76 | +| 7 | `encoder.rs:5820` | `filter_replay_final_matches_the_capture_decode` | via (1) | **RED** | | |
| 77 | +| 8 | `encoder.rs:5872` | `filter_stage_wall_1080p` (`#[ignore]`, probe) | via (1) | probe | | |
| 78 | +| 9 | `encoder.rs:5944` | `tile_search_wall_1080p` (`#[ignore]`, probe) | via (1) | probe | | |
| 79 | +| 10 | `encoder.rs:6179` | `quality_target_is_monotone_in_bytes_and_psnr` | via (1) | **RED** | | |
| 80 | +| 11 | `encoder.rs:2881` | `the_facade_codes_the_same_bytes_as_encode_sequence` | `unwrap_or_else` → **runs the film arm on a synthetic card** and asserts as if it were film | **RED**; the substitution now says so on a second, non-`SKIP` line | | |
| 81 | +| 12 | `encoder.rs:6042` in `rav1e_wall_reference` | 2 wall-table probes | `!has_rav1e \|\| !clip.exists()` behind ONE line — the clip's absence hid inside a tool-absence message and had no escape | split; clip through the probe | | |
| 82 | +| 13 | `encode.rs:20345` | `real_clip_encodes_within_its_quality_and_size_budget` | `clip.exists()` → `SKIP` | **RED** | | |
| 83 | +| 14 | `encode.rs:20410` | `…_at_a_straddle_size` | `clip.exists()` → `SKIP` | **RED** | | |
| 84 | +| 15 | `encode.rs:20913` | `the_encoders_own_streams_are_byte_identical_to_their_pins` | `clip.exists()` → `SKIP` — compared nothing at all | **RED** | | |
| 85 | +| 16 | `encode.rs:20494` | `calibration_sweep_base_q_idx` (`#[ignore]`, probe) | per-clip `!path.exists()` → `continue`; with every clip absent the loop ran zero times and **passed** | probe through the probe | | |
| 86 | +| 17 | `encode.rs:21561`, `:22113`, `:22672` | `bd_rate_vs_libaom_and_rav1e`, `native_gate_clips`, `tpl_intra_denominator_histogram` (all `#[ignore]`) | per-clip `!path.exists()` → drop/`continue` with no escape; `tpl` printed nothing and passed | per-clip checks through the probe; roots re-resolved | | |
| 87 | +| 18 | `encode.rs:16846`, `:19735`, `:21179` | `probe_intrabc_key_frame`, `pricer_error_census_on_clips`, `probe_screen_library` (all `#[ignore]`) | `read_to_string(…/real-library-manifest.tsv)` `Err` → `SKIP` naming no path | manifest through the probe; a present-but-unreadable manifest is now a hard error, not a second silent skip | | |
| 88 | +| 19 | `stream.rs:6296` | `a_libaom_stream_with_128_intra_blocks_in_inter_frames_decodes_exact` | `clip.exists()` → `SKIP` — decoded nothing | **RED** | | |
| 89 | +| 20 | `stream.rs:45096` | `a_straddling_frame_decodes_exactly_on_both_reference_encoders_ladders` | `clip.exists()` → `return` **from the middle of the gate**: everything above it had already run, the encoder-ladder half never did, and a half-executed gate reported green | **RED** | | |
| 90 | + | |
| 91 | +Left alone on purpose: | |
| 92 | + | |
| 93 | +* `stream.rs:9426 pin_dir()` — names `../../fixtures` as a *fallback* for pins | |
| 94 | + that are committed crate-local; the gate above it (`require_pin`) panics | |
| 95 | + unconditionally on absence, so there is no skip to close, and the preflight's | |
| 96 | + invariant-4 census classifies gates by that root literal. | |
| 97 | +* All 44 `crate_pin` sites — already the lane-av1skipfix shape: an absent | |
| 98 | + COMMITTED pin is a repo defect and fails with no escape. | |
| 99 | + | |
| 100 | +Class-wide proof, root absent, **without** require envs — every gate prints | |
| 101 | +exactly one `SKIP` line: | |
| 102 | + | |
| 103 | +``` | |
| 104 | +a_1080p_multi_tile_stream_decodes_sample_exact_through_both_decoders skip_lines=1 ok. 1 passed | |
| 105 | +bytes_per_frame_target_settles_within_20_percent skip_lines=1 ok. 1 passed | |
| 106 | +bitrate_target_lands_within_5_percent_over_48_frames skip_lines=1 ok. 1 passed | |
| 107 | +bytes_per_frame_controller_never_oscillates_past_its_clamp skip_lines=1 ok. 1 passed | |
| 108 | +quality_target_is_monotone_in_bytes_and_psnr skip_lines=1 ok. 1 passed | |
| 109 | +the_facade_codes_the_same_bytes_as_encode_sequence skip_lines=1 ok. 1 passed | |
| 110 | +filter_replay_final_matches_the_capture_decode skip_lines=1 ok. 1 passed | |
| 111 | +real_clip_encodes_within_its_quality_and_size_budget skip_lines=2 ok. 2 passed (filter matched both straddle tests; 1 each) | |
| 112 | +real_clip_encodes_within_its_quality_and_size_budget_at_a_straddle_size skip_lines=1 ok. 1 passed | |
| 113 | +the_encoders_own_streams_are_byte_identical_to_their_pins skip_lines=1 ok. 1 passed | |
| 114 | +a_libaom_stream_with_128_intra_blocks_in_inter_frames_decodes_exact skip_lines=1 ok. 1 passed | |
| 115 | +a_straddling_frame_decodes_exactly_on_both_reference_encoders_ladders skip_lines=1 ok. 1 passed | |
| 116 | +tile_wall_table_at_1080p / tile_search_wall_1080p / filter_stage_wall_1080p skip_lines=0 1 ignored (probes, #[ignore]d) | |
| 117 | +``` | |
| 118 | + | |
| 119 | +Class-wide proof, root absent, `EC_AV1_REQUIRE_FFMPEG=1 EC_AV1_REQUIRE_AOMENC=1` | |
| 120 | +— **all eleven are RED**: | |
| 121 | + | |
| 122 | +``` | |
| 123 | +a_1080p_multi_tile_stream_decodes_sample_exact_through_both_decoders FAILED. 0 passed | |
| 124 | +bytes_per_frame_target_settles_within_20_percent FAILED. 0 passed | |
| 125 | +bitrate_target_lands_within_5_percent_over_48_frames FAILED. 0 passed | |
| 126 | +bytes_per_frame_controller_never_oscillates_past_its_clamp FAILED. 0 passed | |
| 127 | +quality_target_is_monotone_in_bytes_and_psnr FAILED. 0 passed | |
| 128 | +the_facade_codes_the_same_bytes_as_encode_sequence FAILED. 0 passed | |
| 129 | +filter_replay_final_matches_the_capture_decode FAILED. 0 passed | |
| 130 | +real_clip_encodes_within_its_quality_and_size_budget FAILED. 0 passed | |
| 131 | +the_encoders_own_streams_are_byte_identical_to_their_pins FAILED. 0 passed | |
| 132 | +a_libaom_stream_with_128_intra_blocks_in_inter_frames_decodes_exact FAILED. 0 passed | |
| 133 | +a_straddling_frame_decodes_exactly_on_both_reference_encoders_ladders FAILED. 0 passed | |
| 134 | +``` | |
| 135 | + | |
| 136 | +`EC_REQUIRE_FIXTURES=1` alone is enough as well (proved on the 1080p gate). | |
| 137 | + | |
| 138 | +## 4. Reconciliation: the clip path resolves through `EC_FIXTURES` | |
| 139 | + | |
| 140 | +**Choice: `library_fixture::root()` honours `EC_FIXTURES` first**, the | |
| 141 | +alternative being to make the preflight FAIL when the tests' default root is | |
| 142 | +absent. | |
| 143 | + | |
| 144 | +Why this one: | |
| 145 | + | |
| 146 | +* `EC_FIXTURES` is already the fleet-wide convention — `gen-fixtures.sh`, | |
| 147 | + `fetch-vectors.sh`, `scan-real-library.sh`, `gen-fixture-library.sh` and | |
| 148 | + `verify-fixture-library.sh` all take it, and every generator row in the | |
| 149 | + manifest is resolved through it. A crate reading `$ROOT/fixtures` | |
| 150 | + unconditionally was the odd one out, and that is the whole of the mismatch. | |
| 151 | +* The preflight cannot fix its own side of it. Failing whenever | |
| 152 | + `$ROOT/fixtures` is absent would RED every properly-staged runner that points | |
| 153 | + `EC_FIXTURES` at a library elsewhere — a false red, and a batch that cannot | |
| 154 | + start. | |
| 155 | +* One direction of the fix makes the two sides *identical by construction* | |
| 156 | + rather than keeping two roots in agreement by convention. The bad case | |
| 157 | + (preflight GREEN over a root the gates do not read) becomes unrepresentable. | |
| 158 | + | |
| 159 | +`EC_AV1_WALL_CLIP` still overrides with a path outside any root, which is why | |
| 160 | +`require_at` exists alongside `require`. | |
| 161 | + | |
| 162 | +One preflight change beyond the resolver: its last line no longer says a bare | |
| 163 | +`GREEN` when mode (i) was reported — it says `GREEN-WITH-FINDINGS` and how to | |
| 164 | +make it fatal. A reader who read only the verdict was reading GREEN over a tree | |
| 165 | +whose fixture root does not exist. | |
| 166 | + | |
| 167 | +`scripts/gen-fixture-library.sh` learned the resolver's **library-relative** | |
| 168 | +literal (a `library_fixture::require("video/…", …)` argument). Without it the | |
| 169 | +`RESOLVE` pass silently lost every clip row the moment a gate stopped spelling | |
| 170 | +`../../fixtures` — the preflight would have stopped checking the exact paths | |
| 171 | +whose absence this lane is about. The rule is scoped to lines that call the | |
| 172 | +resolver, so it adds no rows outside ec-av1. The manifest's row **set** is | |
| 173 | +unchanged (`fixtures/video`, both clips, `real-library-manifest.tsv` all still | |
| 174 | +present); only `required_by` line attributions moved, which is why | |
| 175 | +`scripts/fixture-library.tsv` is regenerated in this commit. | |
| 176 | + | |
| 177 | +### Four cases, raw output | |
| 178 | + | |
| 179 | +Gate: `a_1080p_multi_tile_stream_decodes_sample_exact_through_both_decoders`. | |
| 180 | + | |
| 181 | +**1 — root present, `EC_FIXTURES` unset** (symlink from | |
| 182 | +`scripts/link-fixtures.sh`; the clip is 3320956 B): | |
| 183 | + | |
| 184 | +``` | |
| 185 | +1080p 2x1 tiles: 84488 bytes, sample-exact | |
| 186 | +1080p 2x2 tiles: 84208 bytes, sample-exact | |
| 187 | +1080p 4x2 tiles: 84685 bytes, sample-exact | |
| 188 | +test …a_1080p_multi_tile_stream… ... ok | |
| 189 | +test result: ok. 1 passed; 0 failed; … finished in 28.77s | |
| 190 | +``` | |
| 191 | + | |
| 192 | +**2 — root ABSENT, `EC_FIXTURES` set** (was the false green; the gate now runs | |
| 193 | +on the very tree the preflight validated): | |
| 194 | + | |
| 195 | +``` | |
| 196 | +$ EC_FIXTURES=$LIB EC_AV1_REQUIRE_FFMPEG=1 cargo test … a_1080p_multi_tile_stream… | |
| 197 | +1080p 2x1 tiles: 84488 bytes, sample-exact | |
| 198 | +1080p 2x2 tiles: 84208 bytes, sample-exact | |
| 199 | +1080p 4x2 tiles: 84685 bytes, sample-exact | |
| 200 | +test result: ok. 1 passed; 0 failed; … finished in 28.73s | |
| 201 | +``` | |
| 202 | + | |
| 203 | +**3 — root absent, `EC_FIXTURES` unset, no require env** — the documented skip, | |
| 204 | +one line: | |
| 205 | + | |
| 206 | +``` | |
| 207 | +SKIP a_1080p_multi_tile_stream_decodes_sample_exact_through_both_decoders: | |
| 208 | + h264-1080p-23.976-8bit.mp4 absent at | |
| 209 | + /…/wt-av1clipprobe/crates/ec-av1/../../fixtures/video/h264-1080p-23.976-8bit.mp4 | |
| 210 | + -- this gate proved nothing; run scripts/link-fixtures.sh, point EC_FIXTURES | |
| 211 | + at a library root, or set EC_REQUIRE_FIXTURES=1 / EC_AV1_REQUIRE_FFMPEG=1 to | |
| 212 | + make this a failure. | |
| 213 | +test result: ok. 1 passed; 0 failed; … finished in 0.05s | |
| 214 | +``` | |
| 215 | + | |
| 216 | +**4 — both absent, require env set** — RED: | |
| 217 | + | |
| 218 | +``` | |
| 219 | +thread '…a_1080p_multi_tile_stream…' panicked at crates/ec-av1/src/library_fixture.rs:107:5: | |
| 220 | +a_1080p_multi_tile_stream_decodes_sample_exact_through_both_decoders: the library clip is | |
| 221 | +absent at /…/wt-av1clipprobe/crates/ec-av1/../../fixtures/video/h264-1080p-23.976-8bit.mp4 | |
| 222 | +-- this gate would prove nothing. A linked worktree has no gitignored root `fixtures/`: | |
| 223 | +run scripts/link-fixtures.sh, or point EC_FIXTURES at a library root, or set | |
| 224 | +EC_REQUIRE_FIXTURES=1 / EC_AV1_REQUIRE_FFMPEG=1 only on a tree that really has the library. | |
| 225 | +test result: FAILED. 0 passed; 1 failed; … finished in 0.05s | |
| 226 | +``` | |
| 227 | + | |
| 228 | +A fifth, adversarial: `EC_FIXTURES` pointed at `$LIB/video` (one level too | |
| 229 | +deep) with `EC_REQUIRE_FIXTURES=1` — resolves to `…/fixtures/video/video/…` | |
| 230 | +and is RED, not a skip: | |
| 231 | + | |
| 232 | +``` | |
| 233 | +a_1080p_…: the library clip is absent at /…/fixtures/video/video/h264-1080p-23.976-8bit.mp4 … | |
| 234 | +test result: FAILED. 0 passed; 1 failed; | |
| 235 | +``` | |
| 236 | + | |
| 237 | +**GREEN-with-absent-root is dead** in both directions: | |
| 238 | + | |
| 239 | +| | preflight before | preflight after | gate before | gate after | | |
| 240 | +|---|---|---|---|---| | |
| 241 | +| root absent + `EC_FIXTURES` set | `GREEN (305 rows)`, `resolve 0 missing` — over a root no gate read | `GREEN (295 rows)`, and the header prints `the clip gates resolve $LIB too` | `SKIP … no fixture`, `ok` | **runs**, sample-exact, or RED under require | | |
| 242 | +| root absent, `EC_FIXTURES` unset | mode (i) reported, then a bare `GREEN` last | `GREEN-WITH-FINDINGS` (or `RED` under `EC_REQUIRE_FIXTURES=1`) | `SKIP`, `ok` | one `SKIP` line, `ok`; **RED** under any require env | | |
| 243 | +| root present | `GREEN` | `GREEN (295 rows)` | runs | runs | | |
| 244 | + | |
| 245 | +## 5. Non-vacuity and gate results | |
| 246 | + | |
| 247 | +* Root absent + require envs → **RED** (case 4, and all eleven gates in §3). | |
| 248 | +* Root absent, no require envs → **exactly one** `SKIP` line per gate naming the | |
| 249 | + resolved path and the escape hatch (§3 table). | |
| 250 | +* Root present → the 1080p gate still **passes**: | |
| 251 | + `1080p 2x1 84488 / 2x2 84208 / 4x2 84685 bytes, sample-exact`, `ok. 1 passed` | |
| 252 | + in 28.8 s release — and it passes with `EC_AV1_REQUIRE_FFMPEG=1 | |
| 253 | + EC_AV1_REQUIRE_AOMENC=1` set, so the new failure path is not armed on a good | |
| 254 | + tree. | |
| 255 | +* `real_clip_encodes_within_its_quality_and_size_budget` (+ its straddle | |
| 256 | + sibling), root present: `ok. 2 passed` in 6.2 s. | |
| 257 | +* The crate's own anti-regression scans, all green: | |
| 258 | + `gate_coverage` 13 passed (incl. `no_tool_presence_check_outside_its_probe`), | |
| 259 | + `refusal_inventory` 19 passed, `library_fixture` 1 passed. | |
| 260 | +* Preflight, root present: `GREEN (295 rows)`, `code-shape violations: 0`, | |
| 261 | + `pin gates: total=8 committed=21 uncommitted=0 ignored=0 assertless=0`, | |
| 262 | + invariant-1 positive control fired, invariant-4 census self-test passed. | |
| 263 | + Under `EC_REQUIRE_FIXTURES=1` with the root absent: exit 1, | |
| 264 | + `FAIL [mode i]`, `RED`. | |
| 265 | + | |
| 266 | +New test: `library_fixture::tests::the_resolver_follows_ec_fixtures_over_the_gitignored_root` | |
| 267 | +asserts the precedence itself, so the reconciliation is a check rather than a | |
| 268 | +sentence in a comment. | |
| 269 | + | |
| 270 | +## Notes for the merge owner | |
| 271 | + | |
| 272 | +* `scripts/fixture-library.tsv` is regenerated. `required_by` line attributions | |
| 273 | + moved because the edits shifted lines; the row **set** is identical, verified | |
| 274 | + by `diff <(cut -f1,3 | sort -u)` against the pre-change manifest. | |
| 275 | +* The lane worktree needs `scripts/link-fixtures.sh` (or `EC_FIXTURES`) before | |
| 276 | + the clip gates can do anything; a `git archive` staging excludes the | |
| 277 | + gitignored root `fixtures/`, which is the staging gap the wave-3c-b owner | |
| 278 | + measured. After this commit that staging is no longer silent: the clip gates | |
| 279 | + are RED under the require envs instead of green. |