Skip to content

fix(cli): avoid deleting installed binary when rerunning setup --install - #2755

Merged
BYK merged 1 commit into
getsentry:mainfrom
Pybsama:fix/cli-setup-preserve-installed-binary-on-reinstall
Dec 2, 2026
Merged

BYK merged 1 commit into
getsentry:mainfrom
Pybsama:fix/cli-setup-preserve-installed-binary-on-reinstall

Conversation

@Pybsama

@Pybsama Pybsama commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes a destructive cleanup edge case in packages/cli/src/commands/cli/setup.ts (handleInstall):

  • Preserve the installed binary when execPath already resolves to the install target: Previously, after installBinary(execPath, installDir) returned binaryPath, handleInstall unconditionally called unlinkSync(execPath) on POSIX platforms. If a user re-ran sentry cli setup --install from an already-installed binary (directly or via a symlinked directory), handleInstall deleted the installed binary immediately after reporting it installed.
  • Drain grandfathered #1531 silent catch: Replaced the silent catch around temporary binary cleanup with await unlink(execPath) and logger.withTag("cli.setup").debug(...) on non-ENOENT errors, matching migrateLegacyBinary().

Testing

  • Added 2 regression tests in packages/cli/test/commands/cli/setup.test.ts covering direct and symlinked re-runs of sentry cli setup --install.
  • Verified locally:
    • pnpm --filter sentry run lint (oxlint + oxfmt --check) — passed
    • pnpm --filter sentry run typecheck — passed
    • TZ=UTC ./node_modules/.bin/vitest run test/commands/cli/setup.test.ts — 1 file, 85/85 passed
    • pnpm --filter @sentry/mcp-server run bundle (3810.8 KB) & test:bundle — 26/26 passed

Co-Authored-By: Antigravity <noreply@google.com>
@vercel

vercel Bot commented Dec 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Dec 2, 2026 5:43am UTC

Request Review

@vercel
vercel Bot temporarily deployed to Preview – sentry-local December 2, 2026 05:43 Inactive
@vercel

vercel Bot commented Dec 2, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Sentry Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Dec 2, 2026
@BYK
BYK enabled auto-merge December 2, 2026 11:27
@BYK
BYK added this pull request to the merge queue Dec 2, 2026
Merged via the queue into getsentry:main with commit b799941 Dec 2, 2026
27 of 28 checks passed

This branch was previously deployed

1 inactive deployment
Preview – sentry-local — c4736b0a Deployed Dec 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants