Skip to content

JSON report: list crawled pages with their HTTP outcome and the rules that ran #1260

Closed

Description

@deniskern

Summary

We consume squirrel audit -f json in a pipeline that tracks which pages and rules a run actually covered, so a finding that disappears can be marked fixed only when the page was really checked. The JSON report has no list of crawled pages with their HTTP outcome and no list of the rules that ran, so we reconstruct both ourselves:

  • Page statuses: we stream-parse the entity map and infer rate-limited or errored pages from links/broken-links items (meta.statusCode). Pages without entities are invisible, and a run with rate-limited pages cannot attribute them to URLs, so we have to treat the whole run as unattributed.
  • Executed rules: we re-read our own squirrel.toml, apply [rules].disable patterns to the bundled catalog and subtract notChecked, which drifts whenever a rule is skipped for a reason we do not model (time budget, local host, missing input).

Request

Add two top-level fields to the JSON report (and report -f json):

  1. pages: one entry per URL the crawl requested, with url, finalUrl, status (HTTP code or null), and an outcome such as ok, http-error, rate-limited, error (with reason), skipped (excluded, robots, out of scope).
  2. executedRules: the rule ids that actually ran on this audit, so issues + passedRules + notChecked + skippedChecks can be checked against it.

Why

Both are known inside the CLI at report time. With them we could delete our entity-map parser and the coverage inference (about 250 lines) and stop guessing which absent findings are real fixes.

Tested with v0.0.139 (audit <url> --http -m 30 -f json): top-level keys are meta, status, score, summary, issues, skippedChecks, notChecked, technologies, structure, entities.

Related: #701 (page map export) and #518 (skipped checks per rule and page) cover neighbouring parts; this asks only for page outcomes and the executed rule list.


Triage

The JSON report (packages/report/src/output/json.ts) has skippedChecks, notChecked, technologies, structure and entities, so the reporter's key list is accurate. passedRules also exists (json.ts, {ruleId, name, category, scope, pages}) but is emitted only with --include-passed, which the reporter did not use. structure (ReportStructure in packages/core-contracts/src/index.ts) holds aggregates only (pages is a count, plus link sections and page-type counts), so there is no per-URL list; the claim that pages are not listed is accurate. There is no pages array and no executedRules field today. Overlap: #701 (page map export, per-page metadata) and #518 (skipped checks per rule and page) are adjacent; #669 (info checks missing from JSON) is unrelated to coverage. The two asks are distinct and cheap because both are known at report time: a per-URL crawl outcome list (url, finalUrl, status, outcome with reason) and the ids of rules that ran. Recommend building both as additive, optional top-level fields, with pages capped and flagged when truncated (reports can be large and publish payloads are size-capped), and defining executedRules as rules that produced at least one non-skipped check so it composes with issues + passedRules + notChecked + skippedChecks. Do not fold this into #701's table export; share the page-outcome type with it.

Acceptance Criteria

Restated on 2026-10-30 to the maintainer decision of 2026-10-29 (opt-in --include-pages):

  • squirrel audit -f json --include-pages and squirrel report -f json --include-pages add a top-level pages array with url, finalUrl, status, outcome (ok, http-error, rate-limited, error) and ruleCount for every page with a stored response. Off by default: no pages key without the flag.
  • A stored 429 response is listed with outcome rate-limited; a URL whose fetch never stored a response is not a page (rate-limited hosts are counted in rateLimited).
  • A redirected URL keeps the URL asked for in url and names where it was served from in finalUrl.
  • The list is capped at 2,000 entries with pagesTotal and pagesTruncated; the fields are optional additions (meta.schemaVersion 1.2 when this shipped).
  • Docs for the schema are updated and make validate passes in docs/.
  • Tests cover a 404 page, a redirected page, a 429 row and the cap.

Split out to #1396 (closed): executedRules, and a reason plus skipped outcome for URLs that never answered (connection error, excluded, robots).

Activity

  1. added
    enhancement
    size: M
    on Oct 29, 2026
  2. nc9 commented on Oct 29, 2026

    @nc9
    Contributor

    Thanks @deniskern, this is a clear request and the data is already known at report time. We will add a per-URL pages outcome list and an executedRules list to the JSON report, kept optional and size-bounded, and queue it.

  3. added theissue type on Oct 29, 2026
  4. nc9 commented on Oct 30, 2026

    @nc9
    Contributor

    Decision (Nik, 2026-10-29): opt-in. The per-page list is off by default so existing consumers and report size do not change. With the flag, pages[] carries url, status and ruleCount, capped with a truncated marker beyond a documented limit, and the report schema gets a minor version bump. Queued with the CLI audit-controls group (#1271, #1258).

  5. nc9 commented on Oct 30, 2026

    @nc9
    Contributor

    Checked against main (23a34c1, v0.0.144). The 2026-10-29 maintainer decision made the list opt-in as --include-pages with url, status and ruleCount per row, with truncation bounded and marked. Open against the written criteria: no finalUrl or outcome, no reason on skipped or errored entries, no rate-limited outcome, no executedRules, and no tests for errored, rate-limited or excluded pages. Restate the criteria to the decided scope or split the rest.

    nik

  6. nc9 commented on Oct 31, 2026

    @nc9
    Contributor

    Restated acceptance criteria, matching the maintainer decision of 2026-10-29 (opt-in --include-pages) and what shipped plus pub PR for this round:

    • squirrel audit -f json --include-pages and squirrel report -f json --include-pages add a top-level pages array with url, finalUrl, status, outcome (ok, http-error, rate-limited, error) and ruleCount for every page with a stored response. Off by default: no pages key without the flag.
    • A stored 429 response is listed with outcome rate-limited; a URL whose fetch never stored a response is not a page (rate-limited hosts are counted in rateLimited).
    • A redirected URL keeps the URL asked for in url and names where it was served from in finalUrl.
    • The list is capped at 2,000 entries with pagesTotal and pagesTruncated; the fields are optional additions (meta.schemaVersion 1.2).
    • Docs for the schema are updated and make validate passes in docs/.
    • Tests cover a 404 page, a redirected page, a 429 row and the cap.

    Split out to #1396: executedRules, and a reason plus skipped outcome for URLs that never answered (connection error, excluded, robots).

    nik

  7. nc9 commented on Oct 31, 2026

    @nc9
    Contributor

    Re-checked against main after v0.0.147. The six restated criteria in the last maintainer comment are all met (opt-in --include-pages, finalUrl and outcome on each row, 429 as rate-limited, redirect keeps url and finalUrl, the 2,000-entry cap with pagesTotal and pagesTruncated, docs and tests). The checklist in the issue body still lists the original criteria, three of which (executedRules, reason and the skipped outcome) were split out to #1396. Leaving this open until the body checklist is edited to the restated list, then it can close.

    nik

  8. nc9 commented on Nov 2, 2026

    @nc9
    Contributor

    Edited the body checklist to the restated list from the 2026-10-30 comment, all six ticked, with the split to #1396 noted. Verified on main (e86767ff): packages/report/tests/json-pages-1260.test.ts passes 8/8 (no pages key by default, url/finalUrl/status/outcome/ruleCount rows including a 404, 429 as rate-limited, the cap at the limit and one over with the real total, an empty crawl), and docs/cli/audit.mdx documents --include-pages under "Pages list". executedRules and the unstored-page reason shipped under #1396 (closed). meta.schemaVersion is 1.5 on main now (the test pins it), a superset of the 1.2 the criterion named. Closing.

    nik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    clienhancementsize: M

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions