forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on c4b999cc9cc2da93ec20faabcbcaf121c130405aFiltered to scripts/pin-gate-audit.pyClear filter

2026-09-29

scripts: plant the raw-string shape in the pin audit's own self-testAhmet Kaan Gümüş · c1b62f2
scripts: plant the raw-string shape in the pin audit's own self-test

Closes the not-done from lane-av1pinauditfix: --self-test planted only the
PROSE shape, so the new rule's negative control rested on the live tree's
11 -> 9 / 4 -> 0 count change instead of on a committed case. A mask
regression would have gone unnoticed.

A third synthetic gate embeds a raw string containing a synthetic gate that
reproduces the forbidden root literal -- the exact shape pin_inventory_tests
has in the real tree, and the one that made the audit red on a tree with no
real violation in it.

The phantom carries the `selftest_` prefix ON PURPOSE. self_test skips any fn
whose name does not start with selftest_, so a differently-named phantom would
be filtered out and the control would pass for the wrong reason. With the
prefix a broken mask makes the phantom appear as a row and the control fails.

Three assertions: the real gate is present and still crate_pin; the phantom
gate is absent from the rows; and no row's pin names contain `phantom`.

Mutation -- mask disabled in read_source:
  SELFTEST  selftest_phantom_inside_a_raw_string  root-literal
  SELFTEST  FAIL  phantom_gate_counted=[('selftest_phantom_inside_a_raw_string',
            'root-literal', ...)]
  selftest_exit=1
which also shows a second symptom: the real gate's name list goes EMPTY,
because fn_bodies attributed the raw string's `fn` and cut its body short.
Restored, both are green again.

Green:
  SELFTEST  PASS  a doc comment between two gates left both counted as
                    crate_pin, and a raw-string input did not become a gate
  selftest_exit=0
  pin gates: total=9 committed=22 uncommitted=0 ignored=0 assertless=0
  pin_audit_exit=0 state=GREEN
  VERDICT=GREEN

total=9 uncommitted=0 is unchanged from 5da8b247: the control runs entirely in
the self-test's temp crate and adds no gate to the census of the real tree.
scripts: the pin-gate audit must not read its own test dataAhmet Kaan Gümüş · 4c07cbc
scripts: the pin-gate audit must not read its own test data

The pin audit has been RED on every tree since 35deab68 (2026-09-29), which
added pin_inventory_tests' synthetic capability-test gate: an r#"..."# whose
body is a synthetic gate reproducing the forbidden /../../fixtures root, fed
to pins_read as DATA. Both scanners read it as CODE --

  * verify-fixture-library.sh invariant 1: a line regex over the whole file
  * scripts/pin-gate-audit.py invariant 4: worse, fn_bodies finds `fn` lines
    BY REGEX, so `fn a_gate_using_the_old_shape()` inside the raw string is
    attributed as a real gate and its body is classified

This is the mirror of the class this script already fixed for prose (a doc
comment reproducing a root literal invented a gate). Comments were stripped;
embedded SOURCE was not.

THE RULE, general and not a path allowlist: a match inside a string literal
that SPANS LINES is not a gate. Rust has no line-spanning non-raw string, so
such a literal is embedded source -- a scanner test's input or a doc blob --
while a real pin read names its path in a one-line literal.

It cannot hide a real violation: a non-raw literal aborts at the first newline,
so it can only blank within one line, and a one-line literal holds no Rust
source. A char literal is recognised only when it closes within three chars, so
a LIFETIME (&'a str) is not mistaken for a string start.

Implemented once, in pin-gate-audit.py (mask_embedded_source / read_source /
code_of); invariant 1 IMPORTS it rather than carrying a second copy, because
the two checks must not disagree about what counts as a gate. read_source masks
at FILE level -- fn_bodies' regex `fn` scan is what resurrects the raw string,
so masking after attribution is already too late.

Before: total=11 uncommitted=4, four BADROW/BARDIR lines naming
  gate_coverage.rs:1927 a_gate_using_the_old_shape
  gate_coverage.rs:1966 shapes
After:  total=9  uncommitted=0
  pin_audit_exit=0 state=GREEN
  VERDICT=GREEN

Controls, both directions:
  * a REAL /../../fixtures read in a real gate body still reds, named:
      crates/ec-av1/src/zz_control_probe.rs:2:a_real_gate_reading_through_...
      concat!  1/1 pin(s) not committed+tracked, e.g. control-obu.obu
  * the rustfmt-SPLIT form of that same real violation still reds (invariant 4)
  * --self-test PASS, unchanged: a doc comment between two gates left both
    counted as crate_pin

The RED was PRE-EXISTING: 35deab68 is red, its parent ec4e9528 is green.
census: comment-stripped matching plus a self-test in the shape that cost a gateAhmet Kaan Gümüş · 3972653
census: comment-stripped matching plus a self-test in the shape that cost a gate

The strip was real but landed in 2b4ecf71, not in the commit I told Agent01-5 it
was in, so their measurement against 12cae635 was accurate for that tree: a doc
comment belonging to the NEXT gate lands inside the previous gate's body (fn_bodies
spans fn-line to next-fn-line), ROOT_RE matched the comment, the gate was
reclassified into the root-literal branch, found no names and hit continue. The
census count dropped and NOTHING went red -- unproven read as clean.

Two things close that door:
  - every search (ROOT_RE, JOIN_RE, the crate_pin/pin_dir singles, the asserts
    check) matches on a comment-stripped body, /* */ and // and /// alike;
  - scripts/pin-gate-audit.py --self-test is a POSITIVE CONTROL in the exact
    shape: a comment reproducing the forbidden literal INSIDE a gate that reads
    crate_pin, plus a second gate after it. It runs the real pipeline over a
    synthetic tree in a temp dir, so it works on a read-only staged tree, and it
    asserts BOTH gates are still counted as crate_pin. The verifier runs it and
    fails if it does not pass.
    MUTATION-PROVED: with the stripping removed from the self-test path it fails
    with reclassified=[('selftest_a_reads_a_pin', 'root-literal')]; restored, it
    passes. A control that only proved 'the scanner finds a forbidden literal'
    would NOT have caught this, which is why it is a separate control.

Re-measured with the verbatim prose restored (the state that ships): census
total=8 committed=21 uncommitted=0 ignored=0 assertless=0, code-shape violations
0, both positive controls firing, verify GREEN (303 rows).
report: correct the wrong-gate attribution, and close the last census blind spotAhmet Kaan Gümüş · 3371138
report: correct the wrong-gate attribution, and close the last census blind spot

An earlier version of section 6 named pinned_lr_sgr_stream_call_unique_dump as
reading /../../fixtures/lr-sgr-r7.obu. It does not: at that base the gate already
read crate_pin("lr-sgr-r7.obu"). The only invariant-1 hit in the tree was a DOC
COMMENT inside pinned_golden7_stream_decodes_pixel_exact reproducing the literal
verbatim while explaining the shape it removed -- prose, not code, and a report
that names the wrong gate sends the next reader to the wrong file. The real
violation was the warp gate, closed by Agent01-5's 2364d7a7.

Also: the census printed one GATE row per NAME in the crate_pin branch (21 rows
for 8 gates) while COUNT total=8 was the real number. One row per gate now, and
one per name on the NAME rows where the detail belongs.
flip shape to fatal by default: both live violations are closedAhmet Kaan Gümüş · 59fe559
flip shape to fatal by default: both live violations are closed

Agent01-5's 2364d7a7 (merged) closed both crates/ec-av1 shape violations -- the
root pin reads crate_pin("lr-sgr-r7.obu"), and all fourteen warp pins are
committed under crates/ec-av1/fixtures/ and read through the pin helper, which
also un-ignores the gate. EC_REQUIRE_FIXTURES=1 scripts/verify-fixture-library.sh
is now GREEN (303 rows) with shape fatal by default: SHAPE=:-1. --strict and
EC_FIXTURE_SHAPE_STRICT=0 are the escape hatches.

Three defects this lane's own preflight had, each found by running it somewhere
other than its own tree, each the class the lane exists to prevent:
  - off-git the tracked column was recomputed as no-git for all 37 pin rows, so
    every host reported DRIFT with a good library;
  - invariant 1 could not see a comment -- a doc comment reproducing the
    forbidden literal to explain the fix read as a live violation for a round;
    it now strips comments before matching;
  - the census's single-name branch neither counted ignored nor noticed a
    crate_pin whose name is built at runtime, so such a gate vanished silently;
    it now counts ignored and emits a BADCALL row the preflight fails on.

Five modes re-measured after the flip: A 0, B 1, C 0, D 1, E 0 (was 1), and F --
a reintroduced concat! root-pin line -- 1 with no flag at all.
preflight rework: path-free generated header, reproducible artifact, split exit statusAhmet Kaan Gümüş · e6d595d
preflight rework: path-free generated header, reproducible artifact, split exit status

Review findings, fixed:
1. The generated header carried the AUTHORING WORKTREE's absolute path. A
   generated artefact is exactly how a host path slips past the commit-message
   scan, so the header now says only 'FIXTURE ROOT: worktree-relative' and
   resolves through EC_FIXTURES at run time. No absolute path remains anywhere
   in scripts/fixture-library.tsv.
2. The tsv carried three '(named absent pin)' rows the generator never emits --
   the post-loop injection did, and it was already removed. Regenerated: zero
   such rows, and every one of the pins that row claimed (golden3, sbpart,
   ll444-lossless-key) is now present and tracked, as are the four recovered
   this session (golden4, golden6, golden7, lr-sgr-r7), which are committed
   here so the gate census reads committed=7 instead of committed=3.
   Regeneration is now byte-identical: cp tsv, regenerate, cmp -> IDENTICAL.
3. The host-dependent header is gone, so the drift check is no longer
   structurally red off the generating worktree; what legitimately differs is
   confined to the host-state columns (status, tracked, sha256) and the
   unresolved-literal count, all excluded from the row comparison.
4. ec-vorbis: the guard is NOT there and is not added. Its three fixture sites
   are the operator's own media library, which EC_REQUIRE_FIXTURES must not
   turn into a red fleet; the crate carries non-empty floors instead. The report
   now names the exact crate list instead of the wrong 'four crates'.
5. The 1054-line edit in ec-opus/../ec-h264/../ec-flac is GONE from this branch:
   the wave landed the same class fix in its own require_fixtures shape, and
   two conventions in one file is the defect this lane exists to prevent. Those
   three files are now main's version verbatim. What remains is the crates the
   wave did not touch: ec-aac (2 files), ec-flac/encode_matrix, ec-mp3,
   ec-vp9 (4), plus ec-vorbis floors.
6. lanes/av1fixlib.report.md now exists on this branch.

Exit status is split, deliberately: the LIBRARY verdict (mode i, mode ii,
drift) decides the exit under EC_REQUIRE_FIXTURES=1, and the four code-shape
invariants are reported with their own count and fail only under
EC_FIXTURE_SHAPE_STRICT=1. A shape violation is a defect in a file this
preflight does not own -- two live sites in crates/ec-av1 -- and a batch that
cannot start because another crate has two open lines helps nobody. Nothing is
hidden: the count is printed every run, and one env var away from fatal.
Default: GREEN 286 rows. Strict: RED (code-shape violations).