+
Skip to content

Conversation

siketyan
Copy link
Member

@siketyan siketyan commented Aug 6, 2025

Summary

Fixed broken WASM build after #6989.

Test Plan

Will be synced to next.biomejs.dev/playground so we can try there

Docs

N/A

@siketyan siketyan self-assigned this Aug 6, 2025
Copy link

changeset-bot bot commented Aug 6, 2025

⚠️ No Changeset found

Latest commit: c6cc440

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

Copy link
Contributor

coderabbitai bot commented Aug 6, 2025

Walkthrough

The change shifts the instantiation of the ScanContext object in the Scanner::scan method to occur before entering the thread scope, rather than inside it. This adjustment applies to both non-WASM and WASM code paths, ensuring the same ScanContext instance is reused and consistently passed into scanning functions.

Changes

Cohort / File(s) Change Summary
ScanContext Instantiation Refactor
crates/biome_service/src/scanner.rs
Moved ScanContext creation outside the thread scope in Scanner::scan, reusing the instance in all scan paths.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant Scanner
    participant ScanContext
    participant scan_folder

    Caller->>Scanner: scan()
    Scanner->>ScanContext: instantiate ctx
    Scanner->>scan_folder: pass &ctx
    scan_folder-->>Scanner: scan results
    Scanner-->>Caller: return results
Loading

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d4e0e64 and c6cc440.

📒 Files selected for processing (1)
  • crates/biome_service/src/scanner.rs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{rs,toml}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Format code (Rust + TOML) using just format

Format Rust and TOML files using just f (alias for just format).

Files:

  • crates/biome_service/src/scanner.rs
crates/biome_*/**/*

📄 CodeRabbit Inference Engine (CLAUDE.md)

Core crates must be located in /crates/biome_*/

Files:

  • crates/biome_service/src/scanner.rs
**/*.rs

📄 CodeRabbit Inference Engine (CONTRIBUTING.md)

Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.

Files:

  • crates/biome_service/src/scanner.rs
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: You are encouraged to split the work for a new rule into multiple PRs and describe your plan in an issue if unfamiliar with Biome's APIs.
📚 Learning: applies to crates/biome_service/src/workspace_watcher.rs : keep the workspace state in sync with the...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:59.193Z
Learning: Applies to crates/biome_service/src/workspace_watcher.rs : Keep the workspace state in sync with the filesystem using WorkspaceWatcher (src/workspace_watcher.rs)

Applied to files:

  • crates/biome_service/src/scanner.rs
📚 Learning: applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : when banning certain functions o...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When banning certain functions or variables, always check if the variable is global using the semantic model to avoid false positives.

Applied to files:

  • crates/biome_service/src/scanner.rs
📚 Learning: applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : avoid deep indentation by using ...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Avoid deep indentation by using combinators like `map`, `filter`, and `and_then` instead of nested `if let` or `match` statements.

Applied to files:

  • crates/biome_service/src/scanner.rs
📚 Learning: applies to crates/biome_formatter/**/context.rs : define the `htmlformatcontext` type inside a file ...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/context.rs : Define the `HtmlFormatContext` type inside a file called `context.rs`, including `comments` and `source_map` fields, and implement the `FormatContext` and `CstFormatContext` traits.

Applied to files:

  • crates/biome_service/src/scanner.rs
📚 Learning: applies to crates/biome_parser/crates/biome_*/src/generated/ : create a `generated/` folder inside t...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/src/generated/ : Create a `generated/` folder inside the `src/` folder of each new language crate (e.g., `crates/biome_html_syntax/src/generated/`).

Applied to files:

  • crates/biome_service/src/scanner.rs
📚 Learning: applies to crates/biome_service/src/workspace/watcher.tests.rs : add tests for watcher workspace met...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:59.193Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Add tests for watcher workspace methods in watcher.tests.rs (src/workspace/watcher.tests.rs)

Applied to files:

  • crates/biome_service/src/scanner.rs
📚 Learning: applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : new rules must be placed inside ...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : New rules must be placed inside the `nursery` group for incubation before promotion.

Applied to files:

  • crates/biome_service/src/scanner.rs
📚 Learning: applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : when a rule requires semantic in...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When a rule requires semantic information, use the `Semantic<>` query type and access the semantic model via `ctx.model()`.

Applied to files:

  • crates/biome_service/src/scanner.rs
📚 Learning: applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : avoid unnecessary string allocat...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Avoid unnecessary string allocations by comparing against `&str` or `TokenText` instead of calling `to_string()`.

Applied to files:

  • crates/biome_service/src/scanner.rs
📚 Learning: applies to crates/biome_analyze/biome_rule_options/lib/*.rs : use boxed slices (`box<[box]>`) i...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/*.rs : Use boxed slices (`Box<[Box<str>]>`) instead of `Vec<String>` for string arrays in rule options to save memory.

Applied to files:

  • crates/biome_service/src/scanner.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: autofix
  • GitHub Check: Documentation
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: End-to-end tests
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-windows-2022-4)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Check Dependencies
🔇 Additional comments (1)
crates/biome_service/src/scanner.rs (1)

344-357: Excellent fix for the WASM build issue.

Moving ScanContext instantiation outside the thread scope resolves lifetime issues that likely broke the WASM build. The unified approach ensures both WASM and non-WASM paths use the same context instance consistently, eliminating the redundant context creation that was happening inside the thread closure.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the A-Project Area: project label Aug 6, 2025
@siketyan siketyan merged commit f0e9439 into biomejs:next Aug 6, 2025
11 checks passed
@arendjr
Copy link
Contributor

arendjr commented Aug 6, 2025

Sorry about that! It’s not the first time I’ve broken the playground 😬 How can I better check if it still works?

@siketyan siketyan deleted the fix/wasm-build branch August 7, 2025 02:06
@siketyan
Copy link
Member Author

siketyan commented Aug 7, 2025

@arendjr No worries! It was a build failure this time, so I noticed from a failed workflow notification (https://github.com/biomejs/biome/actions/runs/16779123934). For runtime issues, we could run Playwright tests before merging the sync PR, adding more tests :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Project Area: project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载