Skip to content

fix: self-heal missing platform bundle from GitHub Releases (#303)#335

Merged
colbymchenry merged 1 commit into
mainfrom
fix/303-self-heal-platform-bundle
May 22, 2026
Merged

fix: self-heal missing platform bundle from GitHub Releases (#303)#335
colbymchenry merged 1 commit into
mainfrom
fix/303-self-heal-platform-bundle

Conversation

@colbymchenry
Copy link
Copy Markdown
Owner

Problem

codegraph init failing with no prebuilt bundle for <platform> after npm i -g @colbymchenry/codegraph (#303). Not a packaging bug — npmjs has all six per-platform packages published correctly. The reporters install through the npmmirror/cnpm mirror, which had not mirrored the per-platform packages. The runtime ships as an optional dependency, and npm silently skips an optional package it can't fetch from the mirror, so the launcher ends up with no bundle.

Reproduced end-to-end: a clean install from registry.npmmirror.com installs only the shim (exact error); the same install from npmjs works.

Fix

  • Self-heal in scripts/npm-shim.js — when the platform bundle isn't installed, download the same archive from GitHub Releases (the one install.sh uses), cache it under ~/.codegraph/bundles/, and exec it. Works on any registry, corporate proxy, or --omit=optional setup.
    • Best-effort SHA256SUMS verification (mismatch aborts; absent/old release skips).
    • Download timeout so a stalled connection fails fast with guidance instead of hanging.
    • Knobs: CODEGRAPH_NO_DOWNLOAD, CODEGRAPH_INSTALL_DIR, CODEGRAPH_DOWNLOAD_BASE.
  • release.yml — publish a SHA256SUMS asset and trigger an npmmirror sync of all packages after publish (best-effort, continue-on-error).
  • Tests__tests__/npm-shim.test.ts: hermetic coverage (installed-bundle resolution, cache reuse, disable knob, and the download/checksum match/mismatch/absent paths via a local HTTPS mock).

Also synced all 6 platform packages on npmmirror manually, so 0.9.2/0.9.3 already install there again.

Closes #303

🤖 Generated with Claude Code

Installing from a registry mirror (npmmirror/cnpm) that hadn't mirrored the
per-platform optionalDependency left codegraph failing with "no prebuilt
bundle for <platform>" — npm treats an unfetchable optional dep as success and
silently skips it. The npm-shim now self-heals: when the bundle is missing it
downloads the matching archive from GitHub Releases (checksum-verified, with a
download timeout) and caches it, so a global install works on any registry.

release.yml now publishes SHA256SUMS and triggers an npmmirror sync after
publish. Adds hermetic tests for the shim (resolution, cache reuse, disable
knob, download + checksum match/mismatch/absent).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@colbymchenry colbymchenry merged commit 15072aa into main May 22, 2026
@colbymchenry colbymchenry deleted the fix/303-self-heal-platform-bundle branch May 22, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

no prebuilt bundle for darwin-arm64

1 participant