Repository navigation
Description
Problem
A page whose main script or stylesheet returns 404 or 500 looks fine to the crawler: the HTML is 200, the title and meta are there. In a browser the page is unstyled or its interactive parts never run. The classic cause is a deploy: cached HTML still references hashed bundles (/assets/app.3f9a1c.js, /_next/static/chunks/123.js) that the new deploy deleted.
squirrel already fetches these files. The asset phase requests every referenced script (site.scripts), stylesheet (site.resourceSizes.css) and font (site.resourceSizes.fonts), and stores status, error and sourcePages for each. The size, compression and caching rules read those entries, but no rule reports a 4xx/5xx or a failed fetch. Images are the exception: images/broken-images covers them.
Proposal
New rule reliability/broken-resources that reads the existing asset data. It needs no render, so it runs in the CLI and in HTTP-only audits.
- Error: a first-party script or stylesheet (same registrable domain as the site) answers 4xx/5xx.
- Warn: a third-party script or stylesheet answers 4xx/5xx, a font answers 4xx/5xx, or any of these fails at the network level (DNS, TLS, timeout).
- Not broken: 429, 503 with
Retry-After, or a WAF challenge. Report these as unverified (info), the same way link checks do. - One finding per resource URL, listing the status and the pages that reference it, rather than one per page.
- Says when the check was partial: the asset fetch is capped, so the finding should say so when not every referenced resource was checked.
New category: Reliability
None of the existing categories fit: Core SEO is meta tags and page structure, Site Integrity is about compromise (cloaking, malicious scripts), and a broken bundle is a correctness problem, not a speed one. Add a Reliability category (code reliability, rule prefix reliability/):
- Description: "Runtime errors, broken resources and failed requests"
- Group: Performance
- First rules:
reliability/broken-resources(this issue) andreliability/js-errors(New rule: JavaScript errors and failed runtime requests on rendered pages #704) - Later candidates: forms that silently fail, clipped or overlapping text at common widths, TLS certificates close to expiry
Notes
- Cost: none beyond today. The data is already fetched.
- False-positive risk: low for 4xx/5xx on first-party bundles. Network-level failures can be transient, which is why they only warn.
- Companion issue: New rule: JavaScript errors and failed runtime requests on rendered pages #704 (runtime JavaScript errors on rendered pages, needs the renderer from New rule: security/csp-violations - report what the browser actually blocked during rendered crawls #425).
Acceptance Criteria
- A
reliabilitycategory exists (name "Reliability", in the Performance group) and appears in reports, scoring and the docs rule index - Fixture: a page with
<script src="/app.js">where/app.jsreturns 404 produces an error finding naming the URL, the 404 status and the referencing page, in an HTTP-only (non-rendered) audit - Fixture: a first-party stylesheet returning 500 produces an error finding
- Fixture: a third-party script returning 404, and a font returning 404, each produce a warning, not an error
- A resource answering 429, 503 with
Retry-After, or a WAF challenge is reported as unverified (info), never as broken - The same broken URL referenced from 5 pages produces one finding listing those pages, not 5 findings
- When the asset fetch cap left referenced resources unchecked, the result says so
- Broken images stay with
images/broken-imagesand are not reported twice - The rule has a docs page under
docs/rules/reliability/
Activity
fix(rules): cover third-party, WAF, throttled and capped assets in br…
feat(rules): add reliability/broken-resources and the Reliability cat…
feat(rules): add reliability/broken-resources and the Reliability cat…
feat(rules): add reliability/broken-resources and the Reliability cat…
feat(rules): add reliability/broken-resources and the Reliability cat…
feat(rules): add reliability/broken-resources and the Reliability cat…
test(audit-engine): derive fixture origins from the server URL #703
Merge origin/main into claude/703-broken-resources #703
Merge origin/claude/703-broken-resources into the #703 branch #703
feat(rules): add reliability/broken-resources and the Reliability cat…
feat(rules): add links/broken-anchors for in-page anchor links #706
feat(rules): add security.txt and version-disclosure rules #713