fix: resolve platform sub-package bin/ in runtime seeder (PILOT-209)#4
Merged
Merged
Conversation
pkgBinDir() previously only looked in the main package's bin/<platform>/ directory for native binaries. Because bin/ is .gitignored and excluded from the files array, published packages never contain it. The optional platform sub-packages (e.g. pilotprotocol-darwin-arm64) ship binaries in their own bin/ directories, but the runtime never checked there. Add a fallback: when the main package bin/<platform>/ is absent, resolve node_modules/pilotprotocol-<platform>/bin/ from the optional dependency. Also tightened the existence check: the sub-package fallback only resolves when pilotctl (BIN_NAMES[0]) actually exists there.
Collaborator
Author
🦾 Matthew PR Check — #4 PILOT-209Status
Summary
This PR adds a sub-package fallback: when the main-package What's next
🤖 auto-generated by matthew-pilot |
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
pkgBinDir()insrc/runtime.tspreviously only looked in the main package'sbin/<platform>/directory for native Go binaries. Becausebin/is.gitignore'd and excluded from thefilesarray, published packages never contain it.The optional platform sub-packages (e.g.
pilotprotocol-darwin-arm64@0.1.1) are designed to ship these binaries in their ownbin/directories, but the runtime never checked there — causing the "Binary not found — may be for a different platform" error on all platforms.Change
Add a sub-package fallback in
pkgBinDir(): when the main packagebin/<platform>/is absent, resolvenode_modules/pilotprotocol-<platform>/bin/from the optional dependency installed by npm.The fallback only resolves when
pilotctl(the first binary inBIN_NAMES) actually exists at that path — so a missing or empty sub-package still falls through to the existing error message.Testing
npm run build(TypeScript): ✅ cleannpx vitest run(173 tests): ✅ all passRelated
🤖 auto-generated by matthew-pilot