diff --git a/crates/ec-aac/tests/oracle.rs b/crates/ec-aac/tests/oracle.rs index 7ddde830..79b3070f 100644 --- a/crates/ec-aac/tests/oracle.rs +++ b/crates/ec-aac/tests/oracle.rs @@ -676,6 +676,16 @@ fn esds_asc(mp4: &[u8]) -> Option> { /// AAC tracks from the machine's own library, not just generated fixtures: the /// elementary stream is copied out to ADTS and decoded both ways. +// lane-h264reallib: same shape as the ec-h264 `real_library_streams_match_ffmpeg` +// fix, same reason. The manifest is generated by `scripts/scan-real-library.sh` +// from `~/Videos ~/Downloads ~/Music` and is gitignored because it is +// machine-local. The guard below makes a host with NO manifest print green +// (nothing was checked), and a host that ran the scan but has since moved or +// deleted files falls through to `checked >= 3` and goes red for a reason that +// has nothing to do with the decoder. An ignore is visible in `--list` and +// cannot go green silently, which an env gate would. +// Run on the workstation: cargo test -p ec-aac --test oracle real_library_tracks_match_ffmpeg -- --ignored +#[ignore = "sweeps the PERSONAL media library (~/Videos, ~/Downloads, ~/Music) through the gitignored fixtures/real-library-manifest.tsv and asserts >= 3 tracks swept; a runner host has no such library, so it is either a silent green or a red for the wrong reason. Run it on the workstation with --ignored."] #[test] fn real_library_tracks_match_ffmpeg() { if !have_ffmpeg() { diff --git a/crates/ec-h264/tests/conformance.rs b/crates/ec-h264/tests/conformance.rs index c8b38314..b0b1ca16 100644 --- a/crates/ec-h264/tests/conformance.rs +++ b/crates/ec-h264/tests/conformance.rs @@ -1842,6 +1842,32 @@ fn compare_container_streamed( /// resolutions and GOP structures the fixtures never use, and they are the ones /// a user actually opens. Every file either decodes bit-exactly or is refused /// by name; a file that decodes to different pixels is a failure. +// lane-h264reallib: LOCAL-ONLY, and the reason lives in the attribute so it +// shows in `cargo test -- --list` instead of hiding in a skip print. +// +// The precondition is a PERSONAL MEDIA LIBRARY: the manifest is generated by +// `scripts/scan-real-library.sh`, which scans `~/Videos ~/Downloads ~/Music` +// by default and is gitignored precisely because it is machine-local. A +// runner host has none of those directories, so both of this test's possible +// behaviours there are wrong: +// +// - manifest absent -> the `SKIP: ... missing` early return, which prints +// green. That is the silent-skip class this batch is removing: a green +// that means "nothing was checked". +// - manifest present but its absolute paths unresolvable (a host that ran +// the scan script against an empty library) -> zero files swept and +// `decoded >= 3` fails. That is the red every fleet run currently eats, +// and it is red for a reason that has nothing to do with the decoder. +// +// Hence `#[ignore]` rather than an env gate: an env gate whose variable is +// absent on the runner prints the same green the missing manifest already +// prints, which is the defect rather than the fix. An ignore is visible in +// `--list`, cannot go green silently, and leaves the assertion itself intact +// -- "the sweep is the point" still holds on the machine that can run it. +// +// Run it on the workstation, where the library is: +// cargo test -p ec-h264 --test conformance real_library_streams_match_ffmpeg -- --ignored +#[ignore = "sweeps the PERSONAL media library (~/Videos, ~/Downloads, ~/Music) through the gitignored fixtures/real-library-manifest.tsv; MINUTES of wall time (measured past 840 s on the workstation), so workstation only -- budget an hour, it is not wedged. A runner host has no such library, so the test is either a silent green or a red for the wrong reason. Run it on the workstation with --ignored."] #[test] fn real_library_streams_match_ffmpeg() { if !have_ffmpeg() { diff --git a/lanes/h264reallib.report.md b/lanes/h264reallib.report.md new file mode 100644 index 00000000..3e0c02e6 --- /dev/null +++ b/lanes/h264reallib.report.md @@ -0,0 +1,180 @@ +# lane-h264reallib — real-library sweep: shape, local verdict, class sweep + +Branch `lane-h264reallib` (worktree `~/.cache/wt/h264reallib`, base `a21f3680`). +Tests only. No decoder change, no assertion weakened. + +Three separate deliverables, per Main's request to keep them apart: +(a) the local verdict on the real library, (b) the shape change that stops +runners reporting a false red, (c) the count and table of the rest of the class. + +--- + +## (a) Local verdict — PASSES on the workstation, no decoder defect + +Run on the workstation, where the library is: + +``` +EC_NOMEMGUARD=1 cargo test -p ec-h264 --test conformance \ + real_library_streams_match_ffmpeg -- --ignored --nocapture +``` + +`fixtures/real-library-manifest.tsv` is gitignored and generated by +`scripts/scan-real-library.sh` (ffprobe sweep of `~/Videos ~/Downloads ~/Music`). +Copied from the primary checkout into the worktree for the run; **111 h264 rows, +all 111 paths resolve** on this host. + +Result — **15 decoded bit-exact, 0 refused by name, 0 failures**, 1918 s: + +| file | container | width | frames | +|---|---|---|---| +| reel-24f2c8 | matroska,webm | 2560px | 500 bit-exact | +| reel-7538d2 | mov,mp4,m4a,3gp,3g2,mj2 | 2560px | 500 bit-exact | +| reel-1c3a81 | matroska,webm | 1280px | 500 bit-exact | +| reel-286c86 | mov,mp4,… | 3840px | 500 bit-exact | +| reel-010d74 | mov,mp4,… | 576px | 500 bit-exact | +| reel-ab1f6d | mov,mp4,… | 640px | 500 bit-exact | +| reel-e99558 | mov,mp4,… | 1920px | 500 bit-exact (container demux) | +| reel-436303 | mov,mp4,… | 1274px | 439 bit-exact | +| reel-28cd87 | mov,mp4,… | 720px | 500 bit-exact | +| reel-bf1a18 | matroska,webm | 1920px | 500 bit-exact | +| reel-92d5fc | mov,mp4,… | 1080px | 500 bit-exact | +| reel-6ee243 | mov,mp4,… | 1078px | 500 bit-exact | +| reel-1db5fd | mov,mp4,… | 1280px | 185 bit-exact | +| reel-4148f8 | mov,mp4,… | 1916px | 500 bit-exact | +| reel-ccbe4e | mov,mp4,… | 1138px | 500 bit-exact | + +Both demuxers are exercised (matroska + mov/mp4), the sweep covers 576px→3840px, +and one file took the container-demux fallback exactly as designed. **The +decoder is fine; the fleet red was never about the decoder.** + +Runtime: **1918 s (~32 min)**, matching Main's independent observation that it +runs past 840 s. That number is now in the ignore reason so the next person does +not read the wall time as a wedge. + +## (b) Shape change — why `#[ignore]`, and what it stops + +`crates/ec-h264/tests/conformance.rs:1846` `real_library_streams_match_ffmpeg`. + +The precondition is a personal media library, which has exactly two possible +behaviours on a runner, and **both are wrong**: + +- manifest absent → the existing `SKIP: … missing` early return prints + **green**. That is the silent-skip class this batch is removing: a green that + means "nothing was checked". +- manifest present but its absolute paths unresolvable (a host that ran the scan + script against an empty library) → zero files swept and `decoded >= 3` fails. + That is **the red every fleet run currently eats**, and it is red for a reason + that has nothing to do with the decoder. + +`#[ignore]` over an env-gated SKIP, justified: an env gate whose variable is +absent on the runner prints *the same green the missing manifest already prints* — +that is the defect, not the fix. An ignore is visible in +`cargo test -- --list`, cannot go green silently, and needs no runner-side +configuration that could itself drift. The assertion is untouched: `decoded >= 3` +still stands, and still holds, on the machine that can run it (it did: 15 ≥ 3). + +Verified — the target is no longer red, and the reason is printed verbatim: + +``` +test real_library_streams_match_ffmpeg ... ignored, sweeps the PERSONAL media +library (~/Videos, ~/Downloads, ~/Music) through the gitignored +fixtures/real-library-manifest.tsv; MINUTES of wall time (measured past 840 s on +the workstation), so workstation only -- budget an hour, it is not wedged. ... +test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 22 filtered out +``` + +Also fixed, because the fix is the *identical* one-line `#[ignore]` + reason and +no judgement call: `crates/ec-aac/tests/oracle.rs:680` +`real_library_tracks_match_ffmpeg` — same manifest, same +"skip if manifest missing, then assert `checked >= 3`" shape, same two failure +modes. Verified reporting `1 ignored`. + +## (c) Class sweep — 51 sites examined, 2 fixed, 3 need a decision, 46 already correct + +The class: a test that reads `~/Music`, `~/Videos`, `~/Downloads`, a hardcoded +`/home//` path, or the generated manifest; **or** asserts a minimum count +of personal files. Swept `crates/*/tests/**`, `crates/*/src/**` (incl. +`#[cfg(test)]`), `tests/**`, `tools/**`, `shims/**`, and the scripts. + +**Members of the class that are RED-ON-RUNNER and not ignored — the ones that +still need a decision (not fixed here, because the right fix is NOT the +identical one-liner):** + +| file:line | what it needs | runs on a runner? | current behaviour | proposed shape | +|---|---|---|---|---| +| `crates/ec-probe/tests/library.rs:490` `a_real_library_sweep` | manifest + ≥1 row whose path still exists | partially | red-on-runner | **Remove the minimum-count assert, do not ignore.** The file's own header (:5-6) states moved files are "skipped and reported, never failed" — the `:490` assert contradicts the stated contract. This is a real bug in the test's own spec, not a shape problem. | +| `crates/ec-aac/tests/sbr_real_library.rs:4797` `sbr_residual_locator` | `$HOME` set at all — bare `env::var("HOME").unwrap()` | partially | red-on-runner | **One-line `unwrap_or_default()`**, matching the five sibling HOME reads in the same file (:2710, :3426, :4109, :4182, :4575). The `:4803` `path.exists()` guard already handles the absent file; only the bare `unwrap` panics. | +| `crates/ec-aac/tests/obs_real_content.rs:151` `obs_content_table` | `$HOME` set — bare `unwrap()` | partially | silent-skip | **One-line `unwrap_or_default()`**, same reason. The `read_dir` guard at :152 already handles the absent directory. | + +**Already correctly shaped — `leave alone` (14 named, rest by the same pattern):** +these read personal paths but handle absence correctly, so they are NOT the +class. The template worth copying: + +- `crates/ec-h264/tests/encode.rs:751` `real_library_frames_encode_and_decode_exactly` + — **the reference "correct" shape of this class**: `:728-731` soft-skips when no + qualifying row survives, so the `sources.len() >= 6` assert is only reachable + once a real file was actually opened. This is what the two sites above should + be rewritten to. +- `crates/ec-aac/tests/oracle.rs:848` `he_aac_library_track_decodes_to_its_core` + — sibling of the one I ignored, correctly shaped: prints a named SKIP at :919 + and returns at :917, so the :912 assert only fires on a file it decoded. +- `crates/ec-image/tests/real_library.rs:52`, `:132`; `crates/ec-truehd/tests/library.rs:78`, + `crates/ec-truehd/tests/oracle.rs:87`; `crates/ec-probe/tests/library.rs:585`, `:621`, + `:756`; `crates/ec-aac/tests/reelh_per_frame.rs:29`; `crates/ec-hw/tests/gpu.rs:2050` + (and the three other gpu.rs personal-path sites, all GPU-guarded) — all guard + on `exists()`/`read_dir` and print a named skip. +- `crates/ec-aac/tests/sbr_real_library.rs:2710`, `:3690`, `:4176`, `:4566` — filter + candidates on `.exists()`, empty list skips, no minimum-count assert. + +**Already `#[ignore]`d with a reason naming the precondition — `leave alone` +(~20):** `ec-mp3/tests/encode_matrix.rs:639`, `:851`; `ec-mp4/tests/mp4.rs:789`; +`ec-matroska/tests/matroska.rs:538`, `:965`, `:1058`, `:1282`, `:1400`; +`ec-vorbis/tests/oracle.rs:1190`; `ec-opus/tests/conformance.rs:758`, `:2958`, +`:3149`, `:3428`, `:3654`, `:3859`, `:4091`, `:4572`; `ec-av1/src/encode.rs:16808`, +`:19748`, `:20068`, `:20175`, `:21054`, `:21163`, `:22857`, `:22982`. The repo's +dominant convention is already "ignore + reason", which is why this lane's fix +follows it rather than inventing a new shape. + +**False positives — do NOT touch (the class looks bigger than it is):** + +- `scripts/extract_vp8_tables.py:15`, `scripts/build-aom-oracle.sh:17`, + `build-aom-affine-oracle.sh:23`, `instrument-aom-oracle.sh:73`, + `gen_vp8_fixtures.sh:52`, `memguard-runner.sh:39` — `$HOME/.cache/{aom-oracle,vp8}` + and `$HOME/.config/systemd`: build/toolchain locations, all env-overridable, + none read media. +- `tools/ec-bench/src/main.rs:82` — non-test bench binary; reports "no candidate". +- `crates/ec-aac/tests/sbr_real_library.rs:3715`, `:4572` — `$CARGO_MANIFEST_DIR/../../.cache/heaac-fixtures`, + a generated-fixture cache relative to the repo. +- `crates/ec-vp9/tests/scaledref_exact.rs:18` — a doc comment recording how a + *committed* .ivf was produced; the test reads the tracked file. +- `crates/ec-mp4/tests/mp4.rs:635` — personal file is purely additive to a repo + fixture that is always present; not a dependency. + +**Non-test dependents of the manifest** (why it exists on some hosts and not +others — worth knowing when reading a red): + +- `scripts/scan-real-library.sh` — the generator; defaults to + `$HOME/Videos $HOME/Downloads $HOME/Music`, writes the gitignored + `fixtures/real-library-manifest.tsv`, honours `EC_FIXTURES`. +- `lanes/b64b/bin-control:59261` — a built binary that reads the manifest. +- No CI workflow file in the repo runs the scan, which is exactly why runner + behaviour differs: a host that once ran the script by hand keeps a manifest + whose paths no longer resolve, and that is the state that produces the false red. + +**One incidental finding, not fixed (out of scope, flagged not hidden):** +`crates/ec-matroska/tests/matroska.rs:966` reads the manifest at a **hardcoded +absolute** `/home/user/Documents/Code/Rust/edith_codecs/fixtures/…` instead +of `CARGO_MANIFEST_DIR`-relative like every sibling. It is already `#[ignore]`d +with a soft skip, so it is harmless today, and it also silently defeats +worktree isolation. Worth converting to the relative form if that ignore is ever +lifted. + +## Change list + +| file | change | +|---|---| +| `crates/ec-h264/tests/conformance.rs:1870` | `#[ignore = "…"]` + 25-line reason above the test; assertion untouched | +| `crates/ec-aac/tests/oracle.rs:688` | `#[ignore = "…"]` + reason; identical shape, assertion untouched | + +No decoder change. No new `#[ignore]` beyond the two class members above (both +were red-on-runner, never green). No assertion weakened anywhere.