fix(core): enforce min_tool_version check during pack install#233
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enforces min_tool_version from pack.toml so packs that require a newer weave version fail early with an actionable error, rather than installing and potentially breaking.
Changes:
- Adds a new
WeaveError::IncompatibleToolVersionerror variant for clear upgrade guidance. - Introduces
check_min_tool_version()(semver compare vsCARGO_PKG_VERSION) and calls it in registry installs, local installs (including dry-run), and profile switching. - Adds unit tests for the version check and an E2E test covering an incompatible local pack.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/core/install.rs |
Adds check_min_tool_version() and enforces it in install flows; includes unit tests. |
src/core/use_profile.rs |
Enforces min_tool_version during use_profile::switch() (dry-run and normal). |
src/error.rs |
Adds IncompatibleToolVersion error variant and message. |
tests/e2e/cli_install.rs |
Adds E2E coverage for local install failing on incompatible min_tool_version. |
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.
Summary
min_tool_versionin their manifest to require a minimum weave version. Previously this field was parsed but never enforced, so incompatible packs would silently install and potentially break.IncompatibleToolVersionerror variant and acheck_min_tool_version()function that comparespack.min_tool_versionagainstCARGO_PKG_VERSIONusing semver comparison.install_from_registry(),install_local()(both normal and dry-run paths), anduse_profile::switch()so users always see a clear upgrade message.Closes #197
Test plan
min_tool_versionhigher than current returnsIncompatibleToolVersionerrormin_tool_versionequal to current succeedsmin_tool_versionsucceeds (backward compatible)min_tool_version = "99.0.0"fails install with clear messagecargo fmt --allpassescargo test --libpasses (215 tests, 0 failures)