-
-
Notifications
You must be signed in to change notification settings - Fork 794
fix(cli): make config-path absolute #8188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 177d9f2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
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 |
WalkthroughChanges make configuration-path resolution explicit by passing the current working directory into the configuration hinting logic. Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ 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)
🔇 Additional comments (2)
Comment |
There was a problem hiding this 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 solidThreading the
Utf8Pathworking directory intoas_configuration_path_hintand joining relativeconfig_pathvalues 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’sjoinsemantics.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 improvementUsing
fs.working_directory().unwrap_or_default()once and threading thatUtf8Paththrough config loading, path validation, andScanKind::KnownFilestarget construction makes the CLI’s behaviour much more predictable, especially with nested roots and in-memory file systems.The
project_dirchoice (root_configuration_dirvsworking_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_dirin the.editorconfigloading 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 changesetTiny 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
📒 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
crates/biome_cli/src/cli_options.rs
Outdated
| 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)) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works! :) 55ef110 (#8188)
chansuke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Summary
Closes #7390
The issue was caused by
--config-pathnot 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