Skip to content

feat(report): executedRules, and --include-pages lists URLs the crawl requested but stored no page for #1396 - #1492

Closed
nc9 wants to merge 5 commits into
mainfrom
feat/report-executed-rules-1396
Closed

nc9 wants to merge 5 commits into
mainfrom
feat/report-executed-rules-1396

Conversation

@nc9

@nc9 nc9 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1396.

What

  • executedRules (JSON report, meta.schemaVersion 1.5): the sorted ids of the rules that produced at least one non-skipped check on this audit. A rule whose checks were all skipped (a scan limit, a missing probe, an internal error) or that was disabled is not listed, so every rule in issues, passedRules and skippedChecks that ran is in it. Bounded by the rule catalog. Omitted when no rule produced a check, and on a report read back with squirrel report --input (no rule results), which the docs say, like passedRules.
  • --include-pages rows for URLs with no stored page: the crawl's frontier entries that failed (a connection error, a rate limit with no stored response, an HTTP error with no stored response) or were skipped (excluded, out of scope, robots.txt, URL too long) and have no stored page are listed after the crawled pages with status 0, ruleCount 0, outcome error or skipped and a reason (rate-limited, excluded, not-included, other-site, robots-disallowed, url-too-long, or, for a failed request, a short code: http-<status>, timeout, dns, tls, connection-refused, connection-reset, too-many-redirects, off-site-redirect, unreadable-body, request-failed). They count toward pagesTotal and the 2,000-entry cap; unstored rows are loaded up to the cap and pagesTotal carries the real count.
  • Both fields are optional, so existing consumers and the published-report schema keep validating; the page-row outcome gains skipped.

How

  • packages/report: collectExecutedRules, unstoredPageRow, row reason, pagesTotal override.
  • packages/crawler: getUnstoredFrontierEntries(crawlId, limit) (frontier failed/skipped with no row in pages, oldest first, plus the true total; read-only SQL, no schema change).
  • apps/cli: reconstructReport reads them only for --include-pages (and squirrel report --include-pages); generateJsonReport appends the rows.

Tests

  • executed-rules-1396.test.ts (report, 16 with the schema test): fully skipped, empty and mixed rules; every issue and passed rule is executed; rows carry outcome and reason; pagesTotal is the real count under the cap; reason mapping, bounded and cleaned.
  • unstored-frontier-1396.test.ts (crawler, 2): failed and skipped with no page, oldest first, true total, a stored page not listed, another crawl not listed.
  • reconstruct-page-rule-counts-1260.test.ts (CLI, 5 + 3): an errored fetch, a rate-limited request with no stored response, an excluded URL and a robots-blocked URL are listed; a default report does not read them; the JSON report lists them after the crawled pages and executedRules omits a fully skipped rule.
  • audit-unstored-pages-1396-e2e.test.ts (CLI e2e, 2): a real squirrel audit --include-pages against a raw local server (one path drops the connection, one is excluded in squirrel.toml, one is robots-disallowed): the three rows carry the right outcome and reason, crawled pages come first, pagesTotal counts every row; without the flag nothing is listed and executedRules is sorted and covers every issue. Existing include-pages e2e updated to schema 1.5.
  • Checks: tsgo on core-contracts, report, crawler and cli; cli format:check and lint; docs make validate.

Docs and skill

docs/configuration/output.mdx (schema 1.5 text, executedRules, the unstored rows), docs/cli/audit.mdx and docs/cli/report.mdx (the pages-list sections). CHANGELOG bullet under Added. Skill change: none (the agent skill does not describe the JSON report fields).

Not covered: the cloud publish path does not call reconstructReport with --include-pages, so published reports are unchanged.

nik

Review item: what reason can carry

The crawl's error text can hold a URL (an off-site redirect target with its query), a host, an address or the start of a response body, so a failed request's reason is never that text: unstoredPageRow maps it onto the fixed codes above (a skipped entry's reason is a code from the crawl's own set, anything else is skipped). The test the reason carries no URL, query string, token, address or response text feeds redirect targets with tokens and fragments, userinfo URLs, an HTTP error with a body naming a password and an address, a JSON error naming an API key, and control and bidi characters, and requires the reason to match ^[a-z0-9-]{1,40}$ and to contain none of them. The row's own url is the URL the crawl requested, as in the crawled rows (the docs already say a URL carrying credentials appears as stored).

Review round 2

  • Codes match what the crawl writes: Server error: 500 is http-500, Request blocked by server is blocked; the crawl's own messages (rate limit, off-site redirect, decode, TLS, timeout) are matched at their start, and for a transport error's free text URLs are removed first, so a path such as /timeout or /ssl cannot name a cause (a decode error for .../timeout is unreadable-body).
  • Types: UnstoredPageReason is a literal union (UNSTORED_PAGE_REASONS plus http-<n>) on UnstoredPage and JsonPageRow; skipped is the documented fallback for a skip with an unknown reason; the dead invalid_url mapping is gone.
  • Cap order: failed requests are listed before skipped URLs (a real error at index 1001 of 1002 is no longer cut), each group oldest first then by URL; a listed url is cut at 2,048 characters (a url-too-long row).
  • executedRules in a smart audit: a check carried over from an earlier audit (provenance: "carried") no longer makes a rule executed; the docs say "in this audit".
  • Tests added: the cap test (1,000 skips before 2 errors under a cap of 1,000), tie-break by URL, off-site-redirect, server error and WAF codes, the URL-in-message cases, pagesTotal with unstoredPagesTotal beyond the rows loaded, a failing read that leaves the rows out without failing the report, carried-only rules.
  • Left as is: row URLs are as the crawl stored them, like crawled rows (documented). Redacting both row kinds is open for decision.

Round 3

Blocked by <provider> challenge (403) now maps to blocked (test with the real WAF wording); spy test pins the cap passed to getUnstoredFrontierEntries (mutation to 1,000,000 fails it); CHANGELOG clause that a smart-audit carried finding does not make a rule executed. Skill change: none.

nc9 added 5 commits November 1, 2026 14:17
… requested but stored no page for #1396

Signed-off-by: Nik Cubrilovic <[email protected]>
Signed-off-by: Nik Cubrilovic <[email protected]>
…query string, token or response text #1396

Signed-off-by: Nik Cubrilovic <[email protected]>
… typed reasons, anchored classifier, errors before skips under the cap, carried checks are not executed rules #1396

Signed-off-by: Nik Cubrilovic <[email protected]>
… unstored cap; changelog clause on carried findings #1396

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9 nc9 mentioned this pull request Nov 1, 2026
@nc9

nc9 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Landed in v0.0.156 as bf3012e0, e4f26ffa, 833b4393, 02b6b13d, b39e1c1b via #1506.

nik

@nc9 nc9 closed this Nov 1, 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.

JSON report: executedRules and a reason for pages that never answered

1 participant