fix(core): prevent late console logs from failing the run (isolate: false)#1368
Conversation
Rsdoctor Bundle Diff AnalysisFound 13 projects in monorepo, 1 project with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 core/mainPath:
📦 Download Diff Report: core/main Bundle Diff Generated by Rsdoctor GitHub Action |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 29bd5cd637
ℹ️ 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".
29bd5cd to
0ae3aae
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ae3aaed9d
ℹ️ 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".
3358328 to
c85f73e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c85f73e2b5
ℹ️ 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".
c85f73e to
3fb6473
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3fb6473777
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! ℹ️ 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". |
…alse) With `isolate: false`, all test files share one worker but each file owns its own birpc channel. The host disposes a file's channel as soon as the file finishes, while the worker only closes it when the next file starts. A console reference captured by a file (e.g. a logger that flushes from a late `setTimeout`/microtask) could fire in or after that window and forward the log over a disposed/closed channel. The console interceptor does not await the forward, so the rejected send surfaced as an `unhandledRejection` (`[birpc] rpc is closed`) that failed the run even though every assertion passed, and was misattributed to whichever file happened to be running. Console forwarding is best-effort, with two failure modes handled at their own layer: - Delivery failures (a disposed/closed channel, a teardown race) are an expected lifecycle artifact. The worker forwards the log fire-and-forget and swallows the rejected send, so the late log is dropped instead of crashing the run — matching `isolate: true` where such logs are lost as the worker is torn down. - Handler failures (a user `onConsoleLog` filter or a reporter's `onUserConsoleLog` throwing) would otherwise be hidden by that swallow. The host now surfaces them where they occur, without failing the otherwise-passing run. Covered by e2e regression tests (with console suppression) across the forks and threads pools and both isolate modes, plus one for a throwing `onConsoleLog` hook. Originally surfaced while migrating Rsbuild's e2e runner to rstest (web-infra-dev/rsbuild#7776), then reduced to the minimal repro in #1367. Closes #1367
3fb6473 to
ec5cde3
Compare
pkg.pr.new preview
|
Summary
With
isolate: false, all test files share one worker but each file owns its own birpc channel. The host disposes a file's channel as soon as the file finishes, while the worker only closes it when the next file starts. A console reference captured by a file (e.g. a logger that flushes from a latesetTimeout/microtask) could fire in or after that window and forward the log over a disposed/closed channel.The console interceptor does not await the forward, so the rejected send surfaced as an
unhandledRejection([birpc] rpc is closed) that failed the run even though every assertion passed, and blamed the wrong file — whichever happened to be running when the late log fired.Console forwarding is best-effort, with two failure modes now handled at their own layer:
isolate: truewhere such logs are lost as the worker is torn down.onConsoleLogfilter or a reporter'sonUserConsoleLogthrowing) would otherwise be hidden by that swallow. The host now surfaces them where they occur, without failing the otherwise-passing run.The change lives in the pool-agnostic worker/host paths, so it applies to both the
forksandthreadspools.Originally surfaced while migrating Rsbuild's e2e runner to rstest (web-infra-dev/rsbuild#7776), then reduced to the minimal repro in #1367.
Related Links
Checklist