Skip to content
This repository was archived by the owner on Oct 23, 2026. It is now read-only.

fix(upgrade): remove v prefix from release URLs and work around Bun.write streaming bug - #243

Merged
BYK merged 1 commit into
mainfrom
fix/v-prefix-upgrade
Feb 14, 2026
Merged

BYK merged 1 commit into
mainfrom
fix/v-prefix-upgrade

Conversation

@BYK

@BYK BYK commented Feb 14, 2026

Copy link
Copy Markdown
Member

Summary

Fixes two bugs that prevent sentry cli upgrade from working for curl-installed users (CLI-5F):

  1. v prefix on release URLs — getBinaryDownloadUrl() and versionExists() constructed GitHub release URLs with a v prefix (e.g., /download/v0.10.1/...), but this repo's tags are un-prefixed (0.10.1), causing HTTP 404 errors.

  2. Bun.write(path, Response) event-loop bug — Even with correct URLs, Bun.write(tempPath, response) with a large streaming HTTP response body doesn't properly keep the Bun event loop alive. The process exits mid-download with code 0 and no error output. The workaround is to materialise the body first via await response.arrayBuffer(), then write the buffer.

Changes

src/lib/binary.ts

  • Remove v prefix from download URL template in getBinaryDownloadUrl()

src/lib/upgrade.ts

  • Remove v prefix from version-exists tag check URL in versionExists()
  • Replace Bun.write(tempPath, response) with response.arrayBuffer() + Bun.write(tempPath, body) to work around the Bun streaming bug

Tests — Updated URL assertions and mocks across 3 test files to match the un-prefixed tag format.

How the Bun bug was diagnosed

strace showed the process actively receiving data from GitHub's CDN, then calling exit_group(0) mid-download. Adding debug logging confirmed Bun.write(path, Response) starts but its await never resolves — the event loop drains and the process exits cleanly. A standalone repro (await Bun.write(path, await fetch(url))) hangs indefinitely, but within the CLI's async call stack, the process exits. Materialising the body first with arrayBuffer() fixes both cases.

…rite streaming bug

Download URLs used a `v` prefix (e.g. `/download/v0.10.1/...`) but this
repo's GitHub tags are un-prefixed. Additionally, `Bun.write(path, Response)`
with a large streaming body silently exits the process before the download
completes (Bun event-loop bug). Materialise the body via `arrayBuffer()`
first so the await keeps the process alive.

Fixes CLI-5F
@github-actions

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Bug Fixes 🐛

  • (upgrade) Remove v prefix from release URLs and work around Bun.write streaming bug by BYK in #243

Internal Changes 🔧

  • Use @sentry/api client for requests by MathurAditya724 in #226

🤖 This preview updates automatically when you update the PR.

@github-actions

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 4126 uncovered lines.
✅ Project coverage is 68.13%. Comparing base (base) to head (head).

Files with missing lines (71)
File Patch % Lines
human.ts 58.29% ⚠️ 395 Missing
resolve-target.ts 20.26% ⚠️ 366 Missing
list.ts 14.39% ⚠️ 345 Missing
api-client.ts 59.38% ⚠️ 262 Missing
list.ts 23.47% ⚠️ 212 Missing
oauth.ts 30.68% ⚠️ 183 Missing
list.ts 21.96% ⚠️ 167 Missing
plan.ts 19.37% ⚠️ 154 Missing
resolver.ts 3.23% ⚠️ 120 Missing
help.ts 19.85% ⚠️ 109 Missing
upgrade.ts 57.87% ⚠️ 107 Missing
view.ts 36.48% ⚠️ 101 Missing
interactive-login.ts 9.17% ⚠️ 99 Missing
errors.ts 5.94% ⚠️ 95 Missing
view.ts 25.81% ⚠️ 92 Missing
view.ts 39.44% ⚠️ 86 Missing
clipboard.ts 4.49% ⚠️ 85 Missing
status.ts 24.07% ⚠️ 82 Missing
migration.ts 47.44% ⚠️ 82 Missing
list.ts 27.18% ⚠️ 75 Missing
browser.ts 4.11% ⚠️ 70 Missing
login.ts 33.33% ⚠️ 64 Missing
span-tree.ts 5.00% ⚠️ 57 Missing
explain.ts 33.33% ⚠️ 56 Missing
api.ts 89.80% ⚠️ 47 Missing
upgrade.ts 66.91% ⚠️ 46 Missing
telemetry.ts 84.72% ⚠️ 46 Missing
seer.ts 75.54% ⚠️ 45 Missing
schema.ts 89.56% ⚠️ 40 Missing
refresh.ts 40.63% ⚠️ 38 Missing
seer.ts 79.87% ⚠️ 30 Missing
preload.ts 53.23% ⚠️ 29 Missing
view.ts 87.27% ⚠️ 28 Missing
utils.ts 88.94% ⚠️ 25 Missing
view.ts 61.54% ⚠️ 25 Missing
detector.ts 90.10% ⚠️ 20 Missing
binary.ts 88.67% ⚠️ 17 Missing
list.ts 91.16% ⚠️ 16 Missing
list.ts 90.70% ⚠️ 16 Missing
code-scanner.ts 95.00% ⚠️ 16 Missing
help.ts 57.14% ⚠️ 15 Missing
sentry-client.ts 92.22% ⚠️ 13 Missing
arg-parsing.ts 90.00% ⚠️ 12 Missing
dsn-cache.ts 94.62% ⚠️ 12 Missing
logout.ts 56.00% ⚠️ 11 Missing
token.ts 52.17% ⚠️ 11 Missing
fix.ts 83.61% ⚠️ 10 Missing
qrcode.ts 33.33% ⚠️ 10 Missing
fs-utils.ts 57.14% ⚠️ 9 Missing
view.ts 94.70% ⚠️ 7 Missing
project-root.ts 97.73% ⚠️ 7 Missing
version-check.ts 91.76% ⚠️ 7 Missing
feedback.ts 84.21% ⚠️ 6 Missing
auth.ts 95.52% ⚠️ 6 Missing
shell.ts 96.23% ⚠️ 6 Missing
app.ts 93.90% ⚠️ 5 Missing
region.ts 86.49% ⚠️ 5 Missing
setup.ts 97.84% ⚠️ 4 Missing
list.ts 97.33% ⚠️ 4 Missing
index.ts 95.96% ⚠️ 4 Missing
project-aliases.ts 97.40% ⚠️ 2 Missing
project-root-cache.ts 96.92% ⚠️ 2 Missing
output.ts 89.47% ⚠️ 2 Missing
alias.ts 99.42% ⚠️ 1 Missing
completions.ts 99.37% ⚠️ 1 Missing
env-file.ts 99.19% ⚠️ 1 Missing
parser.ts 98.63% ⚠️ 1 Missing
colors.ts 98.21% ⚠️ 1 Missing
trace.ts 99.16% ⚠️ 1 Missing
helpers.ts 97.62% ⚠️ 1 Missing
helpers.ts 94.74% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    68.12%    68.13%    +0.01%
==========================================
  Files          108       108         —
  Lines        12944     12945        +1
  Branches         0         0         —
==========================================
+ Hits          8818      8819        +1
- Misses        4126      4126         —
- Partials         0         0         —

Generated by Codecov Action

@BYK
BYK merged commit eb898ac into main Feb 14, 2026
23 checks passed
@BYK
BYK deleted the fix/v-prefix-upgrade branch February 14, 2026 13:39
betegon added a commit that referenced this pull request Aug 20, 2026
CLI side of the simplified repository-tool contract. Pairs with
getsentry/cli-init-api#243.

## What changed

`list_dir` now behaves like bounded metadata discovery:

- regular files include byte `size`;
- it never opens or reads file contents just to build a listing;
- the advisory `isBinary` sniff is removed;
- it returns `truncated: true` when `maxDepth`/`maxEntries` stop
traversal or a directory cannot be read.

This gives the agent enough information to avoid obviously huge files
without paying an extra open/read for every file. When traversal is
incomplete, the agent can list a narrower path instead of assuming the
result is exhaustive.

## Compatibility

File size remains optional and `truncated` is additive. Older server
versions ignore the extra result field; newer servers preserve it
through the agent transcript. The existing read-files V2 contract is
unchanged.

## Validation

- Init test suite: 34 files, 517 tests
- Focused filesystem tools: 21 tests
- TypeScript typecheck
- Full Biome lint (987 files)
- `git diff --check`

The full local CLI suite also ran 9,203 tests successfully; its two
existing Bash-completion shell simulations fail on this local macOS
shell environment and are unrelated to this diff.

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant