Skip to content

audit --max-duration: bound the CPU cost of one very large page #1332

Closed

Description

@nc9

Follow-up to #1271 (PR #1324). --max-duration cannot interrupt synchronous work: a single very large page (a 30 MB HTML file) blocks the event loop while it is parsed, during the crawl as well as in the rules phase. The budget timer then fires late, and a loaded run was seen taking 109 s against a 15 s budget.

Acceptance Criteria

  • In a budgeted run, a page whose body exceeds a documented size is not parsed or evaluated past the deadline: either a size cap for budgeted runs, or a deadline check before the parse, and the skipped page is counted in maxDuration.pagesTooLarge and listed in maxDuration.tooLargePages (pagesNotEvaluated stays 0 by design)
  • A real-CLI test with a local site serving one very large page and a small budget exits within budget plus the documented margin
  • A run without --max-duration is unchanged
  • The "Limits" paragraph in docs/cli/audit.mdx is updated to match

Activity

  1. added
    enhancement
    size: M
    performance
    on Oct 30, 2026
  2. added theissue type on Oct 30, 2026
  3. nc9 commented on Oct 30, 2026

    @nc9
    ContributorAuthor

    Verified against main after v0.0.145. Met: criteria 2, 3 and 4 (a 6 MiB page finishes inside the budget, a run without the flag is unchanged, the docs describe the cap). Open: criterion 1 says the skipped page counts in pagesNotEvaluated, but it is reported in its own pagesTooLarge and tooLargePages fields (pagesNotEvaluated stays 0). Either the criterion needs amending to the shipped fields or the count should also go into pagesNotEvaluated. Leaving this open for that decision.

    nik

  4. nc9 commented on Oct 30, 2026

    @nc9
    ContributorAuthor

    Shipped in v0.0.145 (ec1a5b78 31f5bacb), verified against main: every acceptance criterion is met. Criterion 1 now names the shipped fields: a skipped large page is counted in maxDuration.pagesTooLarge and listed in maxDuration.tooLargePages, and pagesNotEvaluated stays 0 by design. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.145

    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

    clienhancementperformancesize: M

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions