fix(upgrade): improve current version detection#9973
Conversation
Greptile SummaryThis PR improves upgrade version detection by correctly identifying the currently-installed version when a config entry uses a prefix (e.g.
Confidence Score: 5/5Safe to merge — changes are scoped to the outdated/upgrade display path and the symlink skip guard, both backed by new regression tests. The core logic changes are well-bounded: No files require special attention. Important Files Changed
Reviews (4): Last reviewed commit: "test(upgrade): assert lockfile summary c..." | Re-trigger Greptile |
There was a problem hiding this comment.
Code Review
This pull request refactors the OutdatedInfo struct to more accurately determine the currently installed version by introducing a current_version helper method. This method handles different ToolRequest types, such as specific versions or prefixes, and queries the backend for the latest matching installed version. A unit test was added to verify this logic. The review feedback suggests improving test robustness by explicitly covering the ToolRequest::Prefix code path in addition to the existing version request test.
| let request = ToolRequest::Version { | ||
| backend: Arc::new(backend), | ||
| version: "1.25".into(), | ||
| options: ToolVersionOptions::default(), | ||
| source: ToolSource::Argument, | ||
| }; |
There was a problem hiding this comment.
The test correctly simulates a prefix-like version request using ToolRequest::Version, which is how mise handles tool = "1.25" from a config file. However, since the current_version function also explicitly handles ToolRequest::Prefix, it would be more robust to also test that variant. Consider changing this test to use ToolRequest::Prefix to ensure both paths are covered, or adding a separate test for it.
| let request = ToolRequest::Version { | |
| backend: Arc::new(backend), | |
| version: "1.25".into(), | |
| options: ToolVersionOptions::default(), | |
| source: ToolSource::Argument, | |
| }; | |
| let request = ToolRequest::Prefix { | |
| backend: Arc::new(backend), | |
| prefix: "1.25".into(), | |
| options: ToolVersionOptions::default(), | |
| source: ToolSource::Argument, | |
| }; |
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.5.11 x -- echo |
9.6 ± 0.4 | 8.9 | 11.7 | 1.00 |
mise x -- echo |
11.0 ± 1.8 | 9.3 | 25.3 | 1.14 ± 0.19 |
x -- echo measured 14% slower, but hyperfine reported statistical outliers. |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.5.11 env |
9.6 ± 0.4 | 8.7 | 11.3 | 1.00 |
mise env |
10.5 ± 0.9 | 9.0 | 15.8 | 1.10 ± 0.11 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.5.11 hook-env |
11.7 ± 1.2 | 9.7 | 16.4 | 1.00 |
mise hook-env |
12.7 ± 1.5 | 9.5 | 19.7 | 1.09 ± 0.17 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.5.11 ls |
10.0 ± 1.0 | 8.1 | 13.8 | 1.00 |
mise ls |
10.6 ± 1.4 | 8.0 | 16.2 | 1.05 ± 0.17 |
xtasks/test/perf
| Command | mise-2026.5.11 | mise | Variance |
|---|---|---|---|
| install (cached) | 70ms | 71ms | -1% |
| ls (cached) | 36ms | 36ms | +0% |
| bin-paths (cached) | 37ms | 38ms | -2% |
| task-ls (cached) | 63ms | 64ms | -1% |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6a06aa1. Configure here.

Summary
go = "1.25"latestfrom borrowing an installed version unless the resolved concrete version is actually installedlatest -> ./1.0.0through outdated resolution while still skipping user-linked symlinksToolRequest::Version,ToolRequest::Prefix, stale install-state entries, resolvedlatest, and the lockfile-backed plainmise upsummary pathRoot Cause
Plain
mise upcan resolve a prefix request to the target version before building the summary. Forgo = "1.25", the summary checked whether the resolved target like1.25.10was already installed and reported(none)when only the matching previous version like1.25.9existed.The fix computes the displayed current version from the original request when the resolved target is not installed, so prefix requests can show the best matching installed version. Literal
latestremains conservative: it only reports current when the resolved concrete version is actually installed.Follow-ups
CI and review exposed adjacent edge cases while validating the fix: runtime symlinks need to continue through the outdated resolver, and
ToolRequest::Prefix/resolved-latestneeded direct tests.Validation
cargo fmt --checkcargo test toolset::outdated_infocargo clippy -- -D warningsmise run test:e2e e2e/cli/test_upgrade_parallel_failuremise run test:e2e e2e/cli/test_upgradereached and passed the new lockfile summary assertion, then later failed on an unrelated GitHub API 401 while installingubi:bazelbuild/buildtools