Skip to content

docs(meta/design): add ast-mutation design doc#9338

Merged
graphite-app[bot] merged 1 commit into
mainfrom
ember-gecko
May 12, 2026
Merged

docs(meta/design): add ast-mutation design doc#9338
graphite-app[bot] merged 1 commit into
mainfrom
ember-gecko

Conversation

@hyf0

@hyf0 hyf0 commented May 10, 2026

Copy link
Copy Markdown
Member

Summary

Adds meta/design/ast-mutation.md describing how rolldown currently threads per-AST-node metadata between the scan, link, and finalize passes via side tables keyed by oxc Span.

The doc covers:

  • The three-stage pipeline (scan → link → finalize) and which stage mutates the AST.
  • The Span-as-identity contract: insertion at scan/link, lookup by node.span() in the finalizer.
  • The pre-scan span normalization performed by PreProcessor (crates/rolldown/src/utils/tweak_ast_for_scanning.rs) — targeted deduplication for the node kinds used as side-table keys (ModuleDeclaration, ImportExpression, ThisExpression, require call/ident, NewExpression).
  • Three classical patterns that side tables instantiate: scan→finalize, scan→link→finalize, and scan→link.
  • Known fragilities: cloned spans, synthetic-SPAN collisions, hand-maintained PreProcessor coverage, no post-scan validation, and the existing member_expr_ref.rs FIXME pointing at AstNodeId.
  • Why this is on the radar: oxc is introducing AstNodeId, and this doc is the baseline for evaluating that migration.

This is descriptive only — no code changes, no proposal. It captures the current state so a future migration has something concrete to compare against.

Test plan

  • Doc reads cleanly end-to-end
  • File:line citations resolve to the code they reference

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings May 10, 2026 15:18
@netlify

netlify Bot commented May 10, 2026

Copy link
Copy Markdown

Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit 9f77a9c
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6a033ec25f64660008343131
😎 Deploy Preview https://deploy-preview-9338--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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new design document capturing rolldown’s current approach to threading per-AST-node metadata across passes using Span-keyed side tables, intended as a baseline for evaluating a future move to oxc AstNodeId.

Changes:

  • Add meta/design/ast-mutation.md documenting the scan → link → finalize pipeline and where AST mutation occurs.
  • Describe the Span-as-identity contract and the pre-scan span normalization performed by PreProcessor.
  • Catalog common side-table flow patterns and current fragilities/limitations of Span-keying.

Comment thread meta/design/ast-mutation.md Outdated
Comment thread meta/design/ast-mutation.md Outdated
Comment thread meta/design/ast-mutation.md Outdated
Comment thread meta/design/ast-mutation.md Outdated
@IWANABETHATGUY

Copy link
Copy Markdown
Member

Address is used as a node identity in several places, we probably also need to mention that.

@hyf0

hyf0 commented May 12, 2026

Copy link
Copy Markdown
Member Author

Good call — added an "Address-as-identity (alternative key)" section in d886f45 covering the Address-keyed side tables (DynamicImportExprInfo.address, side_effect_free_call_expr_addr, unreachable_import_expression_addresses, EntryPoint.related_stmt_infos, and PreProcessor's scratch state), plus a short note on why both Span and Address identities exist side by side (Span survives into the finalizer with no live AST reference; Address is unique-by-construction but tied to the allocator lifetime).

hyf0 commented May 12, 2026

Copy link
Copy Markdown
Member Author

Merge activity

## Summary

Adds `meta/design/ast-mutation.md` describing how rolldown currently threads per-AST-node metadata between the scan, link, and finalize passes via side tables keyed by oxc `Span`.

The doc covers:

- The three-stage pipeline (scan → link → finalize) and which stage mutates the AST.
- The Span-as-identity contract: insertion at scan/link, lookup by `node.span()` in the finalizer.
- The pre-scan span normalization performed by `PreProcessor` (`crates/rolldown/src/utils/tweak_ast_for_scanning.rs`) — targeted deduplication for the node kinds used as side-table keys (`ModuleDeclaration`, `ImportExpression`, `ThisExpression`, `require` call/ident, `NewExpression`).
- Three classical patterns that side tables instantiate: scan→finalize, scan→link→finalize, and scan→link.
- Known fragilities: cloned spans, synthetic-`SPAN` collisions, hand-maintained `PreProcessor` coverage, no post-scan validation, and the existing `member_expr_ref.rs` FIXME pointing at `AstNodeId`.
- Why this is on the radar: oxc is introducing `AstNodeId`, and this doc is the baseline for evaluating that migration.

This is descriptive only — no code changes, no proposal. It captures the current state so a future migration has something concrete to compare against.

## Test plan

- [ ] Doc reads cleanly end-to-end
- [ ] File:line citations resolve to the code they reference

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@graphite-app graphite-app Bot merged commit 9f77a9c into main May 12, 2026
32 checks passed
@graphite-app graphite-app Bot deleted the ember-gecko branch May 12, 2026 14:54
@rolldown-guard rolldown-guard Bot mentioned this pull request May 13, 2026
shulaoda added a commit that referenced this pull request May 13, 2026
## [1.0.1] - 2026-05-13

### 🚀 Features

- experimental/lazy-barrel: advice on oversized barrel modules (#9236) by @shulaoda
- rolldown: inline optional-chain enum access (#9379) by @Dunqing
- chunk-optimization: dedupe already-loaded dynamic deps (#9305) by @IWANABETHATGUY
- binding: call moduleParsed hook in ParallelJsPlugin (#9318) by @jaehafe

### 🐛 Bug Fixes

- transform: enable `enum_eval` for `transformSync` and vite TS transform (#9325) by @Dunqing
- error: remove severity prefix from diagnostic messages (#9262) by @Kyujenius
- deps: pin pnpm to 10.23.0 to work around catalog mismatch on Netlify (#9364) by @shulaoda
- ci: pin mimalloc-safe to 0.1.58 (#9361) by @shulaoda
- dev/lazy: fix exports of lazy requests in lazy chunks (#9249) by @h-a-n-a
- rolldown_plugin_vite_resolve: handle errors in `resolveSubpathImports` callback (#9355) by @sapphi-red
- rolldown_plugin_lazy_compilation: use loadExports for fetched proxy to preserve original export names (#9132) by @h-a-n-a
- common: include offending index in HybridIndexVec panic message (#9296) by @SAY-5

### 🚜 Refactor

- ecmascript: extract semantic_builder_for_transform helper (#9326) by @Dunqing
- test: extract reusable static-import-cycle helper (#9332) by @IWANABETHATGUY

### 📚 Documentation

- clarify scope of `topLevelVar` (#9380) by @IWANABETHATGUY
- meta/design: add ast-mutation design doc (#9338) by @hyf0
- feat: add ai policy in contribution guide (#9315) by @mdong1909

### ⚡ Performance

- binding: enable mimalloc v3 to reduce idle memory (#9349) by @shulaoda

### 🧪 Testing

- mcs: cover require() in `$initial` group (#9376) by @hyf0
- add regression for CJS facade chunk merge into entry (#9351) by @IWANABETHATGUY

### ⚙️ Miscellaneous Tasks

- switch prepare-release to manual dispatch with version input (#9383) by @shulaoda
- migrate `@rolldown/pluginutils` to `rolldown/plugins` (#9317) by @shulaoda
- deps: pin libmimalloc-sys2 to 0.1.54 (#9372) by @shulaoda
- replace `igorskyflyer/action-readfile` with `cat` (#9369) by @sapphi-red
- deps: update test262 submodule for tests (#9371) by @rolldown-guard[bot]
- use app token for test dep update PRs (#9368) by @sapphi-red
- replace some actions with gh commands (#9367) by @sapphi-red
- replace action-semantic-pull-request with inline regex (#9366) by @sapphi-red
- remove pull_request_target workflows (#9188) by @Boshen
- deps: upgrade oxc to 0.130.0 (#9360) by @shulaoda
- deps: update github actions (major) (#9348) by @renovate[bot]
- deps: update github actions (#9341) by @renovate[bot]
- deps: update rust crates (#9344) by @renovate[bot]
- deps: update crate-ci/typos action to v1.46.1 (#9357) by @renovate[bot]
- deps: update npm packages (#9343) by @renovate[bot]
- deps: update pnpm to v10.33.4 (#9347) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to ^0.25.0 (#9346) by @renovate[bot]
- .claude: add rolldown-repl encoder, rename decode skill (#9352) by @IWANABETHATGUY
- deps: update crate-ci/typos action to v1.46.0 (#9345) by @renovate[bot]
- deps: update napi to v3.8.6 (#9342) by @renovate[bot]
- deps: update dependency vite-plus to v0.1.20 (#9340) by @renovate[bot]
- enable rollup chunking-form test (#9335) by @IWANABETHATGUY
- typo: fix typo in watcher options comment (#9324) by @thescripted

### ❤️ New Contributors

* @Kyujenius made their first contribution in [#9262](#9262)
* @SAY-5 made their first contribution in [#9296](#9296)
* @thescripted made their first contribution in [#9324](#9324)

Co-authored-by: shulaoda <[email protected]>
IWANABETHATGUY pushed a commit that referenced this pull request May 18, 2026
## Summary

Adds `meta/design/ast-mutation.md` describing how rolldown currently threads per-AST-node metadata between the scan, link, and finalize passes via side tables keyed by oxc `Span`.

The doc covers:

- The three-stage pipeline (scan → link → finalize) and which stage mutates the AST.
- The Span-as-identity contract: insertion at scan/link, lookup by `node.span()` in the finalizer.
- The pre-scan span normalization performed by `PreProcessor` (`crates/rolldown/src/utils/tweak_ast_for_scanning.rs`) — targeted deduplication for the node kinds used as side-table keys (`ModuleDeclaration`, `ImportExpression`, `ThisExpression`, `require` call/ident, `NewExpression`).
- Three classical patterns that side tables instantiate: scan→finalize, scan→link→finalize, and scan→link.
- Known fragilities: cloned spans, synthetic-`SPAN` collisions, hand-maintained `PreProcessor` coverage, no post-scan validation, and the existing `member_expr_ref.rs` FIXME pointing at `AstNodeId`.
- Why this is on the radar: oxc is introducing `AstNodeId`, and this doc is the baseline for evaluating that migration.

This is descriptive only — no code changes, no proposal. It captures the current state so a future migration has something concrete to compare against.

## Test plan

- [ ] Doc reads cleanly end-to-end
- [ ] File:line citations resolve to the code they reference

🤖 Generated with [Claude Code](https://claude.com/claude-code)
IWANABETHATGUY pushed a commit that referenced this pull request May 18, 2026
## [1.0.1] - 2026-05-13

### 🚀 Features

- experimental/lazy-barrel: advice on oversized barrel modules (#9236) by @shulaoda
- rolldown: inline optional-chain enum access (#9379) by @Dunqing
- chunk-optimization: dedupe already-loaded dynamic deps (#9305) by @IWANABETHATGUY
- binding: call moduleParsed hook in ParallelJsPlugin (#9318) by @jaehafe

### 🐛 Bug Fixes

- transform: enable `enum_eval` for `transformSync` and vite TS transform (#9325) by @Dunqing
- error: remove severity prefix from diagnostic messages (#9262) by @Kyujenius
- deps: pin pnpm to 10.23.0 to work around catalog mismatch on Netlify (#9364) by @shulaoda
- ci: pin mimalloc-safe to 0.1.58 (#9361) by @shulaoda
- dev/lazy: fix exports of lazy requests in lazy chunks (#9249) by @h-a-n-a
- rolldown_plugin_vite_resolve: handle errors in `resolveSubpathImports` callback (#9355) by @sapphi-red
- rolldown_plugin_lazy_compilation: use loadExports for fetched proxy to preserve original export names (#9132) by @h-a-n-a
- common: include offending index in HybridIndexVec panic message (#9296) by @SAY-5

### 🚜 Refactor

- ecmascript: extract semantic_builder_for_transform helper (#9326) by @Dunqing
- test: extract reusable static-import-cycle helper (#9332) by @IWANABETHATGUY

### 📚 Documentation

- clarify scope of `topLevelVar` (#9380) by @IWANABETHATGUY
- meta/design: add ast-mutation design doc (#9338) by @hyf0
- feat: add ai policy in contribution guide (#9315) by @mdong1909

### ⚡ Performance

- binding: enable mimalloc v3 to reduce idle memory (#9349) by @shulaoda

### 🧪 Testing

- mcs: cover require() in `$initial` group (#9376) by @hyf0
- add regression for CJS facade chunk merge into entry (#9351) by @IWANABETHATGUY

### ⚙️ Miscellaneous Tasks

- switch prepare-release to manual dispatch with version input (#9383) by @shulaoda
- migrate `@rolldown/pluginutils` to `rolldown/plugins` (#9317) by @shulaoda
- deps: pin libmimalloc-sys2 to 0.1.54 (#9372) by @shulaoda
- replace `igorskyflyer/action-readfile` with `cat` (#9369) by @sapphi-red
- deps: update test262 submodule for tests (#9371) by @rolldown-guard[bot]
- use app token for test dep update PRs (#9368) by @sapphi-red
- replace some actions with gh commands (#9367) by @sapphi-red
- replace action-semantic-pull-request with inline regex (#9366) by @sapphi-red
- remove pull_request_target workflows (#9188) by @Boshen
- deps: upgrade oxc to 0.130.0 (#9360) by @shulaoda
- deps: update github actions (major) (#9348) by @renovate[bot]
- deps: update github actions (#9341) by @renovate[bot]
- deps: update rust crates (#9344) by @renovate[bot]
- deps: update crate-ci/typos action to v1.46.1 (#9357) by @renovate[bot]
- deps: update npm packages (#9343) by @renovate[bot]
- deps: update pnpm to v10.33.4 (#9347) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to ^0.25.0 (#9346) by @renovate[bot]
- .claude: add rolldown-repl encoder, rename decode skill (#9352) by @IWANABETHATGUY
- deps: update crate-ci/typos action to v1.46.0 (#9345) by @renovate[bot]
- deps: update napi to v3.8.6 (#9342) by @renovate[bot]
- deps: update dependency vite-plus to v0.1.20 (#9340) by @renovate[bot]
- enable rollup chunking-form test (#9335) by @IWANABETHATGUY
- typo: fix typo in watcher options comment (#9324) by @thescripted

### ❤️ New Contributors

* @Kyujenius made their first contribution in [#9262](#9262)
* @SAY-5 made their first contribution in [#9296](#9296)
* @thescripted made their first contribution in [#9324](#9324)

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.

3 participants