Repository navigation
fix(shim): attribute missing executables to configured tools - #11398
Conversation
📝 WalkthroughWalkthroughThe change adds backend executable-name matching and uses configured tool metadata to produce targeted reinstall guidance when a requested shim executable is unavailable. ChangesConfigured tool shim diagnostics
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Sequence Diagram(s)sequenceDiagram
participant WhichRun
participant Toolset
participant Shims
WhichRun->>Toolset: look up requested executable
WhichRun->>Shims: request unavailable configured tool message
Shims->>Toolset: inspect configured versions and backend metadata
Shims-->>WhichRun: return reinstall guidance or no message
WhichRun-->>WhichRun: emit targeted error or existing fallback
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 SummaryThis PR improves attribution and remediation messaging when a configured tool no longer provides a requested executable.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "normalize Windows shim names" | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/cli/args/backend_arg.rs (1)
755-765: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover the
tool_namefallback in the unit test.Both added
codexcases end incodexforshortandtool_name, so they do not exercise the second matching branch. Add an alias-shaped case such asdotnet-corematchingdotnet(the existing test at Line 789 demonstrates that parsing shape).🤖 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/args/backend_arg.rs` around lines 755 - 765, Extend test_matches_bin_name_uses_tool_identity with an alias-shaped BackendArg whose short name differs from its tool_name, such as dotnet-core matching dotnet, and assert that matches_bin_name returns true to cover the tool_name fallback branch.
🤖 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/cli/args/backend_arg.rs`:
- Around line 213-226: Update matches_bin_name to normalize executable-name
comparisons on Windows: remove the .exe suffix case-insensitively and compare
the resulting binary name against short and tool_name components
case-insensitively. Preserve the existing case-sensitive behavior on non-Windows
platforms.
---
Nitpick comments:
In `@src/cli/args/backend_arg.rs`:
- Around line 755-765: Extend test_matches_bin_name_uses_tool_identity with an
alias-shaped BackendArg whose short name differs from its tool_name, such as
dotnet-core matching dotnet, and assert that matches_bin_name returns true to
cover the tool_name fallback branch.
🪄 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: 94ec6c21-c148-4af2-9a3d-1851994e59ef
📒 Files selected for processing (3)
src/cli/args/backend_arg.rssrc/cli/which.rssrc/shims.rs
Instruction counts
No instruction-count regression above 1%. Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run. Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.
|
Summary
mise whichcallsRoot cause
When a shim could not resolve, mise scanned every installed tool version for any executable with the same filename. An inactive Node installation containing an npm-installed
codexcould therefore cause a failed configured Codex shim to recommend activating that Node version.User impact
If a configured tool is installed but no longer exposes its namesake executable, mise now explains that its installation is incompatible with current backend metadata and recommends
mise install --force <tool>@<version>. Unrelated tools that happen to contain the same executable are not presented as the primary remediation.Validation
cargo test cli::args::backend_arg::tests::test_matches_bin_name_uses_tool_identitycargo test unavailable_tool_message_prefers_matching_configured_toolcargo fmt --all -- --checkNote
Low Risk
User-facing CLI/shim diagnostics only; no auth, install pipeline, or data-model changes beyond clearer error selection.
Overview
Fixes shim and
mise whicherrors that blamed unrelated installed tools when another runtime happened to ship the same executable name (e.g. npmcodexunder Node vs configured Codex).Adds
BackendArg::matches_bin_nameso resolution keys off tool identity (short/tool_name, with Windows.exeand case handling) instead of scanning every install for a matching filename.When a configured tool is installed but does not expose the requested binary under current backend metadata,
unavailable_configured_tool_messageexplains the mismatch and suggestsmise install --force <tool>@<version>. That path runs from shim resolution and frommise whichwhen lookup fails.Reviewed by Cursor Bugbot for commit d31e4cf. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
mise install --force <tool>@<version>” message when appropriate.