forge
Explore
Log in

Don't you dare go Hollow

Generalise the count-vacuity guard, and hand the 43-site ledger forward

Browse files at this commit

9c0e824a799d68e5395bdbd8a91a1bf3dd3ca80cAhmet Kaan GümüşParent: 572204b
  • test
    • generalise the count-vacuity guard, and hand the 43-site ledger forward
Show full message
test(av1): generalise the count-vacuity guard, and hand the 43-site ledger forward

Rebased onto main 97b4ee04. The preflight lane had independently landed the r5 pin
work, with a BETTER shape -- `crate_pin` string literals are resolvable name-by-name
and so never create the runtime-name blind spot my r5 form did. All three
conflicted hunks resolved to main's side; the duplicate pin commit became a no-op.
Diff vs main is now 3 files, +1215/-8, additions only.

The r7 anchor asserted ONE literal at the fixed gate and would have gone quiet as
other sites are fixed. It now asserts the general rule -- no decode-derived count
(`pictures.len()` / `decoded.len()` / `frames.len()`) may reappear at that gate
under any binding name -- plus an unpinned CEILING of 43, so a NEW site is an
immediate red and the ceiling drops only when a site is actually fixed.

The report carries the full 43-row ledger (a=1, b=37, c=4, ?=1) with bucket,
candidate, spec_in_scope and a per-row disposition; names the one genuinely
unclassified gate with its reason rather than guessing; records the three
detection bugs that each produced a plausible clean output (a line index handed to
a byte-offset walk; `assert_eq!` split by rustfmt; a `}` inside a format string
counted as a closing brace); and states the class note so the next reader does not
chase a nonexistent silent-pass bug -- a wrong count cannot pass silently, the
helper's length assert fires, and the defect is a MISATTRIBUTED RED that
`frame_count_diagnosis` now explains.

gate_coverage 18, refusal_inventory 19, count_vacuity 2, pin_inventory 3, 0 warnings.
crates/ec-av1/src/gate_coverage.rsmodified+22 -3
@@ -2397,10 +2397,29 @@ mod count_vacuity_tests {
23972397 // moved from "the site is still there" to "the fix is still in place AND
23982398 // the dominant remaining shape is still found", so the sweep cannot go
23992399 // quiet by either route.
2400+ // The GENERAL rule, not the one literal r7 fixed. Every decode-derived
2401+ // count expression is banned at the gate r7 fixed, so a future edit that
2402+ // reintroduces the shape under a different binding name is caught, and so
2403+ // the guard does not go quiet as the OTHER sites are fixed later.
2404+ const DECODE_DERIVED: &[&str] = &["pictures.len()", "decoded.len()", "frames.len()"];
24002405 assert!(
2401- !s.iter().any(|x| x.count_expr == "pictures.len()"),
2402- "3895 regressed: a site is passing `pictures.len()` as the oracle's expected \
2403- count again -- our decode's length must never be the expected value"
2406+ !s.iter().any(|x| x.gate
2407+ == "a_real_aomenc_segmentation_stream_with_map_inheritance_decodes_pixel_exact"
2408+ && DECODE_DERIVED.contains(&x.count_expr.as_str())),
2409+ "the r7 fix regressed: {} is passing a decode-derived count as the oracle's \
2410+ expected count again -- our decode's length is the thing UNDER TEST and \
2411+ must never be the expected value",
2412+ "a_real_aomenc_segmentation_stream_with_map_inheritance_decodes_pixel_exact"
2413+ );
2414+ // A CEILING on the unpinned population, so a NEW site cannot be added
2415+ // silently. Lower it as sites are fixed; a fix that does not lower it is
2416+ // still a fix, but a NEW site is an immediate red.
2417+ let unpinned = s.iter().filter(|x| x.pinned_by.is_none()).count();
2418+ const UNPINNED_CEILING: usize = 43;
2419+ assert!(
2420+ unpinned <= UNPINNED_CEILING,
2421+ "{unpinned} unpinned count site(s), ceiling is {UNPINNED_CEILING} -- a new one \
2422+ was added (lower the ceiling only when a site is actually fixed)"
24042423 );
24052424 assert!(
24062425 s.iter().any(|x| x.count_expr == "frames.len()"),
lanes/av1pins.report.mdmodified+147 -0
@@ -924,3 +924,150 @@ reasoning per row.** Every unclassifiable row in this table carries the sentence
924924 that disqualified it, so a reader can disagree with a bucket instead of
925925 inheriting it — and the one `?` in the table is more useful than a confident
926926 guess would have been.
927+
928+---
929+
930+# r7 closeout — rebased onto main, ledger handed forward
931+
932+Rebased onto main `97b4ee04`. **One conflict worth recording:** the fixture-preflight
933+lane had, independently, already landed the r5 work — the 14 pins are committed
934+under `crates/ec-av1/fixtures/` and `pinned_warp_stream_decodes_pixel_exact` was
935+rewired to `crate_pin` with **string literals**, which is a better shape than my
936+`crate_pin(&format!("{n}.ext"))`: a literal is resolvable name-by-name, so it does
937+not create the shape-(e) blind spot at all. All three conflicted hunks resolved to
938+main's side; my duplicate pin commit became a no-op.
939+
940+**Ownership, settled:** main's `scripts/pin-gate-audit.py` owns the standalone
941+census (a human/agent runs it); `pin_inventory` in `gate_coverage.rs` owns the
942+CI-enforced invariant (it fails the suite when a pin is uncommitted). Different
943+jobs, same question, both run.
944+
945+`git diff main --stat`: **3 files, 1215 insertions, 8 deletions** — pure additions.
946+`gate_coverage` 18, `refusal_inventory` 19, `count_vacuity` 2, `pin_inventory` 3,
947+`cargo check --all-targets` **0 warnings**.
948+
949+## 1. Merge readiness
950+
951+| | |
952+|---|---|
953+| branch | `lane-av1pins5` (canonical), rebased onto main `97b4ee04` |
954+| diff vs main | 3 files, +1215 / −8 — additions only |
955+| test-count delta | branch carries +5 CI tests over main (pin_inventory 3, count_vacuity 2); the 18/19 gate_coverage/refusal_inventory totals include the preflight lane's |
956+| sweep floor | holds: 61 sites ≥ 40; unpinned ceiling 43 holds |
957+| warnings | 0 |
958+
959+## 2. The class note — stop the next reader chasing a nonexistent bug
960+
961+**A wrong count here cannot pass silently.** `ffmpeg_decode_sequence`'s
962+`out.stdout.len() == frame_bytes * frames` assert is unconditional, so a wrong
963+count REDS. The defect is a **misattributed red**: the old message
964+(`expected N 4:2:0 frames, ffmpeg said: <empty>`) named ffmpeg for a count ffmpeg
965+never chose. `frame_count_diagnosis` — the class-level fix — reports the caller's
966+count, ffmpeg's actual count, the byte arithmetic, and states that the fix is on
967+OUR side. That single change converts the class from confusing to diagnosable
968+without touching a caller. **This, not the 38 sites, is what the branch is for.**
969+
970+## 3. The three detection bugs, each of which produced a plausible clean output
971+
972+1. **A line index handed to a byte-offset walk** (r7). The sweep computed each
973+ gate's body by indexing `src.as_bytes()` with a LINE number. 40 of 44 rows read
974+ "unclassified" — and "unclassified" looks like a finding, not a bug.
975+2. **`assert_eq!` split by rustfmt** (r6). The lookback required
976+ `assert_eq!(frames.len()` on one line, but rustfmt emits `assert_eq!(` then
977+ `frames.len(),` on the next. Every multi-line spelling was missed, inflating the
978+ unpinned count 48 → 44 once a two-line window was used.
979+3. **A `}` inside a format string counted as a closing brace** (r6). The body walk
980+ counted raw bytes, so a brace in a message truncated the slice and every
981+ compare-detection read false. Same trap that made `stream.rs` look two braces
982+ short in the first review of this wave.
983+
984+Each was caught by a floor or a synthetic-input capability test, and each would
985+have survived an honest-looking table. The rules they earn: **walk offsets in the
986+units you index; match a call across the line breaks rustfmt introduces; and never
987+count braces without skipping string literals.** A scanner column derived from a
988+hand-rolled slice is a hypothesis, not a measurement.
989+
990+## 4. The ledger — 43 sites, handed forward
991+
992+| file:line | gate | count expr before | bucket | candidate | spec_in_scope | disposition |
993+|---|---|---|---|---|---|---|
994+| stream.rs:5631 | `an_svt_screen_palette_block_with_a_split_transform_decodes_exactly` | `decoded.len()` | a | candidate=- | spec_in_scope=- | deferred(bucket a first: count from the PIN) |
995+| stream.rs:10513 | `a_real_aomenc_palette_stream_with_8x8_leaves_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
996+| stream.rs:10732 | `rect_tx_tool_gate` | `decoded.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
997+| stream.rs:10734 | `rect_tx_tool_gate` | `decoded.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
998+| stream.rs:11212 | `a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
999+| stream.rs:11383 | `a_16x4_intrabc_pair_strip_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1000+| stream.rs:11455 | `a_lossless_16x4_chroma_pair_repairs_the_measured_site` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1001+| stream.rs:11838 | `a_coded_rect_intrabc_block_reconstructs_in_both_orientations` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1002+| stream.rs:11981 | `a_coded_rect_intrabc_block_reconstructs_in_both_orientations` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1003+| stream.rs:12224 | `an_sb128_screen_stream_with_intrabc_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1004+| stream.rs:12226 | `an_sb128_screen_stream_with_intrabc_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1005+| stream.rs:12612 | `a_sub8_leaf_census_over_intrabc_screen_streams_measures_the_sub8_refusal` | `frames.len()` | c | candidate=- | spec_in_scope=- | report-only (census/probe asserts no verdict) |
1006+| stream.rs:12687 | `an_intrabc_vartx_census_measures_the_mixed_leaf_refusal` | `frames.len()` | c | candidate=- | spec_in_scope=- | report-only (census/probe asserts no verdict) |
1007+| stream.rs:12791 | `a_real_aomenc_intrabc_mixed_vartx_tree_decodes_without_the_mixed_leaf_refusal` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1008+| stream.rs:13093 | `an_intrabc_block_under_tx_mode_select_decodes_pixel_exact` | `frames.len()` | ? | candidate=- | spec_in_scope=- | UNCLASSIFIED - needs a reader |
1009+| stream.rs:13154 | `a_real_aomenc_stream_with_cdf_update_disabled_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1010+| stream.rs:13360 | `a_real_aomenc_rect_strip_palette_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1011+| stream.rs:13362 | `a_real_aomenc_rect_strip_palette_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1012+| stream.rs:15497 | `first_diff` | `decoded.len()` | c | candidate=- | spec_in_scope=- | report-only (census/probe asserts no verdict) |
1013+| stream.rs:27636 | `a_real_aomenc_stream_with_a_coded_rect_strip_below_16x16_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1014+| stream.rs:27764 | `a_real_aomenc_stream_whose_square_block_reads_a_sub16_neighbours_mode_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1015+| stream.rs:27933 | `a_real_aomenc_stream_whose_chroma_edge_filter_reads_a_sub16_neighbours_uv_mode_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1016+| stream.rs:27935 | `a_real_aomenc_stream_whose_chroma_edge_filter_reads_a_sub16_neighbours_uv_mode_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1017+| stream.rs:28129 | `a_real_aomenc_sb128_stream_whose_skipped_cfl_and_1to4_chroma_pairs_decode_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1018+| stream.rs:28131 | `a_real_aomenc_sb128_stream_whose_skipped_cfl_and_1to4_chroma_pairs_decode_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1019+| stream.rs:28456 | `a_real_aomenc_stream_with_ab_partitions_below_16x16_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1020+| stream.rs:28458 | `a_real_aomenc_stream_with_ab_partitions_below_16x16_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1021+| stream.rs:28609 | `sweep_rectx_recipes` | `frames.len()` | c | candidate=- | spec_in_scope=- | report-only (census/probe asserts no verdict) |
1022+| stream.rs:29212 | `a_real_aomenc_stream_with_a_32_level_ab_partition_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1023+| stream.rs:30646 | `a_real_aomenc_stream_with_restoration_reads_lr_symbols_correctly` | `pics.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1024+| stream.rs:30744 | `a_real_aomenc_stream_with_restoration_reads_lr_symbols_correctly` | `pics.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1025+| stream.rs:38033 | `edge32_gate` | `decoded.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1026+| stream.rs:38035 | `edge32_gate` | `decoded.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1027+| stream.rs:41761 | `a_real_aomenc_stream_with_a_coded_strip_whose_chroma_is_a_4to1_or_sub8_rect_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1028+| stream.rs:41763 | `a_real_aomenc_stream_with_a_coded_strip_whose_chroma_is_a_4to1_or_sub8_rect_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1029+| stream.rs:41998 | `the_chroma_rect_gates_excluded_seed_46_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1030+| stream.rs:42000 | `the_chroma_rect_gates_excluded_seed_46_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1031+| stream.rs:42167 | `a_real_aomenc_band_stream_seed46_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1032+| stream.rs:42169 | `a_real_aomenc_band_stream_seed46_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1033+| stream.rs:42376 | `a_real_aomenc_stream_whose_frame_edge_partition_bit_is_horz_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1034+| stream.rs:42378 | `a_real_aomenc_stream_whose_frame_edge_partition_bit_is_horz_decodes_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=- | deferred(bucket b: count from the ENCODER) |
1035+| stream.rs:42602 | `a_real_aomenc_rect_inter_block_predicts_chroma_with_the_narrow_kernel_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=FRAMES | deferred(bucket b: count from the ENCODER) |
1036+| stream.rs:42604 | `a_real_aomenc_rect_inter_block_predicts_chroma_with_the_narrow_kernel_pixel_exact` | `frames.len()` | b | candidate=- | spec_in_scope=FRAMES | deferred(bucket b: count from the ENCODER) |
1037+
1038+TOTALS: a=1 b=37 c=4 ?=1 total=43
1039+
1040+Totals: **a=1, b=37, c=4, ?=1**.
1041+
1042+**The `?` row is genuinely unclassified**, not a guess:
1043+`an_intrabc_block_under_tx_mode_select_decodes_pixel_exact` neither drives aomenc
1044+in its own body nor reads from disk, and is not a probe. It most likely encodes
1045+through a path the helper list does not name. Left as `?` with the reason rather
1046+than assigned a bucket I cannot justify.
1047+
1048+**Per-gate recipe.** Bucket **a** first (1 site): take the count from the pinned
1049+stream's recorded frame count or a length assert on the pinned bytes. Then bucket
1050+**b** (37 sites): bind the encoder's frame count to a named const at the encode
1051+call and pass that, exactly as `stream.rs:3895` does (`const ENCODED_FRAMES: usize
1052+= 40;` from its own `encode_aomenc_stream(source, w, h, 40, …)`). Where the encode
1053+is inside a `cq`/`depth` loop, the count is the helper's frame-count argument and
1054+must be read from that call — the sweep's `candidate` column resolves for only one
1055+gate, which is exactly why these were not bulk-edited. Bucket **c**: leave; a
1056+census reports and asserts no verdict, so a wrong count there is not a wrong count.
1057+
1058+**DISPOSITION: deferred(needs a lane that classifies by READING each gate, bucket a
1059+then bucket b).** Not a merge blocker: with `frame_count_diagnosis` in place, a
1060+wrong count is now loud and self-explaining, so the 43 are diagnosable rather than
1061+mysterious.
1062+
1063+## 5. The guard, generalized
1064+
1065+The r7 anchor asserted one literal (`pictures.len()`) at the fixed gate, which
1066+would go quiet as other sites are fixed. It now asserts the **general** rule:
1067+
1068+* no **decode-derived** count (`pictures.len()` / `decoded.len()` / `frames.len()`)
1069+ may reappear at the gate r7 fixed, under any binding name; and
1070+* an **unpinned ceiling** of 43 — a NEW site is an immediate red, and the ceiling
1071+ is lowered as sites are actually fixed.
1072+
1073+The `>= 40` floor on total sites stays, so the class cannot shrink unnoticed.