Skip to content

Conversation

@hyf0
Copy link
Member

@hyf0 hyf0 commented Nov 11, 2025

Fixes the case of recovering from intial build error at #6648.

  • I removed Mutex<BuildState> to prevent potential dead lock problem.
  • No shared state observation, every actor maintains its own state within itself. State transition are done by messaging.
  • All operations are done by passing messages(will revise this decision for performance intensive scenario.
  • General error handling is still in investigation.

Copy link
Member Author

hyf0 commented Nov 11, 2025


How to use the Graphite Merge Queue

Add the label graphite: merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@netlify
Copy link

netlify bot commented Nov 11, 2025

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 9c25840
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/691333e63fd9dc000860d572

@hyf0 hyf0 marked this pull request as ready for review November 11, 2025 10:04
@hyf0 hyf0 requested a review from sapphi-red November 11, 2025 10:04
@hyf0 hyf0 force-pushed the 11-11-refactor_dev_use_actor_design_pattern_and_allow_to_recover_from_intial_build_error branch from bcb6583 to eee2b98 Compare November 11, 2025 10:06
@github-actions
Copy link
Contributor

github-actions bot commented Nov 11, 2025

Benchmarks Rust

  • target: main(b2f79cb)
  • pr: 11-11-refactor_dev_use_actor_design_pattern_and_allow_to_recover_from_intial_build_error(9c25840)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.00     67.5±1.96ms        ? ?/sec    1.01     68.0±2.49ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.00     74.6±2.43ms        ? ?/sec    1.00     74.8±2.25ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00    111.5±1.95ms        ? ?/sec    1.00    111.6±2.26ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.00    125.0±2.97ms        ? ?/sec    1.00    125.5±1.67ms        ? ?/sec
bundle/bundle@threejs                                        1.00     41.4±2.61ms        ? ?/sec    1.02     42.1±2.30ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.00     44.7±1.18ms        ? ?/sec    1.00     44.9±1.06ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    404.7±4.44ms        ? ?/sec    1.00    406.4±5.06ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.00    464.1±4.56ms        ? ?/sec    1.01    466.6±5.06ms        ? ?/sec
scan/scan@rome_ts                                            1.01     89.8±2.39ms        ? ?/sec    1.00     88.7±1.93ms        ? ?/sec
scan/scan@threejs                                            1.00     30.1±1.86ms        ? ?/sec    1.00     30.0±2.04ms        ? ?/sec
scan/scan@threejs10x                                         1.00    307.3±4.90ms        ? ?/sec    1.00    308.3±5.69ms        ? ?/sec

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the dev server to use an actor design pattern, replacing shared Mutex<BuildState> with message-passing between actors. The primary goal is to fix recovery from initial build errors and prevent potential deadlock issues.

Key Changes:

  • Introduced BundleCoordinator actor that manages build state via message passing instead of shared locks
  • Added InitialBuildState tracking to properly handle initial build failures and retries
  • Replaced BuildDriver/BuildDriverService with unified BundleCoordinator that handles both scheduling and execution coordination

Reviewed Changes

Copilot reviewed 21 out of 31 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
crates/rolldown/src/dev/bundle_coordinator.rs New coordinator actor implementing message-based build orchestration
crates/rolldown/src/dev/types/initial_build_state.rs Enum tracking initial build lifecycle (InProgress/Succeeded/Failed)
crates/rolldown/src/dev/types/coordinator_msg.rs Message types for coordinator communication
crates/rolldown/src/dev/types/bundling_status.rs Response type for build status queries
crates/rolldown/src/dev/types/task_input.rs Added InitialBuild variant for retry after initial failure
crates/rolldown/src/dev/dev_engine.rs Refactored to use coordinator pattern instead of build driver
crates/rolldown/src/dev/bundling_task.rs Simplified task execution without state machine transitions
crates/rolldown/src/dev/dev_context.rs Removed shared state, only keeps coordinator channel reference
crates/rolldown/tests/rolldown/topics/hmr/recover_from_intial_build_error/* Test case for initial build error recovery
crates/rolldown_testing/src/integration_test.rs Updated to handle optional HMR callbacks for initial builds
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (2)

crates/rolldown/tests/rolldown/topics/hmr/recover_from_intial_build_error/artifacts.snap:39

  • Typo in "intial" - should be "initial". This appears in the file path.
    crates/rolldown/src/dev/bundling_task.rs:178
  • The error message returned here is not informative. Instead of a generic "Err" message, it should include details about what failed. Consider using the actual error from build_result or providing a more descriptive error message.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hyf0 hyf0 force-pushed the 11-11-refactor_dev_use_actor_design_pattern_and_allow_to_recover_from_intial_build_error branch 2 times, most recently from 9411aec to 61f496a Compare November 11, 2025 12:14
Copy link
Member Author

hyf0 commented Nov 11, 2025

Merge activity

graphite-app bot pushed a commit that referenced this pull request Nov 11, 2025
…ial build error (#6936)

Fixes the case of recovering from intial build error at #6648.

- I removed `Mutex<BuildState>` to prevent potential dead lock problem.
- No shared state observation, every actor maintains its own state within itself. State transition are done by messaging.
- All operations are done by passing messages(will revise this decision for performance intensive scenario.
- General error handling is still in investigation.
@graphite-app graphite-app bot force-pushed the 11-11-refactor_dev_use_actor_design_pattern_and_allow_to_recover_from_intial_build_error branch from 61f496a to 018d175 Compare November 11, 2025 12:48
…ial build error (#6936)

Fixes the case of recovering from intial build error at #6648.

- I removed `Mutex<BuildState>` to prevent potential dead lock problem.
- No shared state observation, every actor maintains its own state within itself. State transition are done by messaging.
- All operations are done by passing messages(will revise this decision for performance intensive scenario.
- General error handling is still in investigation.
@graphite-app graphite-app bot force-pushed the 11-11-refactor_dev_use_actor_design_pattern_and_allow_to_recover_from_intial_build_error branch from 018d175 to 9c25840 Compare November 11, 2025 13:02
@graphite-app graphite-app bot merged commit 9c25840 into main Nov 11, 2025
28 checks passed
@graphite-app graphite-app bot deleted the 11-11-refactor_dev_use_actor_design_pattern_and_allow_to_recover_from_intial_build_error branch November 11, 2025 13:17
shulaoda pushed a commit that referenced this pull request Nov 12, 2025
## [1.0.0-beta.50] - 2025-11-12

### 🚀 Features

- rolldown: oxc_resolver v11.13.2 (#6956) by @Boshen
- rolldown: oxc v0.97.0 (#6940) by @Boshen

### 🐛 Bug Fixes

- handle error when creating output chunk directories (#6953) by @sapphi-red
- throw error if `experimental.hmr` is set for APIs other than `dev` (#6860) by @Copilot
- apply output.paths transformation to chunk.imports and generated code (#6923) by @Copilot

### 🚜 Refactor

- use `anyhow::Context::context` where applicable (#6952) by @sapphi-red
- dev: use actor design pattern and allow to recover from intial build error (#6936) by @hyf0

### 📚 Documentation

- add sitemap (#6929) by @mdong1909

### 🧪 Testing

- validate publishConfig.exports matches exports field (#6950) by @Copilot
- re-enable output/paths/function test (#6934) by @Copilot

### ⚙️ Miscellaneous Tasks

- rename `rolldown_watcher` to `rolldown_fs_watcher` (#6958) by @hyf0
- enable trust policy (#6948) by @iiio2
- deps: update napi (#6951) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.17.6 (#6947) by @renovate[bot]
- deps: update npm packages (#6937) by @renovate[bot]
- deps: update dependency tsdown to v0.16.2 (#6933) by @renovate[bot]

### ❤️ New Contributors

* @mdong1909 made their first contribution in [#6929](#6929)

Co-authored-by: sapphi-red <[email protected]>
hyf0 added a commit that referenced this pull request Nov 12, 2025
#6965)

- I'm investigating
#6936 (comment). I
find I have to use tracing to inspect the behavior, so I turn to solve
some issues related to tracing.
- Previously, we use `trace` level to infer the event is a
devtools-specific event, while this allows us to freely write tracing
code with any level now. @IWANABETHATGUY cc
graphite-app bot pushed a commit that referenced this pull request Nov 12, 2025
…e a rebuild task if there're no queued tasks (#6968)

Fixes [edit-reload test](#6936 (comment)).
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.

3 participants