Skip to content

fix(rules): skip, not pass, when a work cap cut the hidden-text or dev-leakage scan short #501 - #509

Merged
nc9 merged 1 commit into
mainfrom
fix/501-scan-cap-not-pass
Oct 6, 2026
Merged

nc9 merged 1 commit into
mainfrom
fix/501-scan-cap-not-pass

Conversation

@nc9

@nc9 nc9 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Closes #501.

Score-adjacent: on a page whose scan a work cap cut short, the rule now skips instead of passing. Skipped checks are left out of the score, so that page leaves the rule's pass denominator on the sampled path.

Cause

content/hidden-text stops its element walk at 20,000 elements and its stylesheet index at 400,000 characters or 4,000 rules. content/dev-leakage stops at 50,000 elements, 2,000 href/src values or 500,000 characters of copy. When the part they did read held nothing, both reported pass.

A pass is evaluation evidence. buildResolutionSignal (packages/rules/src/resolution.ts) counted the page as evaluated clean, so the publish merge resolved a prior finding on it, even though that finding can sit past the cap and still be there.

Fix

  • Rules. When scanTruncated is true and nothing was found, both rules emit status: "skipped" with skipReason: "scan-truncated" and details: { scanTruncated: true, foldKey: "scan-truncated" }. The constant is the new SCAN_TRUNCATED_SKIP_REASON in @squirrelscan/core-contracts/resolution. The foldKey keeps the skip apart from the rules' other skips when checks fold. A page read in full still passes.
  • Signal builder. A skipped check is never evaluation evidence, so the page is not evaluated. On its own, though, that only carries the prior while some OTHER page evaluated the check. When none did, the key would be absent from the signal, and an absent key falls back to resolving every prior on a crawled page. So the builder now registers the key for a scan-truncated skip, with no evaluated page, which puts the page in notEvaluated.
  • Comment fix. The noindex comment claimed an absent key "carries". It falls back to resolving instead (for noindex that is the outcome the verdict wanted anyway).
  • Docs. docs/rules/content/hidden-text.mdx and docs/rules/content/dev-leakage.mdx describe the new skip, its message, and why it is not a pass.

Tests

packages/audit-engine/tests/scan-truncated-carry.test.ts (new) runs the real rules on generated pages and the real buildResolutionSignal and runCloudSmartAudits, two publishes to one store. For each rule:

  • a page past the cap that holds nothing → skipped, scan-truncated;
  • a small clean page → pass;
  • the signal lists the capped page as not evaluated;
  • a prior finding on the capped page CARRIES (open, provenance carried), both when another page evaluated the check and when none did;
  • a page read in full and clean still RESOLVES the prior.

It also covers hidden-text's stylesheet rule budget, dev-leakage's href value cap, and a folded aggregate of the skip (beside a no-body skip), whose pages stay not evaluated.

Before/after. On origin/main's rules and builder, 8 of the 12 per-rule tests fail: the rules return pass, the signal has no notEvaluated entry, and the prior resolves. With the rules fixed but the old builder, the two "no other page evaluated the check" tests still fail (the prior resolves). With both changes, all pass.

Other results:

  • The new file: 15 pass.
  • rules: hidden-text, content-dev-leakage, resolution, noindex-skip, item-cap-remainder: 200 pass.
  • audit-engine: cloud-merge, item-locator-resolve: 41 pass.
  • tsgo --noEmit in packages/rules, core-contracts and audit-engine: clean.
  • Docs make validate is not run locally (the docs workspace is not installed in this lane); CI runs the docs build.

Codex review: no rule-level pass leak; every cap that can end with zero findings reaches the skip. The noindex merge and folding were confirmed. It also raised two limits that are not specific to this rule; I filed them as #508:

  • when the signal's key budget or notEvaluated complement is exhausted, the merge's fallback resolves;
  • the complete-store finalize and the CLI local merge do not use the signal at all.

Changelog

  • Rules: content/hidden-text and content/dev-leakage no longer pass a page whose scan a work cap cut short. They skip it, so a finding from an earlier audit stays open.

@nc9
nc9 marked this pull request as ready for review October 6, 2026 23:24
…v-leakage scan short #501

A pass is evaluation evidence: the publish resolution signal counted the
page as evaluated clean and the merge resolved a prior finding that may sit
past the cap. Both rules now skip with skipReason scan-truncated, and the
signal registers the check's key for that skip, so the page lands in
notEvaluated and its priors carry even when no other page evaluated the
check.

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the fix/501-scan-cap-not-pass branch from 98e8411 to 3f631fb Compare October 6, 2026 23:24
@nc9
nc9 merged commit c15be9d into main Oct 6, 2026
14 checks passed
@nc9
nc9 deleted the fix/501-scan-cap-not-pass branch October 6, 2026 23:33
@nc9 nc9 mentioned this pull request Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rules: hidden-text and dev-leakage report pass after a scan cut short by a work cap

1 participant