Skip to content

perf(audit-engine): derive the template fan-out signature from what the declared rules read #1373

Closed

Description

@nc9

Follow-up to #585. The tripwire (template-verdict-inputs.test.ts) and the parity golden gate a declaration, but a reviewed UNKEYED read is still allowed, so the fan-out signature is a hand-maintained subset of what declared rules read. Deriving the key from the declared reads would close that, but it would also make clusters finer and fragment them, so it needs the cluster-coverage measurement first.

Acceptance Criteria

  • The cluster-coverage measurement on the existing estates (gymshark.com and openelectricity.org.au crawls, the fan-out bench) is recorded with the signature derived from the declared rules' reads, against today's
  • (not applicable: coverage regressed to 22.9% and 0.0%, see the closing comment) If coverage does not regress beyond an agreed bound, the signature is derived from each declared rule's reads and a rule that reads an input outside it fails the parity test
  • Otherwise the issue is closed with the measurement and the tripwire stays the gate
  • The engine golden tests show no regression and the docs for rule authors describe the final mechanism

Related: #585, #614, #296.

nik

Activity

  1. added
    enhancement
    size: L
    rules
    on Oct 30, 2026
  2. added theissue type on Oct 30, 2026
  3. nc9 commented on Nov 12, 2026

    @nc9
    ContributorAuthor

    Not closed after v0.0.179 (https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.179). The --coverage --signature mode of the bench shipped. Still open: the recorded measurement (gymshark, openelectricity), the keep-or-change decision, and the rule-author docs. The change that shipped is f9dfaf9.

    nik

  4. nc9 commented on Nov 12, 2026

    @nc9
    ContributorAuthor

    Triage: #585 is closed as superseded by this issue (its scope, the tripwire and the parity golden, shipped; see its close comment). This is now the epic #637's remaining signature sub-issue, listed there. Open criteria are unchanged: the recorded cluster-coverage measurement on gymshark.com and openelectricity.org.au (the --coverage --signature bench mode shipped in f9dfaf9, v0.0.179), the keep-or-change decision, and the rule-author docs for the final mechanism.

    nik

  5. added
    blocked
    on Nov 20, 2026
  6. nc9 commented on Nov 21, 2026

    @nc9
    ContributorAuthor

    No coverage number yet. Both attempts on the openelectricity.org.au corpus (1,405 pages, see #1971) stopped before reporting:

    • --signature current hit its 10 minute cap at load 22;
    • --signature derived was running when the maintainer's machine ran out of memory and reset.

    From now on, crawls, corpus builds and benches for this issue run in a Daytona sandbox or on Boat, never on a laptop. It stays blocked until one of those runs both signatures. The 1,405-page corpus and its content store stay where #1971 records them.

    nik

  7. removed
    blocked
    on Nov 21, 2026
  8. nc9 commented on Nov 21, 2026

    @nc9
    ContributorAuthor

    AC1 measurement, run in a Daytona sandbox (4 vCPU, 8 GB), never on a laptop. Both estates were crawled fresh into a content store inside the sandbox (--level full -m 1500, CLI from source), then the fan-out bench's coverage pass ran on a copy of each project.db. The streamed coverage pass in #2195 makes this fit in 8 GB.

    Crawl

    Estate Pages With HTML Distinct HTML Resolved in store
    openelectricity.org.au 1406 1405 1274 1274
    www.gymshark.com 1566 1499 1499 1499

    Gymshark stopped at the 1,500-page cap; its sitemap lists 7,408 URLs. Every distinct HTML hash resolves to a stored page.

    Coverage, today's signature (current) against one derived from every selector and attribute the declared rules read (derived)

    Estate Signature Pages Clusters Singletons Coverage
    openelectricity current 1405 17 7 98.8%
    openelectricity derived 1405 1083 1066 22.9%
    gymshark current 1499 21 10 98.6%
    gymshark derived 1499 1499 1499 0.0%

    Deriving the signature from the declared rules' reads splits nearly every page into its own cluster. On gymshark not one page would inherit a verdict, and on openelectricity coverage drops from 98.8% to 22.9%. That is the regression AC2 and AC3 ask about. Whether it is within an agreed bound is the maintainer's call; on these numbers the derived signature would remove almost all of the fan-out's benefit.

    Notes:

    • The bench needs --batch 25 on pages this size. The default 200 still peaked at about 6.6 GB RSS on openelectricity.
    • Peak RSS was about 1.2-1.8 GB per coverage run at batch 25.

    nik

  9. nc9 commented on Nov 21, 2026

    @nc9
    ContributorAuthor

    Closing per AC3: the derived signature would remove almost all of the fan-out's benefit, so today's signature and its tripwire stay the gate.

    Estate Signature Pages Clusters Singletons Coverage
    openelectricity.org.au current 1405 17 7 98.8%
    openelectricity.org.au derived 1405 1083 1066 22.9%
    www.gymshark.com current 1499 21 10 98.6%
    www.gymshark.com derived 1499 1499 1499 0.0%

    Deriving the key from every selector and attribute the declared rules read splits nearly every page into its own cluster. No bound would accept that, so AC2 does not apply.

    • AC1: the measurement is in the comment above, run in a Daytona sandbox on fresh crawls of both estates, with every page's HTML in the store.
    • AC4:
      • The engine golden tests pass on main: test:engine green in the post-merge run at 7013fba.
      • CONTRIBUTING.md ("Declaring verdictScope: "template"") already describes the mechanism that stays: template-verdict-inputs.test.ts holds each template rule's reads to a reviewed list, rule-verdict-scope.test.ts checks declarations against measured invariance, and template-fanout-parity-golden.test.ts compares fanned-out verdicts with a full run.
      • Plugin rules are told to stay verdictScope: "page" (docs/configuration/plugins.mdx).
    • Corpus kept: /Volumes/BACKUP/squirrel-store/bench-corpus-dt/corpus-1373.tgz on the maintainer's corpus disk. That is 680 MB, sha256 07d17bc2a25308100e8a961b1ad6dac2b3769bcfe14429c1d6b4bc6fa000ecbe, holding both project.dbs and the content store.
    • The streamed coverage pass is perf(bench): stream the template fan-out coverage pass per batch #1373 #2195. A follow-up will batch it by bytes, so heavy pages can't push a batch to about 6.6 GB.

    nik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementrulessize: L

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions