Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Two-client formatting corruption

Scaffolded with npx --yes @biomejs/create-biome-reproduction@latest, generator version 0.2.1.

This reproduces formatting corruption with two LSP clients connected to the same daemon and opening the same file.

Run

Requires Linux, Node.js 18 or newer, npm, and a locally built Biome binary. Build the Biome checkout with cargo build --bin biome, then run from this directory:

npm run repro -- /absolute/path/to/biome/target/debug/biome

BIOME_BIN can also select a binary. The explicit command-line argument takes precedence.

The reproduction uses Node.js built-in modules and does not require npm install. The generator's published Biome dependency remains in package.json, but the reproduction command does not use it.

Sequence

  1. Start two LSP clients with an isolated daemon cache directory.
  2. Open src/index.ts in both clients with identical contents at version 1.
  3. Confirm both clients' formatting edits match CLI formatting.
  4. Change A's in-memory buffer to version 2 without changing B or the disk file.
  5. Confirm A's formatting edits still match CLI formatting.
  6. Request formatting from B, apply the returned edits to B's original text, and compare against CLI formatting of that original text.

The fixture is ASCII, so character offsets also equal UTF-16 offsets. Applying edits clamps positions past a line's end to that line's end and positions past the document to its end.

Expected: B's formatting matches CLI formatting of B's buffer and remains valid TypeScript.

Observed with checkout 88854dd63d: the baseline controls and A's control pass, but B's edits corrupt its buffer. Formatting the result fails with parser errors. No network delay or overlapping formatting requests are needed.

Exit status is 0 when B matches the expected output and 1 when it differs. Setup failures also exit nonzero; check the summary and REPRODUCED message to distinguish them.

Evidence

Each run writes artifacts/:

  • result.json: binary path, server version, and control results.
  • a.jsonl and b.jsonl: LSP messages.
  • client-a.ts: A's changed buffer.
  • expected.ts and actual.ts: expected and actual formatting of B.
  • edits.json: formatting edits returned to B.
  • parse-errors.txt: parser diagnostics for B's resulting text.

The runner leaves src/index.ts unchanged. It closes its clients and removes its temporary daemon cache after the run.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages