Skip to content

fix(diagnostics): change FileTooLarge severity to Warning#9962

Closed
Gasg10 wants to merge 16 commits intobiomejs:mainfrom
Gasg10:fix/file-too-large-warning-severity
Closed

fix(diagnostics): change FileTooLarge severity to Warning#9962
Gasg10 wants to merge 16 commits intobiomejs:mainfrom
Gasg10:fix/file-too-large-warning-severity

Conversation

@Gasg10
Copy link
Copy Markdown

@Gasg10 Gasg10 commented Apr 13, 2026

Summary

Fixes #9941

FileTooLarge diagnostic had Severity::Information instead of Severity::Warning, which caused --error-on-warnings to not treat oversized files as warnings and exit with code 0, making it impossible to catch in CI pipelines.

Test Plan

Added a snapshot test file_too_large_error_on_warnings in crates/biome_cli/tests/commands/check.rs that verifies the exit code is non-zero when a file exceeds files.maxSize with --error-on-warnings enabled.

AI Disclosure

I used Claude (claude.ai) to help navigate the codebase and understand the contribution guidelines.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 13, 2026

🦋 Changeset detected

Latest commit: 3591261

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 Apr 13, 2026
@Gasg10 Gasg10 changed the title fix(diagnostics): FileTooLarge severity from Information to Warning fix(diagnostics): change FileTooLarge severity to Warning Apr 13, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 13, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

The FileTooLarge diagnostic severity was changed from Information to Warning. A new CLI test file_too_large_error_on_warnings was added to run biome check --error-on-warnings with one oversized file and one within-limit file and assert the command exits with an error. A changeset for a patch release was added documenting that Biome exits non‑zero when a file exceeds files.maxSize while --error-on-warnings is enabled. No public API signatures were changed.

Suggested reviewers

  • ematipico
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarises the main change: updating FileTooLarge diagnostic severity from Information to Warning.
Description check ✅ Passed The description is directly related to the changeset, explaining the bug fix, its purpose, test approach, and acknowledging the use of Claude.
Linked Issues check ✅ Passed The PR fully addresses issue #9941 by changing FileTooLarge severity to Warning, enabling --error-on-warnings to exit with non-zero code for oversized files.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the FileTooLarge severity issue: diagnostic update, test addition, and changeset documentation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Copy Markdown
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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/biome_service/src/diagnostics.rs`:
- Around line 358-361: Add a regression test that asserts the FileTooLarge
diagnostic now reports Severity::Warning: locate the FileTooLarge type and its
impl Diagnostic::severity and add a unit test that constructs a FileTooLarge
instance and asserts severity() == Severity::Warning (or add a CLI integration
test that triggers FileTooLarge and asserts the output/snapshot shows "warning"
and that --error-on-warnings does not treat it as an error). Ensure the new test
lives alongside other diagnostics tests and includes a clear assertion or
snapshot to prevent future regressions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: feb6ff62-1600-46ab-b2ab-5c8a41870620

📥 Commits

Reviewing files that changed from the base of the PR and between bcd6508 and d202fe3.

📒 Files selected for processing (1)
  • crates/biome_service/src/diagnostics.rs

Comment thread crates/biome_service/src/diagnostics.rs
Copy link
Copy Markdown
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 for contribution. Please read our contribution guidelines. Here's what needs to be address:

  • restore our PR template
  • add a changeset
  • add a test
  • comply to what the PR template requests

Everything is in the contribution guidelines

@github-actions github-actions Bot added the A-CLI Area: CLI label Apr 13, 2026
@Gasg10
Copy link
Copy Markdown
Author

Gasg10 commented Apr 13, 2026

Hi! I've addressed all the points:

  • ✅ Restored the PR template with Summary, Test Plan, and AI Disclosure sections
  • ✅ Added a changeset (shy-bugs-fix.md)
  • ✅ Added a snapshot test (file_too_large_error_on_warnings)
  • ✅ Complied with the PR template

Thank you for the feedback!

Comment on lines +1348 to +1355
let mut console = BufferConsole::default();
fs.insert(Utf8PathBuf::from("biome.json"), CONFIG_FILE_SIZE_LIMIT);
let file_path = Utf8Path::new("check.js");
fs.insert(file_path.into(), "statement1();\nstatement2();");
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["check", "--error-on-warnings", file_path.as_str()].as_slice()),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The test isn't good enough. This tests only one single file, and since this one file exceed the limit, Biome exit because no files were analyzed (check the snapshot).

Test with two files, where only one exceed the limit.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated the test to use two files — large.js (exceeds the limit) and small.js (within the limit). The snapshot now shows Checked 1 file confirming the small file was processed normally.

Comment thread .changeset/shy-bugs-fix.md Outdated
---
"@biomejs/biome": patch
---
Fix FileTooLarge diagnostic severity from Information to Warning, so that --error-on-warnings correctly exits with a non-zero code when a file exceeds files.maxSize.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated the changeset description to follow the guidelines.

Comment thread .changeset/shy-bugs-fix.md Outdated
Comment thread .changeset/shy-bugs-fix.md Outdated
@ematipico
Copy link
Copy Markdown
Member

ematipico commented Apr 13, 2026

@Gasg10 please update the snapshots. Please don't entirely rely on those agents, I don't want to review the fix 10 times 😅 run the commands locally. Format the code, lint it, test it ...

@Gasg10
Copy link
Copy Markdown
Author

Gasg10 commented Apr 13, 2026

Ran all commands locally — cargo fmt, cargo clippy, and cargo test -p biome_cli file_too_large_error_on_warnings. All passed with no issues. Also fixed the missing newline at end of changeset file.

@ematipico
Copy link
Copy Markdown
Member

ematipico commented Apr 13, 2026

Ran all commands locally — cargo fmt, cargo clippy, and cargo test -p biome_cli file_too_large_error_on_warnings. All passed with no issues. Also fixed the missing newline at end of changeset file.

And yet CI still failing, and no snapshots committed. You must run all tests, not only the one you added

@ematipico ematipico closed this Apr 13, 2026
@ematipico ematipico reopened this Apr 13, 2026
@Gasg10
Copy link
Copy Markdown
Author

Gasg10 commented Apr 13, 2026

Updated all snapshots by running the full test suite (cargo test -p biome_cli). 21 snapshots were outdated because they still showed i (information) instead of ! (warning). All 819 tests now pass.

Copy link
Copy Markdown
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.

Not sure how's the setup on your machine, but the snapshots are incorrect. If you can't fix it, we can't merge the PR

Comment thread .changeset/shy-bugs-fix.md Outdated
Comment on lines +4 to +7
Fixed [#9941](https://github.com/biomejs/biome/issues/9941): Biome now emits a `warning` diagnostic when a file exceed the `files.maxSize` limit.



Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Fixed [#9941](https://github.com/biomejs/biome/issues/9941): Biome now emits a `warning` diagnostic when a file exceed the `files.maxSize` limit.
Fixed [#9941](https://github.com/biomejs/biome/issues/9941): Biome now emits a `warning` diagnostic when a file exceed the `files.maxSize` limit.

@Gasg10
Copy link
Copy Markdown
Author

Gasg10 commented Apr 14, 2026

Fixed the snapshots — the help snapshots contained my Windows user path (C:/Users/Gonçalo Gonçalves/...) instead of the platform-independent <BIOME_DIR>/biome-logs. Updated all 8 affected snapshots. Also removed the temporary .snap.new files that were accidentally committed.

@ematipico ematipico added the M-Likely Agent Meta: this was likely an automated PR without a human in the loop label Apr 14, 2026
@ematipico ematipico closed this Apr 14, 2026
@Gasg10
Copy link
Copy Markdown
Author

Gasg10 commented Apr 14, 2026

Hi @ematipico, I understand why you closed the PR. I used Claude to help me improve my responses and commit messages, as I'm a Portuguese student and I'm still working on my English. I do understand the fix though — FileTooLarge had Severity::Information instead of Severity::Warning, which caused --error-on-warnings to not work correctly. I ran all tests locally and they passed. Can you reopen it?

@ematipico
Copy link
Copy Markdown
Member

ematipico commented Apr 14, 2026

Hi @ematipico, I understand why you closed the PR. I used Claude to help me improve my responses and commit messages, as I'm a Portuguese student and I'm still working on my English. I do understand the fix though — FileTooLarge had Severity::Information instead of Severity::Warning, which caused --error-on-warnings to not work correctly. I ran all tests locally and they passed. Can you reopen it?

I see two main problems:

  • You didn't disclose any of this information, and while I understand you want to use AI for translation, it's not translating using your native language tone, it completely mangles the message, making robotic. There are tools for that.
  • This is a very easy fix that doesn't require any AI intervention. It was a replacement of a variant, and just run the necessary commands that we recommend in the contribution guide. But it took you 16 commits to get this right, which means you're blindly using an agent, assuming that everything it does is correct.
  • If something wasn't clear, you could have asked us. Any question, we answer. However you kept using a tool.

We welcome people that want to contribute and learn, but we don't welcome people that want to use Biome as a AI playground and learning platform. If language is a barrier, just use portuguese. I speak portuguese too, and we have translations platform all over the internet.

@Gasg10
Copy link
Copy Markdown
Author

Gasg10 commented Apr 14, 2026

I understand your point, but I wanted to clarify that I'm not using AI blindly. This is my first contribution to an open source project and I'm still learning the workflow — especially when it comes to validating tests and making sure they pass correctly. The many commits happened precisely because of trial and error while trying to understand the process and fix the issues. Regarding AI, I only used it as occasional support (for example, to clarify doubts), but I'm not just accepting everything without reviewing or understanding it. Anyway, I appreciate the feedback — I'll pay more attention to the process and try to consolidate changes better before committing. I put some time into fixing everything, so I wanted to ask if, by reopening the PR, and if everything is correct, it could already be approved.

@Gasg10
Copy link
Copy Markdown
Author

Gasg10 commented Apr 14, 2026

I see you took my fix and submitted it yourself in #9980. Since I did all the technical work — found the bug, implemented the fix, wrote the test, updated the snapshots — would you consider giving me credit, or would you be open to me opening a new clean single-commit PR with the same fix so I can get it properly approved? The work was mine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Project Area: project M-Likely Agent Meta: this was likely an automated PR without a human in the loop

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 biome returns 0 when file exceeds maxSize even if --error-on-warnings is enabled

3 participants