report: correct the wrong-gate attribution, and close the last census blind spot
Browse files at this commit3371138c4a1e96605beb572579be7242f9b3561eParent: 59fe5593 changed files +73 -30
- lanes/av1fixlib.report.md +31 -18
- scripts/pin-gate-audit.py +16 -12
- scripts/verify-fixture-library.sh +26 -0
lanes/av1fixlib.report.mdmodified+31 -18
| @@ -258,21 +258,34 @@ That is the measured blind spot, not a sync failure. | |||
| 258 | - `pinned_lr_sgr_stream_call_unique_dump` stays `#[ignore]`d for a true reason: | 258 | - `pinned_lr_sgr_stream_call_unique_dump` stays `#[ignore]`d for a true reason: |
| 259 | it prints per-frame mismatch counts and asserts nothing. | 259 | it prints per-frame mismatch counts and asserts nothing. |
| 260 | 260 | ||
| 261 | -## 6. Open, and owned elsewhere | 261 | +## 6. The two shape violations: what they were, and who fixed them |
| 262 | - | 262 | + |
| 263 | -Two code-shape violations in `crates/ec-av1`, named on every preflight run and | 263 | +A CORRECTION to an earlier version of this section, because a report naming an |
| 264 | -fatal under `EC_FIXTURE_SHAPE_STRICT=1`: | 264 | +already-fixed gate sends the next reader to the wrong file. |
| 265 | - | 265 | + |
| 266 | -- `stream.rs` — `pinned_lr_sgr_stream_call_unique_dump` reads | 266 | +- `pinned_lr_sgr_stream_call_unique_dump` was named here as reading |
| 267 | - `/../../fixtures/lr-sgr-r7.obu` through the gitignored root although that pin | 267 | + `/../../fixtures/lr-sgr-r7.obu`. **It does not.** At the base this was measured |
| 268 | - is now committed crate-local. One-line fix: `crate_pin("lr-sgr-r7.obu")`. | 268 | + on, that gate already read `crate_pin("lr-sgr-r7.obu")` (`stream.rs:30519`) |
| 269 | -- `stream.rs` — `pinned_warp_stream_decodes_pixel_exact`, fourteen pins to commit | 269 | + and the pin is committed at `crates/ec-av1/fixtures/lr-sgr-r7.obu`. |
| 270 | - under `crates/ec-av1/fixtures/` and read through the pin helper, or the gate | 270 | +- The only invariant-1 hit in the tree was a **DOC COMMENT** inside |
| 271 | - stays a no-op. | 271 | + `pinned_golden7_stream_decodes_pixel_exact` that reproduces the forbidden |
| 272 | - | 272 | + literal verbatim while explaining the shape it removed. A `grep` cannot tell |
| 273 | -The four pins recovered this session (`golden4-pin.obu` 137 B `1754023e…`, | 273 | + prose from code. The comment is correct and stays; the scanner was wrong. |
| 274 | -`golden6-mismatch.obu` 452 B `c56909b9…`, `golden7-forwarding-mismatch.obu` 152 B | 274 | +- The one real violation was `pinned_warp_stream_decodes_pixel_exact` |
| 275 | -`81b3bf65…`, `lr-sgr-r7.obu` 192 B `6b95b20e…`) are committed here with | 275 | + (`stream.rs:31386`): the `/../../fixtures` directory literal plus a 14-name |
| 276 | -`recovered-original` provenance; they lived only in the gitignored root, i.e. | 276 | + runtime list, none of the fourteen committed under the crate. |
| 277 | -only in each machine's scratchpad. That recovery is where `committed=7` comes | 277 | + |
| 278 | -from. | 278 | +All of it is closed as of `53b851a7` (merging Agent01-5's `2364d7a7`): the warp |
| 279 | +gate's fourteen pins — `warp-mismatch`, `warp-flake-5`, `warp-flake-7`, | ||
| 280 | +`ii-flake-1/2/3/5/6/7/8/9`, `rect-flake-1/2/3` — are committed under | ||
| 281 | +`crates/ec-av1/fixtures/` and each is read through `crate_pin` with a string | ||
| 282 | +literal, and the gate is no longer `#[ignore]`d because a plain run proves it | ||
| 283 | +executes (`warp_selected_hits` 0 → 113, 1 passed in 1.8 s plus ffmpeg). Census | ||
| 284 | +after the fix: `total=8 committed=21 uncommitted=0 ignored=0 assertless=0`, | ||
| 285 | +`code-shape violations: 0`, and shape is fatal by default. | ||
| 286 | + | ||
| 287 | +The four pins recovered earlier in this lane (`golden4-pin.obu` 137 B | ||
| 288 | +`1754023e…`, `golden6-mismatch.obu` 452 B `c56909b9…`, | ||
| 289 | +`golden7-forwarding-mismatch.obu` 152 B `81b3bf65…`, `lr-sgr-r7.obu` 192 B | ||
| 290 | +`6b95b20e…`) are committed with `recovered-original` provenance; they lived only | ||
| 291 | +in the gitignored root, i.e. only in each machine's scratchpad. | ||
scripts/pin-gate-audit.pymodified+16 -12
| @@ -125,15 +125,20 @@ def main(): | |||
| 125 | for line, name, body, attrs in fn_bodies(text): | 125 | for line, name, body, attrs in fn_bodies(text): |
| 126 | if not any(a.startswith("#[test") for a in attrs): | 126 | if not any(a.startswith("#[test") for a in attrs): |
| 127 | continue | 127 | continue |
| 128 | + # Match every shape on a COMMENT-STRIPPED body. A doc comment that | ||
| 129 | + # reproduces a root literal to explain the shape it removed used to | ||
| 130 | + # invent a gate here, the same blindness invariant 1 had. | ||
| 131 | + code = re.sub(r"/\*.*?\*/", "", body, flags=re.S) | ||
| 132 | + code = "\n".join(l.split("//", 1)[0] for l in code.splitlines()) | ||
| 128 | root_lit = None | 133 | root_lit = None |
| 129 | root_kind = "none" | 134 | root_kind = "none" |
| 130 | var = None | 135 | var = None |
| 131 | - m = ROOT_RE.search(body) | 136 | + m = ROOT_RE.search(code) |
| 132 | if m: | 137 | if m: |
| 133 | root_lit, var = m.group(1), None | 138 | root_lit, var = m.group(1), None |
| 134 | root_kind = "concat!" | 139 | root_kind = "concat!" |
| 135 | else: | 140 | else: |
| 136 | - m = JOIN_RE.search(body) | 141 | + m = JOIN_RE.search(code) |
| 137 | if m: | 142 | if m: |
| 138 | joined = re.findall(r'\.join\("([^"]*)"\)', m.group(0)) | 143 | joined = re.findall(r'\.join\("([^"]*)"\)', m.group(0)) |
| 139 | root_lit = "".join(joined) | 144 | root_lit = "".join(joined) |
| @@ -143,30 +148,29 @@ def main(): | |||
| 143 | # the census counts every pin-reading gate, not only the ones | 148 | # the census counts every pin-reading gate, not only the ones |
| 144 | # reached through a root literal. | 149 | # reached through a root literal. |
| 145 | ign_s = "yes" if any("ignore" in a for a in attrs) else "no" | 150 | ign_s = "yes" if any("ignore" in a for a in attrs) else "no" |
| 146 | - singles = re.findall(r'crate_pin\(\s*"([^"]+)"', body) | 151 | + singles = re.findall(r'crate_pin\(\s*"([^"]+)"', code) |
| 147 | # A gate that builds the pin name at runtime (crate_pin(&format!(..))) | 152 | # A gate that builds the pin name at runtime (crate_pin(&format!(..))) |
| 148 | # matches no single-name shape and would VANISH from the census -- | 153 | # matches no single-name shape and would VANISH from the census -- |
| 149 | # the same blind spot in a new place. Surface it instead. | 154 | # the same blind spot in a new place. Surface it instead. |
| 150 | - for dyn_call in re.findall(r'crate_pin\(\s*&?\s*(?!")', body): | 155 | + for dyn_call in re.findall(r'crate_pin\(\s*&?\s*(?!")', code): |
| 151 | print("BADCALL\t{}\t{}\tcrate_pin argument is not a string literal: {}" | 156 | print("BADCALL\t{}\t{}\tcrate_pin argument is not a string literal: {}" |
| 152 | .format("{}:{}".format(rel, line), name, dyn_call.strip()[:60])) | 157 | .format("{}:{}".format(rel, line), name, dyn_call.strip()[:60])) |
| 153 | bad.append("BADROW\t{}\t{}\tcrate_pin\tname built at runtime -- this census " | 158 | bad.append("BADROW\t{}\t{}\tcrate_pin\tname built at runtime -- this census " |
| 154 | "cannot resolve it, so the gate is UNPROVEN here".format( | 159 | "cannot resolve it, so the gate is UNPROVEN here".format( |
| 155 | "{}:{}".format(rel, line), name)) | 160 | "{}:{}".format(rel, line), name)) |
| 156 | singles += re.findall( | 161 | singles += re.findall( |
| 157 | - r'pin_dir\(\)\.join\(\s*"([^"]+)"', body) | 162 | + r'pin_dir\(\)\.join\(\s*"([^"]+)"', code) |
| 158 | if not singles: | 163 | if not singles: |
| 159 | continue | 164 | continue |
| 160 | total += 1 | 165 | total += 1 |
| 161 | if ign_s == "yes": | 166 | if ign_s == "yes": |
| 162 | ignored += 1 | 167 | ignored += 1 |
| 168 | + print("GATE\t{}\t{}\tcrate_pin\tyes\t{}\t{}".format( | ||
| 169 | + "{}:{}".format(rel, line), name, ign_s, len(singles))) | ||
| 163 | for n in singles: | 170 | for n in singles: |
| 164 | committed_rel = "crates/{}/fixtures/{}".format(crate, n) | 171 | committed_rel = "crates/{}/fixtures/{}".format(crate, n) |
| 165 | present = os.path.isfile(os.path.join(ROOT, committed_rel)) | 172 | present = os.path.isfile(os.path.join(ROOT, committed_rel)) |
| 166 | tr = tracked(committed_rel) if present else "no" | 173 | tr = tracked(committed_rel) if present else "no" |
| 167 | - total_names = 1 | ||
| 168 | - print("GATE\t{}\t{}\tcrate_pin\tyes\t{}\t{}".format( | ||
| 169 | - "{}:{}".format(rel, line), name, ign_s, len(singles))) | ||
| 170 | print("NAME\t{}\t{}\t{}\t{}\t{}\t{}".format( | 174 | print("NAME\t{}\t{}\t{}\t{}\t{}\t{}".format( |
| 171 | "{}:{}".format(rel, line), name, n, | 175 | "{}:{}".format(rel, line), name, n, |
| 172 | "present" if present else "absent", tr, "yes")) | 176 | "present" if present else "absent", tr, "yes")) |
| @@ -182,7 +186,7 @@ def main(): | |||
| 182 | v = re.search( | 186 | v = re.search( |
| 183 | r'let\s+([a-z_0-9]+)\s*=\s*(?:concat!\(\s*env!\("CARGO_MANIFEST_DIR"\)|' | 187 | r'let\s+([a-z_0-9]+)\s*=\s*(?:concat!\(\s*env!\("CARGO_MANIFEST_DIR"\)|' |
| 184 | r'Path::(?:new|buf_from)\(\s*env!\("CARGO_MANIFEST_DIR"\)\s*\)\s*(?:\.join\("[^"]*"\)\s*)+)', | 188 | r'Path::(?:new|buf_from)\(\s*env!\("CARGO_MANIFEST_DIR"\)\s*\)\s*(?:\.join\("[^"]*"\)\s*)+)', |
| 185 | - body, | 189 | + code, |
| 186 | ) | 190 | ) |
| 187 | if v: | 191 | if v: |
| 188 | var = v.group(1) | 192 | var = v.group(1) |
| @@ -211,7 +215,7 @@ def main(): | |||
| 211 | for n in items: | 215 | for n in items: |
| 212 | names.append((n, ext)) | 216 | names.append((n, ext)) |
| 213 | if not names: | 217 | if not names: |
| 214 | - lit = re.search(r'"(/[A-Za-z0-9._/-]+\.[A-Za-z0-9]+)"', body) | 218 | + lit = re.search(r'"(/[A-Za-z0-9._/-]+\.[A-Za-z0-9]+)"', code) |
| 215 | # a lane dump under lanes/ is not a fixture and is not this gate | 219 | # a lane dump under lanes/ is not a fixture and is not this gate |
| 216 | if lit and "/fixtures/" in lit.group(1): | 220 | if lit and "/fixtures/" in lit.group(1): |
| 217 | names.append((os.path.basename(lit.group(1)), "")) | 221 | names.append((os.path.basename(lit.group(1)), "")) |
| @@ -219,10 +223,10 @@ def main(): | |||
| 219 | continue | 223 | continue |
| 220 | 224 | ||
| 221 | # assertion classification through the CALL GRAPH | 225 | # assertion classification through the CALL GRAPH |
| 222 | - asserts = "assert" in body | 226 | + asserts = "assert" in code |
| 223 | via = "" | 227 | via = "" |
| 224 | if not asserts: | 228 | if not asserts: |
| 225 | - for h in HELPER_RE.findall(body): | 229 | + for h in HELPER_RE.findall(code): |
| 226 | hb = helpers.get(h) | 230 | hb = helpers.get(h) |
| 227 | if hb and "assert" in hb: | 231 | if hb and "assert" in hb: |
| 228 | asserts = True | 232 | asserts = True |
scripts/verify-fixture-library.shmodified+26 -0
| @@ -205,6 +205,32 @@ for crate in sorted(os.listdir(os.path.join(root, "crates"))): | |||
| 205 | print("{}:{}:{}".format(os.path.relpath(p, root), i, line.strip())) | 205 | print("{}:{}:{}".format(os.path.relpath(p, root), i, line.strip())) |
| 206 | PYEOF | 206 | PYEOF |
| 207 | ) | 207 | ) |
| 208 | +# POSITIVE CONTROL. A comment-stripping bug makes this scan match NOTHING, and | ||
| 209 | +# "no violations" would then be indistinguishable from a scanner that is blind. | ||
| 210 | +# So before trusting the result, plant a known forbidden literal in a scratch | ||
| 211 | +# file and require the scanner to catch it. A scanner that cannot find a literal | ||
| 212 | +# it is looking at is broken, not clean. | ||
| 213 | +control=$(mktemp --suffix=.rs) | ||
| 214 | +printf 'fn probe() { let _ = concat!(env!("CARGO_MANIFEST_DIR"), "/../../fixtures/control.obu"); }\n' >"$control" | ||
| 215 | +control_hit=$(python3 - "$ROOT" "$control" <<'PYEOF' | ||
| 216 | +import re, sys | ||
| 217 | +pat = re.compile(r'concat!\(\s*env!\("CARGO_MANIFEST_DIR"\)\s*,\s*"/\.\./\.\./fixtures/[^/"]*\.') | ||
| 218 | +text = open(sys.argv[2], encoding="utf-8", errors="replace").read() | ||
| 219 | +text = re.sub(r"/\*.*?\*/", "", text, flags=re.S) | ||
| 220 | +print("1" if any(pat.search(l.split("//", 1)[0]) for l in text.splitlines()) else "0") | ||
| 221 | +PYEOF | ||
| 222 | +) | ||
| 223 | +rm -f "$control" | ||
| 224 | +if [ "$control_hit" != 1 ]; then | ||
| 225 | + echo "FAIL [invariant 1]: the scanner's own positive control did not fire -- the" >&2 | ||
| 226 | + echo " comment-stripping pass is broken, so 'no violations' would be a" >&2 | ||
| 227 | + echo " silent all-clear. Fix the scanner before trusting its verdict." >&2 | ||
| 228 | + shape_fail=1 | ||
| 229 | + fail=1 | ||
| 230 | +else | ||
| 231 | + note " invariant 1: positive control fired (the scanner can still see a literal)" | ||
| 232 | +fi | ||
| 233 | + | ||
| 208 | if [ -n "$forbidden" ]; then | 234 | if [ -n "$forbidden" ]; then |
| 209 | if [ "$SHAPE" != 0 ]; then | 235 | if [ "$SHAPE" != 0 ]; then |
| 210 | echo "FAIL [invariant 1]: a committed pin is reached through the gitignored root" >&2 | 236 | echo "FAIL [invariant 1]: a committed pin is reached through the gitignored root" >&2 |