Skip to content

fix(useConsistentTestIt): fix panic when applying code fix#9942

Merged
dyc3 merged 1 commit intomainfrom
dyc3/issue-9918
Apr 12, 2026
Merged

fix(useConsistentTestIt): fix panic when applying code fix#9942
dyc3 merged 1 commit intomainfrom
dyc3/issue-9918

Conversation

@dyc3
Copy link
Copy Markdown
Contributor

@dyc3 dyc3 commented Apr 12, 2026

Summary

The rule was using the wrong method to replace the token, which caused the panic.

fixes #9918

Test Plan

added debug assertions to the batch mutation API, so snapshot tests will be able to detect it now
tested manually on the repro

Docs

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 12, 2026

🦋 Changeset detected

Latest commit: df3aaba

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-Core Area: core A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Apr 12, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 12, 2026

Merging this PR will not alter performance

✅ 58 untouched benchmarks
⏩ 196 skipped benchmarks1


Comparing dyc3/issue-9918 (df3aaba) with main (80c5c00)

Open in CodSpeed

Footnotes

  1. 196 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.

@github-actions
Copy link
Copy Markdown
Contributor

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 53178 53178 0
Passed 51958 51958 0
Failed 1178 1178 0
Panics 42 42 0
Coverage 97.71% 97.71% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 38 38 0
Passed 37 37 0
Failed 1 1 0
Panics 0 0 0
Coverage 97.37% 97.37% 0.00%

markdown/commonmark

Test result main count This PR count Difference
Total 652 652 0
Passed 652 652 0
Failed 0 0 0
Panics 0 0 0
Coverage 100.00% 100.00% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 5467 5467 0
Passed 1915 1915 0
Failed 3552 3552 0
Panics 0 0 0
Coverage 35.03% 35.03% 0.00%

ts/babel

Test result main count This PR count Difference
Total 640 640 0
Passed 569 569 0
Failed 71 71 0
Panics 0 0 0
Coverage 88.91% 88.91% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 18876 18876 0
Passed 13014 13014 0
Failed 5861 5861 0
Panics 1 1 0
Coverage 68.94% 68.94% 0.00%

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d8c5b0bf-59ed-44e4-8a2e-dbb972c469be

📥 Commits

Reviewing files that changed from the base of the PR and between a6e6994 and df3aaba.

⛔ Files ignored due to path filters (1)
  • crates/biome_js_analyze/tests/specs/nursery/useConsistentTestIt/invalid.js.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (9)
  • .changeset/fair-otters-count.md
  • .changeset/sad-buttons-kneel.md
  • .changeset/tidy-bags-draw.md
  • .claude/skills/changeset/SKILL.md
  • crates/biome_js_analyze/src/lint/nursery/use_consistent_test_it.rs
  • crates/biome_js_analyze/src/lint/suspicious/no_focused_tests.rs
  • crates/biome_js_analyze/src/lint/suspicious/no_skipped_tests.rs
  • crates/biome_js_analyze/tests/specs/nursery/useConsistentTestIt/invalid.js
  • crates/biome_rowan/src/ast/batch.rs
✅ Files skipped from review due to trivial changes (6)
  • .claude/skills/changeset/SKILL.md
  • .changeset/fair-otters-count.md
  • .changeset/sad-buttons-kneel.md
  • .changeset/tidy-bags-draw.md
  • crates/biome_js_analyze/src/lint/nursery/use_consistent_test_it.rs
  • crates/biome_js_analyze/tests/specs/nursery/useConsistentTestIt/invalid.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/biome_rowan/src/ast/batch.rs

Walkthrough

Adds patch changeset entries and multiple linter fix-path modifications that switch from element-level replacement to token-level replacement for several rules (useConsistentTestIt, noFocusedTests, noSkippedTests). Adds a test case for chained test.for([...])(...)(...) call expressions. Introduces a debug-only assertion to BatchMutation to validate slot/element compatibility. Small refactors in AST mutation code (replacing tokens directly) with no public API changes.

Suggested labels

A-Project

Suggested reviewers

  • ematipico
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main fix: resolving a panic in the useConsistentTestIt rule when applying code fixes.
Description check ✅ Passed The description clearly explains the root cause (wrong token replacement method), references the issue fixed (#9918), and documents the testing approach.
Linked Issues check ✅ Passed The PR directly addresses issue #9918 by fixing the token-replacement panic through corrected mutation logic and debug assertions to prevent similar issues.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the panic: rule fixes (useConsistentTestIt, noFocusedTests, noSkippedTests), batch mutation validation, test case 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
  • Commit unit tests in branch dyc3/issue-9918

Comment @coderabbitai help to get the list of available commands and usage tips.

@dyc3 dyc3 force-pushed the dyc3/issue-9918 branch from a6e6994 to df3aaba Compare April 12, 2026 15:43
@dyc3 dyc3 enabled auto-merge (squash) April 12, 2026 16:00
@dyc3 dyc3 merged commit 9956f1d into main Apr 12, 2026
37 checks passed
@dyc3 dyc3 deleted the dyc3/issue-9918 branch April 12, 2026 16:14
@github-actions github-actions Bot mentioned this pull request Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Core Area: core A-Linter Area: linter L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Internal error/panic in 2.4.11

2 participants