Skip to content

perf: only query settings once#7593

Merged
arendjr merged 2 commits intobiomejs:nextfrom
arendjr:only-query-settings-once
Sep 25, 2025
Merged

perf: only query settings once#7593
arendjr merged 2 commits intobiomejs:nextfrom
arendjr:only-query-settings-once

Conversation

@arendjr
Copy link
Contributor

@arendjr arendjr commented Sep 25, 2025

Summary

Tiny optimisation to only query settings once when opening/indexing files. Previously, settings were queried in the parse() method, and separately for determining the max file size. For HTML files there was even a third query to pass settings to the embedded parsers, and similarly plain JavaScript files also had a third query to determine the jsx_everywhere setting. Now there's always only a single settings query.

This even fixes a tiny issue with max file size setting, which was previously always looked up in the root settings.

Test Plan

Everything should stay green.

Docs

N/A

@changeset-bot
Copy link

changeset-bot bot commented Sep 25, 2025

🦋 Changeset detected

Latest commit: c6c6f0a

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 the A-Project Area: project label Sep 25, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 25, 2025

Walkthrough

Moves file-size resolution into Settings (method added) and removes Projects' get_max_file_size, making files.max_size resolve from the nearest biome.json (monorepo-aware). The workspace server now retrieves Settings early in open_file_internal and threads them through parsing and embedded-language handling; many internal signatures replaced project_key with a Settings reference. File-size checks now call settings.get_max_file_size(path). Adds a changeset for a @biomejs/biome patch release.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly identifies the core change as a performance optimisation by querying settings only once, concisely summarising the main purpose of the pull request without extraneous detail.
Description Check ✅ Passed The description directly relates to the changeset by explaining the optimisation to consolidate settings lookups, noting the fixed max file size issue, and providing a clear test plan, so it is on-topic and informative.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 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 bbaaaa6 and c6c6f0a.

📒 Files selected for processing (1)
  • crates/biome_service/src/settings.rs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/biome_service/src/settings.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Documentation
  • GitHub Check: End-to-end tests
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Check Dependencies
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: autofix

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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

🧹 Nitpick comments (1)
.changeset/max-managers-mandate.md (1)

5-5: Add an issue reference at the start of the changeset.

Per repo guidelines, bug‑fix changesets should start with a link to the issue. If there’s no issue, reference the PR for traceability.

Apply this diff and replace if applicable:

-Fixed an issue with the `files.maxSize` setting. Previously the setting would always be looked up in the root settings, even in monorepos where a closer `biome.json` is available. It now correctly uses the nearest configuration.
+Fixed #<issue-number>: Fixed an issue with the `files.maxSize` setting. Previously, the setting was always looked up in the root settings, even in monorepos where a closer `biome.json` is available. It now correctly uses the nearest configuration.
📜 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 f890861 and bbaaaa6.

📒 Files selected for processing (4)
  • .changeset/max-managers-mandate.md (1 hunks)
  • crates/biome_service/src/projects.rs (0 hunks)
  • crates/biome_service/src/settings.rs (1 hunks)
  • crates/biome_service/src/workspace/server.rs (12 hunks)
💤 Files with no reviewable changes (1)
  • crates/biome_service/src/projects.rs
🧰 Additional context used
📓 Path-based instructions (4)
.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

.changeset/*.md: In changeset files, only use #### or ##### headers; avoid other header levels
Changeset descriptions should use past tense for what you did (e.g., "Added...")
Describe current Biome behavior in present tense within changesets (e.g., "Biome now supports...")
For bug fixes in changesets, start with a link to the issue (e.g., "Fixed #1234: ...")
When referencing rules or assists in changesets, include links to their documentation pages
Include a minimal code block in the changeset when applicable to demonstrate the change
End every sentence in the changeset description with a period

Files:

  • .changeset/max-managers-mandate.md
crates/biome_service/src/workspace/server.rs

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

Use WorkspaceServer (src/workspace/server.rs) to maintain workspace state in daemon and CLI daemonless modes

Files:

  • crates/biome_service/src/workspace/server.rs
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_service/src/workspace/server.rs
  • crates/biome_service/src/settings.rs
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Format all Rust source files before committing (just f)

Files:

  • crates/biome_service/src/workspace/server.rs
  • crates/biome_service/src/settings.rs
🧠 Learnings (2)
📚 Learning: 2025-09-07T17:35:00.517Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-09-07T17:35:00.517Z
Learning: Applies to .changeset/*.md : Describe current Biome behavior in present tense within changesets (e.g., "Biome now supports...")

Applied to files:

  • .changeset/max-managers-mandate.md
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
PR: biomejs/biome#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/max-managers-mandate.md
🧬 Code graph analysis (2)
crates/biome_service/src/workspace/server.rs (3)
crates/biome_service/src/file_handlers/css.rs (7)
  • settings (382-382)
  • settings (386-386)
  • settings (390-390)
  • settings (455-455)
  • settings (477-477)
  • settings (495-495)
  • parse (397-438)
crates/biome_service/src/file_handlers/javascript.rs (10)
  • settings (508-508)
  • settings (512-512)
  • settings (516-516)
  • settings (530-530)
  • settings (599-599)
  • settings (782-782)
  • settings (989-989)
  • settings (1010-1010)
  • settings (1025-1025)
  • parse (523-538)
crates/biome_service/src/file_handlers/html.rs (4)
  • parse (284-298)
  • parse_embedded_js_script (300-343)
  • parse_embedded_json (345-378)
  • parse_embedded_style (380-413)
crates/biome_service/src/settings.rs (1)
crates/biome_lsp/src/session.rs (1)
  • file_path (362-374)
⏰ 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). (5)
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: autofix
🔇 Additional comments (10)
crates/biome_service/src/workspace/server.rs (10)

21-21: LGTM: import for MaxSize default fallback is correct.


296-300: Nice: resolve settings once and thread them through.

This removes duplicate lookups and respects nested biome.json in monorepos.


338-339: Correct source of truth for file-size limit.

Using settings.get_max_file_size(&path) fixes the “always root” bug.


346-352: Parse now parameterised by Settings.

API alignment with file handlers looks good.


368-377: Good: reuse the same Settings for embedded language parsing.

Avoids a second settings fetch and keeps options consistent.


503-561: HTML-guard and settings-driven embed options look solid.

Early exit when not HTML and deriving JS/JSON/CSS options via settings.parse_options are on point.


574-600: API alignment: parse accepts &Settings and forwards correctly.


1256-1261: Sensible fallback for file-size checks.

Using MaxSize::default().into() when settings aren’t available avoids surprises, but please confirm the default matches the intended global limit (e.g., 0, 1MB, etc.).


1289-1293: Consistent: fetch settings once in change_file.


1310-1317: Good: embedded parsing uses the same settings and source indexing.

@arendjr arendjr merged commit e51dd55 into biomejs:next Sep 25, 2025
12 checks passed
@github-actions github-actions bot mentioned this pull request Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Project Area: project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant