Skip to content

fix(shims): do not record the platform for --help/--version calls - #16

Merged
gpmayorga merged 3 commits into
mainfrom
fix/platform-marker-yarn-flags
Nov 28, 2026
Merged

gpmayorga merged 3 commits into
mainfrom
fix/platform-marker-yarn-flags

Conversation

@gpmayorga

Copy link
Copy Markdown
Owner

What changed

is_install_command now returns false for any call that carries --help, -h, --version or -v, before it looks for the subcommand.

Why

Reported in #10 (bug 3). The function skips flags to find the subcommand, so yarn --version and yarn --help looked like a bare yarn (an install) and rewrote the node_modules platform marker. In NODE_SHIMS_MODE=local that recorded the host platform over a container install, hiding a real mismatch and causing false warnings later. npm install --help and pnpm add -h had the same issue.

Verification

  • Extended unit test: yarn --version, yarn -v, yarn --help, npm install --help, pnpm add -h, npm i --version leave an existing marker untouched. Fails before the fix (marker rewritten by: yarn --version), passes after.
  • New unit test: bare yarn and yarn --frozen-lockfile still record the marker.
  • bats test/unit 38/38, shellcheck -S warning clean.

AI-drafted (Claude Code); not yet reviewed by a human.


Generated by Claude Code

is_install_command skips flags to find the subcommand, so `yarn
--version` and `yarn --help` looked like a bare `yarn` (an install) and
rewrote node_modules' platform marker. In local mode that recorded the
host platform over a container install and hid a real mismatch. `npm
install --help` and `pnpm add -h` had the same problem.

Treat any call with --help/-h/--version/-v as not an install. A bare
`yarn` or `yarn --frozen-lockfile` is still an install.

Verified: extended unit test fails before ("marker rewritten by: yarn
--version") and passes after; new test pins that bare yarn still
records the marker. bats test/unit 38/38, shellcheck clean.

Generated-with: Claude Code
Claude-Session: https://claude.ai/code/session_015QijPSQw2k943Mg36FYjYS
@gpmayorga gpmayorga added the bug Something isn't working label Nov 28, 2026 — with Claude
@gpmayorga
gpmayorga marked this pull request as ready for review November 28, 2026 11:07
@gpmayorga
gpmayorga merged commit 50338c3 into main Nov 28, 2026
3 checks passed
@gpmayorga
gpmayorga deleted the fix/platform-marker-yarn-flags branch November 28, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants