lanes/av1pins r7: the bucket table, the one fix, and 38 handed back
Browse files at this commit572204be8fc5a8b8c0b54ccfc1c9233a7f3f6e74Parent: 862cfda1 changed file +95 -0
- lanes/av1pins.report.md +95 -0
lanes/av1pins.report.mdmodified+95 -0
| @@ -829,3 +829,98 @@ worse than no column** — because a 44-row table built on it would send a lane | ||
| 829 | 829 | after the wrong gates. Two of the four bugs in this lane's scanners were exactly |
| 830 | 830 | this: a slice that stopped at `len()`'s own paren, and a brace count that did not |
| 831 | 831 | skip string literals. |
| 832 | + | |
| 833 | +--- | |
| 834 | + | |
| 835 | +# r7 — classify by reading, fix the first, hand back 38 | |
| 836 | + | |
| 837 | +Branch `lane-av1pins5`. Commit `71afc8c9`. Tests and test helpers only. Not | |
| 838 | +pushed. **Canonical branch: `lane-av1pins5`**; `av1pinslive` is dropped. | |
| 839 | + | |
| 840 | +## 1. The classification, printed per site so it is auditable | |
| 841 | + | |
| 842 | +The sweep now emits, on every run: | |
| 843 | + | |
| 844 | +``` | |
| 845 | +ROW <line> | <gate> | <count expr> | bucket | candidate | spec_in_scope | <reason> | pixel_comparing | |
| 846 | +``` | |
| 847 | + | |
| 848 | +| bucket | sites | rule | | |
| 849 | +|---|---|---| | |
| 850 | +| **b** | 37 | live aomenc encode → the count belongs to the **encoder** | | |
| 851 | +| **a** | 1 | stream read from disk → the count belongs to the **pin** | | |
| 852 | +| **c** | 4 | census/probe → report only, never fix | | |
| 853 | +| **?** | 1 | unclassified, **with the reason printed** rather than a guess | | |
| 854 | + | |
| 855 | +Each gate is classified from its own body, over a **string-aware** extent. Two | |
| 856 | +details that changed the answer: 21 of the bucket-b gates encode through a | |
| 857 | +*helper* (`screen_intrabc_stream_at_depth`, `run_multi_tile_gate`, `edge32_gate`, | |
| 858 | +`rect_tx_tool_gate`, …) rather than calling `aomenc_path()` directly, so a first | |
| 859 | +pass that only looked for `aomenc_path()` called six plainly-encoding gates | |
| 860 | +"unclassified". | |
| 861 | + | |
| 862 | +**A third offset bug, same family as the two r6 caught.** The sweep handed its | |
| 863 | +body-walk a **line index** where a **byte offset** was required, so every | |
| 864 | +body-dependent classification read "unclassified" — 40 of 44, all looking like a | |
| 865 | +legitimate result. It is the third time in this lane that a line/byte or | |
| 866 | +slice-boundary confusion has silently produced a plausible clean output. | |
| 867 | + | |
| 868 | +## 2. Fixed: `stream.rs:3895` | |
| 869 | + | |
| 870 | +`a_real_aomenc_segmentation_stream_with_map_inheritance_decodes_pixel_exact`: | |
| 871 | +`ffmpeg_decode_sequence(..., pictures.len())` → `ENCODED_FRAMES` (40), the count | |
| 872 | +its own `encode_aomenc_stream(source, w, h, 40, &extra)` call encodes. Our | |
| 873 | +decode's length is the thing **under test**, so using it as the oracle's expected | |
| 874 | +count was circular. Gate green, 2.05 s, now comparing 40 frames against ffmpeg's | |
| 875 | +40 rather than a self-fulfilling number. | |
| 876 | + | |
| 877 | +**The sweep's "known site" anchor moved with the fix.** It used to assert that | |
| 878 | +`pictures.len()` was still present, which went red the moment the fix landed — a | |
| 879 | +guard that punishes the fix. It now asserts the *opposite* (no site may pass | |
| 880 | +`pictures.len()` again) **and** that the dominant `frames.len()` shape is still | |
| 881 | +found, so the sweep cannot go quiet by either route. | |
| 882 | + | |
| 883 | +## 3. NOT DONE: 38 of the 39 fixable sites | |
| 884 | + | |
| 885 | +The sweep prints a `candidate` — the numeric frame count in the gate's own encode | |
| 886 | +call — and it resolves for exactly **one** gate. The rest encode inside loops or | |
| 887 | +through per-gate helpers whose frame-count argument has to be read per gate, and | |
| 888 | +only 3 of 44 are a clean one-line swap to something already in scope. | |
| 889 | + | |
| 890 | +I am handing those back with the method rather than editing 38 call sites on a | |
| 891 | +guess, for the same reason r6 refused the 44-row table on an untrustworthy column: | |
| 892 | +a plausible-looking bulk edit built on a heuristic I have now shown wrong three | |
| 893 | +times in this lane would send the next reader after the wrong lines. | |
| 894 | + | |
| 895 | +Per-gate recipe for whoever takes it: | |
| 896 | + | |
| 897 | +* **bucket b** — bind the encoder's frame count to a named const at the encode | |
| 898 | + call (`const ENCODED_FRAMES: usize = <n>;`) and pass that to | |
| 899 | + `ffmpeg_decode_sequence`, exactly as `stream.rs:3895` now does. Where the | |
| 900 | + encode is inside a loop over `cq`/`depth`, the count is the helper's frame-count | |
| 901 | + argument and must be read from that call. | |
| 902 | +* **bucket a** — the count is the pinned stream's; take it from the pin's recorded | |
| 903 | + frame count or a length assert on the pinned bytes, not from `decode_stream`. | |
| 904 | +* **bucket c** — leave. A census reports; it asserts no verdict, so a wrong count | |
| 905 | + there is not a wrong count. | |
| 906 | + | |
| 907 | +The sweep prints the full 44-row table on every run, so the ledger cannot drift | |
| 908 | +from the source, and the `>= 40` floor plus the two-direction anchor stop the | |
| 909 | +class from quietly shrinking or from being "fixed" away. | |
| 910 | + | |
| 911 | +## 4. State | |
| 912 | + | |
| 913 | +`lane-av1pins5`, five commits on top of `2e5509e9`. `cargo check -p ec-av1 | |
| 914 | +--all-targets` clean, **0 warnings**. `gate_coverage` 15, `refusal_inventory` 15, | |
| 915 | +`count_vacuity` 2, `pin_inventory` 3, and the fixed gate all green. `#[ignore]` | |
| 916 | +unchanged at 34. Lane-scoped `CARGO_TARGET_DIR` with touch-first, per the | |
| 917 | +observation that the shared target dir served another worktree's binary. | |
| 918 | + | |
| 919 | +Not verified: a full `cargo test -p ec-av1` run (project-wide validation is | |
| 920 | +Main's). | |
| 921 | + | |
| 922 | +The rule r7 adds: **a scanner that classifies by reading must print its | |
| 923 | +reasoning per row.** Every unclassifiable row in this table carries the sentence | |
| 924 | +that disqualified it, so a reader can disagree with a bucket instead of | |
| 925 | +inheriting it — and the one `?` in the table is more useful than a confident | |
| 926 | +guess would have been. |