Lane-fixdet r1 charter (gate fixtures are not reproducible)
Browse files at this commitdf7e2d1fd9e4872ca65e4a9b172d60051ab50f58Parent: c8e7f7e- docs
- lane-fixdet r1 charter (gate fixtures are not reproducible)
1 changed file +72 -0
- lanes/fixdet-r1.charter.md +72 -0
lanes/fixdet-r1.charter.mdadded+72 -0
| @@ -0,0 +1,72 @@ | |||
| 1 | +# lane-fixdet r1 charter — the gate fixtures are not reproducible | ||
| 2 | + | ||
| 3 | +## Where you are | ||
| 4 | +Worktree /home/user/Documents/Code/Rust/edith_codecs-fixdet, branch | ||
| 5 | +lane-fixdet @ main. | ||
| 6 | +Build/test ONLY: | ||
| 7 | + `env CARGO_TARGET_DIR=$HOME/.cache/cargo-target-fixdet CARGO_BUILD_JOBS=4 nice -n 19 cargo test -p ec-av1 --release --lib <name> -- --nocapture` | ||
| 8 | +FOREGROUND, EC_AV1_REQUIRE_AOMENC=1 on gates. Never push. Never touch the main | ||
| 9 | +checkout or the sibling -rectwire2 worktree. WIP COMMIT after every green step. | ||
| 10 | + | ||
| 11 | +## The measurement (already done — do not repeat it, build on it) | ||
| 12 | +ffmpeg's `gradients` lavfi source IGNORES its `seed` parameter for colour | ||
| 13 | +selection. Hashing its output five times with an identical command line: | ||
| 14 | + | ||
| 15 | + e981f6da916b400a 2451ed66cdf1c114 13c53f4382ab72a1 | ||
| 16 | + f9ac6e84c77489ff dcffa3d8caa39e78 | ||
| 17 | + | ||
| 18 | +Five runs, five different fixtures. Twenty gate sites in | ||
| 19 | +`crates/ec-av1/src/stream.rs` build their fixture this way, so those gates have | ||
| 20 | +never had a reproducible input. | ||
| 21 | + | ||
| 22 | +Two consequences, both measured: | ||
| 23 | +- `a_real_aomenc_filter_intra_stream_decodes_pixel_exact` fails about 1 run in | ||
| 24 | + 15 even in isolation with the encoder pinned to one thread. The encoder is | ||
| 25 | + NOT the source of that: hashing aomenc's output six times over a FIXED y4m | ||
| 26 | + gives the same bytes every time. The fixture is the variable. | ||
| 27 | +- Every "attempt-selection flake" attributed to aomenc's RD search deserves | ||
| 28 | + re-examination. Some of those were the SOURCE changing under the gate. | ||
| 29 | + | ||
| 30 | +Naming a seed that does nothing is worse than having no seed: it advertises | ||
| 31 | +reproducibility the gate does not have, and a pin captured from such a run | ||
| 32 | +cannot be regenerated. | ||
| 33 | + | ||
| 34 | +## The fix | ||
| 35 | +`gradients` IS deterministic once the colours are given explicitly — verified, | ||
| 36 | +three identical hashes. But the gates need per-attempt VARIETY too: they sweep | ||
| 37 | +`seed` across attempts precisely to sample different content, and freezing the | ||
| 38 | +colours would make every attempt identical and quietly destroy the sampling | ||
| 39 | +that makes features fire (this repo has a `sampler-decorrelated-gate` class | ||
| 40 | +already). | ||
| 41 | + | ||
| 42 | +So derive the colours FROM the seed. Verified working: seeds 42, 43, 42 gave | ||
| 43 | +hashes c25eb1d4d042, 5097b017faf7, c25eb1d4d042 — different seeds differ, the | ||
| 44 | +same seed reproduces exactly. | ||
| 45 | + | ||
| 46 | +1. Write ONE helper in `stream.rs`, e.g. | ||
| 47 | + `fn gradients_source(seed: u32, w: usize, h: usize, duration: f64) -> String`, | ||
| 48 | + that maps the seed deterministically to `c0`..`c3` (and keeps passing | ||
| 49 | + `seed` so any future ffmpeg that honours it still varies). Document WHY in | ||
| 50 | + a comment: the seed alone does not make this source reproducible. | ||
| 51 | +2. Route all 20 sites through it. Keep each site's existing width/height/ | ||
| 52 | + duration/rate; this is a determinism fix, not a content change. | ||
| 53 | +3. Prove it: a test that builds the same source string twice for one seed and | ||
| 54 | + runs ffmpeg on both, asserting byte-identical output, and that two | ||
| 55 | + different seeds differ. That test is the guard against this regressing. | ||
| 56 | + | ||
| 57 | +## Then re-measure what the fix changes | ||
| 58 | +- Run `a_real_aomenc_filter_intra_stream_decodes_pixel_exact` 20 times. It was | ||
| 59 | + 14/15 before. Report the new number honestly, whatever it is. | ||
| 60 | +- Run the free-partition gate 3 times and report whether its refusal/match | ||
| 61 | + counts are now stable run-to-run. If they are, say so; if they still move, | ||
| 62 | + aomenc attempt selection is real on top of this and the report should say | ||
| 63 | + that too, with the numbers. | ||
| 64 | +- If a gate now fails CONSISTENTLY, that is a genuine decoder defect this | ||
| 65 | + nondeterminism was hiding. Do NOT paper over it: pin it with | ||
| 66 | + EC_AV1_GATE_DUMP, name it in the report, and refuse-by-name rather than | ||
| 67 | + guess-fix. | ||
| 68 | + | ||
| 69 | +## Done criteria | ||
| 70 | +Full lib suite 231 passed / 0 failed. All 20 sites through the helper. The | ||
| 71 | +determinism test in place. REPORT `lanes/fixdet-r1.report.md`, VERDICT on the | ||
| 72 | +FIRST line, with the before/after flake rates as measured counts. | ||