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

Skip to content

Conversation

@ematipico
Copy link
Member

Summary

Closes #7390

The issue was caused by --config-path not made absolute when computed. This was causing some issues when the rest of the configuration files were loaded.

Making the path absolute yields the correct behaviour.

Test Plan

I had to test it manually against the repository, because any test I added yielded the correct result. I believe this is caused by the working directories not being correct when doing testing stuff when using the memory file system

Docs

N/A

@changeset-bot
Copy link

changeset-bot bot commented Nov 21, 2025

🦋 Changeset detected

Latest commit: 177d9f2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

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

@ematipico ematipico requested review from a team November 21, 2025 10:51
@github-actions github-actions bot added the A-CLI Area: CLI label Nov 21, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 21, 2025

Walkthrough

Changes make configuration-path resolution explicit by passing the current working directory into the configuration hinting logic. as_configuration_path_hint now accepts working_directory: &Utf8Path and resolves non-absolute user-provided config paths against it (after stripping a leading ./). Command setup (configure_workspace) retrieves the working directory once and forwards it into the hint, removing redundant lookups and ensuring --config-path applies the selected configuration file when multiple root configs exist.

Suggested reviewers

  • dyc3
  • siketyan

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'fix(cli): make config-path absolute' accurately summarises the main change: resolving config-path to an absolute path to fix configuration resolution issues.
Description check ✅ Passed The description clearly relates to the changeset, explaining the root cause and solution of issue #7390, and describes the manual testing approach.
Linked Issues check ✅ Passed The code changes successfully address issue #7390's objectives: the --config-path is now resolved to an absolute path using the working directory, ensuring the CLI respects explicitly selected configurations and prevents default configs from overriding them.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the config-path resolution issue: modifications to CLI option handling, configuration path hinting, and workspace configuration logic are all necessary and focused on the stated objective.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/multiple-roots-same-level

📜 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 2c1a124 and 55ef110.

📒 Files selected for processing (1)
  • crates/biome_cli/src/cli_options.rs (2 hunks)
⏰ 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). (9)
  • GitHub Check: End-to-end tests
  • GitHub Check: Documentation
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Check Dependencies
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Test Node.js API
  • GitHub Check: autofix
🔇 Additional comments (2)
crates/biome_cli/src/cli_options.rs (2)

112-116: Solid fix – correctly handles both absolute and relative paths.

The logic properly distinguishes absolute paths (returned unchanged) from relative paths (resolved against working_directory). This ensures --config-path is always absolute, fixing the multiple root config issue. Good resolution of the earlier absolute-path concern from the previous review.


103-106: Now I need to examine the codebase to see the actual implementation of fs.working_directory() and confirm the concern:

Based on my verification of the code and Rust path semantics, I can now provide the rewritten review comment.

Method signature change correctly threads the working directory, but verify the call site's None-case handling.

The updated signature properly accepts the working directory needed for resolving relative config paths. However, at the call site (crates/biome_cli/src/commands/mod.rs:944), if the path is empty or getting the current directory fails, then an error will be returned — and unwrap_or_default() on a missing working directory would produce an empty path, which is relative by default in Rust. Ensure fs.working_directory() is guaranteed to return a value, or handle the None case explicitly to enforce the absolute path requirement.


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: 0

🧹 Nitpick comments (3)
crates/biome_cli/src/cli_options.rs (1)

103-113: Config-path hint now anchored on working directory – looks solid

Threading the Utf8Path working directory into as_configuration_path_hint and joining relative config_path values against it (after stripping a leading "./") is exactly what was missing for the multiple-root case; absolute paths will still behave as expected via camino’s join semantics.

If you feel like tightening this further, a couple of small tests (relative vs absolute --config-path, and a directory-valued hint) would make sure no-one “fixes” this behaviour back by accident later.

crates/biome_cli/src/commands/mod.rs (1)

54-55: Working directory is now a single source of truth – nice improvement

Using fs.working_directory().unwrap_or_default() once and threading that Utf8Path through config loading, path validation, and ScanKind::KnownFiles target construction makes the CLI’s behaviour much more predictable, especially with nested roots and in-memory file systems.

The project_dir choice (root_configuration_dir vs working_dir, preferring the ancestor path) also matches the comment and should keep “strict” configs from unexpectedly drifting back to the default root.

If you want to squeeze a bit more consistency later, you could consider reusing this working_dir in the .editorconfig loading path too, but that’s a separate tidy-up rather than something for this PR.

Also applies to: 942-1030

.changeset/bumpy-months-draw.md (1)

5-7: Minor wording/typo tweak in the changeset

Tiny copy edit to make this read more smoothly:

-Fixed [#7390](https://github.com/biomejs/biome/issues/7390), where Biome couldn't apply the correct configuration passed via `--config-path`.
-
-Now if you have multiple **root** configuration files, running any command with `--config-path` will apply the chose configuration file.
+Fixed [#7390](https://github.com/biomejs/biome/issues/7390), where Biome couldn't apply the correct configuration passed via `--config-path`.
+
+If you have multiple **root** configuration files, running any command with `--config-path` will now apply the chosen configuration file.

[nit, but it will save future readers a wince.]

📜 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 8e97b89 and a2c2595.

📒 Files selected for processing (3)
  • .changeset/bumpy-months-draw.md (1 hunks)
  • crates/biome_cli/src/cli_options.rs (2 hunks)
  • crates/biome_cli/src/commands/mod.rs (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 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:

  • .changeset/bumpy-months-draw.md
🧬 Code graph analysis (1)
crates/biome_cli/src/commands/mod.rs (5)
crates/biome_service/src/workspace.rs (1)
  • fs (1517-1517)
crates/biome_service/src/workspace/server.rs (2)
  • fs (2070-2072)
  • fs (2158-2160)
crates/biome_service/src/workspace/client.rs (1)
  • fs (210-212)
crates/biome_service/src/scanner/test_utils.rs (1)
  • fs (73-75)
crates/biome_service/src/scanner/workspace_bridges.rs (3)
  • fs (15-15)
  • fs (107-107)
  • fs (200-202)
🪛 LanguageTool
.changeset/bumpy-months-draw.md

[uncategorized] ~6-~6: Possible missing comma found.
Context: ...figuration passed via --config-path. Now if you have multiple root configura...

(AI_HYDRA_LEO_MISSING_COMMA)

⏰ 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: Documentation
  • GitHub Check: Check Dependencies
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: autofix
  • GitHub Check: Test Node.js API

let path = Utf8PathBuf::from(path);
let path = path.strip_prefix("./").unwrap_or(&path);
ConfigurationPathHint::FromUser(path.to_path_buf())
ConfigurationPathHint::FromUser(working_directory.join(path))
Copy link
Member

Choose a reason for hiding this comment

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

This will break when the user provided an absolute path?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, let me make a better check and I will test it too

Copy link
Member Author

Choose a reason for hiding this comment

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

Works! :) 55ef110 (#8188)

Copy link
Member

@chansuke chansuke left a comment

Choose a reason for hiding this comment

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

lgtm

@ematipico ematipico enabled auto-merge November 23, 2025 06:51
@dyc3 dyc3 disabled auto-merge November 23, 2025 13:25
@dyc3 dyc3 added this pull request to the merge queue Nov 23, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Nov 23, 2025
@dyc3 dyc3 merged commit 4ca088c into main Nov 23, 2025
13 checks passed
@dyc3 dyc3 deleted the fix/multiple-roots-same-level branch November 23, 2025 16:16
@github-actions github-actions bot mentioned this pull request Nov 22, 2025
@github-actions github-actions bot mentioned this pull request Nov 25, 2025
l0ngvh pushed a commit to l0ngvh/biome that referenced this pull request Dec 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Multiple root configs don't work with config-path

5 participants