You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(audit-engine): derive the template fan-out signature from what the declared rules read, with a parity test #585
Follow-up to the fan-out key change. The signature covers script src, meta names, some meta content and the main count; other inputs a fanned rule can read (link rel, headings, attributes) are still outside it, so the class of bug remains.
Acceptance Criteria
The fan-out signature is derived from the inputs each declared rule reads, or a parity test fails when a fanned rule reads an input outside the signature
Adding a rule input without updating its declaration fails CI
The engine golden tests and the fan-out bench show no regression in cluster coverage on the existing estates
Docs for rule authors say how to declare the inputs a fanned rule reads
Related: #614 (the three inputs the key misses today) and #296 (cache and fan-out composing).
Checked against current main (ad95fb2): PARTLY FIXED ON MAIN, after 0.0.108.
Criterion 2 is largely met by fix(audit-engine): fan-out signature covers html/body attrs and icon links (#614) #621 (ad2e562). packages/rules/tests/template-verdict-inputs.test.ts scans each verdictScope: "template" rule's source for selectors, attribute names, raw ctx.page.html, textContent and so on. It fails unless every read is reviewed as KEYED or UNKEYED, and its last test holds the VerdictScope doc to the UNKEYED list. The test header says what the scan cannot see: a selector held in a variable, or what a helper the document is handed to reads.
Criterion 1 is not met. fanoutInputSignature (packages/audit-engine/src/template-fanout.ts, from line 150) is still a hand-written list. The doc comment at packages/rules/src/types.ts:122-151 names declared rules whose reads the key does not cover: raw HTML (core/doctype, a11y/focus-visible, analytics/*, perf/js-libraries), everything getCWVHints reads, inline script and style bodies, the <main> id and class, and iframe and image src. It also names three gaps no entry captures: order, <noscript> ancestry and head vs body placement. So the test records divergence; it does not stop it.
Criterion 4: the only author guidance is that doc comment in types.ts. Nothing under docs/ covers it; docs/cli/debug.mdx only mentions fan-out.
AC1 ticked on the second branch: packages/rules/tests/template-verdict-inputs.test.ts fails when a declared rule reads anything not on its reviewed list, and template-fanout-parity-golden.test.ts runs in CI. Full derivation of the signature from the declared reads is not built: a reviewed unkeyed read stays allowed, recorded in the test and the VerdictScope doc. Rule-author docs are in #1364. The remaining boxes close with that PR and the existing golden and bench runs.
Verified against main after v0.0.145 (the contributing section landed). Met: criteria 1 and 4. Open: criterion 2 (a selector held in a variable or read by a helper is invisible to the scan, and an unkeyed read can be added to the reviewed list without changing the signature) and criterion 3 (no cluster-coverage bench result recorded). Leaving this open for those.
Closing as superseded by #1373, which is the same work after this issue's own scope shipped. What this issue asked for is in main: the tripwire packages/rules/tests/template-verdict-inputs.test.ts fails when a declared verdictScope: "template" rule reads an input that is not on its reviewed KEYED or UNKEYED list (criterion 2, from ad2e562, first released in v0.0.109), packages/audit-engine/tests/template-fanout-parity-golden.test.ts and template-fanout-equivalence-golden.test.ts gate the fan-out against running every rule (the golden half of criterion 3), and the rule-author docs are in. The other half of criterion 3, a recorded cluster-coverage measurement on the existing estates, is not done here: it moves to #1373 and criterion 3 is left unticked on purpose. Criterion 1 was ticked on its second branch (tripwire, not a derived signature).
What is left is exactly #1373: deriving the signature from the declared reads, behind the cluster-coverage measurement (the --coverage --signature bench mode, f9dfaf9, shipped in v0.0.179). #1373 stays open as the one remaining sub-issue, and is now in epic #637. Priority labels are left as they were.
Activity
nc9 commentedon Oct 11, 2026
Checked against current main (ad95fb2): PARTLY FIXED ON MAIN, after 0.0.108.
packages/rules/tests/template-verdict-inputs.test.tsscans eachverdictScope: "template"rule's source for selectors, attribute names, rawctx.page.html,textContentand so on. It fails unless every read is reviewed as KEYED or UNKEYED, and its last test holds theVerdictScopedoc to the UNKEYED list. The test header says what the scan cannot see: a selector held in a variable, or what a helper the document is handed to reads.fanoutInputSignature(packages/audit-engine/src/template-fanout.ts, from line 150) is still a hand-written list. The doc comment atpackages/rules/src/types.ts:122-151names declared rules whose reads the key does not cover: raw HTML (core/doctype,a11y/focus-visible,analytics/*,perf/js-libraries), everythinggetCWVHintsreads, inline script and style bodies, the<main>id and class, and iframe and image src. It also names three gaps no entry captures: order,<noscript>ancestry and head vs body placement. So the test records divergence; it does not stop it.types.ts. Nothing underdocs/covers it;docs/cli/debug.mdxonly mentions fan-out.nc9 commentedon Oct 30, 2026
AC1 ticked on the second branch:
packages/rules/tests/template-verdict-inputs.test.tsfails when a declared rule reads anything not on its reviewed list, andtemplate-fanout-parity-golden.test.tsruns in CI. Full derivation of the signature from the declared reads is not built: a reviewed unkeyed read stays allowed, recorded in the test and theVerdictScopedoc. Rule-author docs are in #1364. The remaining boxes close with that PR and the existing golden and bench runs.nik
docs(contributing): how to declare verdictScope template and what the…
docs(contributing): verdictScope section: what rules may read, three …
docs(contributing): how to declare verdictScope template and what the…
docs(contributing): verdictScope section: what rules may read, three …
nc9 commentedon Oct 30, 2026
Verified against main after v0.0.145 (the contributing section landed). Met: criteria 1 and 4. Open: criterion 2 (a selector held in a variable or read by a helper is invisible to the scan, and an unkeyed read can be added to the reviewed list without changing the signature) and criterion 3 (no cluster-coverage bench result recorded). Leaving this open for those.
nik
test(rules): prove the template-verdict scan fails on an undeclared r…
nc9 commentedon Nov 12, 2026
Closing as superseded by #1373, which is the same work after this issue's own scope shipped. What this issue asked for is in main: the tripwire
packages/rules/tests/template-verdict-inputs.test.tsfails when a declaredverdictScope: "template"rule reads an input that is not on its reviewed KEYED or UNKEYED list (criterion 2, from ad2e562, first released in v0.0.109),packages/audit-engine/tests/template-fanout-parity-golden.test.tsandtemplate-fanout-equivalence-golden.test.tsgate the fan-out against running every rule (the golden half of criterion 3), and the rule-author docs are in. The other half of criterion 3, a recorded cluster-coverage measurement on the existing estates, is not done here: it moves to #1373 and criterion 3 is left unticked on purpose. Criterion 1 was ticked on its second branch (tripwire, not a derived signature).What is left is exactly #1373: deriving the signature from the declared reads, behind the cluster-coverage measurement (the
--coverage --signaturebench mode, f9dfaf9, shipped in v0.0.179). #1373 stays open as the one remaining sub-issue, and is now in epic #637. Priority labels are left as they were.nik