Skip to content

fix(cli): gate npm release on platform package availability - #506

Merged
shuv1337 merged 1 commit into
integration-v2from
gate-npm-release
Nov 18, 2026
Merged

shuv1337 merged 1 commit into
integration-v2from
gate-npm-release

Conversation

@shuv1337

Copy link
Copy Markdown
Owner

Summary

Gate npm latest promotion, harden Linux libc binary selection, and preflight platform package availability during CLI updates.

  • Two-phase OIDC npm release & live smoke gate (.github/workflows/publish.yml, packages/cli/script/pack.ts, publish-order.ts, npm-availability.ts):
    • stage-npm (--phase=platforms) prepares/verifies distributions, packs wrapper .tgz artifacts (shuvcode-wrappers), publishes only the 17 platform packages, and polls each package's install packument, version metadata, and HEAD tarball URL up to 45 minutes until all return HTTP 200.
    • smoke-npm matrix runs clean global npm install checks of the staged wrapper tarballs against the public registry on ubuntu-22.04-arm (Linux ARM64 glibc) and ubuntu-latest (Linux x64 glibc), verifying glibc platform binary selection, --version, and serve --help.
    • publish (--phase=wrappers --wrappers-dir=...) re-verifies all 17 platform packages, publishes the staged wrappers to ${Script.channel}, waits for wrapper packuments (dist-tags[channel]), version metadata, and tarballs to return 200, and retries live npm install -g shuvcode@<channel> shuvcode-node@<channel> verification before creating the GitHub Release and notifying Discord.
    • Hardens isNpmVersionUploaded to return false only on 404 (throwing on 429/5xx), cleans up mkdtemp directories in finally, tolerates CDN "cannot publish over" retries, and rejects v-prefixed OPENCODE_VERSION inputs up front.
  • Launcher libc & diagnostic hardening (packages/cli/script/launcher.mjs):
    • Detects Linux glibc vs musl (ldd --version + glibcVersionRuntime fallback) and removes cross-libc fallback so missing glibc packages never spawn incompatible -musl binaries.
    • Keeps searching remaining same-libc candidates when an earlier candidate resolves a stale hoisted package, and surfaces actionable errors naming the missing, incomplete, or stale <pkg>@<version> and Reinstall <wrapper>@<version>.
  • Updater preflight & POSIX npm verification (packages/cli/src/services/updater.ts):
    • Updater.upgrade verifies the target <platform>@<version> version metadata (GET 200) and tarball archive (HEAD 200, cancelling response bodies cleanly) before acquiring the upgrade lock or running any package manager (npm, pnpm, bun, yarn).
    • POSIX prefix npm installs now verify <npmBin>/<pkg> --version after installation via the shared checkVersion helper.

Closes #505

No feature flag: release pipeline, updater preflight, and launcher error-handling bug fix.

Verification

  • packages/cli: bun test test/npm-availability.test.ts test/publish-order.test.ts test/publish-ownership.test.ts test/launcher.test.ts test/updater-install.test.ts test/upgrade.test.ts — 77 pass, 4 skip (Windows-only), 0 fail (282 assertions)
  • packages/cli: bun test test/npm-availability.test.ts test/publish-order.test.ts test/launcher.test.ts --rerun-each 10 — 230 pass, 0 fail
  • packages/cli: bun run typecheck and bun run typecheck:tsc — passed
  • Root: bun run check (40/40 tasks), git diff --check, prettier --check on all 10 changed files, and actionlint / shellcheck on .github/workflows/publish.yml (0 new warnings)

Visual

<svg xmlns="http://www.w3.org/2000/svg" width="240" height="72" viewBox="0 0 240 72" fill="none" font-family="ui-sans-serif,system-ui" font-size="10">
<style>.g{animation:ok 3s ease-in-out infinite}@keyframes ok{0%,100%{opacity:.55}50%{opacity:1}}@media (prefers-reduced-motion:reduce){.g{animation:none}}</style>
<rect x="8" y="10" width="96" height="22" rx="4" stroke="currentColor" opacity=".45"/>
<text x="16" y="24" fill="currentColor" opacity=".8">17 platforms (200)</text>
<path d="M108 21h22m-4-3 4 3-4 3" stroke="currentColor" stroke-width="1.3" opacity=".5"/>
<rect x="134" y="10" width="98" height="22" rx="4" stroke="currentColor" opacity=".8" class="g"/>
<text x="143" y="24" fill="currentColor" class="g">wrappers → latest</text>
<rect x="8" y="42" width="224" height="20" rx="4" stroke="currentColor" opacity=".3"/>
<text x="16" y="55" fill="currentColor" opacity=".7">arm64 glibc smoke · same-libc · 200 preflight</text>
</svg>

Ensure npm never moves a dist-tag to a wrapper package before all platform packages and tarballs are downloadable, harden launcher libc fallback and missing/stale diagnostics, and guard CLI upgrades on target platform archive readiness.

- Split npm publish into platforms and wrappers phases with packument, version metadata, and tarball HEAD HTTP 200 polling, staging wrapper tarballs for live ARM64/x64 glibc smoke installs on GitHub Actions before publishing wrappers and creating the GitHub Release.
- Remove cross-libc fallback on Linux in launcher.mjs and report exact missing/stale/incomplete platform packages with reinstall guidance.
- Preflight target platform metadata and tarball availability in Updater.upgrade before running package managers, and verify POSIX prefix npm installs with --version.

Closes #505
@shuv1337 shuv1337 added the full-tests Run the full test suite (unit and e2e) on this PR label Nov 18, 2026
@shuv1337
shuv1337 merged commit cfb8a0e into integration-v2 Nov 18, 2026
7 of 9 checks passed
@shuv1337
shuv1337 deleted the gate-npm-release branch November 18, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-tests Run the full test suite (unit and e2e) on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(release): gate npm latest on platform package availability

1 participant