Skip to content

test(rules): rule-time-budget tests no longer race a 50 ms wall-clock budget - #1352

Closed
nc9 wants to merge 1 commit into
mainfrom
test/rule-time-budget-flake
Closed

nc9 wants to merge 1 commit into
mainfrom
test/rule-time-budget-flake

Conversation

@nc9

@nc9 nc9 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Test-only. rule-time-budget.test.ts "a budget of 0 turns it off" failed on #1333's CI: a call that throws immediately under a 50 ms wall-clock budget got a RuleTimeoutError on a starved shared runner (the budget is the vm watchdog's wall clock, so a pause between start and the throw spends it; the previous test's watchdog can also still be armed until the macrotask ends).

  • the pass-through call now has a 5,000 ms budget and runs after a macrotask boundary;
  • "a rule that timed out once still runs normally on later fast pages" asserted a fast second page under a 50 ms budget: now a 250 ms budget with the slow page spinning 1,000 ms;
  • the other tests in the file assert a timeout of a 150-500 ms spin under 50 ms, which a starved runner only makes more certain, so they are unchanged.

21 pass, three runs in a row locally. No CHANGELOG (test-only). Skill: none.

…ger race a 50 ms wall-clock budget

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

claude Bot commented Oct 30, 2026

Copy link
Copy Markdown

Review: no blocking issues. The test-only change keeps what each test checks and removes the wall-clock race.

  • (nit) rule-time-budget.test.ts: in "a budget of 0 turns it off", the throwing call now runs under 5_000 ms. The test name says budget 0, but that call was already testing exception pass-through under a non-zero budget. A comment or a rename (e.g. "passes exceptions through") would make that clearer.
  • (nit) The 20 ms setTimeout only moves the call past the previous test's macrotask. It reduces the race but cannot guarantee it. The 5 s budget is what makes the test reliable, so that is fine.
  • (nit) The timeout test now spins 1,000 ms. It is interrupted at 250 ms by the watchdog, so it stays well within Bun's 5 s per-test limit. If the watchdog ever failed to fire, the test would just fail by timing out, not hang.

Docs: none. Skill: none.

@nc9

nc9 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

@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.

1 participant