Conversation
Subprocesses and workers can require("bun:test") and use
jest.useFakeTimers()/setSystemTime()/advanceTimersByTime(), so every
firing test is now deterministic instead of waiting for a real minute
boundary. The --hot and worker-terminate tests keep their subprocess
isolation but trigger the cron fire via the mocked clock.
File time on a debug build drops from ~117s to ~5s; release lanes will
be faster again.
|
Warning Review limit reached
Next review available in: 14 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
Comment |
|
Updated 7:46 AM PT - Jul 7th, 2026
❌ @robobun, your commit 345eccb has 2 failures in
🧪 To try this PR locally: bunx bun-pr 33635That installs a local version of the PR into your bun-33635 --bun |
|
Build 69797 finished: 283 jobs passed, 3 failed, none related to this diff.
Unrelated failures:
Ready for review. |
|
Re-verified this branch's test file against a current debug + ASAN build of main (da3851e, which includes the cron local-time change from #35122, the cron state cleanup in #37411 and the Worker teardown rework in #37075, all of which landed after this branch was cut). Same binary, same machine:
One note for anyone re-running locally: on a machine whose |
|
Re-verified again on a debug + ASAN build of main at 6e906e4. That build contains three runtime changes that landed after the previous check and that this test file depends on:
With this branch no test in the file waits for a real minute boundary. |
|
Re-ran this branch's test file on a debug build of main at adc354d (18 commits behind today's HEAD 06820dc, none of them touch this file). The branch still applies cleanly. In 16 full-file runs, 12 pass in 4 to 7s and 4 fail. Every failure is the same test:
Two failure shapes show up in the child process:
CauseThe fake clock is process wide, not per VM.
#38740 (a fake clock per VM) would remove both shapes. It is open and currently conflicts with main. Suggested changeUse one worker per process in that test. Under fake timers the fire is deterministic, so the Note for review: after this change no test in the file fires a job from a real timer tick. The fake clock path shares |
|
Superseded by #40889. That PR keeps this rewrite and fixes the race described above: the terminate-mid-callback test now starts one worker per process, because the fake clock is process-wide. It also strengthens the assertions (exact messages, inline snapshot of the handle, keep-alive cases that can fail, a second fire after a handled error, the no-overlap guarantee). Closing this one so there is a single PR for the file. |
Follow-up to #33623. Now that
Bun.cronhonors fake timers, every firing test can trigger a cron deterministically instead of waiting for a real minute boundary.What changed
Subprocesses and workers can
require("bun:test")and calljest.useFakeTimers()/setSystemTime()/advanceTimersByTime()even outside the test runner, so the subprocess and worker bodies prepend a smallmockClocksnippet and fire the cron withadvanceTimersByTime(60_000).callback fires at minute boundary,async callback: stop() during await,unreferenced job survives GC→ in-process fake timers (no subprocess)sync throw,async throw,stop() while pending,unhandled error exits process) → samebun -eshape, cron fired via mocked clockNcut from 20 to 4 since the fire is now deterministic instead of probabilistic on a minute alignment--hot reload→ v1 arms a cron under the mocked clock; v2 advances past its fire time and checks it never firedAssertions are unchanged from the originals except where a real-time await (
Bun.sleep) now needs a secondadvanceTimersByTimeto resolve.Timing
Debug + ASAN, this container, 3 runs:
The remaining time is subprocess spawn overhead (all concurrent;
--hotis the long pole at ~2s).