fix(cli): make executable presence detection actually probe PATH [RED-887] [ship] - #1460
Merged
Merged
Conversation
…-887] PathLookup.detectPresence() was missing an await on its lookupPath() call, so the returned Promise was always defined and the NotDetectedError branch was unreachable — executable-presence detection always succeeded. The executable-on-PATH fallback tier of package-manager detection therefore unconditionally returned the highest-priority detector (pnpm), even on machines without pnpm, e.g. offering 'pnpm install' in the checkly import prompt. Behavior change: in the fallback case (no lockfile, config file, user agent, or runtime signal), a machine without pnpm now resolves to the first installed of bun > deno > yarn > cnpm > npm instead of pnpm, or to the final npm default when nothing is found. Machines with pnpm installed are unaffected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Linear: RED-887
PathLookup.detectPresence()was missing anawaiton itslookupPath()call: the returned Promise was always defined, so theNotDetectedErrorbranch was unreachable and executable-presence detection always "succeeded". Every detector'sdetectExecutable()delegates to it, so the executable-on-PATH fallback tier of package-manager detection unconditionally returned the highest-priority detector — pnpm — regardless of what is installed, e.g. offeringpnpm installin thecheckly importprompt on machines without pnpm.This adds the
await, removes the now-staleFIXME(RED-887)comment andrequire-awaiteslint-disable, and adds a directdetectPresencetest pair (resolves for an executable on PATH, rejects for a nonexistent one — verified to fail with theawaitreverted).Behavior change
Only the executable-fallback tier is affected, i.e. detection with no lockfile, no config file, no matching user agent, and no runtime signal:
No working setup regresses: machines where the outcome changes were previously offered commands for a package manager that is not installed. As a side effect, an npm-
workspacesmonorepo with no lockfile now gets workspace detection (the wrong pnpm verdict previously found no workspace, since pnpm's lookup requirespnpm-workspace.yaml).🤖 Generated with Claude Code