fix(runtime): filter shims directory from PATH in DetectInstalled#126
Merged
Conversation
The DetectInstalled() functions in all runtime providers were using raw exec.LookPath() which could find dtvem's own shims instead of actual system installations when the shims directory is in PATH. This caused the migrate command to potentially detect our own shims as "system" installations, leading to confusing migration suggestions. Changes: - Add LookPathExcludingShims() to internal/path package - Update Node.js, Python, and Ruby providers to use filtered lookup - Update shim executable to use shared function (deduplication) - Add comprehensive unit tests for the new lookup function Fixes #125
dc72005 to
500899f
Compare
- Convert version from number to string ("2")
- Migrate output format configuration to v2.x structure
- Move linters-settings to linters.settings
- Migrate exclusion rules from issues section to linters.exclusions
- Increase gocyclo complexity threshold to 25 for existing code
- Add goconst to test file exclusions (replaces removed ignore-tests)
Required for golangci-lint-action@v7 which validates schema strictly.
611c237 to
35445f2
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
DetectInstalled()in all providers to exclude dtvem's shims directory from PATH lookupLookPathExcludingShims()tointernal/pathpackage as a shared utilityProblem
When the dtvem shims directory is in PATH (which it is after installation),
exec.LookPath("ruby")would find~/.dtvem/shims/ruby.exeinstead of the actual system Ruby installation. This caused themigratecommand to potentially detect our own shims as "system" installations.Solution
Extract the filtered PATH lookup logic (that already existed in the shim executable) into a shared
internal/pathpackage, then update all providers to use it.Test plan
LookPathExcludingShims()andfindExecutableInDir()Fixes #125