Skip to content

refactor(rust/watch): remove hacky reset_closed_for_watch_mode#8530

Merged
graphite-app[bot] merged 1 commit intomainfrom
03-03-refactor_rust_watch_remove_hacky_reset_closed_for_watch_mode_
Mar 3, 2026
Merged

refactor(rust/watch): remove hacky reset_closed_for_watch_mode#8530
graphite-app[bot] merged 1 commit intomainfrom
03-03-refactor_rust_watch_remove_hacky_reset_closed_for_watch_mode_

Conversation

@hyf0
Copy link
Member

@hyf0 hyf0 commented Mar 3, 2026

Solve issue mentioned in #6482.

Copy link
Member Author

hyf0 commented Mar 3, 2026


How to use the Graphite Merge Queue

Add the label graphite: merge-when-ready 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 Mar 3, 2026

Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit a4f0798
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/69a711c7098b230008b3fdf2
😎 Deploy Preview https://deploy-preview-8530--rolldown-rs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@hyf0 hyf0 marked this pull request as ready for review March 3, 2026 07:13
Copilot AI review requested due to automatic review settings March 3, 2026 07:13
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

Refactors watch-mode “close” handling to eliminate the reset_closed_for_watch_mode workaround by moving per-build cleanup to BundleHandle, so watcher events can close the specific build result without mutating the long-lived Bundler.

Changes:

  • Replace watcher event payload bundler: Arc<Mutex<Bundler>> with bundle_handle: BundleHandle, and update NAPI bindings so JS result.close() calls BundleHandle::close().
  • Remove reset_closed_for_watch_mode/inner_close plumbing from Bundler and add BundleHandle::close() (idempotent) to run the closeBundle plugin hook.
  • Add/update design docs describing Bundler vs ClassicBundler lifecycle and the new close semantics.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/rolldown/src/binding.d.cts Updates public TS declaration comments for watcher result.close() semantics.
meta/design/watch-mode.md Links cleanup item to the new bundler/bundle close design docs.
meta/design/rust-classic-bundler.md New design doc for ClassicBundler and its close semantics.
meta/design/rust-bundler.md New design doc for long-lived Bundler and per-build BundleHandle.close() approach.
crates/rolldown_watcher/src/watch_task.rs Stops resetting bundler closed state; clears prior plugin-driver state; emits BundleHandle in events.
crates/rolldown_watcher/src/event.rs Changes event data to carry BundleHandle instead of a bundler mutex.
crates/rolldown_dev/src/dev_engine.rs Comment-only update describing bundler close behavior.
crates/rolldown_binding/src/types/binding_watcher_event.rs Converts watcher events to expose BundleHandle-backed result object.
crates/rolldown_binding/src/binding_watcher_bundler.rs result.close() now calls BundleHandle::close() directly (no bundler lock).
crates/rolldown/src/bundler/impl_bundler_getter.rs Removes Bundler::closed() getter.
crates/rolldown/src/bundler/impl_bundler_build.rs Ensures prior bundle handle is closed before new write/generate/scan; redefines Bundler::close().
crates/rolldown/src/bundler/bundler.rs Removes reset_closed_for_watch_mode and inner_close implementation.
crates/rolldown/src/bundle/bundle_handle.rs Adds idempotent BundleHandle::close() and closed tracking.
crates/rolldown/src/bundle/bundle.rs Initializes BundleHandle.closed when creating the handle.

@hyf0 hyf0 force-pushed the 03-03-refactor_rust_watch_remove_hacky_reset_closed_for_watch_mode_ branch from 130df0b to 85c5211 Compare March 3, 2026 07:24
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Benchmarks Rust

  • target: main(5f5768f)
  • pr: 03-03-refactor_rust_watch_remove_hacky_reset_closed_for_watch_mode_(51ef3e9)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.04     83.5±1.73ms        ? ?/sec    1.00     80.5±2.54ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.01     92.8±1.77ms        ? ?/sec    1.00     91.8±4.33ms        ? ?/sec
bundle/bundle@rome_ts                                        1.01    168.1±4.81ms        ? ?/sec    1.00    166.4±5.36ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.09    197.7±3.85ms        ? ?/sec    1.00    180.7±5.35ms        ? ?/sec
bundle/bundle@threejs                                        1.14     74.6±3.41ms        ? ?/sec    1.00     65.6±1.59ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.08     81.3±2.48ms        ? ?/sec    1.00     75.3±1.11ms        ? ?/sec
bundle/bundle@threejs10x                                     1.03   795.8±16.36ms        ? ?/sec    1.00   773.1±14.60ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.02   899.9±14.02ms        ? ?/sec    1.00   884.4±10.66ms        ? ?/sec
scan/scan@rome_ts                                            1.03     78.5±1.85ms        ? ?/sec    1.00     76.3±1.44ms        ? ?/sec
scan/scan@threejs                                            1.02     28.0±1.73ms        ? ?/sec    1.00     27.4±1.58ms        ? ?/sec
scan/scan@threejs10x                                         1.03    271.5±3.82ms        ? ?/sec    1.00    264.7±3.62ms        ? ?/sec

@hyf0 hyf0 force-pushed the 03-03-refactor_rust_watch_remove_hacky_reset_closed_for_watch_mode_ branch from 85c5211 to 0fd06fe Compare March 3, 2026 11:53
Copilot AI review requested due to automatic review settings March 3, 2026 11:53
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

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Copilot AI review requested due to automatic review settings March 3, 2026 12:13
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

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings March 3, 2026 12:25
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

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

@hyf0 hyf0 requested a review from sapphi-red March 3, 2026 13:22
Copy link
Member Author

hyf0 commented Mar 3, 2026

Merge activity

Copilot AI review requested due to automatic review settings March 3, 2026 16:52
@graphite-app graphite-app bot force-pushed the 03-03-refactor_rust_watch_remove_hacky_reset_closed_for_watch_mode_ branch from 51ef3e9 to a4f0798 Compare March 3, 2026 16:52
@hyf0 hyf0 review requested due to automatic review settings March 3, 2026 16:52
@graphite-app graphite-app bot merged commit a4f0798 into main Mar 3, 2026
34 checks passed
@graphite-app graphite-app bot deleted the 03-03-refactor_rust_watch_remove_hacky_reset_closed_for_watch_mode_ branch March 3, 2026 17:03
@github-actions github-actions bot mentioned this pull request Mar 4, 2026
@github-actions github-actions bot mentioned this pull request Mar 5, 2026
shulaoda added a commit that referenced this pull request Mar 5, 2026
## [1.0.0-rc.7] - 2026-03-05

⚡ Smarter Code Generation Defaults
- DCE-only minification and smart constant inlining are now enabled by default
- Produces cleaner, smaller output bundles without requiring explicit configuration

💡 LLM-Friendly Bundle Analyzer Reports
- New markdown output format for the bundle analyzer plugin with bundle summaries, module graphs, dependency chains, and optimization suggestions
- Optimization suggestions now also recommend using the entriesAware option when common chunks contain modules only reachable from specific entries


### 💥 BREAKING CHANGES

- enable minify: 'dce-only' by default (#8465) by @IWANABETHATGUY
- settings `inlineConst: { mode: 'smart', pass: 1}`  by default (#8444) by @IWANABETHATGUY

### 🚀 Features

- binding: add original getter to BindingMagicString (#8533) by @IWANABETHATGUY
- native-magic-string: add `offset` property support (#8531) by @IWANABETHATGUY
- add `output.strict` option to control `"use strict"` directive emission (#8489) by @Copilot
- watch: expose `watcher.compareContentsForPolling` (#8526) by @hyf0
- watch: use new watcher to support watch mode (#8475) by @hyf0
- rust/watch: handle bulk-change (#8466) by @hyf0
- add LLM-friendly markdown output format to bundle analyzer plugin (#8242) by @IWANABETHATGUY

### 🐛 Bug Fixes

- expose `plugins` on `NormalizedInputOptions` for `buildStart` hook (#8521) by @Copilot
- only uppercase facade symbols in JSX preserve mode (#8519) by @IWANABETHATGUY
- binding: export BindingResult in generated dts header (#8537) by @minsoo-web
- pre-resolve paths option to avoid `invoke_sync` deadlock (#8518) by @IWANABETHATGUY
- remove debug-only jsx_preset and UntranspiledSyntaxError (#8511) by @IWANABETHATGUY
- apply `topLevelVar` to exported `const`/`let` declarations (#8507) by @IWANABETHATGUY
- rolldown_plugin_vite_web_worker_post: avoid replacing `new.target` (#8488) by @sapphi-red
- update copyright year to 2026 (#8486) by @maciekzygmunt

### 🚜 Refactor

- rust: use Oxc's SymbolFlags::ConstVariable instead of custom IsConst flag (#8543) by @Dunqing
- rust: remove FacadeScoping, use Scoping::create_symbol for facade symbols (#8540) by @Dunqing
- rust/watch: remove hacky `reset_closed_for_watch_mode` (#8530) by @hyf0
- binding: return &str instead of String in filename() getter (#8534) by @IWANABETHATGUY
- rust: remove old watch mode implementation (#8525) by @hyf0
- rust/watch: simply watch logic in the binding layer (#8516) by @hyf0
- rust/watch: tweak struct/function names (#8464) by @hyf0

### 📚 Documentation

- explain how external modules work in rolldown (#8457) by @sapphi-red
- add some diagrams using graphviz (#8499) by @sapphi-red
- use `vitepress-plugin-graphviz` (#8498) by @sapphi-red
- list s390x/ppc64le prebuilt binaries (#8495) by @crusty-voidzero
- fix error type for `RolldownBuild.generate` and others (#8490) by @sapphi-red

### ⚡ Performance

- string_wizard: reduce allocations and add ASCII fast paths (#8541) by @IWANABETHATGUY
- use IndexBitSet to replace IndexVec<XXXIdx, bool> for module/stmt inclusion tracking (#8503) by @IWANABETHATGUY
- plugin: use IndexBitSet to optimize skipped plugins checking (#8497) by @ShroXd
- rust/tla: skip compute_tla if there is no module use TLA (#8487) by @ShroXd

### 🧪 Testing

- node/watch: make watch tests run in concurrent and retry-able (#8512) by @hyf0
- add test case for static flag tree-shaking (#8476) by @IWANABETHATGUY
- migrate post-banner sourcemap-with-shebang to Rust (#8477) by @Copilot

### ⚙️ Miscellaneous Tasks

- vscode: `formatOnSave` for markdown files using oxc formatter (#8536) by @minsoo-web
- deps: update test262 submodule for tests (#8528) by @sapphi-red
- remove `retry` workaround from output paths test fixtures (#8520) by @Copilot
- docs: add Shuyuan Wang (h-a-n-a) and remove from acknowledgements (#8509) by @Copilot
- consolidate top_level_var test cases using configVariants (#8508) by @IWANABETHATGUY
- add s390x and ppc64le linux gnu targets (#8493) by @Brooooooklyn

### ◀️ Revert

- fix(rolldown): increase tokio blocking threads size for watch mode (#8517) by @hyf0

### ❤️ New Contributors

* @minsoo-web made their first contribution in [#8536](#8536)
* @crusty-voidzero made their first contribution in [#8495](#8495)
* @maciekzygmunt made their first contribution in [#8486](#8486)

Co-authored-by: shulaoda <165626830+shulaoda@users.noreply.github.com>
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.

4 participants