Skip to content

fix: yaml linting panic fixes#10287

Open
jjroush wants to merge 4 commits into
biomejs:mainfrom
jjroush:yaml-linting-panic-fixes
Open

fix: yaml linting panic fixes#10287
jjroush wants to merge 4 commits into
biomejs:mainfrom
jjroush:yaml-linting-panic-fixes

Conversation

@jjroush
Copy link
Copy Markdown

@jjroush jjroush commented May 7, 2026

Summary

This PR addresses lexar panics surfaced from #8330 as well as adding indentation diagnostics which were coupled with the panic test scenerios.

AI Disclosure: I paired on this ticket with Claude Code; this is a human cutting the PR.

Umbrella Linting Issue #2365

Test Plan

  • Running these commits in reference to test(formatter/yaml): populate Prettier tests for YAML #8330; this PR resolves two panics that are seen from the yaml lexer.
    REPORT_PRETTIER=1 cargo test -p biome_yaml_formatter --test prettier_tests
  • As a sanity check ran prettier and this biome change against examples in the aforementioned PR giving us the current state:
# Input Prettier (3.8.1) Biome (this PR) Aligned?
1 YAML 1.2.2 §7.4 — double-quoted implicit keys in flow sequence parses, formats to "implicit block key": ["implicit flow key": value] parses cleanly, no diagnostics
2 YAML 1.2.2 §7.8 — single-quoted implicit keys in flow sequence parses, formats to "implicit block key": ["implicit flow key": value] parses cleanly, no diagnostics
3 Insufficient indentation in flow collection parse error: Insufficient indentation in flow collection parse error: Insufficient indentation in flow collection (matching wording)
4 Multi-line plain scalar inside flow sequence parses, formats to xyz: [a bc] parse error: expected ',' but instead found 'bc' ⚠️ pre-existing gap, see below

Cases 1 and 2 are the original panics this PR fixes. Case 3 is the new diagnostic this PR adds. Case 4 is documented as a known limitation tracked for follow-up — the lexer doesn't yet support multi-line plain scalars in flow context (crates/biome_yaml_parser/src/lexer/mod.rs:397 has the existing TODO).

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 7, 2026

⚠️ No Changeset found

Latest commit: b087022

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added A-Parser Area: parser L-Yaml Language: Yaml labels May 7, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Walkthrough

The YAML lexer's flow collection handling now manages indentation breaches more gracefully. When flow collection content exits the parent block scope at nested depth, the lexer emits the "Insufficient indentation in flow collection" diagnostic exactly once, restores the cursor position, and continues processing trivia. Only when at root depth does it break from the loop. Test expectations were updated to reflect the new tokenisation behaviour in nested flow collections.

Suggested labels

A-Parser, L-Yaml

Suggested reviewers

  • dyc3
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly relates to the changeset, documenting panic fixes, diagnostic additions, test results, and known limitations.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title 'fix: yaml linting panic fixes' accurately reflects the main objectives of addressing YAML lexer panics reported in #8330 and related linting issues.

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

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

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@jjroush jjroush mentioned this pull request May 7, 2026
6 tasks
@jjroush jjroush changed the title yaml linting panic fixes fix: yaml linting panic fixes May 7, 2026
@siketyan siketyan requested a review from l0ngvh May 7, 2026 03:13
@ematipico
Copy link
Copy Markdown
Member

It would be great if we added a new file that covers the offending code that causes the panic. At the moment it's only a bunch of changes to existing files

Copy link
Copy Markdown

@Eveeifyeve Eveeifyeve left a comment

Choose a reason for hiding this comment

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

Even tho I am an outside OSS contributor, I see no issues with this apart from the stuff already mentioned.

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

Labels

A-Parser Area: parser L-Yaml Language: Yaml

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants