Repository navigation
fix(lockfile): respect locked versions for prefix: tool requests - #11255
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughPrefix selectors now use bare values and boundary-aware matching when resolving lockfile entries, including selectors obtained through aliases. Unit and end-to-end tests cover lock reuse, upgrades, non-matching versions, boundary cases, and alias-based resolution. ChangesPrefix lockfile resolution
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant ToolRequest
participant ToolVersion
participant Lockfile
ToolRequest->>Lockfile: Query bare prefix with boundary enforcement
ToolVersion->>Lockfile: Query alias-resolved bare prefix
Lockfile-->>ToolRequest: Return boundary-matching locked version
Lockfile-->>ToolVersion: Return boundary-matching locked version
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryFixes lockfile pinning for direct and alias-derived
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains in the fixes associated with the previous review threads. Important Files Changed
Reviews (4): Last reviewed commit: "fix(lockfile): respect locked versions f..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/toolset/tool_request.rs`:
- Around line 344-363: Replace the bare prefix lockfile lookup in
ToolRequest::lockfile_version_query with prefix-aware separator-boundary
matching, preserving the selector kind for direct Prefix requests. Apply the
same matcher in the alias-to-prefix resolution path in
src/toolset/tool_version.rs lines 344-347. Extend
e2e/lockfile/test_lockfile_prefix lines 41-49 with a 10.0.0 lock entry and
assert prefix:1 resolves to 1.1.0 rather than 10.0.0.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: ef27c531-a3c5-4cab-8d81-8903f0870b4d
📒 Files selected for processing (3)
e2e/lockfile/test_lockfile_prefixsrc/toolset/tool_request.rssrc/toolset/tool_version.rs
55da3c1 to
9f38d92
Compare
With `uv = "prefix:0.8"` and lockfile enabled, `mise install` ignored
the locked version and installed the newest prefix match, rewriting the
lockfile - the lockfile had no pinning effect at all for `prefix:`
requests, making install behave like an implicit upgrade.
Root cause: the lockfile lookup matches the request string against
stored versions with starts_with, but ToolRequest::version() returns
the scheme-qualified form ("prefix:0.8") for Prefix requests, which can
never match a stored concrete version like "0.8.1".
- lockfile_resolve now matches Prefix requests on the bare prefix (via
a new lockfile_version_query helper), making `prefix:0.8` behave like
the fuzzy version request "0.8" already does.
- The post-alias lockfile re-check strips a `prefix:` scheme before
matching, so an alias that resolves to a prefix selector is pinned
too.
- `mise upgrade` and `mise lock --bump` still bypass the lock via
use_locked_version=false, so constrained upgrades keep working.
Out of scope: `sub-` requests (relative-to-latest by design; they
already get a bare-version lockfile check after subtraction), and the
--locked strict-mode bail which only exists in the Version arm.
Fixes jdx#5781
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
9f38d92 to
f2ce24e
Compare
Summary
prefix:tool requests against the lockfile using the bare prefix, somise installhonors the locked version instead of re-resolving to the newest matchprefix:scheme in the post-alias lockfile re-check, so aliases that resolve to prefix selectors are pinned tooContext
Fixes the unresolved behavior reported in #5781: with
uv = 'prefix:0.8'andlockfile = true,mise installinstalled the newest prefix match and rewrote.mise.lock, so the lockfile had zero pinning effect — install behaved like an implicit upgrade. jdx noted at the time that lockfile "isn't compatible with prefix: yet"; this makes it compatible.Root cause: the resolution-time lockfile short-circuit calls
ToolRequest::lockfile_resolve, which matches the request string against stored versions viastarts_with. ForPrefixrequests,version()returns the scheme-qualified form (prefix:0.8), which can never starts-with-match a stored concrete version like0.8.1. The short-circuit therefore never fired andresolve_prefixpicked the newest match (install runs withlatest_versions: true).Fix:
lockfile_resolvenow derives its match string from a newlockfile_version_query()helper — the bare prefix forPrefixrequests,version()for everything else (ref:/path:/systementries store that string verbatim;sub-gets its lockfile check after subtraction inresolve_version). This makesprefix:0.8behave exactly like the fuzzy version request"0.8"already does. The same one-line strip is applied in the post-alias re-check (the #8194 path), covering[tool_alias.X.versions] my1 = "prefix:1".Semantics preserved:
mise upgrade/mise lock --bump/mise x tool@.../ tool stubs all run withuse_locked_version: falseand still bypass the lock — constrained upgrades (prefix:0.8bumping within 0.8.x) keep working, which is exactly the reporter's desired workflow.starts_with(same semantics fuzzyVersionrequests have today); noted in the helper's doc comment.Out of scope, noted for completeness:
sub-requests (relative-to-latest by design), and the--lockedstrict-mode "not in lockfile" bail which today only exists in theVersionarm.Reproduced pre-fix on v2026.7.x (isolated env):
jq = 'prefix:1.7'with.mise.lockseeded to1.7→mise installinstalled1.7.1and rewrote the lock. Post-fix (debug build): install keeps1.7.Tests
cargo fmt --checktest_lockfile_version_query_uses_bare_prefixe2e/lockfile/test_lockfile_prefix(dummy plugin, no network): locked older version survivesmise install(fails before this fix), reinstall is a no-op,mise upgradestill bumps within the prefix and updates the lock, a non-matching lock entry falls through to fresh resolution, and an alias resolving toprefix:1is pinned the same wayThis PR was prepared by an AI coding assistant.
Summary by CodeRabbit
Bug Fixes
prefix:selectors so pinned versions are preserved correctly, including after alias resolution.prefix:1won’t match10.0.0, and empty prefixes are rejected).Tests