test: make Bun filesystem watcher integration deterministic - #3552
Conversation
The native watcher integration consumed exactly one filesystem event even though directory watchers may surface queued changes for another path. Keep reading until the file written by the test is observed and always clear the deadline timer. Constraint: Bun's Node-compatible fs.watch can coalesce or delay directory events on CI hosts. Rejected: Increase the timeout only | it would still fail when an unrelated event arrives first. Confidence: high Scope-risk: narrow Reversibility: clean Directive: Filesystem watcher tests must select their target event instead of assuming the first event is relevant. Tested: Reproduced both timeout and wrong-path failures; fmt, lint, typecheck, 100 consecutive Bun runs, npm build, and exact isolated Bun runner passed. Not-tested: Full Bun suite is delegated to PR CI.
|
Warning Review limit reached
Next review available in: 1 minute 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: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Comment |
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Why
PR #3547 exposed this pre-existing CI flake. Bun's Node-compatible directory watcher can surface a queued event for another path before the
file.txtevent, and a busy CI host can deliver the target event after the old three-second deadline. The adapter behavior is correct; the test consumed an underspecified first event.Regression evidence
Before the change, repeated isolated Bun runs reproduced both failure modes:
Bun filesystem watcher integration timed outExpected true, got falseafter the first event named another pathAfter the change, the same test passed 100 consecutive runs.
Verification
deno fmt --check src/platform/adapters/runtime/bun/filesystem-adapter.bun.test.tsdeno lint src/platform/adapters/runtime/bun/filesystem-adapter.bun.test.tsdeno check src/platform/adapters/runtime/bun/filesystem-adapter.bun.test.tsbun test src/platform/adapters/runtime/bun/filesystem-adapter.bun.test.tsdeno task build:npmnode ./tests/bun/run-tests.mjs src/platform/adapters/runtime/bun/filesystem-adapter.bun.test.tsRelated: #3547