Skip to content

chore(xtask): migrate Symbol global types - #11034

Merged
ematipico merged 3 commits into
biomejs:mainfrom
minseong0324:codex/chore-global-types-symbol
Jul 26, 2026
Merged

ematipico merged 3 commits into
biomejs:mainfrom
minseong0324:codex/chore-global-types-symbol

Conversation

@minseong0324

@minseong0324 minseong0324 commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Part of #5977.

Migrates Symbol, Symbol.dispose, and Symbol.asyncDispose to generated global types while preserving their existing raw and Salsa-backed shapes. This does not change the inference engine.

This PR was implemented with AI assistance from Codex.

Test Plan

  • Added lowerer coverage for merged and invalid Symbol declarations.
  • Added runtime coverage for the generated static members and symbol-valued helpers.
  • Verified just gen-global-types is idempotent.

Docs

N/A

@changeset-bot

changeset-bot Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3cd8eba

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

✅ Organic activity

No automation signals detected in the analyzed events.

View full analysis →

This is an automated analysis by AgentScan

@github-actions github-actions Bot added A-Tooling Area: internal tools L-JavaScript Language: JavaScript and super languages A-Type-Inference Area: type inference labels Jul 22, 2026
@codspeed

codspeed Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 213 skipped benchmarks1


Comparing minseong0324:codex/chore-global-types-symbol (3cd8eba) with main (89c27c6)

Open in CodSpeed

Footnotes

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

@minseong0324
minseong0324 force-pushed the codex/chore-global-types-symbol branch 4 times, most recently from 211c8bd to 17b8baf Compare July 23, 2026 16:45
@minseong0324
minseong0324 force-pushed the codex/chore-global-types-symbol branch from 17b8baf to 422ecfb Compare July 23, 2026 17:13
@minseong0324
minseong0324 marked this pull request as ready for review July 23, 2026 17:48
@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 25f56c74-c963-49dc-99e9-be708cf3f09e

📥 Commits

Reviewing files that changed from the base of the PR and between 6f37f9d and 3cd8eba.

📒 Files selected for processing (1)
  • xtask/codegen/src/generate_global_types/emit.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • xtask/codegen/src/generate_global_types/emit.rs

Walkthrough

The global-types pipeline now lowers Symbol, Symbol.dispose, and Symbol.asyncDispose, validates their declarations, emits their type data, and checks the generated structure. Fixtures and codegen tests cover valid and invalid Symbol declarations. Manual Symbol entries are removed from the built-in global table, which now verifies generated members and predefined ID ordering.

Possibly related PRs

  • biomejs/biome#10721: Extends the same global-types pipeline with analogous Error migration.
  • biomejs/biome#10841: Modifies computed disposable Symbol member handling in the shared codegen path.
  • biomejs/biome#11005: Changes the global-types construction around the generated Symbol entries.

Suggested labels: A-Project

Suggested reviewers: dyc3

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: migrating Symbol global types.
Description check ✅ Passed The description accurately describes the Symbol global type migration and the related test coverage.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment on lines +14 to +21
@@ -15,7 +15,10 @@ const OUTPUT_RELATIVE_PATH: &str = "crates/biome_js_type_info/src/generated/glob
///
/// Must stay ordered by ascending `GlobalTypeId` index so the emitted
/// `MIGRATED_PREDEFINED_IDS` stays sorted for the runtime `binary_search`.
const GLOBAL_ID_EMIT_ORDER: [&str; 7] = [
const GLOBAL_ID_EMIT_ORDER: [&str; 10] = [
"SYMBOL_ID_GLOBAL_TYPE_ID",
"SYMBOL_DISPOSE_ID_GLOBAL_TYPE_ID",
"SYMBOL_ASYNC_DISPOSE_ID_GLOBAL_TYPE_ID",

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.

The comment says that these entries must be ordered, but it doesn't seem true? What is it? We should either:

  • remove the "ordered" part
  • order them, and add a regression test

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These entries are ordered by ascending GlobalTypeId index, not lexicographically. The index is defined by the row position in PREDEFINED_ID_ROWS

The emitted order is covered by the expected-order test and the strictly-increasing test. It must remain sorted because the runtime uses binary_search

I fixed the comment in commit 3cd8eba

expect_error_contains(
compare_lowered_globals(&lowered),
"generated globals contain 3 entries, expected 7",
"generated globals contain 3 entries, expected 10",

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.

Honestly, I would remove all these hard coded sizes for the arrays we have. Chances are, we would need to add more of them, and updating the numbers is just noise.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 6f37f9d

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
xtask/codegen/src/generate_global_types/emit.rs (1)

78-79: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make this rustdoc document the contract, or remove it.

Builds the resolver registration statements merely repeats the function’s name and body. Document the useful contract instead — that registrations follow GLOBAL_ID_EMIT_ORDER and propagate missing or unlisted-ID errors — or omit the comment.

As per coding guidelines, comments and documentation must explain contracts, invariants, module purpose, terminology, or rationale rather than duplicate information recoverable from the code.

Proposed wording
-/// Builds the resolver registration statements.
+/// Renders registrations in [`GLOBAL_ID_EMIT_ORDER`], returning an error if
+/// lowered globals contain an unlisted ID or omit an expected ID.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@xtask/codegen/src/generate_global_types/emit.rs` around lines 78 - 79, Update
the rustdoc for render_registrations to document its contract: registrations
follow GLOBAL_ID_EMIT_ORDER and missing or unlisted IDs are propagated as
errors. If that contract cannot be documented accurately, remove the redundant
rustdoc instead.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@xtask/codegen/src/generate_global_types/emit.rs`:
- Around line 78-79: Update the rustdoc for render_registrations to document its
contract: registrations follow GLOBAL_ID_EMIT_ORDER and missing or unlisted IDs
are propagated as errors. If that contract cannot be documented accurately,
remove the redundant rustdoc instead.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 589e16ea-a7aa-4cff-9a3c-4e98823c832b

📥 Commits

Reviewing files that changed from the base of the PR and between 422ecfb and 6f37f9d.

📒 Files selected for processing (4)
  • xtask/codegen/src/generate_global_types/compare.rs
  • xtask/codegen/src/generate_global_types/emit.rs
  • xtask/codegen/src/generate_global_types/lower.rs
  • xtask/codegen/tests/global_types_codegen.rs
💤 Files with no reviewable changes (1)
  • xtask/codegen/src/generate_global_types/compare.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • xtask/codegen/tests/global_types_codegen.rs
  • xtask/codegen/src/generate_global_types/lower.rs

@minseong0324
minseong0324 requested a review from ematipico July 24, 2026 19:30
@ematipico
ematipico merged commit 762c8c1 into biomejs:main Jul 26, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Tooling Area: internal tools A-Type-Inference Area: type inference L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants