Repository navigation
fix(doctor): omit package-runner cache shims from installations - #15059
Conversation
`rea doctor` lists every `which -a rea` / `where rea` hit in `installations.paths` without filtering. A launcher under npm's `_npx` cache or pnpm's `dlx` cache is a cache shim, not a separate installation: the hashed directory is replaced by a later run or a cache prune, so pairing it with a global prefix made doctor report `state: multiple` for one package. Drop launcher paths whose directory chain contains an `_npx` segment or a pnpm `dlx` segment, on both POSIX and Windows spellings. The field stays cosmetic, matching the issue's scope note. Validation: `npm run test:local -- src/application/Doctor.test.ts` (89 passed, including two new cases that fail when the filter is removed); `npm run check:fast`, `npm run lint` and `oxfmt --check` pass. Not run: full `check:pr`, real `where`/`which` on a host with an npx-cache launcher; the new cases drive launcher discovery through an injected execFileOutput.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Low impact] The PR appears safe to merge; no actionable issues remain in the reviewed changes. Summary
Reviews (6) · Last reviewed commit: "fix(doctor): preserve launchers near Yar..." · Reviewed by Greptile |
|
Status at Re-verified on current One detail a reviewer may want to weigh: the pnpm Is a split useful here, or does the single filter hook in |
npm and pnpm cache shims were omitted, but yarn dlx and bunx PATH entries still counted as installations. Match each runner's cache directory on the listed path, and cover POSIX and Windows spellings with path fixtures.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44a8b2f155
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Yarn Berry's default PnP linker writes the `yarn dlx` command wrapper directly into a second `xfs-<hex>` temp directory and puts only that directory on PATH, so `which -a rea` lists `/tmp/xfs-<hex>/rea`. The package-runner filter only matched the other Yarn layout, where the launcher sits under `xfs-<hex>/dlx-<pid>/node_modules/.bin`. A PATH that held a real REA launcher plus that wrapper still read `multiple`. Reproduced with yarn 4.18.0: the wrapper argv points into `xfs-<hex>/dlx-<pid>`, but the PATH entry is the bare `xfs-<hex>` dir. Match the temp segment one or two levels above the launcher, including the bare wrapper, and keep a durable launcher under a bare `xfs-<hex>` or `xfs-<hex>/bin` as an installation.
|
thanks! merged with the tightened Yarn matching and added regression cases. all required CI passed, including Apple E2E; 716 selected tests passed. |
* commit '4ccc685dd5ed028bc625fdd8760539ce5a492d8d': (228 commits) test(asar): verify cleanup on the original file handle (morluto#15155) fix(ubi): bound smaller-grid probe memoization (morluto#15168) fix(artifacts): distinguish content from containment changes (morluto#15165) fix(bflt): retain complete text when data is truncated (morluto#15160) refactor(domain): reuse graph projection and validation helpers (morluto#15173) fix(iso9660): read a directory record's data length from its little-endian half (morluto#14801) test(ghidra): wait for each fixture spawn before expiring startup (morluto#15172) test(beam): reuse the CLI Evidence reader (morluto#15171) test(oci): share descriptor budget refusal assertions (morluto#15159) refactor(audit): share byte framing for offline audit logs (morluto#15162) refactor(evidence): reuse observed file reports for binary metadata (morluto#15161) fix(doctor): omit package-runner cache shims from installations (morluto#15059) refactor(packages): share package inspection budget contracts (morluto#15158) refactor(desktop): share completed command answer recovery (morluto#15156) refactor(views): share page byte reservations (morluto#15152) refactor(artifacts): share GPU and media asset layout rules (morluto#15150) fix(setup): name the detected host when Hopper setup does not apply (morluto#14449) fix(iso9660): read a directory record whose identifier padding byte is not zero (morluto#15020) fix(windows): report the ACE count a private DACL check observed (morluto#14450) fix(artifacts): read Ogg Opus channel mapping tables (morluto#14975) ...
* commit 'e18ed55bac14191010efe91ba61489cab1d2ba55': (137 commits) fix(artifacts): report macOS package bundle release versions (morluto#14860) test(asar): verify cleanup on the original file handle (morluto#15155) fix(ubi): bound smaller-grid probe memoization (morluto#15168) fix(artifacts): distinguish content from containment changes (morluto#15165) fix(bflt): retain complete text when data is truncated (morluto#15160) refactor(domain): reuse graph projection and validation helpers (morluto#15173) fix(iso9660): read a directory record's data length from its little-endian half (morluto#14801) test(ghidra): wait for each fixture spawn before expiring startup (morluto#15172) test(beam): reuse the CLI Evidence reader (morluto#15171) test(oci): share descriptor budget refusal assertions (morluto#15159) refactor(audit): share byte framing for offline audit logs (morluto#15162) refactor(evidence): reuse observed file reports for binary metadata (morluto#15161) fix(doctor): omit package-runner cache shims from installations (morluto#15059) refactor(packages): share package inspection budget contracts (morluto#15158) refactor(desktop): share completed command answer recovery (morluto#15156) refactor(views): share page byte reservations (morluto#15152) refactor(artifacts): share GPU and media asset layout rules (morluto#15150) fix(setup): name the detected host when Hopper setup does not apply (morluto#14449) fix(iso9660): read a directory record whose identifier padding byte is not zero (morluto#15020) fix(windows): report the ACE count a private DACL check observed (morluto#14450) ...
* commit '76cb6645be39cf3844f7a8bb4568b02d8a713595': (95 commits) fix(macos-pkg): retain cpio hard-link contents (morluto#15157) fix(artifacts): report macOS package bundle release versions (morluto#14860) test(asar): verify cleanup on the original file handle (morluto#15155) fix(ubi): bound smaller-grid probe memoization (morluto#15168) fix(artifacts): distinguish content from containment changes (morluto#15165) fix(bflt): retain complete text when data is truncated (morluto#15160) refactor(domain): reuse graph projection and validation helpers (morluto#15173) fix(iso9660): read a directory record's data length from its little-endian half (morluto#14801) test(ghidra): wait for each fixture spawn before expiring startup (morluto#15172) test(beam): reuse the CLI Evidence reader (morluto#15171) test(oci): share descriptor budget refusal assertions (morluto#15159) refactor(audit): share byte framing for offline audit logs (morluto#15162) refactor(evidence): reuse observed file reports for binary metadata (morluto#15161) fix(doctor): omit package-runner cache shims from installations (morluto#15059) refactor(packages): share package inspection budget contracts (morluto#15158) refactor(desktop): share completed command answer recovery (morluto#15156) refactor(views): share page byte reservations (morluto#15152) refactor(artifacts): share GPU and media asset layout rules (morluto#15150) fix(setup): name the detected host when Hopper setup does not apply (morluto#14449) fix(iso9660): read a directory record whose identifier padding byte is not zero (morluto#15020) ...
* commit '6c7dffc59b970fcfae023af3171d92ee0ac50f94': (137 commits) fix(json): classify JSON input heap headroom and string-ceiling refusals (morluto#14949) fix(macos-pkg): retain cpio hard-link contents (morluto#15157) fix(artifacts): report macOS package bundle release versions (morluto#14860) test(asar): verify cleanup on the original file handle (morluto#15155) fix(ubi): bound smaller-grid probe memoization (morluto#15168) fix(artifacts): distinguish content from containment changes (morluto#15165) fix(bflt): retain complete text when data is truncated (morluto#15160) refactor(domain): reuse graph projection and validation helpers (morluto#15173) fix(iso9660): read a directory record's data length from its little-endian half (morluto#14801) test(ghidra): wait for each fixture spawn before expiring startup (morluto#15172) test(beam): reuse the CLI Evidence reader (morluto#15171) test(oci): share descriptor budget refusal assertions (morluto#15159) refactor(audit): share byte framing for offline audit logs (morluto#15162) refactor(evidence): reuse observed file reports for binary metadata (morluto#15161) fix(doctor): omit package-runner cache shims from installations (morluto#15059) refactor(packages): share package inspection budget contracts (morluto#15158) refactor(desktop): share completed command answer recovery (morluto#15156) refactor(views): share page byte reservations (morluto#15152) refactor(artifacts): share GPU and media asset layout rules (morluto#15150) fix(setup): name the detected host when Hopper setup does not apply (morluto#14449) ...
Summary
rea doctorlists everywhich -a rea/where reahit ininstallations.paths, including shims inside a package runner's cache. A cache shim and a global prefix are two directories, sostatereadsmultiplefor one package. Cache shims under npm_npx, pnpmdlx, yarndlx, and bunx are omitted. A directory that is only named_npx,dlx, or.bunstays.Fixes #15027
Problem and expected behavior
Trigger:
PATHholds a durable launcher plus a package runner'snode_modules/.bin.installationLauncherscounts both andstatebecomesmultiple.Expected: a cache shim is not an installation. The cache directory is replaced by a later run or a cache prune, so only a durable launcher is counted.
Change and scope
systemDoctorHost().installationLaunchers()filterswhere/whichoutput before resolving each launcher. Matching uses the listed path, beforerealpath, so a symlinked cache shim is still omitted. Windows folds case and treats\as a separator. POSIX keeps the listed spelling.Layouts matched at the end of the path (
node_modules/.bin/<bin>):_npx/<16 hex>(libnpmexec's truncated sha512 key), any cache rootdlx/<64 or 32 hex>/pkg, ordlx/<64 or 32 hex>/<time>-<pid>(hex, later base36)xfs-<8 or 9 hex>/dlx-<pid>.bunx-<uid>/<package>(POSIX; a scoped package adds one directory) orbunx-<uid>-<package>(Windows and older POSIX)Intentionally not included: the ownership classifier (
ClientRegistrationIdentity) and registration refresh for a launcher from another installed REA package. Both belong to #15022 / #15023 and #15029. This change stays in theinstallationsfield that #15027 describes.Contract and boundary impact
Doctorowns launcher discovery; the change isinstallationLaunchersinsrc/application/Doctor.ts. No consumer outsideDoctor.tsreadsinstallations.doctorJSONidentity.installations.pathskeeps its shape and only omits cache shims. No schema change.Expected effects:
Evidence and regression coverage
src/application/Doctor.test.ts, underdoctor installation count. Injectedwhich -a reaandwhere realines are path fixtures. They do not use the host platform,path.join, or a temp directory./fixtures omit npm, pnpm (pkgand<time>-<pid>), yarn, and bunx (including a scoped package) and keep global bins, a projectnode_modules/.bin, and lookalikes (_npx/bin,pnpm/dlx/bin, a 15-digit_npxkey, a shortdlxkey, a shortxfs-name, and a backslash-spelled path).\fixtures repeat those layouts with mixed case. A second case uses/plus mixed case, including yarn and bunx, and expectsstate: "single"when one durable launcher remains.doctorJSONidentity.installations.PATHactually contains these cache shims. Windows behavior is the injectedwhereoutput, not a Windows host.Validation performed
On
44a8b2f155d90aae954a540e16c2213d7546a1c0:npm run test:focused -- src/application/Doctor.test.ts— 90 passed, 1 skipped (91 tests in the file).npm run check:fast— typecheck and lint succeeded; architecture guards passed across 3322 source files. The pre-push hook rancheck:fastagain and it passed.npm run check:pr, realwhich/whereon an affected host, a Windows host.Compatibility, safety, and release
where/whichoutput it already read; no new command, file write, or network.Author readiness
Human owner: @2SinceJuly
Author checklist (completed by the PR author before requesting review)
type(scope): outcome.REA_runtime setting with a default, floor, and maximum, unless a fixed ceiling has a stated reason.