Repository navigation
perf(cli): stop the report building per-page fields nothing reads - #260
Merged
Merged
Conversation
added 2 commits
September 8, 2026 08:11
`reconstructReport` built a full PageAudit per page — meta, og, twitter, schema, links, images, h1Count, h1Text, loadTime, responseHeaders, security — and most of it was discarded. No output format emits `report.pages`, and the publish path sends `pages: []` after taking the urls, the statuses and the home page's title. Searched rather than assumed. Exactly one reader survived: `pickHomepageSummary` reads `meta` and `og` off the home page to seed the website record's title and description, which is why those two are kept. `links` had a reader on paper, in apps/cli/src/links/index.ts, but that module is referenced only by its own test and never runs in production. The dropped fields stay in the type as optional, so anything constructing or consuming a PageAudit still compiles, and the hosted builder — which publishes these and needs them — is untouched. Also removed with them: the per-page `getLinkAppearancesForPage` query and the whole-crawl `getLinks` read that fed `links`, and three of the five objects in the per-page detach. The image-appearance query stays; it also drives `summary.missingAltText`, which IS emitted. `responseHeaders` going means Set-Cookie can no longer reach a report at all, rather than being stripped by a helper that could be forgotten. The test that covered the strip now asserts the stronger property against the whole page as JSON. Measured neutral on the 1,000-page fixture: heap +114 MB before, +113 to +117 after. The reason is the fixture, and it is worth stating rather than hiding — `links` and `images` are written by the external-link phase, the benchmark runs `--offline` against a site with no outbound links, so this corpus stores zero of either and the arrays being dropped were already empty. What the change removes structurally is a query per page on any site that does have external links; that is not claimed as a number because it was not measured. Recorded that way in the benchmarks file. The publish body is pinned byte-identical with and without the dropped fields by a differential test, the emitted report is unchanged end to end at 400 pages, and the engine goldens are green. Signed-off-by: Nik Cubrilovic <[email protected]>
… page #1938 Review pushed back on the claim, correctly. The commit above said Set-Cookie "can no longer reach a report at all", but the test only looked at the first page's fields, so it did not prove that. It now serializes the whole report, so a cookie arriving by some other route — a check's items, the summary, a field the type does not declare — fails it too. Also noted in the test where it belongs: the security/cookie-flags rule keeps cookie NAMES in its check items on purpose and discards the values. The property being asserted is about the values. Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
feat/report-page-fields
branch
from
September 7, 2026 22:12
2664f54 to
ad90b96
Compare
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes squirrelscan/repo#1938. No behaviour change; the emitted report and the publish body are unchanged.
What was happening
reconstructReportbuilt a fullPageAuditfor every crawled page:meta,og,twitter,schema,links,images,h1Count,h1Text,loadTime,responseHeaders,security. Most of it was built and thrown away.No output format emits
report.pages— not json, llm, markdown, sarif, xml, html, pdf or text. The publish path sendspages: []after taking the urls, the statuses and the home page's title.What actually reads a page field
Searched rather than assumed, across the CLI and
packages/report:cli/commands/audit.ts.lengthcontrollers/report/publish.ts.url,.statusCode, andmeta/ogon the home pagecli/commands/report.ts,reports/filters.ts.checks, filtered in placereports/reconstruct.ts.fallbackReason, for one countlinkshad a reader on paper,apps/cli/src/links/index.ts, but that module is referenced only by its own test file and never runs in production.So
metaandogare kept, becausepickHomepageSummaryreads them off the home page to seed the website record. Everything else in the list above is no longer built.Also removed with them
The per-page
getLinkAppearancesForPagequery and the whole-crawlgetLinksread that fedlinks, and three of the five objects in the per-page detach. The image-appearance query stays: it also drivessummary.missingAltText, which is emitted.Measured neutral here, and the fixture is why
Growth across
reconstructReporton the 1,000-page corpus, warmed, two runs per side:The two largest fields dropped are
linksandimages, and this corpus stores zero of either. They are written by the external-link phase, and the benchmark runs--offlineagainst a site with no outbound links, so the arrays being dropped were already empty and the per-page query had nothing to return.What the change removes structurally — a storage query per page on any site that does have external links — is not claimed as a number, because I did not measure it. The benchmarks file says so in those words rather than recording a win that was not observed.
Parity
slimForPublishoutputs are byte-identical, plus that the home-page title still comes through and non-2xx statuses are still reported. That is the one consumer that could have depended on a field quietly.buildV1Report, which publishespages[]unstripped and needs these fields, is untouched.A side effect worth calling out
responseHeadersgoing means there is no Set-Cookie strip left to forget: the field the cookie used to ride on is no longer built. The test that covered that strip now asserts over the whole report serialized as JSON, so a cookie arriving by some other route would fail it too.Stated precisely, because the review caught me overstating it: the first version of that test looked only at the first page's fields, which did not prove the claim the commit made. It looks at the whole report now. Note also that the
security/cookie-flagsrule deliberately keeps cookie names in its check items and discards the values; this is about the values.Type shape
The dropped fields stay in
PageAuditas optional rather than being removed, so anything constructing or consuming one still compiles.