fix(diagnostics): change FileTooLarge severity to Warning#9962
fix(diagnostics): change FileTooLarge severity to Warning#9962Gasg10 wants to merge 16 commits intobiomejs:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 3591261 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
crates/biome_service/src/diagnostics.rs
ematipico
left a comment
There was a problem hiding this comment.
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
|
Hi! I've addressed all the points:
Thank you for the feedback! |
| 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()), |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| --- | ||
| "@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. |
There was a problem hiding this comment.
There was a problem hiding this comment.
Updated the changeset description to follow the guidelines.
|
@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 ... |
|
Ran all commands locally — |
And yet CI still failing, and no snapshots committed. You must run all tests, not only the one you added |
|
Updated all snapshots by running the full test suite ( |
ematipico
left a comment
There was a problem hiding this comment.
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
| Fixed [#9941](https://github.com/biomejs/biome/issues/9941): Biome now emits a `warning` diagnostic when a file exceed the `files.maxSize` limit. | ||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
| 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. | |
|
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. |
|
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:
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. |
|
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. |
|
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. |
Summary
Fixes #9941
FileTooLargediagnostic hadSeverity::Informationinstead ofSeverity::Warning, which caused--error-on-warningsto 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_warningsincrates/biome_cli/tests/commands/check.rsthat verifies the exit code is non-zero when a file exceedsfiles.maxSizewith--error-on-warningsenabled.AI Disclosure
I used Claude (claude.ai) to help navigate the codebase and understand the contribution guidelines.