Skip to content

fix: a program is not looked for in a node_modules/.bin of the current directory or above; docker found as git is (0.28.2) - #60

Merged
llima merged 6 commits into
mainfrom
fix/path-node-modules-bin
Oct 13, 2026
Merged

llima merged 6 commits into
mainfrom
fix/path-node-modules-bin

Conversation

@llima

@llima llima commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Version bumped to 0.28.2
  • Merging publishes craftar@0.28.2 to npm after approval in the npm environment
  • A PATH entry that is <dir>/node_modules/.bin, for the directory craftar is started in or one above it, is skipped — in the program lookup and in the PATH the program gets. npx craftar puts those entries first, as absolute ones, so a git, a dotnet or a docker committed in a workspace was the program craftar ran. The compare is lexical (no link followed; without case on Windows); a node_modules/.bin elsewhere on PATH is looked in as before.
  • docker is now run from the one runner (src/core/proc.ts), as git and dotnet are since 0.27.2: found in the absolute entries of PATH only, on Windows docker.exe / docker.com only, and given the same reduced PATH. No file under src/ outside proc.ts starts a program any more.
  • No new message: a program then not found reads as on a machine without it (README › Upgrading › to 0.28.2).

Contracts and bytes

  • No emitter, planner or lock code is touched: no emitted byte moves. No --json shape changes.
  • What changes for a user: a git, dotnet or docker reachable only through such a node_modules/.bin — and a docker reachable only through a relative PATH entry or a docker.cmd shim — is no longer found.

Test plan

  • npm run typecheck — exit 0
  • npm run build — exit 0
  • npx vitest run --exclude test/ci.test.ts --maxWorkers=6 — exit 0: 102 files passed, 1 skipped; 2758 tests passed, 8 skipped
  • oracle: skipped (no fixture); no emitted byte is touched
  • test/ci.test.ts — never part of a by-hand run; this PR's CI is its run
  • test/local-bin.test.ts (13 cases) and the guard in test/git-lookup.test.ts: 14 cases fail on the code before the fix, the 15th is a control. No test starts Docker — the planted program is a copy of node under a name no real program has
  • node-cli-reviewer and docs-author: two rounds, clean on 5fc87a4; the reviewer also ran, by hand, a fake git planted in a temporary project's node_modules/.bin: skipped from inside the project, run from an unrelated directory
  • Not run: a real npx craftar, anything with a real docker, Windows and macOS (the win32 branches of the rule are pure and ran on Linux; this CI is their first run on Windows). What docker does with the reduced PATH when it starts a credential helper was not measured

llima added 6 commits October 13, 2026 10:26
…current directory or above; docker is run from proc.ts

npx puts <cwd>/node_modules/.bin, and every ancestor's, first on PATH as
absolute entries, so a git, a dotnet or a docker committed in a workspace was
the program craftar ran. pathEntries drops those entries, for the lookup and
for the PATH the program gets. docker was started by name, outside the one
runner: dockerRunner and runCompose now go through execProgram and
spawnInherited, so docker gets this rule and the one of 0.27.2.
…TH has none, and no file starts a program by name

Fourteen of the cases fail on the code before. The planted program is a copy
of node under a name no real program has; no test starts Docker. The guard
over node:child_process no longer has a docker exception.
…, docker found as git and dotnet are

What stops being found, for which programs, and what each command then says.
… PATH values that tell the lookups apart (review)

The cases that expect the local node_modules/.bin to be skipped had no proof
the program was in it, and two PATH values gave the same answer before the fix.
…es; to 0.28.2 says what services status does and what was not measured (review)

A hand-written entry for the same node_modules/.bin is skipped too, so the
remedy is another directory; services status exits 1 with every service not
created; what docker does with the reduced PATH was not measured.
@llima
llima merged commit a3f55cf into main Oct 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant