Skip to content

fix(rules,audit-engine): an info result on a re-crawled page resolves the rule's old findings #1031 - #1349

Closed
nc9 wants to merge 4 commits into
mainfrom
fix/carried-info-resolve-1031
Closed

nc9 wants to merge 4 commits into
mainfrom
fix/carried-info-resolve-1031

Conversation

@nc9

@nc9 nc9 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1031

Root cause, from the prod shape (3 re-crawled pages each holding 50 open carried a11y/form-labels rows, 0 fresh): the page's fresh form-labels result is info "No form inputs found". The resolution signal builder registered only pass/warn/fail as evaluation evidence, so the page stayed "not evaluated" for the check and the old fail rows were carried forever. Same for perf/inp-hints (fresh inp-third-party: info) and security/third-party-cookies (fresh third-party-resources, no tracking-domains).

Fix (packages/rules/src/resolution.ts):

  • A plain info registers the check and the page as evaluated, like a pass. An info that means "could not judge" carries details.inconclusive: true (set by its rule) and is treated like a skip: no evaluation evidence, it blocks the rule-level inference for that check, and old findings carry. Same in the local merge (merge-core).
  • A page on which the rule gave any verdict (pass/warn/fail/info) is evaluated for the rule's other registered checks too, so a different check of the same rule resolves the old row. A check explicitly skipped on that page (any skip that is not the trusted not-applicable fold) is excluded and still carries; timeouts, thrown rules, scan-truncated and unfolded aggregates keep their existing handling.
  • Coverage: coverage.pagesWithStaleCarry (omitted when 0) counts re-crawled pages that still carry earlier findings; the coverage line says so when above zero.

Failing-first test: packages/audit-engine/tests/carried-info-resolve-1031.test.ts (prior 50 open fails; re-crawl answers info, or only a different check; with and without the resolution signal; the two signal cases failed before). Controls: an explicitly skipped check still carries (50 rows, pagesWithStaleCarry: 1), and coverage omits the field when everything resolved. Existing resolution/merge suites pass (cloud-merge, not-evaluated-carry-508, timeout-no-resolve-968, rule-error-no-resolve-999, not-applicable-resolves-1011, scan-truncated-carry, unconfirmed-resolves-prior-935, compact-resolution-merge, resolution-compact, resolution, bounded-carried-merge, carried-provenance-merge, merge-scoring, merge-session-pages, sampled-audited-pages).

Not in this PR: the hosted container and apps/api consume the same signal builder, so they pick the fix up with the next engine bump (private repo gitlink); the carried rows already stuck in prod resolve on the site's next crawl of those pages. The "expire carried fails after N runs" AC box is a product decision, left open.

Docs: docs/configuration/output.mdx, CHANGELOG under Unreleased. Skill: none.

Review round: info classification (page-scope rules whose info shares a check name with a fail/warn row)

Marked details.inconclusive (could not judge; round 2 added performance/critical-request-chains and font-delivery (no <head>), legal/cookie-consent (info downgrade with no site profile), social/og-image-size (dimensions not specified), social/og-url-match (no canonical), performance/lcp-fetchpriority (no hero candidate), and schema/expected-type label-flap info; the marker also survives the fold, the chunked shell slim and unfold): a11y/color-contrast (limited analysis), a11y/focus-visible, a11y/touch-targets (need CSS analysis), content/keyword-stuffing and content/reading-level (content too short), content/mime-type (unknown extension), performance/compression (unknown encoding), performance/http2 (cannot be determined), schema/expected-type (type not classified with enough confidence; markup too large to judge), schema/breadcrumb (unreadable markup), schema/json-ld-valid (metadata unavailable), mobile/input-zoom (fields not read).
Left as a verdict (nothing found / not applicable / informational finding, old findings resolve): the No X found family (a11y/form-labels, button-name, select-name, frame-title, aria-*, definition-list, list/listitem, table rules, ...), core/* informational (canonical differs, nosnippet, robots-meta, twitter-cards), links/https-downgrade, security/mixed-content, security/sri, url/*, performance/* hint rows, images/*, social/*. Site-scope infos (no pageUrl) never reach the page resolution signal. Fill-in for a new rule: set details: { inconclusive: true } on an info that means "could not judge".
Also: chunked path now computes coverage.pagesWithStaleCarry (fixes capped-rescore.test.ts "#508"); reconfirmed carries (stamped this run) are not stale; scan-truncated checks block rule-level inference; coverage types updated (json, cli types, reconstruct, llm stale-carry-pages, html).

@claude

claude Bot commented Oct 30, 2026

Copy link
Copy Markdown

Review of #1031 (info and rule-level verdicts resolve carried findings). The approach matches the root cause in the description. I read the diff only and did not run the tests.

  • (medium) packages/rules/src/resolution.ts: info now counts as a verdict for the check and the page. Some rules may emit info for "could not determine" cases (data unavailable, fetch not attempted) rather than "nothing to flag". Each of those would now resolve earlier fail rows for that check. Grep the rules for status: "info" on paths where the check did not actually run, and either convert them to skipped or add a test that pins the intended behaviour.
  • (medium) packages/rules/src/resolution.ts: the rule-level fallback marks every page the rule gave any non-skipped verdict on as evaluated for all of that rule's registered checks. If a rule conditionally omits a check on a page (a budget cut, a cap, an early return after the first fail), the omitted check's old rows resolve even though it never ran. Timeouts, thrown rules and scan-truncated results keep their handling, but a rule-internal cap is not covered. A negative test with a multi-check rule where a sibling check is intentionally not emitted would document the limit of this assumption.
  • (low) packages/audit-engine/tests/carried-info-resolve-1031.test.ts:1: the header comment describes a <check>-unconfirmed scenario that this file does not test. It should describe the info and different-check cases.
  • (low) packages/audit-engine/tests/carried-info-resolve-1031.test.ts: no test covers an aggregated skip (details.aggregated with pages), which the new explicitSkips branch handles. No test covers an info result on page A with an old fail on page B either. Both are cheap to add.
  • (low) packages/audit-engine/src/merge-promise.ts: staleCarryPages counts pages with any carried finding, including legitimate carry (capped report, unrendered findings). The doc comment and the coverage text say the rule gave no verdict, which is stronger than what the count shows.
  • (nit) packages/report/src/coverage.ts: the new notes.push line is long. Run bun run lint and confirm the formatting matches the neighbouring lines.
  • (nit) docs/configuration/output.mdx: the new sentences are inserted mid-paragraph into an already very long line. The "Always present" paragraph would read better split.

nc9 added 2 commits October 30, 2026 19:53
… the rule's old findings; coverage pagesWithStaleCarry #1031

Signed-off-by: Nik Cubrilovic <[email protected]>
…; chunked path coverage; stale carry excludes reconfirmed rows #1031

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the fix/carried-info-resolve-1031 branch from 63a94e4 to eb332ae Compare October 30, 2026 08:57
@claude

claude Bot commented Oct 30, 2026

Copy link
Copy Markdown

Review of #1031 fix. I read the diff only and did not run the tests.

  • (medium) packages/rules/src/resolution.ts: a plain info now counts as evidence the page is clean, and inconclusive is opt-in. The rules have about 336 status: "info" sites and this PR marks about 15 of them (21 inconclusive matches in total). Any other "could not judge" info (unreadable page, no data, classifier unsure) now silently resolves real earlier findings. Failing open is the riskier default for a resolver. Consider an audit pass over the remaining info sites, or a test that lists every info-emitting rule and the reason each one is not inconclusive.
  • (medium) resolution.ts (the ruleEvaluated / explicitSkips change): any verdict from a rule on a page now marks the rule's other registered checks as evaluated there. This breaks for a rule that emits only some checks per page depending on page state. For example, a rule that emits check A when a feature is present and check B otherwise would resolve B's old rows when A runs. The PR describes the form-labels case but not this shape. Add a test with a rule whose checks are mutually exclusive per page, or restrict the inference to rules that always emit all their checks.
  • (low) packages/audit-engine/tests/carried-info-resolve-1031.test.ts: the header comment is stale. It talks about <check>-unconfirmed but the tests cover info and a different check. The last two tests are mis-indented and have a stray blank line, so run oxfmt on the file.
  • (low) packages/report/src/output/html.tsx: the coverage banner now also renders when pagesWithStaleCarry > 0. That changes rendered HTML. Please confirm whether REPORT_HTML_VERSION needs a bump per AGENTS.md. build:css:check should also be run.
  • (low) packages/report/src/output/llm.ts: the new stale-carry-pages attribute is interpolated from a numeric field. It is guarded with isSafeInteger, which is fine. A test that covers the JSON, LLM and HTML renderers for the new field would be good, and I did not see one in the diff.
  • (nit) The inconclusive flag is an untyped key in details. A shared constant or helper, for example isInconclusiveInfo(check), would stop merge-core.ts and resolution.ts from duplicating the predicate.

The failing-first test and the controls (explicit skip still carries, coverage omits the field when 0) are good. The docs and CHANGELOG are updated.

…e infos marked; signal-level scan-truncated test #1031

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

claude Bot commented Oct 30, 2026

Copy link
Copy Markdown

Review of #1349 (resolve carried findings when a re-crawled page's rule answers info). The root-cause analysis is sound and the failing-first tests plus the skipped-check controls are good. Findings below. I read the diff only and did not run the test suites.

  • (medium) packages/rules/src/resolution.ts: the fix is opt-out. Every info now counts as evidence the page is clean unless its rule sets details.inconclusive. The PR marks about 20 rules by hand, but any info meaning "could not judge" in a rule that was not marked will now silently resolve real open findings. That is a worse failure than a stuck carry. Please grep status: "info" across packages/rules/src and confirm the audit is exhaustive, or add a registry-wide test that lists every rule emitting info so new ones have to be classified.
  • (medium) packages/rules/src/resolution.ts (the ruleEvaluated block near the end): any verdict from a rule on a page marks the page evaluated for all of that rule's other checks. This is only correct if the rule emits a check result whenever that check would fail. Rules with early returns, caps or truncation after the first check can emit a verdict for one check and never reach the others, so the old findings for those others resolve though never re-evaluated. Please spot-check multi-check rules that bail out partway, and say in the PR which rules you checked.
  • (low) packages/rules/src/fold.ts: foldGroupKey now splits inconclusive and plain info groups, which changes fold output for any rule that sets the marker. I did not verify that fold-inconclusive-1031.test.ts covers the cap and sample paths, so confirm it does. The PR also does not say whether the golden suite was run.
  • (low) packages/audit-engine/src/merge-promise.ts: noteStaleCarry uses lastSeenAt >= now to tell a reconfirmed carry from a stale one. Please confirm now is the same clock value used to stamp reconfirmed carries. If it differs, pagesWithStaleCarry over- or under-counts. There is also a stray extra blank line after buildScoringResultsFromMerged(...).
  • (low) packages/audit-engine/tests/carried-info-resolve-1031.test.ts: indentation is broken around the 'inconclusive info on a DIFFERENT check' test, which sits outside the loop with the wrong nesting, and several lines are far over the formatter width. Also x.test is a non-public zone per AGENTS.md, so use example.com hosts.
  • (low) packages/report/src/output/llm.ts: the new stale expression is long and checks the value twice. Pull it into a local as unrenderedAttr does. packages/report/src/coverage.ts has the same style problem on its notes.push line.
  • (nit) The grammar in the coverage line is built by hand (still carry/carries). Rewording to "N re-crawled page(s) with earlier findings carried" avoids the conditional.
  • (nit) Docs: the new sentences in docs/configuration/output.mdx pile onto an already very long paragraph. Consider splitting them into their own paragraph.
  • (nit) The CHANGELOG bullet is long. Trim it to the user-visible outcome.

Docs: docs/configuration/output.mdx. Skill: none needed.

…s a gap so the old findings carry; run the site-pages contract on the new test store #1031

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

claude Bot commented Oct 30, 2026

Copy link
Copy Markdown

Review of #1349 (resolve carried findings when a re-crawled page answers info)

The approach is sound and the root-cause analysis matches the code. The new tests cover the skip and truncation controls well. Findings:

  • (medium) packages/rules/src/resolution.ts: a plain info now counts as evidence that the page is clean, so every rule that emits an unflagged "could not judge" info will silently resolve its old fail rows. Only the rules in this PR's file list got details.inconclusive. There are 300+ rules, so an audit of the other info emitters (grep status: "info") is needed. The default is also the unsafe one: a missed rule resolves findings that may still be real. Please list the info emitters you reviewed and left unflagged, or add a registry test that every info check either sets inconclusive or is allowlisted as a verdict.
  • (medium) packages/rules/src/resolution.ts (the ruleEvaluated fold): a verdict on any check of the rule now marks the page evaluated for all of the rule's other registered checks. For a rule that emits a check conditionally (for example foo-unconfirmed only when a style hides items) while another check always runs, an old foo fail now resolves even if foo was never re-evaluated. This is intended for smart audits: cloud coverage counts understate carried pages; fails from pages outside the crawl carry indefinitely #1031, but it is a wide behavior change. A test for a rule where the failing check is conditionally emitted would document it.
  • (low) packages/audit-engine/src/merge-promise.ts: noteStaleCarry is called for every carried finding, so the sampled path runs it over all of unionCarried. The cost is a Set insert, so it is fine. The lastSeenAt >= now guard relies on the signal-reconfirmed carry being stamped with this run's time. Please add a test for that path, since the controls only cover the explicit-skip case.
  • (low) packages/audit-engine/tests/carried-info-resolve-1031.test.ts: the header comment describes <check>-unconfirmed behavior that does not match the tests. The for (const signal ...) block's closing and the indentation of the following test(...) are off. The test also has no isolateSquirrelHome call, but it uses an in-memory store, so that is probably fine. Run oxfmt --check on it.
  • (nit) packages/audit-engine/src/merge-promise.ts: a stray extra blank line was added after unionRuleResults.
  • (nit) packages/report/src/output/llm.ts: the stale line is long. Reformat it, and compute the safe integer once.
  • (nit) docs/configuration/output.mdx: the diff shows the "Always present" line changing. If the only change is that coverage.pagesWithStaleCarry was added, the diff is fine. Please confirm the coverage field list documents it, and that the report HTML change needs the REPORT_HTML_VERSION bump from AGENTS.md. The coverage-line text changed, but the CSS did not, so probably not.

I could not run the test suites in this read-only environment.

@nc9

nc9 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Landed in v0.0.145 as 5e82a5b5 cd16b529 b52fc33a ce8bb933 via #1377. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.145. Closing this original.

nik

@nc9 nc9 closed this Oct 30, 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: cloud coverage counts understate carried pages; fails from pages outside the crawl carry indefinitely

1 participant