forge
Explore
Log in

Don't you dare go Hollow

lanes/av1pins r4: lr_sgr gets its asserts, plus two corrections to my own r3 claims

Browse files at this commit

1b5bc7e838bf1901f1f47da999aa5a0ae591b0c1Ahmet Kaan GümüşParent: 0777cd0
The frame count was the substantive fix: the old body passed pics.len() as
ffmpeg's EXPECTED count, so a zero-frame decode asked ffmpeg for zero frames and
compared nothing. Red-before by mutating apply_sgrproj_stripe (+1 on its first
output sample) lands on a PIXEL assert -- and on a CHROMA plane, which luma alone
would have missed.

Records two errors of mine. r3's 'the machine-local-pin population is zero' is
false: pinned_warp_stream_decodes_pixel_exact reads 14 more uncommitted pins
through a directory concat! literal my scanner could not match, and the invariant
I handed the preflight lane is too weak to catch it. And my '4 ignored gates
assert nothing' scan was wrong for that same gate, whose asserts live in a helper
it delegates to.
lanes/av1pins.report.mdmodified+124 -0
@@ -435,3 +435,127 @@ The class rule this lane earns, in the shape Main is adopting as a batch rule: a
435435 a **judgement** ("bisect aid", "not a suite gate"). A judgement cannot be checked
436436 against reality, so it cannot go stale loudly — and that is exactly how the r1
437437 reason survived into a tree where it was false.
438+
439+---
440+
441+# r4 — the last assert-free gate, and two corrections to my own r3 claims
442+
443+Branch `lane-av1pinslive`, rebased onto main `aa0ac8c2`. Commit `9a29c974`.
444+Tests only, no decoder change.
445+
446+## 1. What changed
447+
448+`pinned_lr_sgr_stream_call_unique_dump` now asserts. r3 left it `#[ignore]`d on the
449+fact that it asserted nothing; that is fixed and the ignore is gone.
450+
451+**The substantive fix is the frame count, not the asserts.** The old body passed
452+*our own decode's length* as ffmpeg's expected count:
453+
454+```rust
455+let reference = ffmpeg_decode_sequence(&stream, 192, 128, pics.len());
456+```
457+
458+so a decoder emitting **zero** frames asked ffmpeg for zero frames, the zip compared
459+no pairs, and the gate passed having proved nothing — the `cmpaudit` vacuous-pass
460+shape, in the one gate that was already `#[ignore]`d for asserting nothing. The count
461+now comes from the fixture (`FRAMES = 1`, measured), so a lost frame reds on the
462+count.
463+
464+Also added, matching the three sibling pins: a dimensions assert per frame, an
465+explicit `reference.len() == FRAMES` before the zip, and per-plane per-frame pixel
466+asserts. **The diagnostic print is kept** and now runs *before* the asserts, so a
467+failure still names the shape of the divergence.
468+
469+### On "does it compare only frame 0?" — it does not
470+
471+The loop always visited every frame; it is unchanged in that respect. This pin
472+simply holds **one** frame, which is why the pre-r4 run printed `frame 0` and
473+nothing else. So that particular worry is unfounded, and the real gap was the
474+vacuous count above.
475+
476+## 2. Red-before, on a pixel assertion
477+
478+**Method used: mutating the decoder arithmetic the pin exercises**, not a faked
479+expectation — `restoration.rs::apply_sgrproj_stripe`, `+1` on its first output
480+sample. The pin is a loop-restoration stream, so Sgrproj is on its path.
481+
482+```
483+frame 0: y_mismatch=false u_mismatch=true v_mismatch=true
484+panicked at crates/ec-av1/src/stream.rs:30374:13:
485+ assertion `left == right` failed:
486+ pinned_lr_sgr_stream_call_unique_dump frame 0 U vs ffmpeg (pinned lr-sgr)
487+test result: FAILED. 0 passed; 1 failed; 0 ignored
488+```
489+
490+It reds on a **pixel** assert, not on a shape or counter assert. Worth recording:
491+the mutation landed in a **chroma** plane, so the gate caught it on the U assert
492+while luma stayed clean — a luma-only compare would have missed it entirely. That is
493+the capability the three per-plane asserts buy.
494+
495+Reverted (`git status` on `restoration.rs` empty) and the gate returns green.
496+
497+The **count** assert is proven separately: setting `FRAMES = 2` reds at
498+`stream.rs:30328` with *"decoded 1 frame(s), the pinned stream holds 2 -- a short
499+decode would otherwise ask ffmpeg for the same short count and compare nothing"* —
500+on the count, not on a pixel. Both halves proven independently.
501+
502+## 3. Plain-run evidence
503+
504+```
505+cargo test -p ec-av1 --lib --release -- --exact stream::tests::pinned_lr_sgr_stream_call_unique_dump --test-threads=1 --nocapture
506+ frame 0: y_mismatch=false u_mismatch=false v_mismatch=false
507+ pinned_lr_sgr_stream_call_unique_dump: 1 frame(s) byte-exact vs ffmpeg from .../crates/ec-av1/fixtures/lr-sgr-r7.obu
508+ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 741 filtered out; finished in 0.10s
509+```
510+
511+`#[ignore]` in `stream.rs` **37 → 36**. `gate_coverage` 10 passed,
512+`refusal_inventory` 15 passed.
513+
514+The ignore was never justified by cost: it measured 0.10 s under `--ignored` too.
515+The only honest reason it carried was the missing asserts, which is now gone.
516+
517+## 4. TWO CORRECTIONS TO MY OWN r3 CLAIMS
518+
519+Both are scanner blind spots of mine, found by auditing the class after this change.
520+Neither is a new defect in the tree; both are wrong things I told you.
521+
522+**Correction 1 — "the machine-local-pin population is zero in ec-av1" is FALSE.**
523+It is zero for the gates I fixed, and there is **one more pin gate with 14
524+uncommitted pins**:
525+
526+`pinned_warp_stream_decodes_pixel_exact` (still `#[ignore]`d, reason *"reads pinned
527+fixture paths under the gitignored fixtures dir; run manually"*) reads **14 pins** —
528+`warp-mismatch`, `warp-flake-5`, `warp-flake-7`, `ii-flake-1/2/3/5/6/7/8/9`,
529+`rect-flake-1/2/3` — through a **directory** `concat!(env!("CARGO_MANIFEST_DIR"),
530+"/../../fixtures")` literal plus a name list, and formats `{fixtures}/{n}.obu` at
531+runtime. **0 of 14 are committed under the crate.**
532+
533+My r3 scanner matched only `crate_pin("X")` and `pin_dir().join("X")` — *single-name*
534+call shapes. A directory literal plus a runtime-formatted name list does not match
535+either, so this gate was invisible to it. The r3 invariant I proposed to the preflight
536+lane ("every `crate_pin("X")` must have `crates/ec-av1/fixtures/X` in the tree") is
537+**too weak to catch this**, and the preflight lane should be told so: the scan must
538+also resolve `concat!` directory literals and any `{fixtures}/{n}` runtime format.
539+
540+**Correction 2 — "4 ignored gates assert nothing" is wrong for one of them.**
541+My body-only scan reported `pinned_warp_stream_decodes_pixel_exact` as assert-free.
542+It is not: the gate delegates to `check_pinned_warp_stream` (`stream.rs:31226`),
543+which carries `assert_eq!` on all three planes per frame. The scan looked at the gate
544+body and missed the delegation.
545+
546+The other three are correct and are diagnostics **by name**:
547+`probe_tiny_fixture_trace`, `scratch_decode_pinned_stream_once`,
548+`scratch_isolate_pinned_mismatch` — 0 asserts each, all `probe_*`/`scratch_*`.
549+
550+So the accurate statement is: **no ignored gate named `pinned_*` asserts nothing**,
551+after this change — but that took checking the helpers, not the bodies.
552+
553+## 5. State
554+
555+`lane-av1pinslive`, four work commits on top of `aa0ac8c2`. `cargo check -p ec-av1
556+--all-targets` clean, no warnings. Not pushed; main untouched.
557+
558+Follow-on handed back rather than folded in: the 14 `pinned_warp` pins, which are
559+the same defect as r3's four and want the same `crate_pin` + committed-copy
560+treatment. Not verified: a full `cargo test -p ec-av1` run (project-wide validation
561+is Main's).