Skip to content

fix(lsp): run a pinned @biomejs/biome in the biome bunx fallback - #134

Merged
amondnet merged 2 commits into
mainfrom
amondnet/133-biome-bunx-fallback
Oct 22, 2026
Merged

amondnet merged 2 commits into
mainfrom
amondnet/133-biome-bunx-fallback

Conversation

@amondnet

@amondnet amondnet commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Biome server's last-resort fallback ran bunx biome lsp-proxy --stdio. That resolves the unscoped npm package biome, an unrelated environment-variable tool (latest 0.3.3) that also ships a biome bin. Real Biome is @biomejs/biome. So on a machine without Biome, this fallback downloaded and ran a third-party package, and the Biome language server never started.

Changes in packages/lsp/src/server/biome.ts:

  • Pinned package: the fallback now runs bunx @biomejs/biome@2.6.2 lsp-proxy --stdio. The version is in BIOME_VERSION, the same way fix(lsp): skip an unrunnable typescript-language-server and fall back to bunx #131 pins typescript-language-server.
  • Current PATH: the biome lookup now passes process.env.PATH to Bun.which, like findRunnableBin does. Without it, Bun searches the PATH it captured at startup, and the tests below can't control which biome is found.

Tests in packages/lsp/test/unit/server.test.ts:

  • The fix(lsp): skip an unrunnable typescript-language-server and fall back to bunx #131 helper is now spawnServerWith(server, …) and is shared by the TypeScript and Biome fallback blocks. The TypeScript tests are unchanged.
  • New BiomeServer fallback block (skipped on Windows, like the TypeScript block), with one test per lookup step:
    • bunx runs @biomejs/biome@2.6.2;
    • a biome on PATH wins over bunx;
    • node_modules/.bin/biome wins over both.
  • Mutation check: I reverted each source change in turn, and the matching test failed (bunx biome … for the first, bunx @biomejs/biome… instead of the PATH binary for the second).

Out of scope: the catch around the bunx spawn still almost never runs. node:child_process reports a missing bunx through the async error event, so the npm install @biomejs/biome hint is never logged. #133 notes this. I left it out to keep this PR to the wrong package.

Related issue

Closes #133

Checklist

  • PR title follows Conventional Commits
  • Tests added or updated, and the suite passes (bun test test/unit/server.test.ts: 85 pass, 0 fail)
  • Lint/format pass (eslint on changed files; tsc --noEmit for packages/lsp)
  • Documentation updated if behavior changed (not needed: no docs mention the bunx fallback)
  • No breaking change, or a BREAKING CHANGE: note is included

Summary by cubic

Fixes the Biome server's bunx fallback so it runs a pinned @biomejs/biome package instead of the unrelated unscoped biome npm package, which previously downloaded a third-party environment-variable tool and never started the language server.

  • The fallback resolves bunx from the current PATH before spawning and runs @biomejs/biome@2.6.2 lsp-proxy --stdio; when bunx is missing it logs the install hint and returns undefined instead of a dead process handle, since spawn reports missing commands asynchronously.
  • biome is looked up with the current PATH rather than the copy Bun captured at startup, so tests can control which binary is found.
  • Extracts a shared spawnServerWith test helper and adds tests for the lookup order: project-local biome wins over PATH, which wins over the pinned bunx fallback, plus the missing-bunx case.

Written for commit 7cbe2e6. Summary will update on new commits.

Turn on auto-fix

bunx biome resolved the unrelated unscoped `biome` npm package, so a
machine without Biome installed ran a third-party env-var tool instead
of the Biome language server. Run @biomejs/biome@2.6.2 instead, and look
up a biome on the current PATH rather than the copy Bun captured at
startup.

Closes #133
@amondnet amondnet added type:bug Something isn't working lsp labels Oct 22, 2026
Comment thread packages/lsp/src/server/biome.ts Fixed
@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.57143% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/lsp/src/server/biome.ts 78.57% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Biome LSP server implementation to use a pinned version (2.6.2) of @biomejs/biome when falling back to bunx, preventing conflicts with the unrelated unscoped biome package. It also ensures that Bun.which reads the current PATH environment variable rather than the startup copy. Additionally, the test suite is refactored to introduce a reusable spawnServerWith helper, and new unit tests are added to verify the fallback behavior of the Biome server. There are no review comments, and we have no feedback to provide.

@amondnet
amondnet marked this pull request as ready for review October 22, 2026 14:50

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

cubic analysis

All reported issues were addressed across 2 files

Linked issue analysis

Linked issue: pleaseai/code-intelligence#133: fix(lsp): biome bunx fallback runs the unrelated biome npm package instead of @biomejs/biome

Status Acceptance criteria Notes
✅ Run the pinned @biomejs/biome package in the bunx fallback BiomeServer now invokes @biomejs/biome@2.6.2 with lsp-proxy --stdio, and a test checks the recorded arguments.
Architecture diagram
sequenceDiagram
    participant Client as LSP Client
    participant Server as Biome Server
    participant FS as File System
    participant BIN as node_modules/.bin
    participant PATH as System PATH
    participant BUNX as bunx Runner
    participant NPM as npm Registry

    Note over Client,NPM: Biome Language Server Startup Flow
    
    Client->>Server: Initialize LSP connection
    
    Server->>FS: Search for biome binary
    alt Project-local biome found
        FS-->>Server: node_modules/.bin/biome
        Server->>BIN: Spawn biome lsp-proxy --stdio
        BIN-->>Server: LSP process
    else No project-local biome
        Server->>PATH: Bun.which('biome', { PATH: process.env.PATH })
        alt Global biome on PATH
            PATH-->>Server: biome binary path
            Server->>PATH: Spawn biome lsp-proxy --stdio
            PATH-->>Server: LSP process
        else No global biome
            Server->>BUNX: Spawn bunx @biomejs/biome@2.6.2 lsp-proxy --stdio
            BUNX->>NPM: Fetch @biomejs/biome@2.6.2 package
            NPM-->>BUNX: Package binaries
            BUNX-->>Server: LSP process
        end
    end
    
    Server-->>Client: LSP communication channel
    
    Note over PATH,BUNX: PATH lookup uses current env<br/>not Bun's captured PATH
Loading

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread packages/lsp/src/server/biome.ts Outdated
@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues were found.

Summary

The PR changes the Biome fallback to use pinned @biomejs/biome@2.6.2 and the current PATH.

  • The Biome fallback starts the pinned language server package.

Reviews (2) · Last reviewed commit: "chore(lsp): apply AI code review suggest..." · Reviewed by Greptile

Check for bunx before the Biome fallback spawns it, and return undefined
with the install hint when it is missing. spawn reports a missing
command only as an async error event, so the old try/catch never logged
the hint and a dead process handle reached the LSP manager.
@sonarqubecloud

Copy link
Copy Markdown

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

Labels

lsp type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(lsp): biome bunx fallback runs the unrelated biome npm package instead of @biomejs/biome

2 participants