Skip to content

fix(audit-engine): a check skipped on a page never resolves its prior finding #508 - #1010

Merged
nc9 merged 2 commits into
mainfrom
fix/508-over-budget-signal
Oct 22, 2026
Merged

nc9 merged 2 commits into
mainfrom
fix/508-over-budget-signal

Conversation

@nc9

@nc9 nc9 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

A page check that was skipped this run (perf/ttfb with no timing data, scan-truncated) was protected from a wrong resolve only by the publish resolution signal's notEvaluated list. The skipped checks themselves are now read into evidence the merge consults first, so a prior finding on such a page carries whatever the signal says.

What changed:

  • merge-core.ts: createNotEvaluatedCollector mirrors the signal builder's own definition of "not evaluated": a page that skipped a check (not the noindex verdict, which reads as clean, and not a timeout, which <rule>|* covers) while the check ran on another page, or a scan-truncated skip. A check skipped on every page gives no evidence, as in the signal. A folded skip row clipped past its cap marks every page of the check. computeMerge/createMergeSession take it as notEvaluated and carry before any signal or sample logic.
  • merge-promise.ts: sampled publish merge collects it from the published checks (replays excluded).
  • CLI local merge: the rules-phase sink feeds the collector, runSmartAudits passes it to mergeFindings (apps/cli/src/controllers/audit.ts, apps/cli/src/audit/smart-audits.ts).
  • Docs: docs/configuration/index.mdx Smart Audits bullet; CHANGELOG bullet.

Acceptance criteria:

  1. Signal key dropped past the key cap: fixed (test fails without the change). Key truncated or notEvaluated over budget: already carried since #2658, now pinned by tests in both.
  2. CLI local merge: fixed. Complete-store finalize: NOT changed. It holds streamed findings, not checks, so it has no skip evidence; a producer would have to ship the skipped page checks (a wire change). The docs state it, per the criterion's "or the docs state where it does not and why". Say if you want that wire change as a follow-up issue.
  3. A page whose check passed still resolves (tests, and the existing resolution/merge suites pass).

Tests: packages/audit-engine/tests/not-evaluated-carry-508.test.ts (16; 3 fail with the carry disabled): sampled merge against a healthy, dropped-key and truncated-key signal, all-skipped and noindex staying resolved, clipped folded skip, local merge with and without evidence. Also pass: cloud-merge, merge-session-pages, carried-provenance-merge, bounded-carried-merge, scan-truncated-carry, compact-resolution-merge, complete-store-parity, timeout-no-resolve-968, merge-scoring. tsgo clean in audit-engine and apps/cli; tangly check --strict clean. The CLI sink wiring has no test of its own (one line each, covered by the type check and the computeMerge tests).

Review round:

Docs: updated. Agent skill (squirrelscan/skills): not needed.

Refs #508

@claude

claude Bot commented Oct 22, 2026

Copy link
Copy Markdown

Review of #1010 (carry findings when a check was skipped on a re-crawled page).

The change reads correct. I read the diff and spot-checked KEY_SEP, pageCheckKey and isReplayedCheck in the source. I did not run the tests.

  • The collector's rules match the existing resolution-signal semantics. It ignores the noindex verdict and timeouts, treats scan-truncated as a gap, and gives no evidence when a check was skipped on every page.

  • The carry branch sits inside wasCrawled || signalCrawled, before the signal override, so a dropped or over-budget key can't resolve the finding.

  • The CLI feeds the collector from the sink only when smart audits are on and the page isn't removed. The cloud path skips replayed checks and only runs in sampled mode.

  • The tests cover the signal variants, the folded and clipped aggregate case, and the local merge with and without evidence. The docs and changelog state the complete-store limitation.

  • (low) merge-core.ts (createNotEvaluatedCollector): evaluated and skips grow with distinct (rule, check) and skipped pages for the whole run. This is probably fine, but the CLI sink path is described as bounded. A short comment on the memory bound would help. A skip-heavy crawl, for example a scan that hits its work cap, can add many entries.

  • (nit) controllers/audit.ts: the for (const check of checks) loop has no braces, but the next statement is a const. Braces would read more clearly.

  • (nit) The docs bullet ends in a comma where the other list items end in one, but the last sentence there is a full stop. Check the punctuation of the new bullet against its neighbours.

No blocking issues.

@claude

claude Bot commented Oct 22, 2026

Copy link
Copy Markdown

Review of #1010 (carry findings when a check was skipped on a page)

I read the diff and confirmed that the imported constants and key helpers (pageRuleKey, pageCheckKey, KEY_SEP, the three skip-reason constants) exist. I did not run the tests. CI was still pending when I looked.

  • (low) merge-core.ts, collector add: a rule that timed out or threw with no page to name goes into rules, so every prior finding of that rule carries on every crawled page. That is the safe direction and matches the docs. It does mean a rule that keeps failing never resolves anything locally until it runs cleanly. Consider logging or surfacing this so users can see why findings stay open.
  • (low) controllers/audit.ts: the CLI collector's normalize is the identity function, on the assumption that the sink already receives normalized URLs. If check.pageUrl or check.pages can hold raw URLs, the sets will miss and findings will resolve wrongly. A short test through the CLI path with a non-normalized check.pageUrl would lock this in.
  • (nit) The collector's add handles timed-out/thrown rules and skipped checks in one long function with several early returns. Splitting it into two helpers would make the ordering easier to follow, for example that timedOut must return before the skip-bucket logic.
  • (nit) The complete-store path still has no skip evidence. This is documented in the CHANGELOG and docs, and smart audits: give page-inapplicable rule skips a not-applicable skipReason so they stop carrying priors #1011 tracks the not-applicable cases, so it is acceptable.

The tests cover each signal variant, the key-dropped case, a clipped folded row and the local merge. I found no correctness, security or performance problems.

@nc9
nc9 force-pushed the fix/508-over-budget-signal branch from f6a1170 to 30570e5 Compare October 22, 2026 03:38
@claude

claude Bot commented Oct 22, 2026

Copy link
Copy Markdown

Review of #1010. The change is well scoped and well documented, and I found nothing that should block merge.

  • (medium) merge-core.ts (collector, skipped branch): rules that skip a page because the check doesn't apply (e.g. core/canonical-header with no Link header) and don't use NOT_APPLICABLE_SKIP_REASON now carry their prior finding when the check ran on another page. If the header is removed, the finding stays open as carried and can't resolve. The PR documents this and tracks it in smart audits: give page-inapplicable rule skips a not-applicable skipReason so they stop carrying priors #1011, so it's an accepted tradeoff. Please make sure smart audits: give page-inapplicable rule skips a not-applicable skipReason so they stop carrying priors #1011 is scheduled, because it's a user-visible false-open.
  • (low) apps/cli/src/controllers/audit.ts: createNotEvaluatedCollector((url) => url) relies on the sink already receiving normalized URLs. The comment says so, but nothing enforces it. If any page reaches the sink un-normalized, the collector keys won't match prior.normalizedUrl and the carry fails silently. A small test through the CLI path, or using normalizePageUrl as the normalizer (it's cheap and idempotent), would remove that risk.
  • (nit) The header comment in not-evaluated-carry-508.test.ts points to docs/guides/smart-audits, but the docs change is in docs/configuration/index.mdx.
  • (nit) merge-core.ts, the collector's add: the timeout/thrown handling and the skipped handling each recompute own/aggregate in slightly different ways. Pulling the page-resolution step into a small helper would make it easier to read.

Test coverage is good: it covers the dropped, truncated and healthy signal variants, the scan-truncated case, and a page whose check passed still resolving.

@nc9
nc9 merged commit 696a389 into main Oct 22, 2026
15 checks passed
@nc9
nc9 deleted the fix/508-over-budget-signal branch October 22, 2026 03:51
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.

1 participant