Skip to content

Conversation

@hyf0
Copy link
Member

@hyf0 hyf0 commented Oct 1, 2025

Issues of previous error mechanism:

  • BindingOutputs#errors always got consumed in the js side. It adds unnecessary lazy overhead.
  • BindingOutputs#errors doesn't force develpoers to handle errors.
  • BindingOutputs#errors get handled repeatly due to each function doesn't know about whether its caller handles the error or not.

This PR introduces BindingResult as a unify way, not just for passing BindingOutput​, to handle errors passed from rust to js.

  • Errors are forced to handle if you want to use the value
  • Errors are designed to only need to be handled once.

Related might still need to polished, but I want to set a correct direction first.

Copy link
Member Author

hyf0 commented Oct 1, 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.

@socket-security
Copy link

socket-security bot commented Oct 1, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedstrip-comments@​2.0.110010010078100

View full report

@hyf0 hyf0 marked this pull request as ready for review October 1, 2025 11:50
@hyf0 hyf0 requested a review from IWANABETHATGUY October 1, 2025 11:58
@github-actions
Copy link
Contributor

github-actions bot commented Oct 1, 2025

Benchmarks Rust

  • target: main(1ae7f07)
  • pr: 10-01-refactor_introduce_bindingerrorsor_to_hold_errors(7dec746)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.00     73.6±3.30ms        ? ?/sec    1.00     73.5±2.42ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.03     84.6±4.50ms        ? ?/sec    1.00     82.2±2.37ms        ? ?/sec
bundle/bundle@rome_ts                                        1.03    116.9±3.51ms        ? ?/sec    1.00    114.0±2.37ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.01    132.7±2.99ms        ? ?/sec    1.00    130.9±2.80ms        ? ?/sec
bundle/bundle@threejs                                        1.00     45.6±2.77ms        ? ?/sec    1.00     45.7±1.36ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.00     53.2±1.22ms        ? ?/sec    1.00     52.9±1.02ms        ? ?/sec
bundle/bundle@threejs10x                                     1.02   449.6±10.02ms        ? ?/sec    1.00    442.5±7.79ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.00    507.9±7.60ms        ? ?/sec    1.00    507.8±9.63ms        ? ?/sec
scan/scan@rome_ts                                            1.00     88.6±1.74ms        ? ?/sec    1.00     88.2±1.86ms        ? ?/sec
scan/scan@threejs                                            1.00     32.9±0.46ms        ? ?/sec    1.02     33.5±1.61ms        ? ?/sec
scan/scan@threejs10x                                         1.00    336.8±5.20ms        ? ?/sec    1.00    337.4±5.36ms        ? ?/sec

@hyf0 hyf0 force-pushed the 10-01-refactor_introduce_bindingerrorsor_to_hold_errors branch from 664270c to 0730db7 Compare October 1, 2025 12:44
@graphite-app graphite-app bot changed the base branch from 10-01-chore_node_rename_normalizeerrors_into_aggregatebindingerrorsintoerror_ to graphite-base/6390 October 1, 2025 13:45
@hyf0 hyf0 force-pushed the 10-01-refactor_introduce_bindingerrorsor_to_hold_errors branch from 0730db7 to 84f43b9 Compare October 1, 2025 14:12
@hyf0 hyf0 force-pushed the graphite-base/6390 branch from 6db427d to 3532484 Compare October 1, 2025 14:12
@hyf0 hyf0 changed the base branch from graphite-base/6390 to 10-01-chore_node_rename_normalizeerrors_into_aggregatebindingerrorsintoerror_ October 1, 2025 14:12
@hyf0 hyf0 changed the title refactor: introduce BindingErrorsOr to hold errors refactor: introduce BindingResult to pass errors from rust to js Oct 1, 2025
Base automatically changed from 10-01-chore_node_rename_normalizeerrors_into_aggregatebindingerrorsintoerror_ to main October 1, 2025 16:16
@hyf0 hyf0 requested a review from IWANABETHATGUY October 2, 2025 05:26
@hyf0 hyf0 force-pushed the 10-01-refactor_introduce_bindingerrorsor_to_hold_errors branch from 84f43b9 to 1befe5c Compare October 2, 2025 07:10
@netlify
Copy link

netlify bot commented Oct 2, 2025

Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit 7dec746
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/68de587de9de9a00087a2918
😎 Deploy Preview https://deploy-preview-6390--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.

@graphite-app
Copy link
Contributor

graphite-app bot commented Oct 2, 2025

Merge activity

  • Oct 2, 9:12 AM UTC: hyf0 added this pull request to the Graphite merge queue.
  • Oct 2, 9:22 AM UTC: The Graphite merge queue couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'node-test (ubuntu-latest) / Node Test', 'node-test (macos-latest) / Node Test', 'node-test (windows-latest) / Node Test').
  • Oct 2, 10:32 AM UTC: hyf0 added this pull request to the Graphite merge queue.
  • Oct 2, 11:01 AM UTC: Merged by the Graphite merge queue.

graphite-app bot pushed a commit that referenced this pull request Oct 2, 2025
…6390)

Issues of previous error mechanism:

- `BindingOutputs#errors` always got consumed in the js side. It adds unnecessary lazy overhead.
- `BindingOutputs#errors` doesn't force develpoers to handle errors.
- `BindingOutputs#errors` get handled repeatly due to each function doesn't know about whether its caller handles the error or not.

---

This PR introduces `BindingResult` as a unify way, not just for passing `BindingOutput`​, to handle errors passed from rust to js.

- Errors are forced to handle if you want to use the value
- Errors are designed to only need to be handled once.

Related might still need to polished, but I want to set a correct direction first.
@graphite-app graphite-app bot force-pushed the 10-01-refactor_introduce_bindingerrorsor_to_hold_errors branch from 1befe5c to 3449b6f Compare October 2, 2025 09:12
…6390)

Issues of previous error mechanism:

- `BindingOutputs#errors` always got consumed in the js side. It adds unnecessary lazy overhead.
- `BindingOutputs#errors` doesn't force develpoers to handle errors.
- `BindingOutputs#errors` get handled repeatly due to each function doesn't know about whether its caller handles the error or not.

---

This PR introduces `BindingResult` as a unify way, not just for passing `BindingOutput`​, to handle errors passed from rust to js.

- Errors are forced to handle if you want to use the value
- Errors are designed to only need to be handled once.

Related might still need to polished, but I want to set a correct direction first.
@graphite-app graphite-app bot force-pushed the 10-01-refactor_introduce_bindingerrorsor_to_hold_errors branch from 3449b6f to 7dec746 Compare October 2, 2025 10:48
@graphite-app graphite-app bot merged commit 7dec746 into main Oct 2, 2025
28 checks passed
@graphite-app graphite-app bot deleted the 10-01-refactor_introduce_bindingerrorsor_to_hold_errors branch October 2, 2025 11:01
@github-actions github-actions bot mentioned this pull request Oct 7, 2025
shulaoda pushed a commit that referenced this pull request Oct 7, 2025
## [1.0.0-beta.42] - 2025-10-07

### 🚀 Features

- rolldown: oxc v0.94.0 (#6428) by @Boshen
- add CLI environment flag (#6426) by @IWANABETHATGUY
- dev: use `RebuildStrategy#Auto` by default (#6420) by @hyf0
- rolldown_plugin_vite_html: introduce html plugin state (#6413) by @shulaoda
- dev: expose build errors via `DevOptions#on_output` (#6412) by @hyf0
- dev: add binding for `DevOptions#rebuild_strategy` (#6396) by @hyf0
- dev: add `RebuildStrategy::Auto` to issue rebuild automatically if detecting full reload hmr update (#6395) by @hyf0
- debug: inject `call_id` for `renderChunk` hook (#6392) by @hyf0
- node/dev: add `DevEngine#close` (#6377) by @hyf0
- rust/dev: add `DevEngine#close` (#6376) by @hyf0

### 🐛 Bug Fixes

- rolldown_plugin_react_refresh_wrapper: register exports in next microtask (#6423) by @sapphi-red
- plugin/vite-resolve: try original extension before replacing with TS variants (#6421) by @sapphi-red
- node/resolve: take custom package json path into account (#6419) by @hyf0
- dev: call `watchChange` hook (#6403) by @sapphi-red
- use minify options for DCE for dce-only minify (#6402) by @sapphi-red
- respect package.json type field in plugin-resolved modules (#6400) by @hyf0
- returning result of this.resolve in resolveDynamicImport hook impacts bundle size (#6397) by @sapphi-red
- rolldown_plugin_json: avoid generating named exports for `eval` and `arguments` (#6381) by @sapphi-red
- use static property for namespace object (#6383) by @sapphi-red

### 🚜 Refactor

- rust: improve constuction of `PackageJson` and remove unused fields (#6418) by @hyf0
- introduce `BindingResult` to pass errors from rust to js (#6390) by @hyf0
- rust: rename eager_rebuild to rebuild_strategy with enum (#6394) by @hyf0
- rust/binding: use `BindingError` to cover `JsError` and `NativeError` (#6388) by @hyf0
- rust/binding: rename `BindingError` to `NativeError` (#6387) by @hyf0

### 📚 Documentation

- tweak built-in transforms section (#6384) by @sapphi-red

### ⚡ Performance

- dev: avoid frequent `setTimeout` -> `clearTimeout` (#6375) by @sapphi-red

### 🧪 Testing

- hmr: include generated bundle for full reloads in snapshots (#6374) by @sapphi-red
- dev: add test about doing hmr with not being affected by not executed modules (#6360) by @hyf0
- hmr: hmr patch file generation for `this.addWatchFile` (#5219) by @sapphi-red

### ⚙️ Miscellaneous Tasks

- deps: update crate-ci/typos action to v1.38.0 (#6431) by @renovate[bot]
- deps: update crate-ci/typos action to v1.37.3 (#6429) by @renovate[bot]
- deps: lock file maintenance npm packages (#6417) by @renovate[bot]
- deps: update github-actions (#6414) by @renovate[bot]
- rust/test: sensible heading level for build snapshot of config variant (#6408) by @hyf0
- rust/test: introduce `SnapshotSection` to organize snapshot content (#6407) by @hyf0
- rust/test: extract `ArtifactsSnapshot` and `BuildRoundOutput` into standalone files (#6406) by @hyf0
- rust/test: introduce `ArtifactsSnapshot` to make generating snapshot more clear (#6405) by @hyf0
- deps: update crate-ci/typos action to v1.37.2 (#6409) by @renovate[bot]
- fix `GitHub` casing (#6401) by @iiio2
- rust: remove unused `rolldown_binding_watcher` crate (#6386) by @hyf0
- deps: update crate-ci/typos action to v1.37.1 (#6391) by @renovate[bot]
- node: rename `normalizeErrors` into `aggregateBindingErrorsIntoError` (#6389) by @hyf0
- fix typos (#6382) by @sapphi-red
- deps: update dependency tsdown to v0.15.6 (#6379) by @renovate[bot]
- deps: update crate-ci/typos action to v1.37.0 (#6380) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.16.11 (#6378) by @renovate[bot]
- add comment to `add_watch_file` that the path should be a normalized absolute path (#6371) by @sapphi-red
- deps: update dependency rolldown-plugin-dts to v0.16.10 (#6373) by @renovate[bot]

Co-authored-by: sapphi-red <[email protected]>
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