Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@cormacrelf
Copy link
Contributor

@cormacrelf cormacrelf commented Nov 25, 2025

Summary

We can't really have e2e tests that test root/nonroot config behaviour, and also use biome on its own source code.

This allows e2e by recognizing explicit root: true in nested configs, and converting them to force-ignores of every file therein. This is a bit suboptimal because I would much rather have the scanner stop when it finds a nested root. But for now it just does a full scan anyway, and then ignores.

I didn't delete the RootInRoot error because users are still likely to create nested roots by accident. If you want nested roots, they must be explicit.

Test Plan

This includes a new e2e test of #8239. It has an explicit root, and the other tests don't fail. The stdin test itself doesn't pass without #8239 merged.

Docs

n/a probably. There are some inline docs on the new code.

@changeset-bot
Copy link

changeset-bot bot commented Nov 25, 2025

⚠️ No Changeset found

Latest commit: ffa3b6c

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 github-actions bot added A-CLI Area: CLI A-Core Area: core A-Project Area: project labels Nov 25, 2025
@cormacrelf cormacrelf changed the title Support explicit nested roots Recognise and ignore explicit nested roots Nov 25, 2025
@cormacrelf cormacrelf changed the title Recognise and ignore explicit nested roots feat: Recognise and ignore explicit nested roots Nov 25, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 25, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a new public nested_root: bool field to Configuration (serde-skipped, CLI-hidden). Refactors file-system search predicates to return ControlFlow and updates auto_search_files_with_predicate signature. Introduces load_nested_configuration and makes read_config private with project-path-aware logic to avoid walking above a nested project root. Updates workspace scanner/server APIs to accept and mutate &mut Vec<BiomePath>, implements nested-root resolution and merging behaviour, adapts diagnostics printing, and adds/updates e2e tests and test scripts for nested-configuration scenarios.

Suggested reviewers

  • ematipico

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: recognise and ignore explicit nested roots' accurately summarises the main change: adding support for recognising and handling explicit nested root configurations.
Description check ✅ Passed The pull request description clearly relates to the changeset. It explains the motivation for supporting explicit nested roots and how files are processed when a nested root is detected.

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 007921f and ffa3b6c.

📒 Files selected for processing (18)
  • crates/biome_configuration/src/lib.rs (1 hunks)
  • crates/biome_fs/src/fs.rs (3 hunks)
  • crates/biome_service/src/configuration.rs (8 hunks)
  • crates/biome_service/src/diagnostics.rs (2 hunks)
  • crates/biome_service/src/scanner.rs (2 hunks)
  • crates/biome_service/src/scanner/workspace_bridges.rs (1 hunks)
  • crates/biome_service/src/workspace/server.rs (6 hunks)
  • e2e-tests/relative-path/test.sh (1 hunks)
  • e2e-tests/stdin-nested-config/app.js (1 hunks)
  • e2e-tests/stdin-nested-config/app.js.formatted (1 hunks)
  • e2e-tests/stdin-nested-config/biome.jsonc (1 hunks)
  • e2e-tests/stdin-nested-config/donotformat.ts (1 hunks)
  • e2e-tests/stdin-nested-config/subdirectory/biome.jsonc (1 hunks)
  • e2e-tests/stdin-nested-config/subdirectory/lib.js (1 hunks)
  • e2e-tests/stdin-nested-config/subdirectory/lib.js.formatted (1 hunks)
  • e2e-tests/stdin-nested-config/subdirectory/typed.ts (1 hunks)
  • e2e-tests/stdin-nested-config/subdirectory/typed.ts.formatted (1 hunks)
  • e2e-tests/stdin-nested-config/test.sh (1 hunks)

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/biome_service/src/diagnostics.rs (1)

642-650: Trailing : after each diagnostic looks unintended.

The loop formats each diagnostic with PrintDiagnostic::simple(diagnostic) followed by ": ", but nothing follows the colon. This produces output like:

Error(s) during loading of plugins:
<diagnostic1>: <diagnostic2>: 

Was the intent to have a newline or omit the colon entirely?

 fn message(&self, fmt: &mut biome_console::fmt::Formatter<'_>) -> std::io::Result<()> {
     fmt.write_markup(markup!("Error(s) during loading of plugins:\n"))?;

     for diagnostic in &self.diagnostics {
-        fmt.write_markup(markup! {{PrintDiagnostic::simple(diagnostic)}": "})?;
+        fmt.write_markup(markup! {{PrintDiagnostic::simple(diagnostic)}"\n"})?;
     }

     Ok(())
 }
🧹 Nitpick comments (3)
crates/biome_configuration/src/lib.rs (1)

119-123: LGTM – internal flag for nested root handling.

The attributes correctly hide this from serialization and CLI. Minor note: #[serde(default)] is redundant when #[serde(skip)] is present, as skip already prevents deserialization. Not a blocker, just a nitpick.

e2e-tests/stdin-nested-config/test.sh (1)

3-4: Use single quotes in trap to defer variable expansion.

$TEMP expands when the trap is defined, not when it fires. If TEMP were reassigned later (unlikely here, but good practice), the wrong file would be removed.

 TEMP=$(mktemp)
-trap "rm -f $TEMP" EXIT
+trap 'rm -f "$TEMP"' EXIT
crates/biome_service/src/workspace/server.rs (1)

2233-2239: Clarify iterator consumption pattern.

Using paths.into_iter() on a &mut Vec yields &mut BiomePath references, then you clone at line 2336. Consider using std::mem::take(paths).into_iter() for owned iteration, which would be more idiomatic and avoid the clone.

-        *paths = paths.into_iter().try_fold(
+        *paths = std::mem::take(paths).into_iter().try_fold(
             Vec::new(),
-            |mut filtered_paths, config_path| -> Result<Vec<BiomePath>, WorkspaceError> {
+            |mut filtered_paths, config_path: BiomePath| -> Result<Vec<BiomePath>, WorkspaceError> {

Then at line 2336:

-                filtered_paths.push(config_path.clone());
+                filtered_paths.push(config_path);
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 98ca2ae and 007921f.

📒 Files selected for processing (19)
  • crates/biome_configuration/src/lib.rs (1 hunks)
  • crates/biome_fs/src/fs.rs (3 hunks)
  • crates/biome_service/src/configuration.rs (8 hunks)
  • crates/biome_service/src/diagnostics.rs (2 hunks)
  • crates/biome_service/src/scanner.rs (2 hunks)
  • crates/biome_service/src/scanner/workspace_bridges.rs (1 hunks)
  • crates/biome_service/src/workspace/server.rs (6 hunks)
  • e2e-tests/relative-path/test.sh (1 hunks)
  • e2e-tests/stdin-nested-config/app.js (1 hunks)
  • e2e-tests/stdin-nested-config/app.js.formatted (1 hunks)
  • e2e-tests/stdin-nested-config/biome.jsonc (1 hunks)
  • e2e-tests/stdin-nested-config/donotformat.ts (1 hunks)
  • e2e-tests/stdin-nested-config/subdirectory/biome.jsonc (1 hunks)
  • e2e-tests/stdin-nested-config/subdirectory/lib.js (1 hunks)
  • e2e-tests/stdin-nested-config/subdirectory/lib.js.formatted (1 hunks)
  • e2e-tests/stdin-nested-config/subdirectory/typed.ts (1 hunks)
  • e2e-tests/stdin-nested-config/subdirectory/typed.ts.formatted (1 hunks)
  • e2e-tests/stdin-nested-config/test.sh (1 hunks)
  • e2e-tests/test-all.sh (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Use the Rust dbg!() macro for debugging output during test execution, and pass the --show-output flag to cargo test to display debug output.
Use snapshot testing with the insta crate for testing in Rust projects. Accept or reject snapshots using cargo insta accept, cargo insta reject, or cargo insta review.
Write doc comments as doc tests in Rust using code blocks with assertions that will be executed during the testing phase.
Use rustdoc inline documentation for rules, assists, and their options. Create corresponding documentation PRs for other documentation updates against the next branch of the website repository.
Set the version metadata field in linter rule implementations to 'next' for newly created rules. Update this field to the new version number when releasing a minor or major version.

Files:

  • crates/biome_configuration/src/lib.rs
  • crates/biome_service/src/scanner/workspace_bridges.rs
  • crates/biome_service/src/diagnostics.rs
  • crates/biome_service/src/configuration.rs
  • crates/biome_fs/src/fs.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_service/src/scanner.rs
crates/biome_service/src/workspace/server.rs

📄 CodeRabbit inference engine (crates/biome_service/CONTRIBUTING.md)

Use WorkspaceServer implementation for maintaining workspace state in daemon mode and CLI daemonless mode

Files:

  • crates/biome_service/src/workspace/server.rs
🧠 Learnings (56)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.017Z
Learning: Applies to crates/biome_service/src/workspace*.rs : Implement the Workspace trait in the Biome Service to manage internal state of projects, including open documents, project layout instances, and module graph instances
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : The rule option serde configuration must include 'deny_unknown_fields' to raise errors for extraneous fields in configuration

Applied to files:

  • crates/biome_configuration/src/lib.rs
  • crates/biome_service/src/configuration.rs
  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule option fields should be wrapped in 'Option<_>' to properly track set and unset options during configuration merging

Applied to files:

  • crates/biome_configuration/src/lib.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_service/src/scanner.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule option structs must implement the 'biome_deserialize::Merge' trait to handle merging shared and user configurations

Applied to files:

  • crates/biome_configuration/src/lib.rs
  • crates/biome_service/src/configuration.rs
  • crates/biome_fs/src/fs.rs
  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
Repo: biomejs/biome PR: 7081
File: packages/@biomejs/biome/configuration_schema.json:7765-7781
Timestamp: 2025-08-05T14:43:29.581Z
Learning: The file `packages/biomejs/biome/configuration_schema.json` is auto-generated and should not be manually edited or reviewed for schema issues; any changes should be made at the code generation source.

Applied to files:

  • e2e-tests/stdin-nested-config/biome.jsonc
  • e2e-tests/stdin-nested-config/subdirectory/biome.jsonc
📚 Learning: 2025-11-24T18:05:20.343Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.343Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/tests/specs/**/options.json : Create an `options.json` file (formatted as `biome.json`) in test specification folders to apply non-default formatting options to all test files in that folder

Applied to files:

  • e2e-tests/stdin-nested-config/biome.jsonc
  • e2e-tests/stdin-nested-config/test.sh
  • e2e-tests/stdin-nested-config/subdirectory/biome.jsonc
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/tests/specs/**/*.{js,ts,tsx,jsx,json,css,graphql} : Test files for rules should be placed inside 'tests/specs/' directory organized by group and rule name (e.g., 'tests/specs/nursery/myRuleName/')

Applied to files:

  • e2e-tests/stdin-nested-config/biome.jsonc
  • e2e-tests/stdin-nested-config/test.sh
  • e2e-tests/stdin-nested-config/subdirectory/biome.jsonc
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/tests/specs/**/*.{js,ts,tsx,jsx,json,css,graphql} : Test files should use 'invalid' or 'valid' prefixes to indicate whether they contain code reported by the rule

Applied to files:

  • e2e-tests/stdin-nested-config/biome.jsonc
  • e2e-tests/stdin-nested-config/test.sh
  • e2e-tests/stdin-nested-config/subdirectory/biome.jsonc
📚 Learning: 2025-11-24T18:03:52.014Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.014Z
Learning: For bugfix/feature PRs visible to Biome toolchain users or affecting published crates, create a changeset using the `just new-changeset` command with appropriate package selection, change type (major/minor/patch), and description.

Applied to files:

  • e2e-tests/stdin-nested-config/biome.jsonc
  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:06:12.017Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.017Z
Learning: Applies to crates/biome_service/src/workspace*.rs : Implement the Workspace trait in the Biome Service to manage internal state of projects, including open documents, project layout instances, and module graph instances

Applied to files:

  • crates/biome_service/src/scanner/workspace_bridges.rs
  • crates/biome_service/src/configuration.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_service/src/scanner.rs
📚 Learning: 2025-11-24T18:06:12.017Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.017Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Implement watcher tests for workspace methods in watcher.tests.rs and end-to-end tests in LSP tests

Applied to files:

  • crates/biome_service/src/scanner/workspace_bridges.rs
  • crates/biome_service/src/configuration.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_service/src/scanner.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule option fields should use 'Box<[Box<str>]>' instead of 'Vec<String>' for array types to save memory

Applied to files:

  • crates/biome_service/src/scanner/workspace_bridges.rs
  • crates/biome_service/src/scanner.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Multi-file documentation snippets should use 'file=<path>' property to create an in-memory file system for testing cross-file rule behavior

Applied to files:

  • crates/biome_service/src/scanner/workspace_bridges.rs
  • crates/biome_service/src/configuration.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_service/src/scanner.rs
  • e2e-tests/stdin-nested-config/subdirectory/biome.jsonc
  • e2e-tests/relative-path/test.sh
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules should use 'Type Signals = Box<[Self::State]>' instead of 'Vec<Self::State>' to report multiple diagnostics for a single query match, to save memory

Applied to files:

  • crates/biome_service/src/scanner/workspace_bridges.rs
  • crates/biome_service/src/diagnostics.rs
📚 Learning: 2025-11-24T18:04:57.290Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.290Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Implement the Diagnostic trait on types, or use the #[derive(Diagnostic)] procedural macro to implement the trait. Configure category, severity, description, message, location, and tags using the #[diagnostic] attribute

Applied to files:

  • crates/biome_service/src/diagnostics.rs
  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:04:57.290Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.290Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Ensure the type implementing Diagnostic derives Debug

Applied to files:

  • crates/biome_service/src/diagnostics.rs
  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-11-24T18:04:57.290Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.290Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Use #[derive(Diagnostic)] on enums when every variant contains a type that is itself a diagnostic

Applied to files:

  • crates/biome_service/src/diagnostics.rs
📚 Learning: 2025-11-24T18:04:57.290Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.290Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Use helper types from the biome_diagnostics::v2 module (CodeFrameAdvice, CommandAdvice, DiffAdvice, LogAdvice) or implement the Advices trait yourself for custom advice handling

Applied to files:

  • crates/biome_service/src/diagnostics.rs
  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Code blocks in documentation marked with 'expect_diagnostic' must emit exactly one diagnostic for the build system to generate it automatically

Applied to files:

  • crates/biome_service/src/diagnostics.rs
📚 Learning: 2025-11-24T18:04:57.290Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.290Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Fields with #[advice] or #[verbose_advice] attributes must implement the Advices trait to record advices on the diagnostic

Applied to files:

  • crates/biome_service/src/diagnostics.rs
📚 Learning: 2025-11-24T18:04:57.290Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.290Z
Learning: Applies to crates/biome_diagnostics/crates/biome_diagnostics_categories/src/categories.rs : Register all new diagnostic categories in crates/biome_diagnostics_categories/src/categories.rs

Applied to files:

  • crates/biome_service/src/diagnostics.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Code blocks in rule documentation must specify a language and use 'expect_diagnostic' property for invalid snippets that should emit exactly one diagnostic

Applied to files:

  • crates/biome_service/src/diagnostics.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule diagnostic and action functions must set the category using 'rule_category!()' macro instead of dynamically parsing string names

Applied to files:

  • crates/biome_service/src/diagnostics.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules should only have severity set to 'error' if they report hard errors, dangerous code, or accessibility issues; use 'warn' for possibly erroneous code; use 'info' for stylistic suggestions

Applied to files:

  • crates/biome_service/src/diagnostics.rs
  • e2e-tests/relative-path/test.sh
📚 Learning: 2025-11-24T18:05:27.784Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.784Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Use the `dbg_write!` macro to debug formatter output instead of other logging methods

Applied to files:

  • crates/biome_service/src/diagnostics.rs
  • crates/biome_service/src/workspace/server.rs
  • e2e-tests/relative-path/test.sh
📚 Learning: 2025-09-25T12:32:59.003Z
Learnt from: arendjr
Repo: biomejs/biome PR: 7593
File: crates/biome_service/src/workspace/server.rs:1306-1306
Timestamp: 2025-09-25T12:32:59.003Z
Learning: In the biomejs/biome project, do not flag compilation errors during code review as they are handled by the existing test infrastructure and CI. Focus on other code quality aspects instead.

Applied to files:

  • e2e-tests/stdin-nested-config/test.sh
  • e2e-tests/relative-path/test.sh
📚 Learning: 2025-11-24T18:03:52.013Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.013Z
Learning: Applies to **/Cargo.toml : Use workspace dependencies defined in the root `Cargo.toml` for internal crates, specifying `workspace = true` in each crate's Cargo.toml. Use path dependencies for dev-dependencies to avoid requiring published versions.

Applied to files:

  • crates/biome_service/src/configuration.rs
  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:05:20.343Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.343Z
Learning: Implement the `FormattedIterExt` trait and `FormattedIter` struct in `lib.rs` to provide iterator extensions for formatting

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Use 'let else' pattern to reduce code branching when the rule's run function returns 'Vec'

Applied to files:

  • crates/biome_service/src/configuration.rs
  • crates/biome_fs/src/fs.rs
  • e2e-tests/relative-path/test.sh
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule option structs must derive 'Deserializable', 'Serialize', 'Deserialize', and optionally 'JsonSchema' traits with serde attributes

Applied to files:

  • crates/biome_service/src/configuration.rs
  • crates/biome_fs/src/fs.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Avoid deep indentation in rule implementations by using Rust helper functions like 'map', 'filter', and 'and_then' instead of nested if-let statements

Applied to files:

  • crates/biome_service/src/configuration.rs
  • crates/biome_fs/src/fs.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_service/src/scanner.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : When navigating CST, use the try operator '?' to handle 'Result' types when the rule's run function returns 'Option'

Applied to files:

  • crates/biome_service/src/configuration.rs
  • crates/biome_fs/src/fs.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Code blocks in documentation marked with 'options' should contain only rule-specific options in JSON/JSONC format, while 'full_options' contains complete biome.json configuration

Applied to files:

  • crates/biome_service/src/configuration.rs
  • e2e-tests/stdin-nested-config/subdirectory/biome.jsonc
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : The rule option serde configuration must include 'rename_all = "camelCase"' to match biome.json naming conventions

Applied to files:

  • crates/biome_service/src/configuration.rs
  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:06:03.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.536Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ConditionalParsedSyntax` for syntax that is only valid in specific contexts (e.g., strict mode, file types, language versions) and call `or_invalid_to_bogus()` to convert to a bogus node if not supported

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-11-24T18:05:20.343Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.343Z
Learning: Create test infrastructure with `tests/specs` folder structure and `spec_test.rs`, `spec_tests.rs`, and `language.rs` files in test directories

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-11-24T18:06:03.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.536Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ParseSeparatedList` and `ParseNodeList` for parsing lists with error recovery to avoid infinite loops

Applied to files:

  • crates/biome_fs/src/fs.rs
📚 Learning: 2025-11-24T18:06:12.017Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.017Z
Learning: Applies to crates/biome_service/src/workspace/server.rs : Use WorkspaceServer implementation for maintaining workspace state in daemon mode and CLI daemonless mode

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Code blocks in documentation marked with 'use_options' must follow a preceding configuration block marked with 'options' or 'full_options'

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:05:27.784Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.784Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:05:20.343Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.343Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/lib.rs : Expose a public `format_node` function that accepts formatting options and a root syntax node, returning a `FormatResult<Formatted<Context>>` with appropriate documentation

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:05:20.343Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.343Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/context.rs : Define `<Language>FormatContext` struct in a `context.rs` file containing `comments` and `source_map` fields, implementing `FormatContext` and `CstFormatContext` traits

Applied to files:

  • crates/biome_service/src/workspace/server.rs
  • crates/biome_service/src/scanner.rs
📚 Learning: 2025-11-24T18:05:20.343Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.343Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/lib.rs : Define a type alias `<Language>Formatter<'buf>` as `Formatter<'buf, <Language>FormatContext>` in the main formatter crate

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:05:20.343Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.343Z
Learning: Use the `just gen-formatter` command to generate initial formatter implementations from the grammar, which will use `format_verbatim_node` that must be replaced with proper `biome_formatter` utilities

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:05:20.343Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.343Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/tests/language.rs : Implement `TestFormatLanguage` trait in `tests/language.rs` for the formatter's test language

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:05:20.343Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.343Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/Cargo.toml : Include development dependencies in `Cargo.toml` for formatter tests: `biome_formatter_test`, `biome_<language>_factory`, `biome_<language>_parser`, `biome_parser`, `biome_service`, `countme`, `iai`, `quickcheck`, `quickcheck_macros`, and `tests_macros`

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:05:20.343Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.343Z
Learning: Create a new formatter crate using the command `just new-crate biome_<language>_formatter` where `<language>` is the target language (e.g., `biome_html_formatter` for HTML)

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:05:42.337Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.337Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced

Applied to files:

  • crates/biome_service/src/scanner.rs
📚 Learning: 2025-11-24T18:06:03.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.536Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Parse rules must take a mutable reference to the parser as their only parameter and return a `ParsedSyntax`

Applied to files:

  • crates/biome_service/src/scanner.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that ensure consistency across the codebase should use the 'useConsistent<Concept>' naming convention (e.g., `useConsistentArrayType`)

Applied to files:

  • crates/biome_service/src/scanner.rs
📚 Learning: 2025-11-24T18:06:12.017Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.017Z
Learning: Applies to crates/biome_service/src/workspace_watcher.rs : Use WorkspaceWatcher to keep workspace state in sync with the filesystem, and only activate it in daemon mode

Applied to files:

  • crates/biome_service/src/scanner.rs
📚 Learning: 2025-11-24T18:06:12.017Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.017Z
Learning: Debug the WorkspaceWatcher by starting the daemon with cargo run --bin=biome -- start and running commands such as cargo run --bin=biome -- lint --use-server <path>

Applied to files:

  • e2e-tests/relative-path/test.sh
📚 Learning: 2025-11-24T18:03:52.013Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.013Z
Learning: Applies to **/*.rs : Use the Rust `dbg!()` macro for debugging output during test execution, and pass the `--show-output` flag to `cargo test` to display debug output.

Applied to files:

  • e2e-tests/relative-path/test.sh
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'language' field in 'declare_lint_rule!' should be set to the specific JavaScript dialect (jsx, ts, tsx) if the rule only applies to that dialect, otherwise use 'js'

Applied to files:

  • e2e-tests/relative-path/test.sh
📚 Learning: 2025-11-24T18:03:52.014Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.014Z
Learning: Before committing and opening a PR, run `just f` to format Rust and TOML files, `just l` to lint the whole project, and run appropriate code generation commands (`just gen-analyzer` for linter work, `just gen-bindings` for workspace work).

Applied to files:

  • e2e-tests/relative-path/test.sh
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules ported from other ecosystems should include a 'sources' field in the 'declare_lint_rule!' macro with RuleSource metadata (e.g., '::ESLint')

Applied to files:

  • e2e-tests/relative-path/test.sh
🧬 Code graph analysis (5)
e2e-tests/stdin-nested-config/donotformat.ts (1)
e2e-tests/stdin-nested-config/app.js (1)
  • x (1-1)
crates/biome_service/src/scanner/workspace_bridges.rs (1)
packages/@biomejs/js-api/src/wasm.ts (1)
  • BiomePath (1-1)
e2e-tests/stdin-nested-config/subdirectory/typed.ts (1)
e2e-tests/stdin-nested-config/subdirectory/lib.js (1)
  • y (1-1)
e2e-tests/test-all.sh (1)
xtask/glue/src/glue.rs (1)
  • popd (195-198)
e2e-tests/relative-path/test.sh (1)
e2e-tests/stdin-nested-config/test.sh (1)
  • biome (6-8)
🪛 Shellcheck (0.11.0)
e2e-tests/stdin-nested-config/test.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)


[warning] 4-4: Use single quotes, otherwise this expands now rather than when signalled.

(SC2064)

e2e-tests/test-all.sh

[warning] 10-10: Quote the right-hand side of != in [[ ]] to prevent glob matching.

(SC2053)

⏰ 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). (1)
  • GitHub Check: Validate PR title
🔇 Additional comments (24)
e2e-tests/stdin-nested-config/subdirectory/typed.ts.formatted (1)

1-5: LGTM!

Test fixture correctly shows the expected formatted output with 2-space indentation, matching the nested biome.jsonc formatter configuration.

e2e-tests/relative-path/test.sh (1)

3-3: LGTM!

Adding tee /dev/stderr is a handy debugging aid—makes test output visible whilst preserving the original assertion. Nice for troubleshooting CI failures.

e2e-tests/stdin-nested-config/subdirectory/lib.js (1)

1-5: LGTM!

Intentionally poorly formatted test input—the excessive whitespace makes for a clear before/after comparison with the .formatted variant.

crates/biome_fs/src/fs.rs (3)

133-136: LGTM!

Clean delegation to the predicate-based variant with an always-continue predicate preserves backward compatibility.


138-155: Well-documented API change.

The doc comments clearly explain the three ControlFlow return cases. This makes the predicate contract easy to understand for callers.


158-202: LGTM!

The labelled loop control flow is well-structured:

  • Break(()) → bail out entirely
  • Continue(false) → config file found but rejected, try parent directory
  • Continue(true) → match found, return result

The break 'inner on Continue(false) correctly skips remaining search_files in the current directory and proceeds to the parent—sensible behaviour for nested root discovery.

e2e-tests/stdin-nested-config/subdirectory/biome.jsonc (1)

1-12: LGTM—configuration syntax is valid.

The "extends": "//" microsyntax available in Biome v2 tells Biome to extend from the root configuration, regardless of where the nested configuration is. The file structure and formatter settings are correct.

e2e-tests/stdin-nested-config/subdirectory/typed.ts (1)

1-5: LGTM! Test fixture is appropriate.

This test file is correctly structured to validate formatting behaviour with nested configurations, using irregular spacing to ensure the formatter processes it as expected.

crates/biome_service/src/scanner.rs (1)

469-469: LGTM! Signature change is correct.

The change to pass a mutable reference aligns with the updated update_project_config_files signature for handling nested configurations.

e2e-tests/stdin-nested-config/donotformat.ts (1)

1-1: LGTM! Test fixture for selective formatting.

The irregular spacing is intentional to validate that this file is not formatted when excluded by the nested configuration.

e2e-tests/stdin-nested-config/app.js.formatted (1)

1-5: LGTM! Expected output is correctly formatted.

The formatting correctly applies the 4-space indentation configured in the root biome.jsonc.

e2e-tests/stdin-nested-config/biome.jsonc (1)

1-16: LGTM! Root configuration for nested config testing.

This configuration correctly sets up a nested root boundary with selective file inclusion, validating the PR's explicit nested root support.

e2e-tests/stdin-nested-config/app.js (1)

1-5: LGTM! Input fixture for formatting tests.

The irregular spacing and indentation are intentional test input to validate the formatter applies the correct configuration.

e2e-tests/stdin-nested-config/subdirectory/lib.js.formatted (1)

1-5: LGTM! Expected output with nested config indentation.

The formatting correctly applies the 2-space indentation from the subdirectory's nested configuration, demonstrating proper config hierarchy.

e2e-tests/test-all.sh (2)

1-7: LGTM! Script improvements enhance usability.

The portable shebang, directory navigation, and filter logic are good additions for flexible test execution.


15-17: LGTM! pushd/popd is a better pattern.

Using pushd/popd is more robust than the previous cd approach for directory navigation.

crates/biome_service/src/scanner/workspace_bridges.rs (1)

62-66: Signature change to mutable Vec is appropriate.

The change from &[BiomePath] to &mut Vec<BiomePath> enables in-place filtering during nested-root processing. The trait is pub(crate), so no external API breakage.

crates/biome_service/src/configuration.rs (3)

165-173: Clean addition of load_nested_configuration.

The new function properly delegates to read_config with the project path, enabling nested config discovery without the root-only filter. Good separation of concerns.


237-269: ControlFlow predicate logic is sound.

The early break when project.starts_with(parent) correctly stops the upward search when reaching/passing the project root. The conditional root filtering (lines 259-265) ensures nested configs find any config file while root searches only find root configs.


728-805: Comprehensive test coverage for nested configuration scenarios.

Tests cover the key cases: non-root nested config, implicit root, explicit root, and ensuring project root config isn't returned for nested searches. Well structured.

crates/biome_service/src/workspace/server.rs (4)

1007-1008: Correct handling for nested root settings.

When the configuration has nested_root flag set, starting with default settings makes sense since the nested root configuration is essentially an "ignore everything" directive.


2228-2231: Good approach: sort paths to process parents before children.

Sorting ensures nested roots are discovered before their sub-projects, enabling the skip logic at lines 2241-2247 to work correctly.


2311-2327: Careful merge handling for extends_root case.

Good catch resetting root = Some(Bool(false)) after merging to prevent the root config's root: true from leaking through. This maintains proper nested config semantics.


2299-2309: Force-ignore configuration for nested roots is correct.

The !!**/* glob pattern uses the force-ignore syntax, where patterns starting with !! are never indexed/visited by the scanner. Combined with ignore_unknown: true and nested_root = true, this correctly prevents Biome from processing the nested root directory.

This avoids reading and parsing the root config over and over again.
It also allows us to know that if it does return a root config, it's
definitely not the project's root one, it's a nested root.
@cormacrelf cormacrelf force-pushed the nested-roots branch 2 times, most recently from 1fcb6f7 to f265989 Compare November 25, 2025 04:01
@cormacrelf cormacrelf changed the title feat: Recognise and ignore explicit nested roots feat: recognise and ignore explicit nested roots Nov 25, 2025
@cormacrelf
Copy link
Contributor Author

Ah, actually, we can just ignore with !!**/e2e-tests from the top level config.

@cormacrelf cormacrelf closed this Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Core Area: core A-Project Area: project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant