Skip to content

completions: fix 4 correctness bugs in zsh/bash/fish scripts - #36515

Closed
robobun wants to merge 7 commits into
mainfrom
farm/eaec46cf/shell-completion-correctness
Closed

completions: fix 4 correctness bugs in zsh/bash/fish scripts#36515
robobun wants to merge 7 commits into
mainfrom
farm/eaec46cf/shell-completion-correctness

[autofix.ci] apply automated fixes

eb60d65
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 31, 2026 in 19m 49s

Code review found 1 important issue

Found 1 candidates, confirmed 3. See review comments for details.

Details

Severity Count
🔴 Important 1
🟡 Nit 2
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important test/cli/shell-completion-scripts.test.ts:8-13 Test is not hermetic: bun completions writes bunx-debug symlinks into real $HOME / $BUN_INSTALL

Annotations

Check failure on line 13 in test/cli/shell-completion-scripts.test.ts

See this annotation in the file changed.

@claude claude / Claude Code Review

Test is not hermetic: bun completions writes bunx-debug symlinks into real $HOME / $BUN_INSTALL

`emitCompletions` inherits the real `$HOME`/`$BUN_INSTALL` (via `bunEnv`'s `...process.env`), and `bun completions` runs `install_bunx_symlink` **before** the non-TTY write-and-exit branch — so each of the 5 spawns tries to create `bunx-debug` symlinks in `<exe_dir>`, then on `EEXIST` falls through to `$BUN_INSTALL/bin`, `$HOME/.bun/bin`, and `$HOME/.local/bin`, leaving symlinks in the developer's/CI runner's real home with no cleanup. Add `HOME: undefined, BUN_INSTALL: undefined` (or point them