Repository navigation
Fix CRLF bin e2e failing under npm 11 on macOS - #1896
Mikola Lysenko (mikolalysenko) wants to merge 2 commits 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
|
bugbot run Generated by Claude Code |
|
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 |
|
Ready for review (burn-down agent) at
Generated by Claude Code |
|
Generated by Claude Code |
The --no-bin-links guard looked for .bin/cli.js, but npm names a bin-map link after its key (crlfbin), so the guard could never fire. Pass the link name npm would create for each case: the bin key for the bin map, the file name for directories.bin. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011f9aeTApLyQQnpuXiK39EX
|
Final review: the bugbot run Generated by Claude Code |
|
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 9d7d4cb. Configure here.
|
[burn-down agent] Labeled Ready for review again at
Generated by Claude Code |
Final review briefWhat it does: Test-only fix for the macOS nightly red in Risk: low. One test file, no product code. The test still checks apply, Look here:
Verified: Read the full diff. Changes I made: none. Auto-merge is armed, so approving sends it straight to the merge queue. Generated by Claude Code |
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 in an ignored e2e; no production code or CLI behavior is modified.
Overview
Fixes nightly macOS e2e failures where
npm_agent_keeps_crlf_shebang_of_bin_npm_did_not_linkassumed npm always leaves CRLF shebangs ondirectories.bininstalls from afile:tarball. npm 11 links those bins intonode_modules/.binand rewrites the shebang likefixBin; npm 10 did not.The test now detects whether npm linked the expected
.binentry and picks baseline bytes accordingly: untouched CRLF when unlinked (--no-bin-linksor npm 10-style behavior), LF shebang (NPM_BIN_*) when linked. It still asserts byte-exact apply, apply --check, and rollback, and fails if--no-bin-linksever creates a link. Doc comments were updated to document npm 10 vs 11.Reviewed by Cursor Bugbot for commit 9d7d4cb. Configure here.
Generated by Claude Code