fix(shim): error when secondary executable is missing#255
Merged
CalvinAllen merged 2 commits intomainfrom May 8, 2026
Merged
Conversation
When a secondary executable shim (e.g. uv, pip, npm) cannot be located in the active runtime version's install tree, the shim previously fell back to the primary runtime binary, silently turning `uv --version` into `python --version`. Extract the lookup into a shared `shim.FindSecondaryExecutable` helper that returns an explicit error, and have both the shim entrypoint and `dtvem which` surface a clear "not available in <runtime> <version>" message instead of falling back.
The `goconst` linter flagged ".bat" as a repeated string literal across manager.go, manager_test.go, and path.go. Add `constants.ExtBat` alongside the existing ExtExe / ExtCmd constants and replace the bare literals (and the bare ".exe"/".cmd" alongside them in the same files) with the named constants.
6ee2fbb to
50769f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
uv,pip,npm) cannot be located in the active runtime version's install tree, the shim previously fell back to the primary runtime binary — silently turninguv --versionintopython --version.shim.FindSecondaryExecutablehelper that returns an explicit error, and have both the shim entrypoint anddtvem whichsurface a clear "not available in " message instead of falling back.adjustExecutablePathfunctions insrc/cmd/shim/main.goandsrc/cmd/which.go.Resolves #254
Behavior change (verified locally)
Before:
After:
Test plan
./rnr check(format, lint, full test suite) passessrc/internal/shim/executable_test.gocover: found alongside runtime, found inScripts/, found in../Scripts/,.cmdpreferred over.exe, not-found returnsErrSecondaryExecutableNotFounduv.exe, ran against a Python version that does not haveuv— confirmed clear errorpython.exe— confirmed primary-runtime path still worksNote on related work
This does not fix #253 (shim-map cross-version contamination) — that's a separate change. However, fixing this silent-fallback bug significantly mitigates the user-facing impact of #253: users now see a clear error rather than the runtime binary running in place of the missing command.