Skip to content

feat: allow checks.* to escalate emissions to hard errors#9388

Merged
IWANABETHATGUY merged 1 commit into
mainfrom
05-13-feat_9362
May 18, 2026
Merged

feat: allow checks.* to escalate emissions to hard errors#9388
IWANABETHATGUY merged 1 commit into
mainfrom
05-13-feat_9362

Conversation

@IWANABETHATGUY

@IWANABETHATGUY IWANABETHATGUY commented May 14, 2026

Copy link
Copy Markdown
Member

Closed #9362

Summary

Address #9362 by widening every checks.* entry to accept boolean | 'warn' | 'error':

  • false — suppress the check (unchanged).
  • true or 'warn' — emit a warning (unchanged default).
  • 'error' — promote the emission to a hard build error that fails the build.

Implementation

  • New CheckSetting enum (Off | Warn | Error) in rolldown_common with custom serde + schemars impls so the public API stays boolean | 'warn' | 'error'.
  • Generator emits per-field match arms that populate two disjoint bitflags on NormalizedBundlerOptions: warn_checks and error_checks. Added is_check_enabled(kind) helper for call sites that ask "is this check on at all?".
  • promote_warnings_to_errors pass runs at the end of Bundle::generate/write and moves any warning whose kind is in error_checks into the error channel, so the escalation works for every check kind — not just unresolvedImport.
  • unresolvedImport keeps a resolve-time fast-path in resolve_utils.rs to fail early and skip the synthetic external ResolvedId.

Test plan

  • New fixture crates/rolldown/tests/rolldown/errors/unresolved_import_as_error/unresolvedImport: 'error' fails the build with [UNRESOLVED_IMPORT] Module not found.
  • New fixture crates/rolldown/tests/rolldown/errors/eval_as_error/eval: 'error' fails the build with [EVAL] …, verifying cross-check escalation through the post-processing pass.
  • New fixture crates/rolldown/tests/rolldown/warnings/unresolved_import_explicit_warn/unresolvedImport: 'warn' produces output identical to the existing boolean-default fixture.
  • Existing unresolved_import_treated_as_external snapshot unchanged (default behavior preserved).
  • cargo test -p rolldown --test integration — 1706 passed, 0 failed.
  • cargo clippy clean across rolldown, rolldown_common, rolldown_binding, rolldown_testing, rolldown_error.

🤖 Generated with Claude Code

Copy link
Copy Markdown
Member Author

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

netlify Bot commented May 14, 2026

Copy link
Copy Markdown

Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit 4350414
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6a09ce5e99e8b000081fdc29
😎 Deploy Preview https://deploy-preview-9388--rolldown-rs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@IWANABETHATGUY IWANABETHATGUY changed the title feat: 9362 feat: allow checks.* to escalate emissions to hard errors May 14, 2026
@IWANABETHATGUY IWANABETHATGUY force-pushed the 05-13-feat_9362 branch 4 times, most recently from ca04097 to ba421c0 Compare May 17, 2026 14:13
@IWANABETHATGUY IWANABETHATGUY marked this pull request as ready for review May 17, 2026 14:22

@hyf0 hyf0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM @sapphi-red cc

@codspeed-hq

codspeed-hq Bot commented May 17, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 4 untouched benchmarks
⏩ 10 skipped benchmarks1


Comparing 05-13-feat_9362 (4350414) with main (14f967a)

Open in CodSpeed

Footnotes

  1. 10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@IWANABETHATGUY IWANABETHATGUY merged commit 29ac59a into main May 18, 2026
34 checks passed
@IWANABETHATGUY IWANABETHATGUY deleted the 05-13-feat_9362 branch May 18, 2026 02:30
Comment on lines -13 to +17
circularDependency?: boolean;
circularDependency?: false | 'warn' | 'error';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This breaks the type compat. true is disallowed now.

const ChecksOptionsSchema = v.strictObject({
circularDependency: v.pipe(
v.optional(v.boolean()),
v.optional(v.union([v.literal(false), v.picklist(['warn', 'error'])])),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a breaking change. Passing true will error now.

@sapphi-red

Copy link
Copy Markdown
Member

I personally find it confusing how checks and onLog option interacts after this PR.

@hyf0

hyf0 commented May 18, 2026

Copy link
Copy Markdown
Member

I personally find it confusing how checks and onLog option interacts after this PR.

Let's talk about this in today's meeting. @IWANABETHATGUY cc


Context:

  • The original intention of checks is to give users the ability to turn off some checks. For this purpose, using onLog can only "ignore" some checks.

@IWANABETHATGUY

Copy link
Copy Markdown
Member Author

I personally find it confusing how checks and onLog option interacts after this PR.

I think this is like syntactic sugar for previous checks + onLog. It could avoid the user from writing boilerplate. It also improve the perf a little(Although it is trivial)

@IWANABETHATGUY

Copy link
Copy Markdown
Member Author

Also, I will fix the issue @sapphi-red mentioned after the meeting, or we could revert it if we decide it is not necessary.

IWANABETHATGUY added a commit that referenced this pull request May 18, 2026
Closed #9362
## Summary

Address #9362 by widening every `checks.*` entry to accept `boolean |
'warn' | 'error'`:

- `false` — suppress the check (unchanged).
- `true` or `'warn'` — emit a warning (unchanged default).
- `'error'` — promote the emission to a hard build error that fails the
build.

## Implementation

- New `CheckSetting` enum (`Off | Warn | Error`) in `rolldown_common`
with custom serde + schemars impls so the public API stays `boolean |
'warn' | 'error'`.
- Generator emits per-field `match` arms that populate two disjoint
bitflags on `NormalizedBundlerOptions`: `warn_checks` and
`error_checks`. Added `is_check_enabled(kind)` helper for call sites
that ask "is this check on at all?".
- `promote_warnings_to_errors` pass runs at the end of
`Bundle::generate`/`write` and moves any warning whose kind is in
`error_checks` into the error channel, so the escalation works for every
check kind — not just `unresolvedImport`.
- `unresolvedImport` keeps a resolve-time fast-path in
`resolve_utils.rs` to fail early and skip the synthetic external
`ResolvedId`.

## Test plan

- [x] New fixture
`crates/rolldown/tests/rolldown/errors/unresolved_import_as_error/` —
`unresolvedImport: 'error'` fails the build with `[UNRESOLVED_IMPORT]
Module not found.`
- [x] New fixture `crates/rolldown/tests/rolldown/errors/eval_as_error/`
— `eval: 'error'` fails the build with `[EVAL] …`, verifying cross-check
escalation through the post-processing pass.
- [x] New fixture
`crates/rolldown/tests/rolldown/warnings/unresolved_import_explicit_warn/`
— `unresolvedImport: 'warn'` produces output identical to the existing
boolean-default fixture.
- [x] Existing `unresolved_import_treated_as_external` snapshot
unchanged (default behavior preserved).
- [x] `cargo test -p rolldown --test integration` — 1706 passed, 0
failed.
- [x] `cargo clippy` clean across `rolldown`, `rolldown_common`,
`rolldown_binding`, `rolldown_testing`, `rolldown_error`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
graphite-app Bot pushed a commit that referenced this pull request May 18, 2026
@rolldown-guard rolldown-guard Bot mentioned this pull request May 20, 2026
shulaoda added a commit that referenced this pull request May 20, 2026
## [1.0.2] - 2026-05-20

### 🚀 Features

- devtools: emit package size in PackageGraphReady (#9434) by @IWANABETHATGUY
- devtools: classify package dependency types (#9427) by @IWANABETHATGUY
- devtools: map packages to modules and chunks (#9426) by @IWANABETHATGUY
- devtools: mark used packages (#9423) by @IWANABETHATGUY
- devtools: make duplicate packages discoverable (#9422) by @IWANABETHATGUY
- devtools: emit package metadata (#9421) by @IWANABETHATGUY
- update oxc to 0.132.0 (#9449) by @shulaoda
- update oxc to 0.131.0 (#9424) by @shulaoda
- allow checks.* to escalate emissions to hard errors (#9388) by @IWANABETHATGUY
- dev: support watcher options `include` and `exclude` (#9395) by @h-a-n-a
- emit warnings for invalid pure annotations (#9381) by @Kyujenius

### 🐛 Bug Fixes

- hash: keep chunk file names stable when an unrelated entry is added (#9444) by @hyf0
- call `codeSplitting.groups[].name` in deterministic order (#9457) by @sapphi-red
- dev/lazy: make `resolve_id` idempotent when the resolved id is already a lazy entry (#9439) by @h-a-n-a
- chunk-optimization: publish absorbed dynamic-entry namespace cross-chunk (#9448) by @IWANABETHATGUY
- treeshake: propagate pure annotation through compound exprs (#9431) by @Dunqing
- finalizer: skip redundant init call when barrel executes in same chunk (#9354) by @IWANABETHATGUY
- linking: initialize wrapped ESM re-export owners (#9353) by @IWANABETHATGUY
- do not inherit __toESM across chunks for named-only external imports (#9333) (#9415) by @IWANABETHATGUY
- watcher: don't write output or emit events after close() (#9328) by @situ2001
- chunk-optimization: avoid unsafe dynamic-only merges (#9398) by @IWANABETHATGUY
- cjs: rename CJS-wrapped locals that would shadow chunk-scope names (#9392) by @hyf0
- dev/lazy: watch lazy modules added in rebuilds (#9391) by @h-a-n-a

### 🚜 Refactor

- rolldown_dev: move dev example to break publish cycle (#9465) by @Boshen
- binding: drop unsafe napi string helper, hoist transform ArcStr (#9456) by @hyf0
- ecmascript_utils: split rewrite_ident_reference off JsxExt trait (#9417) by @IWANABETHATGUY
- use `ThreadsafeFunction::call_async_catch` (#9390) by @sapphi-red

### 📚 Documentation

- devtools: document @rolldown/debug usage and package graph consumption (#9435) by @IWANABETHATGUY
- replace `Inter` with system font stack in OG template SVG (#9240) by @yvbopeng
- remove `output.comments` warning as all issues have been resolved (#9393) by @sapphi-red
- in-depth: clarify @__PURE__ scope and document positions (#9389) by @Kyujenius
- readme: remove release candidate notice (#9387) by @shulaoda

### ⚡ Performance

- vite-resolve: cache importer existence checks (#9443) by @Brooooooklyn
- binding: reduce plugin string clones (#9436) by @Brooooooklyn

### 🧪 Testing

- enable `legal_comments_inline` test (#9394) by @sapphi-red

### ⚙️ Miscellaneous Tasks

- bump pnpm to v11.1.2 (#9447) by @Boshen
- deps: update rust crates (#9461) by @renovate[bot]
- deps: update rollup submodule for tests to v4.60.4 (#9453) by @rolldown-guard[bot]
- deps: update test262 submodule for tests (#9454) by @rolldown-guard[bot]
- deps: update npm packages (#9430) by @renovate[bot]
- deps: update github actions (#9429) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.25.1 (#9452) by @renovate[bot]
- deps: update rust crates (#9428) by @renovate[bot]
- revert allow checks.* to escalate emissions to hard errors (#9388) (#9438) by @IWANABETHATGUY
- update mimalloc-safe to 0.1.61 (#9413) by @shulaoda
- deny `todo`, `unimplemented`, and `print_stderr` clippy lints (#9412) by @Boshen
- deps: update mimalloc-safe to 0.1.60 (#9410) by @shulaoda
- remove `pip install setuptools` workaround for node-gyp on macOS (#9370) by @sapphi-red
- renovate: disable automerge to require manual approval (#9386) by @shulaoda
- deps: update napi (#9385) by @renovate[bot]

### ❤️ New Contributors

* @yvbopeng made their first contribution in [#9240](#9240)

Co-authored-by: shulaoda <[email protected]>
V1OL3TF0X pushed a commit to V1OL3TF0X/rolldown that referenced this pull request May 25, 2026
)

Closed rolldown#9362

Address rolldown#9362 by widening every `checks.*` entry to accept `boolean |
'warn' | 'error'`:

- `false` — suppress the check (unchanged).
- `true` or `'warn'` — emit a warning (unchanged default).
- `'error'` — promote the emission to a hard build error that fails the
build.

- New `CheckSetting` enum (`Off | Warn | Error`) in `rolldown_common`
with custom serde + schemars impls so the public API stays `boolean |
'warn' | 'error'`.
- Generator emits per-field `match` arms that populate two disjoint
bitflags on `NormalizedBundlerOptions`: `warn_checks` and
`error_checks`. Added `is_check_enabled(kind)` helper for call sites
that ask "is this check on at all?".
- `promote_warnings_to_errors` pass runs at the end of
`Bundle::generate`/`write` and moves any warning whose kind is in
`error_checks` into the error channel, so the escalation works for every
check kind — not just `unresolvedImport`.
- `unresolvedImport` keeps a resolve-time fast-path in
`resolve_utils.rs` to fail early and skip the synthetic external
`ResolvedId`.

- [x] New fixture
`crates/rolldown/tests/rolldown/errors/unresolved_import_as_error/` —
`unresolvedImport: 'error'` fails the build with `[UNRESOLVED_IMPORT]
Module not found.`
- [x] New fixture `crates/rolldown/tests/rolldown/errors/eval_as_error/`
— `eval: 'error'` fails the build with `[EVAL] …`, verifying cross-check
escalation through the post-processing pass.
- [x] New fixture
`crates/rolldown/tests/rolldown/warnings/unresolved_import_explicit_warn/`
— `unresolvedImport: 'warn'` produces output identical to the existing
boolean-default fixture.
- [x] Existing `unresolved_import_treated_as_external` snapshot
unchanged (default behavior preserved).
- [x] `cargo test -p rolldown --test integration` — 1706 passed, 0
failed.
- [x] `cargo clippy` clean across `rolldown`, `rolldown_common`,
`rolldown_binding`, `rolldown_testing`, `rolldown_error`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
V1OL3TF0X pushed a commit to V1OL3TF0X/rolldown that referenced this pull request May 25, 2026
V1OL3TF0X pushed a commit to V1OL3TF0X/rolldown that referenced this pull request May 25, 2026
## [1.0.2] - 2026-05-20

### 🚀 Features

- devtools: emit package size in PackageGraphReady (rolldown#9434) by @IWANABETHATGUY
- devtools: classify package dependency types (rolldown#9427) by @IWANABETHATGUY
- devtools: map packages to modules and chunks (rolldown#9426) by @IWANABETHATGUY
- devtools: mark used packages (rolldown#9423) by @IWANABETHATGUY
- devtools: make duplicate packages discoverable (rolldown#9422) by @IWANABETHATGUY
- devtools: emit package metadata (rolldown#9421) by @IWANABETHATGUY
- update oxc to 0.132.0 (rolldown#9449) by @shulaoda
- update oxc to 0.131.0 (rolldown#9424) by @shulaoda
- allow checks.* to escalate emissions to hard errors (rolldown#9388) by @IWANABETHATGUY
- dev: support watcher options `include` and `exclude` (rolldown#9395) by @h-a-n-a
- emit warnings for invalid pure annotations (rolldown#9381) by @Kyujenius

### 🐛 Bug Fixes

- hash: keep chunk file names stable when an unrelated entry is added (rolldown#9444) by @hyf0
- call `codeSplitting.groups[].name` in deterministic order (rolldown#9457) by @sapphi-red
- dev/lazy: make `resolve_id` idempotent when the resolved id is already a lazy entry (rolldown#9439) by @h-a-n-a
- chunk-optimization: publish absorbed dynamic-entry namespace cross-chunk (rolldown#9448) by @IWANABETHATGUY
- treeshake: propagate pure annotation through compound exprs (rolldown#9431) by @Dunqing
- finalizer: skip redundant init call when barrel executes in same chunk (rolldown#9354) by @IWANABETHATGUY
- linking: initialize wrapped ESM re-export owners (rolldown#9353) by @IWANABETHATGUY
- do not inherit __toESM across chunks for named-only external imports (rolldown#9333) (rolldown#9415) by @IWANABETHATGUY
- watcher: don't write output or emit events after close() (rolldown#9328) by @situ2001
- chunk-optimization: avoid unsafe dynamic-only merges (rolldown#9398) by @IWANABETHATGUY
- cjs: rename CJS-wrapped locals that would shadow chunk-scope names (rolldown#9392) by @hyf0
- dev/lazy: watch lazy modules added in rebuilds (rolldown#9391) by @h-a-n-a

### 🚜 Refactor

- rolldown_dev: move dev example to break publish cycle (rolldown#9465) by @Boshen
- binding: drop unsafe napi string helper, hoist transform ArcStr (rolldown#9456) by @hyf0
- ecmascript_utils: split rewrite_ident_reference off JsxExt trait (rolldown#9417) by @IWANABETHATGUY
- use `ThreadsafeFunction::call_async_catch` (rolldown#9390) by @sapphi-red

### 📚 Documentation

- devtools: document @rolldown/debug usage and package graph consumption (rolldown#9435) by @IWANABETHATGUY
- replace `Inter` with system font stack in OG template SVG (rolldown#9240) by @yvbopeng
- remove `output.comments` warning as all issues have been resolved (rolldown#9393) by @sapphi-red
- in-depth: clarify @__PURE__ scope and document positions (rolldown#9389) by @Kyujenius
- readme: remove release candidate notice (rolldown#9387) by @shulaoda

### ⚡ Performance

- vite-resolve: cache importer existence checks (rolldown#9443) by @Brooooooklyn
- binding: reduce plugin string clones (rolldown#9436) by @Brooooooklyn

### 🧪 Testing

- enable `legal_comments_inline` test (rolldown#9394) by @sapphi-red

### ⚙️ Miscellaneous Tasks

- bump pnpm to v11.1.2 (rolldown#9447) by @Boshen
- deps: update rust crates (rolldown#9461) by @renovate[bot]
- deps: update rollup submodule for tests to v4.60.4 (rolldown#9453) by @rolldown-guard[bot]
- deps: update test262 submodule for tests (rolldown#9454) by @rolldown-guard[bot]
- deps: update npm packages (rolldown#9430) by @renovate[bot]
- deps: update github actions (rolldown#9429) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.25.1 (rolldown#9452) by @renovate[bot]
- deps: update rust crates (rolldown#9428) by @renovate[bot]
- revert allow checks.* to escalate emissions to hard errors (rolldown#9388) (rolldown#9438) by @IWANABETHATGUY
- update mimalloc-safe to 0.1.61 (rolldown#9413) by @shulaoda
- deny `todo`, `unimplemented`, and `print_stderr` clippy lints (rolldown#9412) by @Boshen
- deps: update mimalloc-safe to 0.1.60 (rolldown#9410) by @shulaoda
- remove `pip install setuptools` workaround for node-gyp on macOS (rolldown#9370) by @sapphi-red
- renovate: disable automerge to require manual approval (rolldown#9386) by @shulaoda
- deps: update napi (rolldown#9385) by @renovate[bot]

### ❤️ New Contributors

* @yvbopeng made their first contribution in [rolldown#9240](rolldown#9240)

Co-authored-by: shulaoda <[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.

[Feature Request]: Allow unresolved imports to be configured as hard errors

3 participants