Skip to content

fix(runtime): filter shims directory from PATH in DetectInstalled#126

Merged
CalvinAllen merged 3 commits into
mainfrom
fix/runtime/path-lookup-filter
Dec 13, 2025
Merged

fix(runtime): filter shims directory from PATH in DetectInstalled#126
CalvinAllen merged 3 commits into
mainfrom
fix/runtime/path-lookup-filter

Conversation

@CalvinAllen

Copy link
Copy Markdown
Contributor

Summary

  • Fix DetectInstalled() in all providers to exclude dtvem's shims directory from PATH lookup
  • Add LookPathExcludingShims() to internal/path package as a shared utility
  • Deduplicate code by updating shim executable to use the shared function
  • Add comprehensive unit tests for the new lookup function

Problem

When the dtvem shims directory is in PATH (which it is after installation), exec.LookPath("ruby") would find ~/.dtvem/shims/ruby.exe instead of the actual system Ruby installation. This caused the migrate command 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/path package, then update all providers to use it.

Test plan

  • All existing tests pass
  • New unit tests for LookPathExcludingShims() and findExecutableInDir()
  • Tests verify shims directory is properly excluded
  • Linting passes (0 issues)

Fixes #125

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
@CalvinAllen CalvinAllen force-pushed the fix/runtime/path-lookup-filter branch from dc72005 to 500899f Compare December 13, 2025 22:00
- 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.
@CalvinAllen CalvinAllen force-pushed the fix/runtime/path-lookup-filter branch from 611c237 to 35445f2 Compare December 13, 2025 22:14
@CalvinAllen CalvinAllen merged commit d3f4133 into main Dec 13, 2025
12 checks passed
@CalvinAllen CalvinAllen deleted the fix/runtime/path-lookup-filter branch December 13, 2025 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

fix(runtime): DetectInstalled uses unfiltered PATH lookup finding own shims

1 participant