fix(lock): lock idiomatic version file tools#10309
Conversation
📝 WalkthroughWalkthroughMaps tool sources (mise.toml and idiomatic version files) to target lockfiles via a new helper, refactors lockfile update/snapshot/auto-lock flows to group by that mapping, updates CLI/config callers to pass Config, and adds e2e tests validating node and dummy idiomatic-file behaviors. ChangesIdiomatic Version File Lockfile Support
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~45 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Greptile SummaryFixes tools sourced from idiomatic version files (e.g.
Confidence Score: 5/5Safe to merge — the change is narrowly scoped to idiomatic version file sources and every affected code path has a matching test scenario. The new No files require special attention. Important Files Changed
Reviews (4): Last reviewed commit: "fix(lock): simplify idiomatic lock guard" | Re-trigger Greptile |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/cli/lock.rs (1)
548-551:⚠️ Potential issue | 🟠 Major | ⚡ Quick winRecover overridden idiomatic-version-file requests here too.
This fallback only walks
config_paths, butget_lockfile_targets()populates that list frommise.tomlsources only. An idiomatic file like.node-versionor.python-versionthat's shadowed by a higher-precedence config drops out of pass 1, and pass 2 never sees it, so an unfilteredmise lockcan prune a still-configured entry frommise.lock.Also applies to: 552-605
🤖 Prompt for 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. In `@src/cli/lock.rs` around lines 548 - 551, The fallback loop over config.config_files currently skips entries not in config_paths_set, which drops idiomatic-version-file requests that were sourced from mise.toml shadowing; update the condition inside the loop (the block that iterates config.config_files in src/cli/lock.rs) to also accept entries that represent idiomatic version files by checking the original lockfile targets or the config file's source kind (e.g., if the entry's source is an IdiomaticVersionFile enum variant or the path matches known idiomatic names like ".node-version" / ".python-version"); in short, change the guard from only config_paths_set.contains(path) to allow paths present in config_paths_set OR entries whose source/metadata marks them as idiomatic-version-file (or present in the initial get_lockfile_targets() result), so pass 2 will recover those overridden idiomatic requests instead of pruning them from mise.lock.
🤖 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.
Outside diff comments:
In `@src/cli/lock.rs`:
- Around line 548-551: The fallback loop over config.config_files currently
skips entries not in config_paths_set, which drops idiomatic-version-file
requests that were sourced from mise.toml shadowing; update the condition inside
the loop (the block that iterates config.config_files in src/cli/lock.rs) to
also accept entries that represent idiomatic version files by checking the
original lockfile targets or the config file's source kind (e.g., if the entry's
source is an IdiomaticVersionFile enum variant or the path matches known
idiomatic names like ".node-version" / ".python-version"); in short, change the
guard from only config_paths_set.contains(path) to allow paths present in
config_paths_set OR entries whose source/metadata marks them as
idiomatic-version-file (or present in the initial get_lockfile_targets()
result), so pass 2 will recover those overridden idiomatic requests instead of
pruning them from mise.lock.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 24729a01-4abb-4906-aded-f73c8d6a8c1b
📒 Files selected for processing (4)
e2e/lockfile/test_lockfile_idiomatic_version_filesrc/cli/lock.rssrc/config/mod.rssrc/lockfile.rs
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.6.2 x -- echo |
19.8 ± 0.9 | 17.9 | 25.0 | 1.00 |
mise x -- echo |
21.0 ± 2.9 | 18.5 | 39.7 | 1.06 ± 0.15 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.6.2 env |
19.3 ± 0.9 | 17.3 | 23.8 | 1.00 |
mise env |
19.9 ± 1.0 | 17.8 | 23.9 | 1.03 ± 0.07 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.6.2 hook-env |
19.9 ± 0.9 | 18.2 | 24.1 | 1.00 |
mise hook-env |
20.6 ± 1.0 | 18.5 | 24.5 | 1.03 ± 0.07 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.6.2 ls |
16.5 ± 0.8 | 14.6 | 20.7 | 1.00 |
mise ls |
16.8 ± 0.9 | 15.0 | 22.5 | 1.02 ± 0.07 |
xtasks/test/perf
| Command | mise-2026.6.2 | mise | Variance |
|---|---|---|---|
| install (cached) | 141ms | 142ms | +0% |
| ls (cached) | 61ms | 61ms | +0% |
| bin-paths (cached) | 66ms | 66ms | +0% |
| task-ls (cached) | 130ms | 130ms | +0% |
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 4af9d2e. Configure here.
| }) | ||
| }) | ||
| .max_by_key(|(root_depth, is_base, _)| (*root_depth, *is_base)) | ||
| .map(|(_, _, lockfile)| lockfile), |
There was a problem hiding this comment.
Ambiguous idiomatic lockfile mapping
Medium Severity
When several base mise.toml configs share the same project_root, lockfile_path_for_tool_source picks the target lockfile via max_by_key on (root_depth, is_base) over forward config_files iteration. Ties (e.g. root mise.toml vs .mise/config.toml) keep the first match in map order, not the highest-precedence config used elsewhere, so idiomatic tools can land in the wrong mise.lock.
Reviewed by Cursor Bugbot for commit 4af9d2e. Configure here.


Summary
Fixes an inconsistency where tools resolved from idiomatic version files, such as
.node-version, were visible in the active toolset but were not written tomise.lock. A latermise install --lockedwould then reject the same tool as missing from the lockfile.Root Cause
Lockfile update paths mapped tool sources by treating any source path like a mise config file. For idiomatic version files, that produced a sibling lockfile path based on
.node-versionor.python-version, which did not match the actual projectmise.locktarget.Changes
mise lockand install-time lockfile update/autolock flows.mise lock,mise install, andmise install --locked --dry-runfor idiomatic version file tools.Validation
cargo fmt --checkcargo checkmise run test:e2e e2e/lockfile/test_lockfile_idiomatic_version_fileNote
Medium Risk
Changes lockfile routing for install and
mise lockacross multiple code paths; wrong mapping could omit tools or write to the wrong lockfile, though behavior for non-idiomatic sources is largely preserved.Overview
Fixes tools from idiomatic version files (e.g.
.node-version) showing in the active toolset but not landing in the projectmise.lock, which brokemise install --locked.Adds
lockfile_path_for_tool_source, which mapsmise.tomlsources as before and attaches idiomatic version files to the nearest enclosing base mise config root instead of a bogus sibling lock path.mise lock,update_lockfiles,snapshot_pre_install_platforms, andauto_lock_new_versionsall use this mapping; install-time autolock now takesConfigso idiomatic sources participate.get_tools_to_lockalso includes idiomatic configs in its second pass and resolves overridden idiomatic requests (not onlylatest), while skipping path-backed sources like.tool-versionsfrom arbitrary project locks.New e2e
test_lockfile_idiomatic_version_filecoversmise lock, install updating the lock, and locked dry-run for node and dummy tools.Reviewed by Cursor Bugbot for commit 4af9d2e. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
Tests
Refactor