Repository navigation
Fix CRLF bin e2e failing under npm 11 on macOS - #1896
Open
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Open
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Conversation
npm_agent_keeps_crlf_shebang_of_bin_npm_did_not_link assumed npm never links a directories.bin-only package installed from a file: tarball. npm 10 doesn't, but npm 11 does: it links bin/cli.js and rewrites its CRLF shebang to LF. The e2e_redirect_npm_build legs use the runner image's npm, which is 11 on macos-latest, so the macOS nightly leg has been red on main since #1805 landed. The test now checks whether npm linked the bin and expects npm's rewritten bytes when it did, and the untouched CRLF bytes when it didn't. apply, apply --check and a byte-exact rollback are still asserted in both cases, and --no-bin-links must still leave the bin unlinked. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011f9aeRC4w7jsAshzLQM6VL
Collaborator
Author
|
bugbot run Generated by Claude Code |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 5e0418e. Configure here.
This was referenced Oct 30, 2026
Collaborator
Author
|
I dispatched a macOS-only run of this branch to check the fix in CI: https://github.com/SocketDev/socket-patch/actions/runs/41029711345
The PR run is green, including the required Generated by Claude Code |
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.
Problem
e2e-macos (macos-latest, e2e_redirect_npm_build, 1)has failed on every run since #1805 (b73b080) landed on 2026-10-29 13:29 UTC:Both failures are the same assertion:
This leg doesn't run on PRs or in the merge queue, so it doesn't block merges. But it keeps the nightly and every
workflow_dispatchrun red (ci-ok (macos only)), which hides new macOS regressions.Root cause
The test's second case installs a
directories.bin-only package from afile:tarball and assumes npm won't link the bin, so the CRLF shebang survives. That holds for npm 10 but not npm 11, which linksbin/cli.jsintonode_modules/.binand rewrites its shebang the wayfixBindoes. Thee2e_redirect_npm_buildlegs have nosetup-nodestep, so they use the runner image's npm: npm 10 on the Ubuntu legs (which pass) and npm 11 onmacos-latest(which fails).I reproduced it on Linux:
node_modules/.binbin/cli.jsshebang\r\nSOCKET_PATCH_NPM_E2E_BIN)cli.js\nFix
Test-only change. The test now checks whether npm linked the bin (
node_modules/.bin/<name>exists):NPM_BIN_BEFORE/NPM_BIN_AFTER, the same constantsnpm_agent_patches_crlf_shebang_bin_npm_rewroteuses).In both cases it still checks
apply,apply --checkand a byte-exactrollback. A new assertion fails if--no-bin-linksever links the bin, so the unlinked#1804path stays covered on every npm version. If npm linked the bin without rewriting it, or rewrote it without linking it, the test still fails. No assertions were removed.Proof
cargo test -p socket-patch-cli --test e2e_redirect_npm_build -- --ignored crlf(all 3 CRLF tests) passes with npm 10.9.4 and with npm 11.21.1.npm_agent_keeps_crlf…10 times under each npm version: 0 failures out of 20.cargo clippy -p socket-patch-cli --test e2e_redirect_npm_build -- -D warningsreports no new warnings. The only errors are twoduplicate_modlints that already fire on main for this test target; CI's clippy job doesn't build test targets.rustfmtrun on the touched file only.The macOS leg only runs on nightly and
workflow_dispatch, so the next nightly will confirm the fix in CI.Where tests run
Nothing removed or moved. The test still runs on the
e2eUbuntu leg (npm 10) and the nightlye2e-macosleg (npm 11).Generated by Claude Code
Note
Low Risk
Test-only change to e2e assertions; no runtime or CLI behavior is modified.
Overview
Fixes the nightly macOS e2e failure where
npm_agent_keeps_crlf_shebang_of_bin_npm_did_not_linkassumed npm always leaves CRLF shebangs on unlinked bins. npm 11 linksdirectories.binfromfile:tarballs and rewrites the shebang likefixBin, which broke the second matrix case onmacos-latest.The test now probes
node_modules/.bin/<name>and branches expected on-disk bytes: unlinked paths still useCRLF_BIN_*; linked paths useNPM_BIN_*(same asnpm_agent_patches_crlf_shebang_bin_npm_rewrote). It adds a guard that--no-bin-linksmust not create a link, and still assertsapply,apply --check, and byte-exactrollbackfor both manifest variants. Doc comments note the npm 10 vs 11 split.Reviewed by Cursor Bugbot for commit 5e0418e. Configure here.
Generated by Claude Code