Repository navigation
fix(opencode): drop stale tarballs before packing - #250
Merged
Merged
Conversation
`bun pm pack` writes its tarball into the directory it packs, so a second pack in the same dist dir bundles the previous run's tarball as package content. Any `release --skip-build` retry — the documented way to resume a failed publish — therefore doubled every platform package, ~55MB to ~112MB. That is also why the concurrent uploads in this script started timing out: 13 packages at twice the expected size saturate the uplink long enough for npm to give up mid-upload (`FETCH_ERROR`), which the retry loop then makes worse by re-packing even bigger tarballs. Delete any stale `*.tgz` before packing. Shipped in 1.18.4-8 for 9 of the 13 packages, hand-repacked; the three darwin ones went up before this was found and keep the nested copy at that version. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
bun pm packwrites its tarball into the directory it packs. A second pack in the same dist dir therefore sees the previous run's.tgzas package content and bundles it — so everyrelease --skip-buildretry, the documented way to resume a failed publish, doubled every platform package:Deleting stale
*.tgzbefore packing takes each platform package from ~112MB (3 files) back to ~55MB (2 files).Why it matters beyond size
This is what made the concurrent uploads in this script start timing out. 13 packages at twice their expected size saturate a laptop uplink long enough for npm to give up mid-upload (
FETCH_ERROR), and the retry loop then re-packs even bigger tarballs each round. The existingATTEMPTS = 5loop was sized for the 40-60MB packages noted at the top of the file — this restores that assumption.Scope
packages/opencode/script/publish.ts— delete stale*.tgzbeforebun pm pack, viaBun.Glob+Bun.file().delete()(Bun's shell errors on an unmatched glob, sorm -f *.tgzbreaks on the main package dir, which has no tarball).DIVERGENCES.md— row 110 extended;publish.tsis an upstream file and the row already covers the retry loop this interacts with.CHANGELOG.md—### Installentry under Unreleased; halving install download is user-facing.Status of 1.18.4-8
Already published. 9 of the 13 packages went up hand-repacked and clean;
codev-code-darwin-arm64,codev-code-darwin-x64, andcodev-code-darwin-x64-baselinewere published before this was found and keep the nested copy — npm burns a version permanently on unpublish, so they stay as-is and self-correct next release.1.18.4-7has the same flaw, so this is not a regression.Test plan
bun typecheckfrompackages/opencodepasses.dist/opencode-linux-x64: repack took the tarball 112M -> 55M, contentspackage/package.json+package/bin/codevonly..tgzpresent) does not throw — that is the main package dir on every run.npm install codev-code@1.18.4-8in a scratch dir resolves and runs:codev --version->1.18.4-8.🤖 Generated with Claude Code