Skip to content

fix(audit-engine,cli): store_scripts is storage only, rules see the same scripts #1280 - #1310

Closed
nc9 wants to merge 2 commits into
mainfrom
fix/1280-store-scripts-storage-only
Closed

nc9 wants to merge 2 commits into
mainfrom
fix/1280-store-scripts-storage-only

Conversation

@nc9

@nc9 nc9 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1280

Nik's decision: option (a), storage only.

What

With store_scripts on, the engine still fetches up to store_scripts_max_scripts scripts, but fetchPreRulesAssets splits the rows: the first scriptRuleLimit(pageCount) (the same limit an audit without the option fetches, 10 to 50, in page order) stay in assets.scripts for the rules, and the rest go to a new assets.storedOnlyScripts, which no rule reads. assetCapDropped (which a rule discloses) is computed from the rules' share, so it is the same as with the option off; the storage warning and crawl_scripts_summary use a separate storedScriptsNotFetched. scriptsToStore stores both groups.

AC 2: meta.scriptsEvaluated (JSON report; <scripts-evaluated count> in LLM output) is the number of first-party scripts the script rules evaluated. Local only, stripped on publish like rulesCache.

AC 3: docs/configuration/storage.mdx has "It does not change the audit" and the old "can report more findings" sentence is gone; output.mdx documents meta.scriptsEvaluated; CHANGELOG under Unreleased.

Tests (failing first)

apps/cli/tests/audit/store-scripts-results-1280.test.ts: real CLI on one page with 25 scripts, three of them over the 250 KB js-file-size warning size and all past the audit's own share of 10. With and without --store-scripts: identical issues, score and summary, meta.scriptsEvaluated is 10 in both, none of the large scripts is flagged, and the stored run still indexes all 25 as stored. On main (engine change stashed) the stored run evaluated 25.

Also pass: store-scripts-1255 (CLI), script-fetch-bounds-1255, publish-cap, asset-compression-capture (audit-engine); apps/cli format, lint, tsgo; tsgo in audit-engine, core-contracts, report; make validate.

Skill: no change needed. Branched from main separately from #1305 (#1268); both edit docs/configuration/storage.mdx and apps/cli/src/audit/store-scripts.ts, so expect small conflicts and a second ### Fixed block in the CHANGELOG.

Review follow-ups: a store_scripts_max_scripts below the audit's own share is raised to it (a 5-script limit on a 120-script page no longer changes findings or scores); preloaded chunks are fetched exactly as without the option; the test now uses 120 scripts, a limit of 5 and a preload-fetch count check; meta.scriptsEvaluated is documented as scripts given to the rules (including failed fetches), listed in output.mdx, and asserted stripped on publish; the 256 MB / 120 s bound gap is documented. Merge order: #1302, #1305, #1310.

Compose note (after #1305 lands)

nc9 added 2 commits October 30, 2026 12:36
…the same scripts as with it off; report scriptsEvaluated #1280

Signed-off-by: Nik Cubrilovic <[email protected]>
…mit is lower; preloads fetched as without it; docs and publish test #1280

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9

nc9 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Landed in v0.0.143 as 929e3983 07ebcb36 via #1341. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.143. Closing this original.

nik

@nc9 nc9 closed this Oct 30, 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.

store_scripts changes audit results: rules evaluate all 200 stored scripts, js-file-size fails on 36.5% vs 29.8% of the same sites

1 participant