Skip to content

test: make Bun filesystem watcher integration deterministic - #3552

Merged
kojiwakayama merged 2 commits into
mainfrom
fix/bun-filesystem-watcher-timeout
Aug 10, 2026
Merged

kojiwakayama merged 2 commits into
mainfrom
fix/bun-filesystem-watcher-timeout

Conversation

@kojiwakayama

Copy link
Copy Markdown
Contributor

Summary

  • wait for the file written by the Bun integration test instead of assuming the first directory watcher event is relevant
  • ignore unrelated queued watcher events and clear the deadline timer during cleanup
  • use the same target-filtering pattern as the Deno watcher integration

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.txt event, 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 out
  • Expected true, got false after the first event named another path

After the change, the same test passed 100 consecutive runs.

Verification

  • deno fmt --check src/platform/adapters/runtime/bun/filesystem-adapter.bun.test.ts
  • deno lint src/platform/adapters/runtime/bun/filesystem-adapter.bun.test.ts
  • deno check src/platform/adapters/runtime/bun/filesystem-adapter.bun.test.ts
  • bun test src/platform/adapters/runtime/bun/filesystem-adapter.bun.test.ts
  • 100 consecutive isolated Bun runs
  • deno task build:npm
  • node ./tests/bun/run-tests.mjs src/platform/adapters/runtime/bun/filesystem-adapter.bun.test.ts
  • repository pre-push formatting, lint, typecheck, and partitioned unit suite

Related: #3547

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

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@kwakayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 1 minute

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0f2915a8-ead3-4d57-babb-aa68c04242ad

📥 Commits

Reviewing files that changed from the base of the PR and between a69bfe8 and 38ef878.

📒 Files selected for processing (1)
  • src/platform/adapters/runtime/bun/filesystem-adapter.bun.test.ts

Comment @coderabbitai help to get the list of available commands.

@kojiwakayama

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 38ef878376

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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

@kojiwakayama
kojiwakayama added this pull request to the merge queue Aug 10, 2026
Merged via the queue into main with commit 9c6de5b Aug 10, 2026
33 checks passed
@kojiwakayama
kojiwakayama deleted the fix/bun-filesystem-watcher-timeout branch August 10, 2026 18:43
@kwakayama kwakayama mentioned this pull request Aug 10, 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