Repository navigation
feat(release): bundle the code embedding model in release binaries - #763
Merged
Merged
Conversation
New bundled-model feature compiles the pinned potion-code-16M-v2 files into the binary; the first use installs them into the data directory, verified, with no network. The release workflow fetches the files with scripts/fetch-model.sh and smoke-tests the binary offline with an empty data directory. Refs #761.
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
bundled-model(off by default). With it the threepotion-code-16M-v2files are compiled into the binary (include_bytes!fromCORA_BUNDLED_MODEL_DIR);model_store::ensureinstalls them into the data directory on first use: size and SHA-256 verified against the pinned values, written to a temporary directory and renamed in one step, under the same lock as a download. No network, soCORA_EMBED_OFFLINE=1works.scripts/fetch-model.shfetches the pinned files and verifies their hashes. The release workflow runs it, builds with--features tree-sitter,bundled-model, and smoke-tests the binary withCORA_EMBED_OFFLINE=1and an empty data directory (index, thencora brainmust return the symbol with avectorsignal) on all four platforms.model_store; theCheckCI job also compiles the feature (with the tiny fixture model).cargo installstill downloads once.Why
A fresh download of cora should work right away, offline or behind a firewall, instead of silently turning the vector signal off until the model can be downloaded. Closes #761.
Testing
cargo fmt --all -- --check,cargo clippy --all-targets --features tree-sitter -- -D warnings, and clippy withbundled-model(fixture model) clean;cargo test: new unit tests cover a verified atomic install, idempotence, a corrupted or incomplete bundle (refused, nothing left behind) and the script pins.bundled-model, 69 MB binary, about 38.5 MB as tar.gz against 8 MB without) in an empty data directory withCORA_EMBED_OFFLINE=1:cora indexunpacked the model intomodels/potion-code-16M-v2/, wrote the vector file, andcora brain "send a network request"returnedsend_request_to_serverwithftsandvectorsignals. A second run reuses the unpacked model.Generated by Claude Code