Skip to content

test: fold hand-unrolled Rust test tables - #11212

Merged
graphite-app[bot] merged 1 commit into
mainfrom
claude/prune-tests-fold-rust-table-tests
Oct 15, 2026
Merged

graphite-app[bot] merged 1 commit into
mainfrom
claude/prune-tests-fold-rust-table-tests

Conversation

@Brooooooklyn

@Brooooooklyn Brooooooklyn commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Requested by Brooklyn · project thread

Before: two Rust test modules were hand-unrolled lookup tables: 19 copy-pasted dynamic_import_to_glob tests, and three relocate tests that differed only in the target.

After: both are table-driven tests. Every row, comment and old test name is kept; the old name is the row label in the assertion message. Test code only: every hunk is inside a #[cfg(test)] mod tests block or under tests/.

Update after review: the two subset tests this PR first deleted (source_utils test_contains_script_closing_tag_in_tagged_template and light_guess unknown_extensions) are restored unchanged in e16c035, because they document that those cases are handled. The PR now only folds tables.

How: each row was defended by mutating product code with the most realistic regression only that row would catch, rebuilding, running, and reverting. Every row is the only guard for at least one mutation, so none was dropped, and evidence comments record that.

Totals

Before After
Files touched – 2
Cases in the 2 touched test binaries 67 48
Cases deleted outright – 0
Cases removed by folding (19 → 2 and 3 → 1, every row kept) – 19
Net lines – −87 (+93 / −180)
Runtime saved (removed cases' summed duration) – ~0 s (every removed case reported <0.000s>)

Whole suite at the merge-base could not be collected here (that needs the full workspace plus the NAPI binding). Counted instead: 522 #[test] / #[tokio::test] functions under crates/, plus fixture cases from 2,164 _config.json files (67 dot-prefixed, skipped); test262 and Vitest not counted.

Per file

  1. crates/rolldown_plugin_vite_dynamic_import_vars/src/dynamic_import_to_glob.rs (hand-unrolled lookup table, 19 → 2)
    • All 19 bodies were the same parse → to_glob_pattern → assert sequence (a port of @rollup/plugin-dynamic-import-vars). They become converts_dynamic_import_expressions_to_globs (16 rows) and rejects_unsupported_dynamic_import_expressions (3 rows).
    • M10–M13 each failed exactly one original test; after the fold the same mutations fail the folded test, and the message names the row.
  2. crates/string_wizard/tests/magic_string.rs › relocate::refuses_to_move_a_selection_to_inside_itself{,2,3} (hand-unrolled lookup table, 3 → 1)
    • One loop over targets [3, 4, 6]. Each target alone guards one edge of to >= start && to <= end (M7, M8, M9), so all three are kept with an evidence comment. After the fold, M7, M8 and M9 all fail it.

Kept after defense — do not re-nominate

  • Every row of both dynamic_import_to_glob tables (M10 → escapes_square_brackets, M11 → data_uri, M12 → throws_…non_add_operator, M13 → throws_…file_extension).
  • All three refuses_to_move… targets (3, 4, 6).
  • source_utils test_contains_script_closing_tag_in_tagged_template and _multiple_occurrences, and light_guess unknown_extensions (kept on review: they document handled cases).

Case counts

File Before After Delta Expected delta
dynamic_import_to_glob.rs (crate lib binary) 19 2 −17 −17
string_wizard/tests/magic_string.rs 48 46 −2 −2
Total 67 48 −19 −19

rolldown_utils (68) and rolldown_ecmascript_utils (18) lib binaries are back to their merge-base counts and pass. 0 new failures, no pre-existing failures.

Mutations

Each was applied alone, rebuilt, run, then reverted (git status clean afterwards).

# Location Change Failed before Failed after
M7 crates/string_wizard/src/magic_string/movement.rs:35 to >= start → to > start refuses…itself, zero_width_relocate_to_its_own_position_still_errors folded test, zero_width…
M8 movement.rs:35 to <= end → to < end refuses…itself3, zero_width… folded test, zero_width…
M9 movement.rs:35 to == start || to == end refuses…itself2 folded test
M10 dynamic_import_to_glob.rs:42 stop escaping [ and ] escapes_square_brackets converts_…
M11 dynamic_import_to_glob.rs:9 drop data: from IGNORED_PROTOCOLS data_uri converts_…
M12 dynamic_import_to_glob.rs:107 accept any binary operator throws_…non_add_operator rejects_…
M13 dynamic_import_to_glob.rs:32 drop the extension check throws_…file_extension rejects_…
M14 dynamic_import_to_glob.rs:89 arguments.is_empty() → len() < 2 nothing (pre-existing gap, not touched here) –

M14 shows single-argument .concat() (e.g. './foo/'.concat(bar)) is untested; this PR does not change that.

What ran and what did not

  • Ran, at origin/main (c9a8cda) and after: cargo test --locked for rolldown_plugin_vite_dynamic_import_vars, string_wizard, rolldown_utils and rolldown_ecmascript_utils (per-test durations via --report-time); cargo clippy --locked -p <those crates> --all-targets -- --deny warnings; cargo fmt --all --check; git diff --check. All clean, including after the restore commit.
  • Not run: the full just test-rust (bundler fixtures and test262), the Node/Vitest suites (just test-node, needs the binding), just lint-repo / just lint-node (no non-Rust files changed).

Excluded pull requests

All 162 open PRs on 2026-10-14 were fetched and every file they touch (1,889 files) was skipped; neither file here is touched by any of them.

Age check (cutoff: 30 days, 2026-09-14)

Test(s) First added
dynamic_import_to_glob tests 2024-08-01 (40cf58b9b, #1732; moved in 9cb5be8a4, #7068)
refuses_to_move… tests 2024-11-04 (2ace0ebac, #2572)

None is in a permission, security or entitlement suite, and neither was added for a bug.

To revert: git revert e16c03518 6a233d9da.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PxVsmvB9xfZKfVnUonY8kf

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T07:02:23.840676Z e16c035 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@netlify

netlify Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit d226543
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6ad090d0f419e34af57e6ce0

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://claude-prune-tests-fold-rust-table-tests-rolldown-rs.voidzero-docs.workers.dev (commit d226543)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://d7022f7b-rolldown-rs.voidzero-docs.workers.dev d226543 2026-10-15T08:39:52.399Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://56d03b4e-rolldown-rs.voidzero-docs.workers.dev e16c035 2026-10-15T07:03:15.867Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://8d043671-rolldown-rs.voidzero-docs.workers.dev 6a233d9 2026-10-14T18:07:03.314Z Visit the dashboard ↗

@codspeed

codspeed Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 4 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 7 untouched benchmarks
⏩ 10 skipped benchmarks1


Comparing claude/prune-tests-fold-rust-table-tests (e16c035) with main (c9a8cda)

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. ↩

@sapphi-red sapphi-red 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.

I think the tests in

  • crates/rolldown_ecmascript_utils/src/source_utils.rs
  • crates/rolldown_utils/src/light_guess.rs

can be kept as it describes those cases are handled.

@Brooooooklyn Brooooooklyn changed the title test: fold hand-unrolled Rust test tables and drop two subset tests test: fold hand-unrolled Rust test tables Oct 15, 2026

sapphi-red commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Merge activity

  • Oct 15, 8:37 AM UTC: The merge label 'graphite: merge-when-ready' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Oct 15, 8:37 AM UTC: sapphi-red added this pull request to the Graphite merge queue.
  • Oct 15, 8:42 AM UTC: Merged by the Graphite merge queue.

<!-- claude-projects-attribution: {"github_login":"Brooooooklyn"} -->
_Requested by **Brooklyn** · [project thread](https://claude.ai/code/project/chan_018s9RxRdtH424j2EhXdzV3N?thread=cmsg_018s9RxRdtH424j2EhXdzV3NQxbeR8Pt7qaqSQwoq9rEFo)_

<!-- routine:prune-tests:fold-rust-table-tests -->

Before: two Rust test modules were hand-unrolled lookup tables: 19 copy-pasted `dynamic_import_to_glob` tests, and three `relocate` tests that differed only in the target.

After: both are table-driven tests. Every row, comment and old test name is kept; the old name is the row label in the assertion message. Test code only: every hunk is inside a `#[cfg(test)] mod tests` block or under `tests/`.

Update after review: the two subset tests this PR first deleted (`source_utils` `test_contains_script_closing_tag_in_tagged_template` and `light_guess` `unknown_extensions`) are restored unchanged in e16c035, because they document that those cases are handled. The PR now only folds tables.

How: each row was defended by mutating product code with the most realistic regression only that row would catch, rebuilding, running, and reverting. Every row is the only guard for at least one mutation, so none was dropped, and evidence comments record that.

### Totals

| | Before | After |
|---|---|---|
| Files touched | – | 2 |
| Cases in the 2 touched test binaries | 67 | 48 |
| Cases deleted outright | – | 0 |
| Cases removed by folding (19 → 2 and 3 → 1, every row kept) | – | 19 |
| Net lines | – | −87 (+93 / −180) |
| Runtime saved (removed cases' summed duration) | – | ~0 s (every removed case reported `<0.000s>`) |

Whole suite at the merge-base could not be collected here (that needs the full workspace plus the NAPI binding). Counted instead: 522 `#[test]` / `#[tokio::test]` functions under `crates/`, plus fixture cases from 2,164 `_config.json` files (67 dot-prefixed, skipped); test262 and Vitest not counted.

### Per file

1. **`crates/rolldown_plugin_vite_dynamic_import_vars/src/dynamic_import_to_glob.rs`** (hand-unrolled lookup table, 19 → 2)
   - All 19 bodies were the same parse → `to_glob_pattern` → assert sequence (a port of `@rollup/plugin-dynamic-import-vars`). They become `converts_dynamic_import_expressions_to_globs` (16 rows) and `rejects_unsupported_dynamic_import_expressions` (3 rows).
   - M10–M13 each failed exactly one original test; after the fold the same mutations fail the folded test, and the message names the row.
2. **`crates/string_wizard/tests/magic_string.rs` › `relocate::refuses_to_move_a_selection_to_inside_itself{,2,3}`** (hand-unrolled lookup table, 3 → 1)
   - One loop over targets `[3, 4, 6]`. Each target alone guards one edge of `to >= start && to <= end` (M7, M8, M9), so all three are kept with an evidence comment. After the fold, M7, M8 and M9 all fail it.

### Kept after defense — do not re-nominate

- Every row of both `dynamic_import_to_glob` tables (M10 → `escapes_square_brackets`, M11 → `data_uri`, M12 → `throws_…non_add_operator`, M13 → `throws_…file_extension`).
- All three `refuses_to_move…` targets (3, 4, 6).
- `source_utils` `test_contains_script_closing_tag_in_tagged_template` and `_multiple_occurrences`, and `light_guess` `unknown_extensions` (kept on review: they document handled cases).

### Case counts

| File | Before | After | Delta | Expected delta |
|---|---|---|---|---|
| `dynamic_import_to_glob.rs` (crate lib binary) | 19 | 2 | −17 | −17 |
| `string_wizard/tests/magic_string.rs` | 48 | 46 | −2 | −2 |
| **Total** | **67** | **48** | **−19** | **−19** |

`rolldown_utils` (68) and `rolldown_ecmascript_utils` (18) lib binaries are back to their merge-base counts and pass. **0 new failures**, no pre-existing failures.

### Mutations

Each was applied alone, rebuilt, run, then reverted (`git status` clean afterwards).

| # | Location | Change | Failed before | Failed after |
|---|---|---|---|---|
| M7 | `crates/string_wizard/src/magic_string/movement.rs:35` | `to >= start` → `to > start` | `refuses…itself`, `zero_width_relocate_to_its_own_position_still_errors` | folded test, `zero_width…` |
| M8 | `movement.rs:35` | `to <= end` → `to < end` | `refuses…itself3`, `zero_width…` | folded test, `zero_width…` |
| M9 | `movement.rs:35` | `to == start \|\| to == end` | `refuses…itself2` | folded test |
| M10 | `dynamic_import_to_glob.rs:42` | stop escaping `[` and `]` | `escapes_square_brackets` | `converts_…` |
| M11 | `dynamic_import_to_glob.rs:9` | drop `data:` from `IGNORED_PROTOCOLS` | `data_uri` | `converts_…` |
| M12 | `dynamic_import_to_glob.rs:107` | accept any binary operator | `throws_…non_add_operator` | `rejects_…` |
| M13 | `dynamic_import_to_glob.rs:32` | drop the extension check | `throws_…file_extension` | `rejects_…` |
| M14 | `dynamic_import_to_glob.rs:89` | `arguments.is_empty()` → `len() < 2` | nothing (pre-existing gap, not touched here) | – |

M14 shows single-argument `.concat()` (e.g. `'./foo/'.concat(bar)`) is untested; this PR does not change that.

### What ran and what did not

- Ran, at origin/main (c9a8cda) and after: `cargo test --locked` for `rolldown_plugin_vite_dynamic_import_vars`, `string_wizard`, `rolldown_utils` and `rolldown_ecmascript_utils` (per-test durations via `--report-time`); `cargo clippy --locked -p <those crates> --all-targets -- --deny warnings`; `cargo fmt --all --check`; `git diff --check`. All clean, including after the restore commit.
- Not run: the full `just test-rust` (bundler fixtures and test262), the Node/Vitest suites (`just test-node`, needs the binding), `just lint-repo` / `just lint-node` (no non-Rust files changed).

### Excluded pull requests

All 162 open PRs on 2026-10-14 were fetched and every file they touch (1,889 files) was skipped; neither file here is touched by any of them.

### Age check (cutoff: 30 days, 2026-09-14)

| Test(s) | First added |
|---|---|
| `dynamic_import_to_glob` tests | 2024-08-01 (`40cf58b9b`, #1732; moved in `9cb5be8a4`, #7068) |
| `refuses_to_move…` tests | 2024-11-04 (`2ace0ebac`, #2572) |

None is in a permission, security or entitlement suite, and neither was added for a bug.

To revert: `git revert e16c035 6a233d9`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01PxVsmvB9xfZKfVnUonY8kf
@graphite-app
graphite-app Bot force-pushed the claude/prune-tests-fold-rust-table-tests branch from e16c035 to d226543 Compare October 15, 2026 08:37
@graphite-app
graphite-app Bot merged commit d226543 into main Oct 15, 2026
36 of 37 checks passed
@graphite-app
graphite-app Bot deleted the claude/prune-tests-fold-rust-table-tests branch October 15, 2026 08:42
@rolldown-guard rolldown-guard Bot mentioned this pull request Oct 21, 2026
shulaoda added a commit that referenced this pull request Oct 21, 2026
## [1.2.15] - 2026-10-21

### 🚀 Features

- rolldown_plugin_vite_resolve: add `isBundled` to pick the browser-external stub format (#11260) by @h-a-n-a
- dev: mark entry modules in the HMR module graph (#11252) by @h-a-n-a
- mark module starts with `// <id>` comments instead of `#region` pairs (#11235) by @IWANABETHATGUY

### 🐛 Bug Fixes

- plugin: stop `this.resolve` recursion between plugins with `skipSelf: true` (#11181) by @anzal1
- rolldown_plugin_vite_resolve: handle external `require` for `ssr.target: 'webworker'` (#11205) by @sapphi-red
- rolldown_plugin_vite_build_import_analysis: only wrap dynamic imports with static specifiers in __vitePreload (#10879) by @smeng9
- strict-execution-order: wrap eager modules that forward wrapped definers (#11186) by @hyfdev
- chunk-import-map: keep common chunk keys unique when enabling inline common chunks (#11230) by @hyfdev
- only register signal-exit handler when a trace subscriber is active (#11208) by @DaniilIsupov

### 🧪 Testing

- fold hand-unrolled Rust test tables (#11212) by @Brooooooklyn

### ⚙️ Miscellaneous Tasks

- deps: upgrade oxc to 0.155.0 (#11228) by @Dunqing
- rollup-tests: retriage failed tests (#11251) by @sapphi-red
- deps: update rollup submodule for tests to v4.64.12 (#11249) by @rolldown-guard[bot]
- deps: update test262 submodule for tests (#11242) by @rolldown-guard[bot]

### ❤️ New Contributors

* @anzal1 made their first contribution in [#11181](#11181)
* @smeng9 made their first contribution in [#10879](#10879)
* @DaniilIsupov made their first contribution in [#11208](#11208)

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.

2 participants