diff --git a/lanes/av1fixlib.report.md b/lanes/av1fixlib.report.md index e5d310d2..3a805894 100644 --- a/lanes/av1fixlib.report.md +++ b/lanes/av1fixlib.report.md @@ -258,21 +258,34 @@ That is the measured blind spot, not a sync failure. - `pinned_lr_sgr_stream_call_unique_dump` stays `#[ignore]`d for a true reason: it prints per-frame mismatch counts and asserts nothing. -## 6. Open, and owned elsewhere - -Two code-shape violations in `crates/ec-av1`, named on every preflight run and -fatal under `EC_FIXTURE_SHAPE_STRICT=1`: - -- `stream.rs` — `pinned_lr_sgr_stream_call_unique_dump` reads - `/../../fixtures/lr-sgr-r7.obu` through the gitignored root although that pin - is now committed crate-local. One-line fix: `crate_pin("lr-sgr-r7.obu")`. -- `stream.rs` — `pinned_warp_stream_decodes_pixel_exact`, fourteen pins to commit - under `crates/ec-av1/fixtures/` and read through the pin helper, or the gate - stays a no-op. - -The four pins recovered this session (`golden4-pin.obu` 137 B `1754023e…`, -`golden6-mismatch.obu` 452 B `c56909b9…`, `golden7-forwarding-mismatch.obu` 152 B -`81b3bf65…`, `lr-sgr-r7.obu` 192 B `6b95b20e…`) are committed here with -`recovered-original` provenance; they lived only in the gitignored root, i.e. -only in each machine's scratchpad. That recovery is where `committed=7` comes -from. +## 6. The two shape violations: what they were, and who fixed them + +A CORRECTION to an earlier version of this section, because a report naming an +already-fixed gate sends the next reader to the wrong file. + +- `pinned_lr_sgr_stream_call_unique_dump` was named here as reading + `/../../fixtures/lr-sgr-r7.obu`. **It does not.** At the base this was measured + on, that gate already read `crate_pin("lr-sgr-r7.obu")` (`stream.rs:30519`) + and the pin is committed at `crates/ec-av1/fixtures/lr-sgr-r7.obu`. +- The only invariant-1 hit in the tree was a **DOC COMMENT** inside + `pinned_golden7_stream_decodes_pixel_exact` that reproduces the forbidden + literal verbatim while explaining the shape it removed. A `grep` cannot tell + prose from code. The comment is correct and stays; the scanner was wrong. +- The one real violation was `pinned_warp_stream_decodes_pixel_exact` + (`stream.rs:31386`): the `/../../fixtures` directory literal plus a 14-name + runtime list, none of the fourteen committed under the crate. + +All of it is closed as of `53b851a7` (merging Agent01-5's `2364d7a7`): the warp +gate's fourteen pins — `warp-mismatch`, `warp-flake-5`, `warp-flake-7`, +`ii-flake-1/2/3/5/6/7/8/9`, `rect-flake-1/2/3` — are committed under +`crates/ec-av1/fixtures/` and each is read through `crate_pin` with a string +literal, and the gate is no longer `#[ignore]`d because a plain run proves it +executes (`warp_selected_hits` 0 → 113, 1 passed in 1.8 s plus ffmpeg). Census +after the fix: `total=8 committed=21 uncommitted=0 ignored=0 assertless=0`, +`code-shape violations: 0`, and shape is fatal by default. + +The four pins recovered earlier in this lane (`golden4-pin.obu` 137 B +`1754023e…`, `golden6-mismatch.obu` 452 B `c56909b9…`, +`golden7-forwarding-mismatch.obu` 152 B `81b3bf65…`, `lr-sgr-r7.obu` 192 B +`6b95b20e…`) are committed with `recovered-original` provenance; they lived only +in the gitignored root, i.e. only in each machine's scratchpad. diff --git a/scripts/pin-gate-audit.py b/scripts/pin-gate-audit.py index 818c0c3b..f21404e7 100755 --- a/scripts/pin-gate-audit.py +++ b/scripts/pin-gate-audit.py @@ -125,15 +125,20 @@ def main(): for line, name, body, attrs in fn_bodies(text): if not any(a.startswith("#[test") for a in attrs): continue + # Match every shape on a COMMENT-STRIPPED body. A doc comment that + # reproduces a root literal to explain the shape it removed used to + # invent a gate here, the same blindness invariant 1 had. + code = re.sub(r"/\*.*?\*/", "", body, flags=re.S) + code = "\n".join(l.split("//", 1)[0] for l in code.splitlines()) root_lit = None root_kind = "none" var = None - m = ROOT_RE.search(body) + m = ROOT_RE.search(code) if m: root_lit, var = m.group(1), None root_kind = "concat!" else: - m = JOIN_RE.search(body) + m = JOIN_RE.search(code) if m: joined = re.findall(r'\.join\("([^"]*)"\)', m.group(0)) root_lit = "".join(joined) @@ -143,30 +148,29 @@ def main(): # the census counts every pin-reading gate, not only the ones # reached through a root literal. ign_s = "yes" if any("ignore" in a for a in attrs) else "no" - singles = re.findall(r'crate_pin\(\s*"([^"]+)"', body) + singles = re.findall(r'crate_pin\(\s*"([^"]+)"', code) # A gate that builds the pin name at runtime (crate_pin(&format!(..))) # matches no single-name shape and would VANISH from the census -- # the same blind spot in a new place. Surface it instead. - for dyn_call in re.findall(r'crate_pin\(\s*&?\s*(?!")', body): + for dyn_call in re.findall(r'crate_pin\(\s*&?\s*(?!")', code): print("BADCALL\t{}\t{}\tcrate_pin argument is not a string literal: {}" .format("{}:{}".format(rel, line), name, dyn_call.strip()[:60])) bad.append("BADROW\t{}\t{}\tcrate_pin\tname built at runtime -- this census " "cannot resolve it, so the gate is UNPROVEN here".format( "{}:{}".format(rel, line), name)) singles += re.findall( - r'pin_dir\(\)\.join\(\s*"([^"]+)"', body) + r'pin_dir\(\)\.join\(\s*"([^"]+)"', code) if not singles: continue total += 1 if ign_s == "yes": ignored += 1 + print("GATE\t{}\t{}\tcrate_pin\tyes\t{}\t{}".format( + "{}:{}".format(rel, line), name, ign_s, len(singles))) for n in singles: committed_rel = "crates/{}/fixtures/{}".format(crate, n) present = os.path.isfile(os.path.join(ROOT, committed_rel)) tr = tracked(committed_rel) if present else "no" - total_names = 1 - print("GATE\t{}\t{}\tcrate_pin\tyes\t{}\t{}".format( - "{}:{}".format(rel, line), name, ign_s, len(singles))) print("NAME\t{}\t{}\t{}\t{}\t{}\t{}".format( "{}:{}".format(rel, line), name, n, "present" if present else "absent", tr, "yes")) @@ -182,7 +186,7 @@ def main(): v = re.search( r'let\s+([a-z_0-9]+)\s*=\s*(?:concat!\(\s*env!\("CARGO_MANIFEST_DIR"\)|' r'Path::(?:new|buf_from)\(\s*env!\("CARGO_MANIFEST_DIR"\)\s*\)\s*(?:\.join\("[^"]*"\)\s*)+)', - body, + code, ) if v: var = v.group(1) @@ -211,7 +215,7 @@ def main(): for n in items: names.append((n, ext)) if not names: - lit = re.search(r'"(/[A-Za-z0-9._/-]+\.[A-Za-z0-9]+)"', body) + lit = re.search(r'"(/[A-Za-z0-9._/-]+\.[A-Za-z0-9]+)"', code) # a lane dump under lanes/ is not a fixture and is not this gate if lit and "/fixtures/" in lit.group(1): names.append((os.path.basename(lit.group(1)), "")) @@ -219,10 +223,10 @@ def main(): continue # assertion classification through the CALL GRAPH - asserts = "assert" in body + asserts = "assert" in code via = "" if not asserts: - for h in HELPER_RE.findall(body): + for h in HELPER_RE.findall(code): hb = helpers.get(h) if hb and "assert" in hb: asserts = True diff --git a/scripts/verify-fixture-library.sh b/scripts/verify-fixture-library.sh index 99910e7d..fa5e87e6 100755 --- a/scripts/verify-fixture-library.sh +++ b/scripts/verify-fixture-library.sh @@ -205,6 +205,32 @@ for crate in sorted(os.listdir(os.path.join(root, "crates"))): print("{}:{}:{}".format(os.path.relpath(p, root), i, line.strip())) PYEOF ) +# POSITIVE CONTROL. A comment-stripping bug makes this scan match NOTHING, and +# "no violations" would then be indistinguishable from a scanner that is blind. +# So before trusting the result, plant a known forbidden literal in a scratch +# file and require the scanner to catch it. A scanner that cannot find a literal +# it is looking at is broken, not clean. +control=$(mktemp --suffix=.rs) +printf 'fn probe() { let _ = concat!(env!("CARGO_MANIFEST_DIR"), "/../../fixtures/control.obu"); }\n' >"$control" +control_hit=$(python3 - "$ROOT" "$control" <<'PYEOF' +import re, sys +pat = re.compile(r'concat!\(\s*env!\("CARGO_MANIFEST_DIR"\)\s*,\s*"/\.\./\.\./fixtures/[^/"]*\.') +text = open(sys.argv[2], encoding="utf-8", errors="replace").read() +text = re.sub(r"/\*.*?\*/", "", text, flags=re.S) +print("1" if any(pat.search(l.split("//", 1)[0]) for l in text.splitlines()) else "0") +PYEOF +) +rm -f "$control" +if [ "$control_hit" != 1 ]; then + echo "FAIL [invariant 1]: the scanner's own positive control did not fire -- the" >&2 + echo " comment-stripping pass is broken, so 'no violations' would be a" >&2 + echo " silent all-clear. Fix the scanner before trusting its verdict." >&2 + shape_fail=1 + fail=1 +else + note " invariant 1: positive control fired (the scanner can still see a literal)" +fi + if [ -n "$forbidden" ]; then if [ "$SHAPE" != 0 ]; then echo "FAIL [invariant 1]: a committed pin is reached through the gitignored root" >&2