Skip to content

tests: integrity-budget-784 fails under load (wall-clock rule time budget); make it clock-independent #1465

Closed

Description

@nc9

packages/rules/tests/integrity-budget-784.test.ts is load-sensitive. It runs the integrity rules through RuleRunner on hostile pages (5 MB of controls, 100 KB of nested templates, 500 KB aria-labelledby, 300 U+FDFA labels, the #1424 label-window budgets) and asserts each rule finished: no -error or timeout check and no skipped check. The runner enforces a wall-clock per-page rule time budget ([rules] time_budget_ms, RunnerOptions.ruleTimeBudgetMs), so on a loaded machine the same test that passes on an idle one is cut by the clock and fails.

Observed: 27 of 27 pass on an idle machine; with load averages of 11 to 13, 6 of 27 failed in one run (two of them budget tests added for #1424), and on some runs the file exits without printing a summary. The tests are about work bounds (how much of the page the rule reads), not about elapsed time.

Acceptance Criteria

  • Tests whose subject is a work bound or a cap do not depend on wall-clock time: they run the runner with the per-page time budget raised or turned off (time_budget_ms), or with an injectable clock
  • Any test whose subject is the wall-clock budget itself uses an injectable clock instead of real elapsed time
  • bun test ./tests/integrity-budget-784.test.ts passes 27 of 27 ten times in a row while the machine is under artificial CPU load (for example 12 busy processes)
  • The file prints its summary on every run (no silent exit)

Activity

  1. added
    size: XS
    rules
    on Oct 31, 2026
  2. added theissue type on Oct 31, 2026
  3. nc9 commented on Nov 1, 2026

    @nc9
    ContributorAuthor

    Shipped in v0.0.154, checked against main. Criteria 1, 3 and 4 are met. Criterion 2 is met only vacuously: no test in the rules package exercises the clock budget and none uses an injectable clock, so it cannot regress visibly. Closing; a follow-up can add a clock-budget test if wanted. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.154

    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

    rulessize: XS

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions