fix: self-heal missing platform bundle from GitHub Releases (#303)#335
Merged
Conversation
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>
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.
Problem
codegraph initfailing withno prebuilt bundle for <platform>afternpm 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.cominstalls only the shim (exact error); the same install from npmjs works.Fix
scripts/npm-shim.js— when the platform bundle isn't installed, download the same archive from GitHub Releases (the oneinstall.shuses), cache it under~/.codegraph/bundles/, and exec it. Works on any registry, corporate proxy, or--omit=optionalsetup.CODEGRAPH_NO_DOWNLOAD,CODEGRAPH_INSTALL_DIR,CODEGRAPH_DOWNLOAD_BASE.release.yml— publish aSHA256SUMSasset and trigger an npmmirror sync of all packages after publish (best-effort,continue-on-error).__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