Skip to content

fix(rules): page-inapplicability skips use a not-applicable reason so their priors resolve #1011 - #1025

Closed
nc9 wants to merge 2 commits into
mainfrom
fix/1011-not-applicable-skip
Closed

nc9 wants to merge 2 commits into
mainfrom
fix/1011-not-applicable-skip

Conversation

@nc9

@nc9 nc9 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Rules that skip a page because the check has nothing to look at used free-text skip reasons (or none), so smart audits could not tell them from a check that did not run, and a prior finding on such a page carried forever (#508). They now skip with one shared reason.

  • packages/core-contracts/src/resolution.ts: CHECK_NOT_APPLICABLE_SKIP_REASON = "not-applicable". Each such skip also carries details.foldKey of the same value (the pattern the noindex gate uses), so a folded row never mixes with a gap.
  • packages/rules/src/resolution.ts: the signal reads a not-applicable skip as evaluated and clean (registers the key and the page, never failing), so the prior resolves. An aggregate is trusted only with the fold key; a clipped one leaves the other pages not evaluated (carry).
  • packages/audit-engine/src/merge-core.ts: the fix(audit-engine): a check skipped on a page never resolves its prior finding #508 #1010 collector ignores it, so the local merge and the cloud publish merge resolve it too.
    Decision table (kept as not-applicable only where the skip is a property of the page's own headers, URL or markup that a fetch, parse or JS-rendering problem cannot produce; when unsure, a gap):
Rule Skip Result Why
core/canonical-header no Link header kept the response headers say so
content/mime-type no file extension kept a property of the URL
crawl/pagination not paginated kept markup property
crawl/canonical-chain no canonical tag kept markup property
mobile/viewport-zoom no viewport meta kept markup property
images/picture-element no <picture> kept markup property
links/dead-end-pages excluded by pattern kept config, not the page
content/placeholder-contact documentation page kept URL/markup classification
a11y/input-types no form sets novalidate kept really means fixed
content/stale-copyright no copyright year kept footer was read
ax/token-weight small 2xx page kept (split) genuine small body; a missing document or a small non-2xx stays a gap
core/doctype empty response reverted transient fetch or bot block
content/quality no text content reverted JS shell or block page
content/hidden-text, mojibake, placeholder-text, placeholder-contact, unrendered-markup, keyword-stuffing, reading-level no body reverted partial parse or cut-off response; matches the parse-failure gap
content/dev-leakage non-production origin reverted re-auditing a preview host would resolve production findings
images/lazy-loading, modern-format, srcset, filename-quality, figure-figcaption, content/placeholder-media no images reverted a lazy-loaded or no-JS crawl may miss images
a11y/autocomplete-tokens, a11y/input-types (typed inputs, multi-field forms) no fields reverted no-JS app shell
analytics/consent-mode, content/stale-copyright no Google tags / no footer region reverted no-JS app shell

Left as gaps from the start: scan-truncated, rule-timed-out, no timing data (performance/ttfb, no_data), cloud and service skips, probe skips, Parse error / No document available / Page could not be parsed / Invalid document structure, and the runner's soft-404 gate.

Known follow-up: the cloud merge's parity at merge-promise.ts (~:798-806) is conservative on a truncated or incomplete crawl: a not-applicable page carries there instead of resolving.

Report output: none of these reasons is listed in the report's skipped-checks section (only scan-truncated is), scores are unchanged (skips are not scored); the only visible delta is that those skipped rows in JSON carry details.foldKey and no longer the free-text skipReason (their message keeps the text).

Tests: packages/audit-engine/tests/not-applicable-resolves-1011.test.ts (15; 5 fail without the change): the #1011 repro (A fails, then A not applicable and B passes: A resolves) in the sampled merge against a healthy and a key-dropped signal, a gap still carries, all-pages not-applicable resolves, folded rows with and without the fold key, the local merge, and the signal's reading. Existing tests that asserted the old free-text reasons were updated (9 rule test files). Also pass: 508, compact-resolution-merge, cloud-merge, scan-truncated-carry, publish-cap, golden-baseline, streaming-rules/page-rules/scoring goldens, rule-cache-replay-golden, rules resolution, fold, noindex-skip. tsgo clean in core-contracts, rules and audit-engine; tangly check --strict clean.

Docs: docs/configuration/index.mdx Smart Audits bullet updated (the #1011 caveat is gone). Agent skill (squirrelscan/skills): not needed.

Closes #1011

@claude

claude Bot commented Oct 22, 2026

Copy link
Copy Markdown

Review of #1025 (not-applicable skips resolve prior findings). I read the diff and did not run the tests.

The design is coherent. There is one shared constant. The aggregate fold is only trusted when it carries foldKey. The tests cover both the local and cloud merge paths, and a gap case that must still carry.

  • (high) packages/rules/src/core/doctype.ts:37: the !html skip ("No HTML content available") is now not-applicable, but an empty ctx.page.html is not the same as a page the check does not apply to. It can mean an evicted or unreadable body (see crawler/tests/evicted-bodies-2342.test.ts), a failed fetch or a truncated crawl. In those cases the check did not run, which is a gap, and a prior doctype finding would now be silently marked resolved. A closed finding the audit never re-checked is the failure merge: a not-evaluated page's prior still resolves when the resolution signal is over budget, and on complete-store and local merges #508 and the carry logic guard against. I suggest keeping this as a gap-style skip, or only treating it as not-applicable when the page is known to be a real, fully fetched empty 200. Please add a test for the empty-body case.
  • (medium) The no-body / "No body element" / "No body content to analyze" skips (hidden-text, mojibake, placeholder-text, placeholder-contact, unrendered-markup, keyword-stuffing, reading-level) have the same problem. A missing body can come from a parse failure or a stripped or evicted body, not only from a page that truly has no body. I suggest confirming each one is only reachable when the body was fully fetched, or splitting a "no body because the fetch or parse failed" case out as a gap.
  • (medium) stale-copyright.ts (no-footer): a footer that fails to render or be detected, for example from a JS-rendering or detection regression, will close the "stale copyright" finding. Is that intended? A no-copyright-year skip is a reasonable resolve, because the year is really gone. no-footer is less clear-cut.
  • (medium) dev-leakage.ts (non-production-origin) and dead-end-pages.ts ("Page excluded by pattern"): these skips depend on config or origin, not on the page. Resolving is defensible when the config now excludes the page. Please confirm the intended semantics, and note them in the CHANGELOG or docs if so.
  • (low) packages/rules/src/resolution.ts: checkNotApplicable accepts a skip with a pageUrl without checking foldKey. That is fine for single-page skips, but a rule that sets the skip reason without foldKey on an aggregated row (pages set and no pageUrl) is silently ignored. A short comment or a dev-time assertion would help future rule authors.
  • (low) Changing the pass branch to warn/fail in the page-collection step (resolution.ts near line 309) alters behaviour for any other status that reaches it. Please confirm no other statuses were relied on there.
  • (nit) The new import sits after the relative imports in many rule files, while some files put @squirrelscan/... imports first. Group it with the other package imports to match the surrounding style.
  • (nit) The old skipReason strings are gone, so anything that displays or filters on them (reports, docs, snapshots) loses that detail. I grepped for the old strings outside tests and found no consumers, but please check the cloud and web side.

@nc9
nc9 force-pushed the fix/1011-not-applicable-skip branch from c425944 to f2ec78d Compare October 22, 2026 10:04
@claude

claude Bot commented Oct 22, 2026

Copy link
Copy Markdown

Review of #1025: the logic looks sound and I found nothing that should block merge. I read the diff only; I did not run the tests or check CI.

  • (low) docs/rules/content/placeholder-contact.mdx:18 still says Skip reason: documentation-page. The rule now emits not-applicable, so the doc is stale.
  • (low) docs/rules/links/dead-end-pages.mdx:17 is slightly stale too. The skip reason changed, though the message text is still correct. Consider noting the new reason.
  • (nit) resolution.ts accepts a skip as not-applicable if it has a pageUrl, even without details.foldKey. Aggregates, by contrast, need the fold key. Each rule sets both, so this is harmless today. A rule that sets only skipReason would resolve silently. Requiring the fold key everywhere would be safer, if that fits the design.
  • (nit) dead-end-pages now resolves a prior finding when a user adds an exclude pattern. That seems intended, since the exclusion means there is nothing left to find. It is worth a line in the docs.
  • (nit) The new test in token-weight.test.ts for the non-2xx case relies on a cast to ParsedPage. It works, but a small helper would be tidier.

Test coverage is good for the merge, the signal and the gap-versus-not-applicable split. Changing the free-text skipReason values is a visible JSON change, and the CHANGELOG notes it.

nc9 added a commit that referenced this pull request Oct 22, 2026
…nt, skip reasons, link phrases (#1034)

Batch of six reviewed PRs landed through one branch and one CI run:
- #1032 Bun 1.4.4 pin (CA blocklist for the eight compromised eMudhra intermediates, NSS 3.131.1 roots)
- #1030 nested CSS evidence for the style reader (repro from #1014 by @dbdefault)
- #1025 page-intrinsic skips use a not-applicable reason so priors resolve
- #1019 generic link phrases in ten more languages for link-text and anchor-text
- #1021 content/word-count skips noindex pages
- #1023 retirement of abandoned crawls uses the crawl lease
Plus a test fix for the residency probe on Bun 1.4.4 linux-x64.

Closes #840
Closes #946
Closes #1011
Closes #1013
Refs #841

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9

nc9 commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Landed through integration PR #1034 (squash merge 4dc22a9 on main), released in v0.0.128. Closing as superseded.

@nc9 nc9 closed this Oct 22, 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.

smart audits: give page-inapplicable rule skips a not-applicable skipReason so they stop carrying priors

1 participant