Skip to content

test(rules): integrity budget tests run with the rule clock off and in files that fit a lane watchdog #1465 - #1471

Closed
nc9 wants to merge 2 commits into
mainfrom
test/integrity-budget-clock-1465
Closed

nc9 wants to merge 2 commits into
mainfrom
test/integrity-budget-clock-1465

Conversation

@nc9

@nc9 nc9 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1465.

integrity-budget-784.test.ts runs the integrity rules on hostile pages through RuleRunner. Its subject is work bounds, but the runner's wall-clock rule budget (2 s) was on, so a loaded machine cut the same page that an idle one finished. And the "file exits without a summary" runs were not the tests: the lane's bun-test-watchdog.sh kills a bun test older than 150 s or over 1.2 GB (its log shows kills of this file at age=161s and rss=1310MB/1366MB), and the one file took 40 to 50 s idle with a 1.3 GB peak.

  • run() builds the runner with ruleTimeBudgetMs: 0 (the budget off), so no case depends on elapsed time. No test has the wall-clock budget as its subject, so none needed an injectable clock; the file header says the subject is work bounds.
  • The 27 tests move into four files over a shared integrity-budget-fixture.ts (same test names, same assertions, one title reworded from "at the default budget" to "no clock"): -784 (12 tests, 14 s idle), -784-nested (the two slowest pages, 21 s), -1424 (11), -1424-decoys (the 8 MB page, 5 s). Peak RSS per file on an idle machine: 1.14 GB, 0.88 GB, 1.01 GB, 0.55 GB (was 1.3 GB for the single file).
  • Verified: all four files pass, twice over with 6 busy processes running (load 6 to 10), every run printed its summary (the slowest took 84 s) and the watchdog killed nothing. I did not run 10 rounds under 12 busy processes (that loaded the shared machine for the other lanes), so the "10 consecutive runs under 12 busy processes" box is partly evidenced: 2 rounds under 6.
  • Test names compared against main: all 27 present.

Bounds pinned (review round 1): with the clock off, nothing asserted the scan's own work bounds, so each could be lifted a thousandfold with every test green. integrity-budget-1465-bounds.test.ts (5 tests, 2 s, 0.75 GB) fails each of those mutations: the ordered and the shared window budget (a page of 600 controls with 40 cue windows each must report 250 to 350 controls unread; the defaults are asserted too), MAX_WINDOWS_PER_CONTROL (a control asking for 200 windows is cut and counted, one asking for 160 is not), and TOTAL_VISITS (3,000 controls of about 200 nodes each are cut short of their nodes and counted).

Ceiling with the clock off: the rule clock was also the runaway guard for a rule that never returns. With ruleTimeBudgetMs: 0 these tests have none: an injected infinite loop would hang until the lane watchdog (150 s) or the CI job timeout cuts the process, the same as on main for any test file that runs without the budget. The tests whose subject is the clock itself live elsewhere and keep the budget on.

Skill: no change needed.

nik

nc9 added 2 commits November 1, 2026 13:45
…n four files that fit a lane watchdog #1465

Signed-off-by: Nik Cubrilovic <[email protected]>
…sit budget with the clock off; drop an unused import #1465

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

nc9 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Landed in v0.0.154 as deb81915 6b0ac211 via #1493. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.154. Closing this original.

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.

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

1 participant