Skip to content

Conversation

@cormacrelf
Copy link
Contributor

@cormacrelf cormacrelf commented Nov 24, 2025

Summary

Fixes #8233. We were just missing a working_dir.join(), so biome was not able to find the project the stdin path was associated with. I don't know if that's exactly correct -- do we have to resolve the path of any symlinks or is cwd.join just fine?

Test Plan

I added an e2e test, and also improved the e2e test runner script. We can now:

  • run without cd e2e-tests first
  • filter tests: ./e2e-tests/test-all.sh stdin, with glob matching
  • Find out which test failed in red at the end instead of scrolling up through cargo output
  • Use { "root": true } in test configs because e2e-tests is now ignored from the root biome.json

Docs

This actually just makes the CLI behave as is already documented in the stdin_file_path CLI params.

@changeset-bot
Copy link

changeset-bot bot commented Nov 24, 2025

🦋 Changeset detected

Latest commit: 290e75a

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

@github-actions github-actions bot added A-CLI Area: CLI A-Project Area: project labels Nov 24, 2025
@cormacrelf cormacrelf force-pushed the fix-stdin-nested-config branch from 32e6803 to 0d95d92 Compare November 24, 2025 07:44
@cormacrelf cormacrelf changed the title Fix --stdin-file-path with nested configuration fix: --stdin-file-path with nested configuration Nov 24, 2025
@ematipico
Copy link
Member

Stdin has no relation to traversal mode or scanning

This, basically, changed the semantics of stdin. That's a breaking change.

There have been discussions around it. However we can't take this change lightly because there are users out there that rely on it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 24, 2025

Warning

Rate limit exceeded

@cormacrelf has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 41 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 189b888 and 290e75a.

⛔ Files ignored due to path filters (2)
  • crates/biome_cli/tests/snapshots/main_commands_check/check_stdin_ignores_unknown_file_path.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_commands_format/format_stdin_does_not_error_with_ignore_unknown_file_extensions.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (16)
  • .changeset/blue-parts-lie.md (1 hunks)
  • biome.json (1 hunks)
  • crates/biome_cli/src/execute/mod.rs (1 hunks)
  • crates/biome_cli/src/execute/std_in.rs (3 hunks)
  • e2e-tests/relative-path-ignore-file/biome.json (1 hunks)
  • e2e-tests/relative-path/biome.json (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)

Walkthrough

Normalises the stdin file path by joining the provided --stdin-file-path with the workspace working directory so config discovery runs relative to the project. Emits explicit error/warning messages when a stdin-supplied path is ignored or when the formatter is disabled. Adds e2e test cases and scripts for nested-config stdin scenarios, updates test orchestration scripts, and adjusts repository includes to ensure e2e-tests are considered.

Possibly related PRs

Suggested labels

A-Project

Suggested reviewers

  • ematipico
  • dyc3

Pre-merge checks and finishing touches

✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main fix: resolving the --stdin-file-path flag to work correctly with nested configuration files.
Description check ✅ Passed The description explains the fix (missing working_dir.join()), references the linked issue #8233, outlines the test plan with e2e improvements, and notes the change aligns with existing documentation.
Linked Issues check ✅ Passed The PR successfully addresses the core requirement from #8233: joining the working directory with the stdin path to enable proper nested config discovery, matching documented --stdin-file-path behaviour.
Out of Scope Changes check ✅ Passed All changes are directly related to the fix: stdin path normalisation, error logging for ignored paths, e2e test infrastructure, and workflow updates. No unrelated changes detected.

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

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

7-12: Docs still mention stdin‑specific scan behaviour that no longer exists

get_forced_scan_kind now ignores root_configuration_dir / working_dir and just matches on TraversalMode, but the comment on derive_best_scan_kind still describes stdin‑based rules. It’d be good to update or trim that bullet so future readers don’t go hunting for logic that was intentionally removed.

Also applies to: 24-61

crates/biome_cli/src/execute/std_in.rs (1)

5-41: Centralising stdin handling via Execution + Stdin looks solid

Deriving biome_path/content once from Stdin and then branching on Execution (is_format / is_check / is_lint / traversal_mode) makes the flow much clearer, and the “print content, then warning” pattern is a nice touch for long inputs. One small hygiene improvement you might consider: in the check/lint path we call open_file but, in the early is_ignored/is_protected returns, never call close_file, so adding a matching close_file there would keep the workspace state symmetric with the happy path even though this is a short‑lived CLI run.

        if file_features.is_ignored() {
            console.append(markup! {{content}});
            // Write error last because files may generally be long
            console.error(markup! {
                <Warn>"The content was not fixed because the path `"{biome_path.as_str()}"` is ignored."</Warn>
            });
-           return Ok(());
+           workspace.close_file(CloseFileParams {
+               project_key,
+               path: biome_path.clone(),
+           })?;
+           return Ok(());
        }

        if file_features.is_protected() {
            let protected_diagnostic = WorkspaceError::protected_file(biome_path.to_string());
            …
            console.append(markup! {{content}});
-
-            return Ok(());
+            workspace.close_file(CloseFileParams {
+                project_key,
+                path: biome_path.clone(),
+            })?;
+            return Ok(());
        };

Also applies to: 43-60, 81-113, 138-145, 257-266

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

901-1011: stdin configuration path looks correct; consider setting a workspace dir for root‑only projects

The new run short‑circuit for stdin plus configure_stdin achieves the goal: you load a root config, optionally overlay a nested config discovered via ConfigurationPathHint::StdinFilePath, merge CLI overrides, and then call into std_in::run without doing any directory scanning. That’s a nice separation from the traversal‑based path.

One small behavioural wrinkle: when there is no nested configuration, project_directory remains None, so update_settings is invoked with workspace_directory: None even though configuration.is_root() will typically be true. In WorkspaceServer::update_settings the root branch uses

let directory = workspace_directory.unwrap_or_default();

to find .gitignore / .ignore, so in stdin mode you end up probing an empty path instead of the project root, which also deviates from configure_workspace (where we pass an explicit project directory).

You might want to mirror the workspace case by deriving a directory for the root‑only stdin scenario, e.g.:

@@ fn configure_stdin(...)
-        let configuration = self.merge_configuration(root_config, fs, console)?;
+        let root_configuration_dir = root_config
+            .directory_path
+            .clone()
+            .unwrap_or_else(|| working_dir.clone());
+        let configuration = self.merge_configuration(root_config, fs, console)?;
@@
-        let result = workspace.update_settings(UpdateSettingsParams {
-            project_key: open_project_result.project_key,
-            workspace_directory: project_directory,
-            configuration,
-        })?;
+        let mut workspace_directory = project_directory;
+        if workspace_directory.is_none() && configuration.is_root() {
+            workspace_directory = Some(BiomePath::new(&root_configuration_dir));
+        }
+        let result = workspace.update_settings(UpdateSettingsParams {
+            project_key: open_project_result.project_key,
+            workspace_directory,
+            configuration,
+        })?;

That keeps stdin’s config walk behaviour while giving VCS/ignore handling a sensible base directory.

📜 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 72b81ee and 32e6803.

📒 Files selected for processing (11)
  • crates/biome_cli/src/commands/check.rs (1 hunks)
  • crates/biome_cli/src/commands/format.rs (1 hunks)
  • crates/biome_cli/src/commands/lint.rs (1 hunks)
  • crates/biome_cli/src/commands/mod.rs (5 hunks)
  • crates/biome_cli/src/commands/scan_kind.rs (1 hunks)
  • crates/biome_cli/src/commands/search.rs (1 hunks)
  • crates/biome_cli/src/execute/mod.rs (2 hunks)
  • crates/biome_cli/src/execute/std_in.rs (5 hunks)
  • crates/biome_configuration/src/lib.rs (3 hunks)
  • crates/biome_service/src/configuration.rs (6 hunks)
  • crates/biome_service/src/workspace/server.rs (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
crates/biome_cli/src/execute/std_in.rs (2)
packages/@biomejs/js-api/src/wasm.ts (2)
  • ProjectKey (2-2)
  • BiomePath (1-1)
crates/biome_cli/src/execute/mod.rs (3)
  • from (78-80)
  • from (90-92)
  • from (225-239)
crates/biome_service/src/workspace/server.rs (1)
crates/biome_service/src/configuration.rs (1)
  • load_nested_configuration (166-172)
crates/biome_cli/src/commands/mod.rs (1)
crates/biome_service/src/configuration.rs (2)
  • load_nested_configuration (166-172)
  • load_configuration (157-163)
🔇 Additional comments (12)
crates/biome_cli/src/commands/format.rs (1)

146-151: Marking Console as unused here is fine

Renaming the parameter to _console is a tidy way to keep the trait signature while making it clear there are no side‑effects from the console in this path.

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

132-155: Unused Console parameter is correctly marked

The rename to _console keeps the CommandRunner signature consistent while making it explicit that lint execution no longer depends on Console/STDIN here.

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

60-77: Console decoupling looks good

Using _console while keeping the Workspace dependency for parse_pattern aligns with the new centralised stdin flow and doesn’t change search semantics.

crates/biome_configuration/src/lib.rs (1)

685-707: New StdinFilePath hint and helpers look consistent

StdinFilePath integrates cleanly with Display and to_path_buf, and the or_else helper behaves as expected (only falling back from None), which should make stdin‑driven config resolution straightforward.

Also applies to: 709-759

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

145-166: Check execution no longer depends on Console – all good

The rename to _console clearly signals that stdin/console state is now handled elsewhere while preserving the existing Check traversal behaviour.

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

7-7: Good reuse of load_nested_configuration in project config updates

Switching update_project_config_files to call load_nested_configuration directly keeps the “non‑root config” loading logic in one place and preserves the existing behaviour and diagnostics handling. Import looks correct and matches the new helper.

Also applies to: 2229-2239

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

156-173: Separated loaders for root and nested configs look sound

load_configuration and the new load_nested_configuration cleanly encode the “root vs non‑root” search by passing seek_root = Some(true/false) into read_config, and both still funnel through LoadedConfiguration::try_from_payload, so diagnostics and extends resolution are preserved.


200-251: seek_root: Option<bool> and stdin path handling are reasonable, but worth keeping in mind

Using seek_root: Option<bool> with

is_some_and(|config| seek_root.is_none_or(|seek| seek == config.is_root()))

nicely preserves the old “first config wins” behaviour for None, while letting callers explicitly ask for only root (Some(true)) or only non‑root (Some(false)) configs. The new StdinFilePath branches give stdin a distinct starting point for the config walk while still resolving external extends from the working directory. This all lines up with the new loaders and tests.


638-687: New stdin config test exercises the right edge cases

should_load_config_for_stdin does a good job of proving that load_configuration finds the root config while load_nested_configuration picks up the nearest non‑root override for a stdin path, and the explicit IndentStyle assertions make the difference very clear. Nice, focused coverage.

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

23-24: CLI imports are aligned with the new stdin config flow

Pulling in ConfigurationPathHint and load_nested_configuration here matches how configure_stdin is implemented below and keeps all CLI‑side config wiring local to this module.

Also applies to: 45-47


1248-1253: ConfiguredStdin is a sensible minimal carrier

Bundling just Execution and ProjectKey into ConfiguredStdin keeps the stdin path tidy and mirrors ConfiguredWorkspace without dragging along fields you don’t need in the non‑scanning case.

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

4-4: Exposing std_in to the CLI is consistent with the new flow

Promoting std_in to pub(crate) so commands::mod can call std_in::run directly is exactly what you want now that stdin handling has moved out of TraversalMode. The workspace imports still line up with the JSON reporter code below.

Also applies to: 30-33

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 24, 2025

CodSpeed Performance Report

Merging #8239 will not alter performance

Comparing cormacrelf:fix-stdin-nested-config (f48cd50) with main (abfeb30)1

Summary

✅ 1 untouched
⏩ 154 skipped2

Footnotes

  1. No successful run was found on main (7fedb92) during the generation of this report, so abfeb30 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 154 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.

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

📜 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 32e6803 and 0d95d92.

📒 Files selected for processing (8)
  • .changeset/blue-parts-lie.md (1 hunks)
  • crates/biome_cli/src/commands/check.rs (1 hunks)
  • crates/biome_cli/src/commands/format.rs (1 hunks)
  • crates/biome_cli/src/commands/lint.rs (1 hunks)
  • crates/biome_cli/src/commands/scan_kind.rs (1 hunks)
  • crates/biome_cli/src/commands/search.rs (1 hunks)
  • crates/biome_cli/src/execute/mod.rs (2 hunks)
  • crates/biome_cli/src/execute/std_in.rs (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • crates/biome_cli/src/commands/format.rs
  • crates/biome_cli/src/commands/scan_kind.rs
  • crates/biome_cli/src/commands/search.rs
  • crates/biome_cli/src/commands/check.rs
🧰 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/blue-parts-lie.md
🪛 LanguageTool
.changeset/blue-parts-lie.md

[grammar] ~21-~21: There is an agreement error between ‘read’ and ‘config’. Insert ‘a(n)’ or change the noun to plural.
Context: ...from subdirectory/biome.json. Now, we read config as expected, reading from the nearest n...

(PRP_VB_NN)

⏰ 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). (4)
  • GitHub Check: Check Dependencies
  • GitHub Check: Test Node.js API
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: autofix
🔇 Additional comments (5)
crates/biome_cli/src/commands/lint.rs (1)

132-156: LGTM — stdin decoupling is clean.

The removal of stdin handling from the lint traversal construction aligns with the broader refactoring to centralise stdin processing. The _console prefix correctly indicates the parameter is intentionally unused here.

crates/biome_cli/src/execute/std_in.rs (2)

21-33: Well-structured stdin refactor.

Deriving biome_path and content from the Stdin parameter at the start of run is cleaner than threading them through multiple call sites. The parameter reordering (session, cli_options, mode, stdin, project_key) groups related concerns logically.


54-57: Good UX consideration.

Writing the error message after the content output is sensible — users won't have to scroll up to find the actual file content after reading a brief warning.

crates/biome_cli/src/execute/mod.rs (2)

4-4: Appropriate visibility change.

Making std_in visible as pub(crate) supports the new stdin configuration flow introduced elsewhere in the PR whilst maintaining encapsulation within the crate.


95-181: Clean API simplification.

Removing the stdin field from all TraversalMode variants (Check, Lint, Format, Search) simplifies the execution model and aligns with the goal of decoupling stdin handling from traversal logic. The change is systematic and consistent.

@cormacrelf
Copy link
Contributor Author

Stdin has no relation to traversal mode or scanning

This, basically, changed the semantics of stdin. That's a breaking change.

There have been discussions around it. However we can't take this change lightly because there are users out there that rely on it.

Almost missed your comment through the AI rabbit noise. Can you explain what broke / give an example of a setup that would behave differently now?

I can only think of files.includes as being something that scanning was responsible for. But I can confirm that ignored files are still ignored, because I am running the loaded configuration through a workspace project so as to make the query about file capabilities. I made a new warning message in stdin mode for files that it hasn't touched because of ignores, and it does print.

@cormacrelf
Copy link
Contributor Author

To be clear when I say scanning, I mean building a big list of files that need attention from biome. When in stdin mode, you should not be recursively walking the directory tree building up a huge list of files. That's just a huge waste. Since we can get the ignore behaviour without scanning, I did that.

@cormacrelf cormacrelf force-pushed the fix-stdin-nested-config branch from 0d95d92 to f48cd50 Compare November 24, 2025 08:22
@cormacrelf
Copy link
Contributor Author

Indeed, all of the scanning code I deleted was "if stdin, use NoScanner scanner". I guess it wasn't really doing anything at all, right?

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 (1)
crates/biome_cli/src/commands/mod.rs (1)

946-1011: Double‑check project root semantics in configure_stdin

The overall stdin flow looks good: you load a root config (respecting --config-path), optionally load a nested config from StdinFilePath, validate both, merge, then open a project and update its settings without doing a scan – exactly what the PR set out to do.

Two small things worth sanity‑checking:

  1. workspace_directory when using --config-path
    When custom_config_path is true, project_directory stays None, so workspace.update_settings sees workspace_directory: None. In the non‑stdin path we always pass a concrete project dir (derived from loaded_configuration.directory_path / working_dir). If Workspace internally assumes a non‑None workspace directory for things like relative resolution, you might want to fall back to root_config.directory_path (or working_dir) here.

  2. open_project path for stdin runs
    Here you call open_project with path: BiomePath::new(stdin.as_path()), whereas the normal flow passes a directory (project_dir). If OpenProjectParams::path is conceptually “project root” rather than “arbitrary file”, it could be safer to instead pass the same directory you intend as workspace_directory (e.g. project_directory.unwrap_or_else(|| BiomePath::new(working_dir)) or similar).

Both could be totally fine depending on Workspace’s invariants, but it’s worth confirming we’re not introducing a slightly odd “project keyed by file path” special case for stdin.

📜 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 0d95d92 and f48cd50.

📒 Files selected for processing (9)
  • .changeset/blue-parts-lie.md (1 hunks)
  • crates/biome_cli/src/commands/check.rs (1 hunks)
  • crates/biome_cli/src/commands/format.rs (1 hunks)
  • crates/biome_cli/src/commands/lint.rs (1 hunks)
  • crates/biome_cli/src/commands/mod.rs (5 hunks)
  • crates/biome_cli/src/commands/scan_kind.rs (1 hunks)
  • crates/biome_cli/src/commands/search.rs (1 hunks)
  • crates/biome_cli/src/execute/mod.rs (2 hunks)
  • crates/biome_cli/src/execute/std_in.rs (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • crates/biome_cli/src/commands/scan_kind.rs
  • crates/biome_cli/src/commands/format.rs
  • crates/biome_cli/src/commands/search.rs
  • crates/biome_cli/src/commands/lint.rs
  • crates/biome_cli/src/commands/check.rs
🧰 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/blue-parts-lie.md
🧬 Code graph analysis (2)
crates/biome_cli/src/execute/std_in.rs (2)
crates/biome_cli/src/commands/mod.rs (2)
  • run (901-944)
  • cli_options (636-656)
packages/@biomejs/js-api/src/wasm.ts (1)
  • BiomePath (1-1)
crates/biome_cli/src/commands/mod.rs (1)
crates/biome_service/src/configuration.rs (2)
  • load_nested_configuration (166-172)
  • load_configuration (157-163)
🪛 LanguageTool
.changeset/blue-parts-lie.md

[uncategorized] ~21-~21: A comma may be missing after the conjunctive/linking adverb ‘Thus’.
Context: ...uration from subdirectory/biome.json. Thus the output of stdin mode formatting dif...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)

🔇 Additional comments (4)
.changeset/blue-parts-lie.md (1)

5-24: Changelog entry reads clearly and matches the behaviour change

The description now accurately explains how --stdin-file-path respects nested configs and inherited root config, and the wording looks fine (the earlier “we read config” nit is already fixed). No changes needed here.

crates/biome_cli/src/execute/std_in.rs (1)

21-34: New stdin run wiring looks sound

Deriving BiomePath and content from Stdin up-front and then reusing them across format/check/lint branches keeps stdin handling nicely centralised and avoids any traversal coupling. The new warnings for ignored paths / disabled formatter, with “write error last” ordering, are a good UX touch for long files. I don’t see any functional landmines here.

Also applies to: 52-58, 104-113, 138-144

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

900-927: Stdin early‑return and ConfiguredStdin integration look consistent

Short‑circuiting run when stdin is present, and deferring to configure_stdin + std_in::run, cleanly separates “config walk + single‑file handling” from the normal traversal path. ConfiguredStdin carrying just Execution and ProjectKey keeps the API minimal and avoids leaking stdin details into traversal logic. This all lines up nicely with the intent to decouple stdin from scanning.

Also applies to: 1248-1253

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

4-4: Module visibility and imports match new callers

Exposing std_in as pub(crate) so CommandRunner::run can delegate to it, and importing OpenFileParams alongside PatternId, are both in line with how the rest of the module uses those types. No issues from my side here.

Also applies to: 30-33

@ematipico
Copy link
Member

ematipico commented Nov 24, 2025

When in stdin mode, you should not be recursively walking the directory tree building up a huge list of files. That's just a huge waste. Since we can get the ignore behaviour without scanning, I did that.

I see your point and I agree with it, but unfortunately there's more to it.

When VCS is enabled, we need the scanner to collect nested ignore files too.

Stdin mode is also used inside editors, sometimes as an alternative to LSP formatting, if the editor doesn't support it. Which means, if a user opens a file inside a nested project, they should expect Biome to apply the correct configuration, or ignore the file if it's ignored. So, while the command needs to be fast, it also needs to be reliable and account for the user's configuration.

In this last case, scanning isn't a waste, but a necessity

@cormacrelf
Copy link
Contributor Author

Ah. I don't use the VCS ignore system because it's too slow on a particular monorepo -- i think it's the gitignore file scanner running on a gazillion directories. I will try to either add the scanner back on top of this or find out what went wrong with the original implementation.

@cormacrelf cormacrelf force-pushed the fix-stdin-nested-config branch from f48cd50 to 4834c1b Compare November 24, 2025 23:38
@github-actions github-actions bot added the A-Core Area: core label Nov 24, 2025
@cormacrelf cormacrelf force-pushed the fix-stdin-nested-config branch from 4834c1b to 8e8f2f2 Compare November 24, 2025 23:45
@cormacrelf
Copy link
Contributor Author

@ematipico done. This was a much smaller diff too, just a path normalisation thing. I had to fix the logging that broke in #7531 as well.

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

🧹 Nitpick comments (1)
.changeset/blue-parts-lie.md (1)

1-23: Consider referencing the linked issue.

The changeset describes the fix clearly and uses correct tense throughout, which is great. You might want to add a reference to issue #8233 for traceability, if that's a convention in this project (e.g., "Fixes #8233" at the end).

📜 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 4834c1b and 8e8f2f2.

📒 Files selected for processing (2)
  • .changeset/blue-parts-lie.md (1 hunks)
  • crates/biome_cli/src/execute/mod.rs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/biome_cli/src/execute/mod.rs
🧰 Additional context used
📓 Path-based instructions (1)
**/.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Changeset descriptions should be user-facing, use past tense for actions taken (e.g., 'Added new feature'), and present tense for Biome behavior (e.g., 'Biome now supports...'). Include issue links, rule links, and code examples where applicable.

Files:

  • .changeset/blue-parts-lie.md
🧠 Learnings (2)
📚 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 **/.changeset/*.md : Changeset descriptions should be user-facing, use past tense for actions taken (e.g., 'Added new feature'), and present tense for Biome behavior (e.g., 'Biome now supports...'). Include issue links, rule links, and code examples where applicable.

Applied to files:

  • .changeset/blue-parts-lie.md
📚 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:

  • .changeset/blue-parts-lie.md
🪛 LanguageTool
.changeset/blue-parts-lie.md

[uncategorized] ~21-~21: A comma may be missing after the conjunctive/linking adverb ‘Thus’.
Context: ...uration from subdirectory/biome.json. Thus the output of stdin mode formatting dif...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)

@cormacrelf cormacrelf force-pushed the fix-stdin-nested-config branch 2 times, most recently from d6884d7 to 2d37b3d Compare November 24, 2025 23:51
@cormacrelf cormacrelf force-pushed the fix-stdin-nested-config branch from 2d37b3d to c55e9b3 Compare November 25, 2025 04:26
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Thank you! The bug fix looks solid, however I noticed some changes that aren't covered by the PR that should be reverted or explained in the PR description

@cormacrelf cormacrelf force-pushed the fix-stdin-nested-config branch from c55e9b3 to 5803674 Compare November 26, 2025 00:14
@github-actions github-actions bot removed A-Core Area: core A-Project Area: project labels Nov 26, 2025
@cormacrelf cormacrelf force-pushed the fix-stdin-nested-config branch from 5803674 to af186da Compare November 26, 2025 00:17
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: 2

🧹 Nitpick comments (1)
.changeset/blue-parts-lie.md (1)

24-25: Consider adding comma before 'but' for grammatical correctness.

The sentence connects two independent clauses and would read more naturally with a comma before "but".

Apply this diff:

-In addition, Biome now shows a warning if `--stdin-file-path` is provided but
+In addition, Biome now shows a warning if `--stdin-file-path` is provided, but
 that path is ignored and therefore not formatted or fixed.
📜 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 8e8f2f2 and af186da.

⛔ Files ignored due to path filters (2)
  • crates/biome_cli/tests/snapshots/main_commands_check/check_stdin_ignores_unknown_file_path.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_commands_format/format_stdin_does_not_error_with_ignore_unknown_file_extensions.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (16)
  • .changeset/blue-parts-lie.md (1 hunks)
  • .github/workflows/pull_request.yml (1 hunks)
  • biome.json (1 hunks)
  • crates/biome_cli/src/execute/mod.rs (1 hunks)
  • crates/biome_cli/src/execute/std_in.rs (3 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)
✅ Files skipped from review due to trivial changes (2)
  • e2e-tests/stdin-nested-config/app.js.formatted
  • e2e-tests/stdin-nested-config/subdirectory/typed.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/biome_cli/src/execute/std_in.rs
🧰 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_cli/src/execute/mod.rs
**/.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Changeset descriptions should be user-facing, use past tense for actions taken (e.g., 'Added new feature'), and present tense for Biome behavior (e.g., 'Biome now supports...'). Include issue links, rule links, and code examples where applicable.

Files:

  • .changeset/blue-parts-lie.md
🧠 Learnings (29)
📚 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
  • biome.json
  • .changeset/blue-parts-lie.md
📚 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/subdirectory/biome.jsonc
  • e2e-tests/stdin-nested-config/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/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/subdirectory/biome.jsonc
  • biome.json
📚 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/subdirectory/biome.jsonc
  • biome.json
📚 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
  • .changeset/blue-parts-lie.md
📚 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:

  • e2e-tests/stdin-nested-config/biome.jsonc
  • e2e-tests/stdin-nested-config/subdirectory/biome.jsonc
  • .changeset/blue-parts-lie.md
📚 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/biome.jsonc
  • e2e-tests/stdin-nested-config/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 : 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:

  • e2e-tests/stdin-nested-config/biome.jsonc
  • biome.json
  • crates/biome_cli/src/execute/mod.rs
📚 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:

  • biome.json
  • .github/workflows/pull_request.yml
📚 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:

  • biome.json
  • .github/workflows/pull_request.yml
📚 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 overwhelmingly apply to a specific framework should be named using 'use<Framework>...' or 'no<Framework>...' prefix (e.g., `noVueReservedProps`)

Applied to files:

  • biome.json
📚 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:

  • biome.json
📚 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:

  • biome.json
  • crates/biome_cli/src/execute/mod.rs
  • .github/workflows/pull_request.yml
📚 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 can use 'ignore' property to exclude snippets from automatic validation (use sparingly)

Applied to files:

  • biome.json
📚 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 allow users to ban specific entities should use the 'noRestricted<Concept>' naming convention (e.g., `noRestrictedGlobals`)

Applied to files:

  • biome.json
📚 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 report code that can lead to runtime failures should use the 'noUnsafe<Concept>' naming convention (e.g., `noUnsafeOptionalChaining`)

Applied to files:

  • biome.json
📚 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 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`.

Applied to files:

  • biome.json
📚 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_cli/src/execute/mod.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_cli/src/execute/mod.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_cli/src/execute/mod.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 be implemented with the 'impl Rule for RuleName' trait, including 'run' function that returns signals and optional 'diagnostic' and 'action' functions

Applied to files:

  • crates/biome_cli/src/execute/mod.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_cli/src/execute/mod.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_cli/src/execute/mod.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/client.rs : Use WorkspaceClient implementation for creating connections to the daemon and communicating with WorkspaceServer

Applied to files:

  • crates/biome_cli/src/execute/mod.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 : The first paragraph of rule documentation must be a single line and serves as the brief description for the rule overview page

Applied to files:

  • crates/biome_cli/src/execute/mod.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:

  • crates/biome_cli/src/execute/mod.rs
  • .github/workflows/pull_request.yml
📚 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/stdin-nested-config/test.sh
📚 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/spec_tests.rs : Use the `tests_macros::gen_tests!` macro in `spec_tests.rs` to generate test functions for each specification file matching the pattern `tests/specs/<language>/**/*.<ext>`

Applied to files:

  • .github/workflows/pull_request.yml
📚 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 **/.changeset/*.md : Changeset descriptions should be user-facing, use past tense for actions taken (e.g., 'Added new feature'), and present tense for Biome behavior (e.g., 'Biome now supports...'). Include issue links, rule links, and code examples where applicable.

Applied to files:

  • .changeset/blue-parts-lie.md
🧬 Code graph analysis (2)
e2e-tests/stdin-nested-config/donotformat.ts (1)
e2e-tests/stdin-nested-config/app.js (1)
  • x (1-1)
crates/biome_cli/src/execute/mod.rs (1)
packages/@biomejs/js-api/src/wasm.ts (1)
  • BiomePath (1-1)
🪛 LanguageTool
.changeset/blue-parts-lie.md

[uncategorized] ~24-~24: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...rning if --stdin-file-path is provided but that path is ignored and therefore not ...

(COMMA_COMPOUND_SENTENCE_2)

🪛 Shellcheck (0.11.0)
e2e-tests/test-all.sh

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

(SC2053)

e2e-tests/stdin-nested-config/test.sh

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

(SC2064)

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

36-36: LGTM!

The re-inclusion pattern for e2e-tests is correct and necessary for the new stdin-nested-config test suite to be discovered properly.

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

1-5: LGTM!

The deliberately irregular formatting (excessive spacing and indentation) is correct for this test fixture, which validates the formatter's ability to normalize code via stdin with nested configuration.

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

1-5: LGTM!

The intentionally inconsistent spacing serves as appropriate test data for validating nested configuration handling in stdin mode.

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

1-5: LGTM!

The formatted fixture correctly represents the expected output with proper spacing and indentation (indent width 2, consistent with the subdirectory's nested configuration).

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

1-1: LGTM!

The excessive spacing in this fixture is intentional for testing the scenario where formatting is skipped (ignored path or disabled formatter), validating that the warning message is shown correctly.

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

1-5: LGTM!

The formatted fixture matches the expected output structure and formatting rules defined in the subdirectory's nested configuration.

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

565-573: Based on my research and the code snippet provided, I can now assess the review comment. The web search confirms that unwrap_or_default() on Option<PathBuf> returns an empty PathBuf when the value is None. When an empty path is joined with the stdin path via empty_path.join(stdin_path), the result is just the stdin path itself.

This is problematic because:

  1. The comment explicitly states: "Biome path must starts_with(the project directory)" - indicating the path should include the working directory context
  2. The fallback behavior is inconsistent: When working_directory() returns None, the resulting biome_path becomes just the relative stdin path, violating the documented requirement
  3. Configuration discovery is affected: The comment notes this is needed to "enable nested configuration discovery," which requires knowing the full project path context

The review comment's concern is valid and represents a potential bug. The current code uses unwrap_or_default() as a silent fallback without ensuring the documented invariant ("must starts_with project directory") is maintained. This could lead to incorrect configuration discovery in edge cases where the working directory cannot be determined.


Verify that working_directory() cannot return None in practice, or add error handling for the case where it does. The current unwrap_or_default() silently violates the documented requirement that the biome path must start with the project directory. Either ensure that working_directory() always returns a valid Some value (with defensive checks), or handle the None case explicitly with appropriate error reporting or a configurable fallback strategy.

// Current code (lines 565-573):
let working_dir = session
    .app
    .workspace
    .fs()
    .working_directory()
    .unwrap_or_default();  // Silent fallback to empty path - violates documented invariant
let biome_path = BiomePath::new(working_dir.join(stdin.as_path()));
e2e-tests/stdin-nested-config/subdirectory/biome.jsonc (1)

1-12: Configuration structure looks good for nested config testing.

The nested config correctly sets root: false, establishes include filters, and overrides formatter settings to demonstrate configuration discovery and override behaviour when using --stdin-file-path. The inline comment clarifying path semantics is helpful.

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

1-16: Root configuration appropriately structured for nested config e2e testing.

Setting root: true and including **/biome.jsonc enables discovery of nested configs, whilst vcs.enabled: false keeps the test hermetic. The inclusion of **/*.js but exclusion of *.ts at root level (with nested inclusion in subdirectory) provides a solid test case for configuration override behaviour.

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

1-28: Test structure and approach are sound.

The script effectively tests nested config discovery by formatting files via stdin using --stdin-file-path and comparing output against reference .formatted files. The separate handling of donotformat.ts makes sense if that file should remain unformatted due to nested config rules. The helper function reduces repetition nicely.

Please confirm that all referenced .formatted reference files exist in the test directory and that donotformat.ts is intentionally excluded from formatting per nested configuration.

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

1-26: Improved script robustness with directory handling and selective test execution.

The updated script now properly manages working directory via cd "$(dirname "$0")", enabling safe relative path resolution regardless of where it's invoked. The FILTER mechanism enables selective test execution (useful for debugging specific suites), and pushd/popd is safer than repeated cd. The shift to explicit bash test.sh invocation aligns with updated shebang requirements across test scripts.

This addresses the previous review comment from ematipico requesting coverage of this file's changes in the PR review—changes are now documented and reviewed.

.github/workflows/pull_request.yml (1)

104-104: Workflow step simplification is safe and appropriate.

Delegating environment setup to the improved test-all.sh script (which now handles directory context internally) simplifies the workflow and improves maintainability. The script's proper shebang and cd logic ensure it works correctly regardless of invocation cwd.

Comment on lines +17 to +29
if [[ "$x" != $FILTER ]]; then
echo "Skipping $x"
continue
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Minor: Quote glob pattern to prevent unintended matching (SC2053).

The right-hand side of the != operator should be quoted to prevent glob matching:

-        if [[ "$x" != $FILTER ]]; then
+        if [[ "$x" != "$FILTER" ]]; then
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if [[ "$x" != $FILTER ]]; then
echo "Skipping $x"
continue
fi
if [[ "$x" != "$FILTER" ]]; then
echo "Skipping $x"
continue
fi
🧰 Tools
🪛 Shellcheck (0.11.0)

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

(SC2053)

🤖 Prompt for AI Agents
In e2e-tests/test-all.sh around lines 17 to 20, the conditional compares $x to
$FILTER without quoting the right-hand side, which allows shell globbing
(SC2053); update the comparison to quote the FILTER variable (i.e., use a quoted
right-hand side) so the pattern is compared literally and not treated as a glob,
and keep the existing quoting of $x.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No it should not

…ests

This also runs the tests with bash, not sh. So we can do more advanced shell scripts
in the various test.sh.
@cormacrelf cormacrelf force-pushed the fix-stdin-nested-config branch from af186da to 189b888 Compare November 26, 2025 00:26
This enables us to have explicit root: true without making the root biome project error out.
This fixes nested config discovery/matching with the filepath.
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

♻️ Duplicate comments (1)
e2e-tests/stdin-nested-config/test.sh (1)

4-5: Defer $TEMP expansion in trap and quote it

Using double quotes here expands $TEMP when the trap is set, and drops quoting when it runs. Better to defer expansion and keep the value quoted:

-TEMP=$(mktemp)
-trap "rm -f $TEMP" EXIT
+TEMP=$(mktemp)
+trap 'rm -f "$TEMP"' EXIT

This matches ShellCheck’s SC2064 suggestion and is safer if the path ever contains odd characters.

🧹 Nitpick comments (2)
.changeset/blue-parts-lie.md (1)

5-25: Very minor comma/style nit in final sentence

The wording is clear and the changeset matches the guidelines (past tense for the fix, present for behaviour). If you want to appease grammar pedants, you could add a comma before “but”:

-In addition, Biome now shows a warning if `--stdin-file-path` is provided but
+In addition, Biome now shows a warning if `--stdin-file-path` is provided, but

Purely optional; content is otherwise spot on.

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

12-14: Intentional glob matching in FILTER; shellcheck can be ignored here

The FILTER="*$1*" plus [[ "$x" != $FILTER ]] gives the desired glob/substring match (see the “Glob matcher” comment). Quoting $FILTER would silently change semantics to a literal compare and break filtering, so the current form is correct despite SC2053.

If SC2053 is noisy in CI, consider annotating this with a one-line # shellcheck disable=SC2053 to document the intent.

Also applies to: 24-29

📜 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 af186da and 189b888.

⛔ Files ignored due to path filters (2)
  • crates/biome_cli/tests/snapshots/main_commands_check/check_stdin_ignores_unknown_file_path.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_commands_format/format_stdin_does_not_error_with_ignore_unknown_file_extensions.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (16)
  • .changeset/blue-parts-lie.md (1 hunks)
  • .github/workflows/pull_request.yml (1 hunks)
  • biome.json (1 hunks)
  • crates/biome_cli/src/execute/mod.rs (1 hunks)
  • crates/biome_cli/src/execute/std_in.rs (3 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)
🚧 Files skipped from review as they are similar to previous changes (10)
  • e2e-tests/stdin-nested-config/subdirectory/lib.js.formatted
  • e2e-tests/stdin-nested-config/donotformat.ts
  • e2e-tests/stdin-nested-config/subdirectory/lib.js
  • crates/biome_cli/src/execute/mod.rs
  • e2e-tests/stdin-nested-config/app.js.formatted
  • .github/workflows/pull_request.yml
  • biome.json
  • e2e-tests/stdin-nested-config/biome.jsonc
  • e2e-tests/stdin-nested-config/app.js
  • e2e-tests/stdin-nested-config/subdirectory/typed.ts.formatted
🧰 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_cli/src/execute/std_in.rs
**/.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Changeset descriptions should be user-facing, use past tense for actions taken (e.g., 'Added new feature'), and present tense for Biome behavior (e.g., 'Biome now supports...'). Include issue links, rule links, and code examples where applicable.

Files:

  • .changeset/blue-parts-lie.md
🧠 Learnings (19)
📚 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/test.sh
  • e2e-tests/stdin-nested-config/subdirectory/biome.jsonc
📚 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/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: 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/stdin-nested-config/test.sh
📚 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_cli/src/execute/std_in.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_cli/src/execute/std_in.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 : Use the `dbg_write!` macro to debug formatter output instead of other logging methods

Applied to files:

  • crates/biome_cli/src/execute/std_in.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_cli/src/execute/std_in.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 : Deprecated rules must include a 'deprecated' field in the 'declare_lint_rule!' macro with the reason for deprecation

Applied to files:

  • crates/biome_cli/src/execute/std_in.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_cli/src/execute/std_in.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 can use 'ignore' property to exclude snippets from automatic validation (use sparingly)

Applied to files:

  • crates/biome_cli/src/execute/std_in.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_cli/src/execute/std_in.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 : Do not attempt to 'fix' the code; if a token/node is known to be mandatory but is missing, return `None` instead

Applied to files:

  • crates/biome_cli/src/execute/std_in.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_cli/src/execute/std_in.rs
📚 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:

  • .changeset/blue-parts-lie.md
  • e2e-tests/stdin-nested-config/subdirectory/biome.jsonc
📚 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/blue-parts-lie.md
  • e2e-tests/stdin-nested-config/subdirectory/biome.jsonc
📚 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 **/.changeset/*.md : Changeset descriptions should be user-facing, use past tense for actions taken (e.g., 'Added new feature'), and present tense for Biome behavior (e.g., 'Biome now supports...'). Include issue links, rule links, and code examples where applicable.

Applied to files:

  • .changeset/blue-parts-lie.md
📚 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:

  • .changeset/blue-parts-lie.md
  • 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/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/subdirectory/biome.jsonc
🧬 Code graph analysis (2)
e2e-tests/stdin-nested-config/subdirectory/typed.ts (1)
e2e-tests/stdin-nested-config/subdirectory/lib.js (1)
  • y (1-1)
crates/biome_cli/src/execute/std_in.rs (1)
crates/biome_service/src/workspace.rs (1)
  • markup (1176-1178)
🪛 LanguageTool
.changeset/blue-parts-lie.md

[uncategorized] ~24-~24: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...rning if --stdin-file-path is provided but that path is ignored and therefore not ...

(COMMA_COMPOUND_SENTENCE_2)

🪛 Shellcheck (0.11.0)
e2e-tests/stdin-nested-config/test.sh

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

(SC2064)

e2e-tests/test-all.sh

[warning] 26-26: 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). (11)
  • GitHub Check: Documentation
  • GitHub Check: End-to-end tests
  • GitHub Check: Check Dependencies
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Validate PR title
  • GitHub Check: Test Node.js API
  • GitHub Check: lint
  • GitHub Check: autofix
🔇 Additional comments (4)
crates/biome_cli/src/execute/std_in.rs (1)

52-55: Stdin warnings and ordering look good

Writing the warnings after echoing the content is sensible for long inputs, and the three messages cleanly distinguish “ignored path” vs “formatter disabled” vs “not fixed”. No behavioural red flags from these additions.

Also applies to: 106-109, 138-141

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

1-5: Fixture content looks fine

The odd spacing/indentation is appropriate here as unformatted input to exercise the formatter, and it mirrors the existing JS fixture.

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

1-12: Configuration structure looks sound for nested-config e2e testing.

The overall structure is well-suited for the PR's objectives:

  • root: false enables proper config inheritance from parent configs (essential for testing nested overrides)
  • files.includes: ["*.ts"] with the clarifying comment correctly documents that patterns are relative to this config's location
  • Formatter settings provide distinct values for test verification

Once the extends syntax is verified, this should serve the test scenario well.


3-3: The "extends": "//" syntax is correct and intentional.

The "//" is a documented Biome shortcut that tells Biome to extend the project root configuration. This is the proper pattern for nested folder configs to inherit root settings, making it exactly appropriate for this test scenario.

@cormacrelf cormacrelf force-pushed the fix-stdin-nested-config branch from 189b888 to 290e75a Compare November 26, 2025 00:32
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Overall, it looks good. I left a comment we should resolve, if it's applicable

.fs()
.working_directory()
.unwrap_or_default();
let biome_path = BiomePath::new(working_dir.join(stdin.as_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 operation might not be safe, because stdin.as_path might be an absolute path. We should check it before running the join operation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Almost every path library I can think of, including camino, replaces the original path when you .join(absolute).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well there may be an edge case where the working dir has a symlink in it somewhere and someone passes an absolute path that resolves to the same file ultimately, but does not appear to be inside any project. But I am not sure we care.

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.

📝 With --stdin-file-path + inherited config, biome only respects the root configuration

2 participants