Skip to content

fix(upgrade): improve current version detection#9973

Merged
jdx merged 4 commits into
mainfrom
codex/fix-upgrade-summary-current-version
May 25, 2026
Merged

fix(upgrade): improve current version detection#9973
jdx merged 4 commits into
mainfrom
codex/fix-upgrade-summary-current-version

Conversation

@jdx

@jdx jdx commented May 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • show the installed matching version in upgrade summaries when the configured request is a prefix like go = "1.25"
  • keep literal latest from borrowing an installed version unless the resolved concrete version is actually installed
  • allow runtime symlinks such as latest -> ./1.0.0 through outdated resolution while still skipping user-linked symlinks
  • add regression tests for ToolRequest::Version, ToolRequest::Prefix, stale install-state entries, resolved latest, and the lockfile-backed plain mise up summary path

Root Cause

Plain mise up can resolve a prefix request to the target version before building the summary. For go = "1.25", the summary checked whether the resolved target like 1.25.10 was already installed and reported (none) when only the matching previous version like 1.25.9 existed.

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 latest remains 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-latest needed direct tests.

Validation

  • cargo fmt --check
  • cargo test toolset::outdated_info
  • cargo clippy -- -D warnings
  • mise run test:e2e e2e/cli/test_upgrade_parallel_failure
  • mise run test:e2e e2e/cli/test_upgrade reached and passed the new lockfile summary assertion, then later failed on an unrelated GitHub API 401 while installing ubi:bazelbuild/buildtools

@greptile-apps

greptile-apps Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR improves upgrade version detection by correctly identifying the currently-installed version when a config entry uses a prefix (e.g. go = "1.25") rather than a pinned version, and prevents the latest alias from borrowing an already-installed version unless its resolved concrete version is actually on disk.

  • outdated_info.rs: the existing is_version_installed fast path is kept; when it misses, a new current_version() helper calls latest_installed_version with the raw request prefix/version as a query, then double-checks the result is genuinely installed before reporting it — with a special guard that short-circuits when the request is the literal string "latest".
  • mod.rs: the symlink-skip guard is refined to allow runtime symlinks (targets starting with ./) through to the outdated resolver while still skipping user-managed symlinks.
  • e2e/cli/test_upgrade: the lockfile upgrade step now captures and asserts the dummy 1.0.0 → 1.1.0 summary line to prevent regressions on the display fix.

Confidence Score: 5/5

Safe 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: current_version() only affects what version string appears in the upgrade summary, the latest guard prevents the regression from coming back, and the runtime-symlink carve-out restores a narrow case that was over-blocked. All three scenarios are covered by new unit tests, and the e2e test guards the end-to-end display output.

No files require special attention.

Important Files Changed

Filename Overview
src/toolset/outdated_info.rs Replaces inline current-version logic with current_version() helper that falls back to latest_installed_version for prefix/version requests when the resolved version isn't installed; adds five regression tests.
src/toolset/mod.rs Refines the symlink skip guard so that runtime symlinks (pointing to ./…) are allowed through to OutdatedInfo::resolve, while user-managed symlinks continue to be skipped.
e2e/cli/test_upgrade Captures mise up output and asserts the upgrade summary line, but uses a single-quote wrapping pattern that breaks if the captured output contains a ' character.

Fix All in Claude Code

Reviews (4): Last reviewed commit: "test(upgrade): assert lockfile summary c..." | Re-trigger Greptile

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +518 to +523
let request = ToolRequest::Version {
backend: Arc::new(backend),
version: "1.25".into(),
options: ToolVersionOptions::default(),
source: ToolSource::Argument,
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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,
};

@jdx jdx enabled auto-merge (squash) May 18, 2026 18:30
@github-actions

github-actions Bot commented May 18, 2026

Copy link
Copy Markdown

Hyperfine Performance

mise x -- echo

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
⚠️ Inconclusive: 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%

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread src/toolset/outdated_info.rs Outdated
@jdx jdx disabled auto-merge May 18, 2026 18:56
@jdx jdx changed the title fix(upgrade): show previous version for prefix upgrades fix(upgrade): improve current version detection May 18, 2026
@jdx jdx merged commit c5dbe62 into main May 25, 2026
33 checks passed
@jdx jdx deleted the codex/fix-upgrade-summary-current-version branch May 25, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant