Skip to content

Fix multiple-installs false positives for asdf and mise shims - #408

Draft
gtsiolis wants to merge 2 commits into
mainfrom
devx-1015-multiple-installs-warning-false-positives-on-asdf-shim-npm
Draft

Fix multiple-installs false positives for asdf and mise shims#408
gtsiolis wants to merge 2 commits into
mainfrom
devx-1015-multiple-installs-warning-false-positives-on-asdf-shim-npm

Conversation

@gtsiolis

@gtsiolis gtsiolis commented Jul 24, 2026

Copy link
Copy Markdown
Member

Motivation

lstk warns about "multiple installs" whenever a version-manager shim and the install it dispatches to are both reachable on PATH, even though they are the same install — a false positive that fires on every run.

  • asdf: an asdf-managed npm install is also reachable through its asdf shim.
  • mise (reported by Daniel): with shim mode and PATH mode both enabled (mise's recommended mix for interactive + non-interactive sessions), ~/.local/share/mise/shims/lstk and ~/.local/share/mise/installs/<tool>/<version>/lstk both land on PATH. A mise shim is a bare symlink to the mise binary itself (argv[0] dispatch, no metadata), so neither symlink dedup nor content parsing can relate it to its install.

Changes

  • Resolve asdf shim scripts back to their real install path (internal/update/installs_unix.go) by parsing the # asdf-plugin: <name> <version> comment asdf writes into each shim, before dedup runs in FindInstalls (internal/update/installs.go)
  • Resolve dispatcher shims (mise): a candidate in a shims/ dir that symlink-resolves to an executable not named lstk is aliased to the first PATH candidate under the sibling installs/ tree — the same check mise itself uses to recognize its shims (is_active_mise_shim), no hardcoded tool names. A shim with no backing install on PATH (pure shim mode + e.g. a homebrew lstk) still counts, so genuine conflicts keep warning.
  • Add a no-op executableAlias on Windows (installs_windows.go); mise's Windows .exe-copy shims are a known gap left out of scope
  • Add unit tests TestFindInstallsDeduplicatesAsdfShimAlias, TestFindInstallsDeduplicatesMiseShimAlias, TestFindInstallsKeepsMiseShimWithoutBackingInstallOnPath and integration tests TestUpdateCheckDoesNotWarnOnAsdfShimAlias, TestUpdateCheckDoesNotWarnOnMiseShimAlias

Known limitation: mise resolves the shim's dispatch target per-invocation from its config, so a hand-pinned stale installs/<tool>/<old-version> PATH entry diverged from the configured version is deduped rather than warned. Inherent to any heuristic that doesn't execute mise; documented in the code.

Review

Human review advised — user-facing behavior with a teammate-reported case (Daniel's mise setup), and the dispatcher heuristic deserves a second pair of eyes.

Tests

New unit + integration tests reproduce both false positives and confirm they're resolved. Also verified against real installs: asdf + npm on this machine, and a real mise use github:localstack/lstk install (dual shim + PATH mode) that reproduced Daniel's warning byte-for-byte with released v0.18.0 and is silent with this branch, while a mise shim + separate binary install still warns.

Closes DEVX-1015

Co-Authored-By: Claude noreply@anthropic.com

@gtsiolis gtsiolis added semver: patch docs: skip Pull request does not require documentation changes labels Jul 24, 2026
@gtsiolis gtsiolis self-assigned this Jul 24, 2026
@gtsiolis

Copy link
Copy Markdown
Member Author

Cc @skyrpex because #398.

@skyrpex

skyrpex commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@gtsiolis thanks, didn't know about this. I thought we were fine deduping symlinks 😄

@gtsiolis
gtsiolis force-pushed the devx-1015-multiple-installs-warning-false-positives-on-asdf-shim-npm branch from 4f50e57 to 2eb1a75 Compare July 27, 2026 07:08
@gtsiolis
gtsiolis force-pushed the devx-1015-multiple-installs-warning-false-positives-on-asdf-shim-npm branch from 2eb1a75 to 111b373 Compare July 27, 2026 12:49
@gtsiolis gtsiolis changed the title Fix multiple-installs false positive for asdf shims Fix multiple-installs false positives for asdf and mise shims Jul 27, 2026
gtsiolis and others added 2 commits July 28, 2026 07:11
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@gtsiolis
gtsiolis force-pushed the devx-1015-multiple-installs-warning-false-positives-on-asdf-shim-npm branch from 111b373 to a0a392c Compare July 28, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: skip Pull request does not require documentation changes semver: patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants