Skip to content

Engine golden gate ignores finding message/value/expected, so a re-fingerprinting change passes silently #229

Closed

Description

@nc9

Found while working the item-finding identity change (PR #228).

The v1↔v2 engine golden gate compares a deliberately narrow per-finding tuple:

// packages/audit-engine/tests/helpers/golden-baseline.ts
export interface RuleFindingSnapshot {
  ruleId: string;
  checkName: string;
  status: CheckStatus;
  pageUrl: string | null;
}

streaming-rules-golden.test.ts reduces to the same four fields. So message, value, expected and fingerprint are entirely outside the gate.

That matters because those three fields are load-bearing downstream:

  • findingFingerprint(status, message, value, expected) is the change-detector, and the hosted finding_defs dictionary is keyed on it, so a reworded message re-fingerprints every stored finding for a site;
  • packages/report/src/grouping.ts keys report groups on (checkName, status, digit-normalized message), so a reworded message re-splits or re-merges report groups;
  • every renderer prints check.message verbatim.

A rule that changed its message text would therefore pass bun run test:engine cleanly while orphaning stored fingerprints and moving what users see. The only current guard is the handful of inline message literals in the site-query-*-golden and page-features-noindex-golden tests, which cover a few rules rather than the rule set.

Separately, tests/fingerprint-parity.test.ts holds the one pinned fingerprint golden but its filename contains no "golden", so the test:golden glob (tests/*golden*.test.ts tests/streaming*.test.ts ...) does not run it and the CI "Audit engine golden tests" job never executes the pin.

Acceptance Criteria

  • The engine baseline snapshot includes each finding's message, value and expected (or a stable digest of them)
  • A change to any rule's message text fails the golden gate with a readable per-rule divergence
  • The fingerprint pin in fingerprint-parity.test.ts runs in the CI job that gates golden tests
  • The canonical 518-page fixture's snapshot stays byte-stable across two captures with the widened tuple

Activity

  1. added
    P3
    size: M
    on Sep 23, 2026
  2. nc9 commented on Oct 11, 2026

    @nc9
    ContributorAuthor

    Checked against current main (ad95fb2): criteria 1, 2 and 4 STILL TRUE. Criterion 3 is partly out of date.

    • RuleFindingSnapshot (packages/audit-engine/tests/helpers/golden-baseline.ts:132-138) is still { ruleId, checkName, status, pageUrl }.
    • test:golden (packages/audit-engine/package.json:15) still globs tests/*golden*.test.ts tests/streaming*.test.ts tests/redirect-chains-*.test.ts tests/*deadline*.test.ts, so the "Audit engine golden tests" job (bun run test:engine) does not run tests/fingerprint-parity.test.ts.
    • The pin does run in CI, though. Since the suite split in scripts/test-suites.ts, the "CLI tests" job runs every file under packages/audit-engine in its --run audit-engine step (.github/workflows/ci.yml:153). So a broken fingerprint pin already fails every PR, just under a different job name. What criterion 3 still adds is having the pin run in the golden job itself.
  3. added theissue type on Oct 28, 2026
  4. nc9 commented on Oct 30, 2026

    @nc9
    ContributorAuthor

    Shipped in v0.0.145 (330433ca ab97400b fd3908fc), verified against main: every acceptance criterion is met. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.145

    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

    P3choresize: M

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions