Skip to content

feat(rules): add reliability/js-errors for rendered-page JavaScript errors #704 - #2049

Merged
nc9 merged 6 commits into
mainfrom
boat/js-errors-704
Nov 19, 2026
Merged

nc9 merged 6 commits into
mainfrom
boat/js-errors-704

Conversation

@nc9

@nc9 nc9 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Adds the cloud-only rule reliability/js-errors (site scope, meta.cloud render), the optional RenderResultItem.runtime contract it reads (pageErrors, consoleErrors, failedRequests), docs page, hub, changelog.

Closes #704.

Dependency: nothing fills runtime yet. The cloud renderer side (record pageerror, console.error and requestfailed into runtime, with bounded listening after load, caps, redaction and WAF pages excluded) is tracked in the private squirrelscan/repo#4940. Until it lands the rule is skipped with the coded reason runtime-not-recorded and listed under Not checked, never a pass. The rule can land inert and honest. Fixtures are hand-built render results, not a live browser.

Acceptance criteria

  • inline TypeError -> error with message and location: js-errors.test.ts 'inline TypeError on load...'
  • same exception on 5 pages -> one finding, pageCount 5: '...grouped finding with a page count of 5'
  • React hydration mismatch -> hydration finding: 'hydration mismatch is identified'
  • fetch /api/data 500 reported, /api/me 401 not: 'first-party fetch answering 500...'
  • [~] throw 2s after load caught: rule reports whatever the renderer recorded; the post-load wait is New rule: security/csp-violations - report what the browser actually blocked during rendered crawls #425 (test covers the rule side)
  • renderer-blocked/aborted, ResizeObserver, CSP produce no finding: 'renderer-blocked requests, aborts...'
  • meta.cloud declared, listed as locked: audit-engine/tests/js-errors-locked-704.test.ts
  • docs/rules/reliability/js-errors.mdx; make validate passes

Gates

rules js-errors.test.ts 13 pass; broken-resources.test.ts still passes; audit-engine locked test 2 pass; streaming golden updated (333->334 rules) passes; typecheck rules, core-contracts, audit-engine clean; docs make validate passes.

Agent skill: no change needed.

Rebased onto main (2026-11-20)

  • The CHANGELOG.md bullet moved to changelog.d/704-js-errors.added.md. The entry and the docs page now say the renderer does not record runtime data yet, instead of claiming it keeps listening after load.
  • Main now requires every new rule to declare meta.checks (the undeclared baseline only shrinks) and findingScope. The rule declares its five problem checks, the js-errors pass that clears them, the two skipped names, and findingScope: "resource". It is no longer added to rule-checks-undeclared.json.
  • The canonical golden takes one totals line (reliability/js-errors: 1). healthScore.overall is unmoved at 58. The live rule count is 358 (the floor stays 350). The check-names and cloud-rules docs blocks were regenerated.
  • Gates at bf12b6d: typecheck for core-contracts, rules and audit-engine is clean. Tests by path all pass: js-errors, rule-check-declarations, rule-finding-scope, broken-resources, the registry and docs count tests, js-errors-locked-704, the canonical golden, finding-messages, the locked-rules tests and the cloud prefetch tests. oxlint is clean on the changed files, make validate in docs passes, and the changelog guard passes.

Partial runtime coverage is a coded gap (087d2d4)

  • New coded skip reason runtime-not-recorded (gap, listed as not checked). It is in SKIP_REASON_CLASSES with an exported RUNTIME_NOT_RECORDED_SKIP_REASON, in the predicates table, and has a Not checked hint in the report.
  • With no runtime data on any page, the js-errors check is skipped with it.
  • With only some pages measured, the rule still reports what it saw and adds a skipped unchecked-pages check with that reason instead of a pass plus an info. "Some pages" covers a render with no runtime block and a page with no render result. So a stored site-scope finding is never resolved while part of the site went unseen. A pass is emitted only when every page the rule judged carried runtime data.
  • A WAF or bot challenge page is still left out and only noted (an info), not a gap. The "WAF page left out" test keeps that behaviour.
  • New tests cover a partial run (no runtime), a missing render result, and errors reported beside the gap (js-errors.test.ts), plus the report listing it under notChecked (not-checked-runtime-704.test.ts).
  • Private gitlink bump: the bump that pins this needs a runtime-not-recorded line in NOT_CHECKED_REASONS in packages/issues prompts.ts. The audit-summary-not-checked test goes red without it.
  • Gates at 087d2d4: typecheck for core-contracts, rules, audit-engine and report is clean. Tests by path all pass: js-errors, rule-check-declarations, rule-finding-scope, core-contracts rule-outcome-1661 and skip-reason-predicates-1661, report not-checked-runtime-704, not-checked-2729, not-checked-hint-own-property-3368, locked-rules coverage and reasons, js-errors-locked-704, the canonical golden and finding-messages. test-suites.ts --check passes, make validate in docs passes, and the changelog guard passes. oxlint is clean on the changed files except a pre-existing no-control-regex at packages/report/src/not-checked.ts:191, which was already on main.

All-challenge run is an unread-page gap (ed99381)

  • When every rendered page was a WAF or bot challenge, the rule now skips with the existing coded rule-wide gap unread-page instead of a free-text skip (which read as "does not apply"). A stored js-errors finding is no longer resolved by such an audit. It adds no Not checked line, because the audit already carries its own blocked notice. A test asserts the skipReason unread-page and outcome coverage_gap.
  • Gates at ed99381: rules typecheck is clean. js-errors, rule-check-declarations and rule-finding-scope (388) pass, the report not-checked and locked-rules tests (51) pass, and js-errors-locked-704, the canonical golden and finding-messages (6) pass. make validate and oxlint pass.

@nc9
nc9 force-pushed the boat/js-errors-704 branch from 46a4240 to cb64edf Compare November 16, 2026 11:55
@nc9
nc9 marked this pull request as ready for review November 16, 2026 13:11
nc9 added 4 commits November 20, 2026 00:00
…ed runtime requests on rendered pages #704

Signed-off-by: Nik Cubrilovic <[email protected]>
…t-off prefetch reports its coded reason #704

Signed-off-by: Nik Cubrilovic <[email protected]>
… the renderer records no runtime yet #704

Rebased onto main: the CHANGELOG.md bullet moved to changelog.d/704-js-errors.added.md,
the canonical golden takes one totals line (reliability/js-errors: 1; score unmoved at 58),
and RenderResultItem keeps main's `requests` beside the new `runtime`.

Main now requires every new rule to declare meta.checks (the undeclared baseline only
shrinks) and findingScope. js-errors declares its five problem checks, the js-errors
pass that clears them, and the two skipped names, and is "resource" scoped (one finding
per error or failing URL shared across pages). Regenerated the check-names and cloud
rules blocks. The live rule count is 358 (floor stays 350).

The cloud renderer does not fill RenderResultItem.runtime yet, so the docs page and the
changelog entry say the rule is skipped until it does, instead of claiming the renderer
keeps listening after load.

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 marked this pull request as draft November 19, 2026 13:08
@nc9
nc9 force-pushed the boat/js-errors-704 branch from e18f47b to bf12b6d Compare November 19, 2026 13:08
nc9 added 2 commits November 20, 2026 00:15
…ap, never a pass #704

A page the rule has to judge with no runtime data (the render recorded none, or there is
no render result for it) is now the coded skip reason `runtime-not-recorded` (gap, listed
as not checked). With no runtime data anywhere the js-errors check is skipped with it;
with only some pages measured the rule still reports what it saw and adds a skipped
`unchecked-pages` check with that reason instead of a pass plus an info, so a stored
site-scope finding is never resolved while part of the site went unseen. A pass needs
runtime data from every page judged. A WAF or bot challenge page is still left out and
only noted (info), not a gap.

The reason is in SKIP_REASON_CLASSES with an exported constant, the predicates table and a
Not checked hint in the report. Tests: the whole-site and partial cases (no runtime, no
render result, errors beside the gap) and the report listing it under notChecked.

The cloud renderer does not record runtime data yet; the docs say that work is tracked
privately.

Signed-off-by: Nik Cubrilovic <[email protected]>
…unread-page gap #704

When every rendered page was a WAF or bot challenge the rule read nothing, but it
returned a free-text skip, which the outcome table reads as "does not apply", so a
stored js-errors finding could resolve on such an audit. It now skips with the coded
rule-wide gap `unread-page` (coverage gap, not listed as not checked: the audit already
carries its own blocked notice). Test: the all-challenge run is skipped with
`unread-page` and classifies as coverage_gap. The docs page says so.

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 marked this pull request as ready for review November 19, 2026 18:39
@nc9
nc9 merged commit 79debde into main Nov 19, 2026
16 checks passed
@nc9
nc9 deleted the boat/js-errors-704 branch November 19, 2026 18:41
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.

New rule: JavaScript errors and failed runtime requests on rendered pages

1 participant