Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Fix CRLF bin e2e failing under npm 11 on macOS - #1896

Open
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
mainfrom
ci-janitor/npm11-directories-bin-crlf
Open

Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
mainfrom
ci-janitor/npm11-directories-bin-crlf

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

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:

npm_agent_keeps_crlf_shebang_of_bin_npm_did_not_link panicked at e2e_redirect_npm_build.rs:1388:
bin/cli.js: npm left the shebang alone
  left:  "#!/usr/bin/env node\n..."   (LF shebang)
  right: "#!/usr/bin/env node\r\n..." (CRLF shebang)

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_dispatch run red (ci-ok (macos only)), which hides new macOS regressions.

Root cause

The test's second case installs a directories.bin-only package from a file: tarball and assumes npm won't link the bin, so the CRLF shebang survives. That holds for npm 10 but not npm 11, which links bin/cli.js into node_modules/.bin and rewrites its shebang the way fixBin does. The e2e_redirect_npm_build legs have no setup-node step, so they use the runner image's npm: npm 10 on the Ubuntu legs (which pass) and npm 11 on macos-latest (which fails).

I reproduced it on Linux:

npm node_modules/.bin installed bin/cli.js shebang test on main
10.9.4 empty \r\n pass
11.21.1 (SOCKET_PATCH_NPM_E2E_BIN) cli.js \n fails, same assertion as CI

Fix

Test-only change. The test now checks whether npm linked the bin (node_modules/.bin/<name> exists):

  • Not linked: expects the untouched CRLF bytes, as before.
  • Linked: expects npm's rewritten bytes (NPM_BIN_BEFORE/NPM_BIN_AFTER, the same constants npm_agent_patches_crlf_shebang_bin_npm_rewrote uses).

In both cases it still checks apply, apply --check and a byte-exact rollback. A new assertion fails if --no-bin-links ever links the bin, so the unlinked #1804 path 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.
  • Ran 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 warnings reports no new warnings. The only errors are two duplicate_mod lints that already fire on main for this test target; CI's clippy job doesn't build test targets.
  • rustfmt run 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 e2e Ubuntu leg (npm 10) and the nightly e2e-macos leg (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_link assumed npm always leaves CRLF shebangs on unlinked bins. npm 11 links directories.bin from file: tarballs and rewrites the shebang like fixBin, which broke the second matrix case on macos-latest.

The test now probes node_modules/.bin/<name> and branches expected on-disk bytes: unlinked paths still use CRLF_BIN_*; linked paths use NPM_BIN_* (same as npm_agent_patches_crlf_shebang_bin_npm_rewrote). It adds a guard that --no-bin-links must not create a link, and still asserts apply, apply --check, and byte-exact rollback for 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

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
@mikolalysenko Mikola Lysenko (mikolalysenko) added the ci-janitor Opened by the CI janitor routine (flakes, redundant tests, CI perf) label Oct 30, 2026
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

bugbot run


Generated by Claude Code

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.

@mikolalysenko

Copy link
Copy Markdown
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 ci-ok and clippy checks.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-janitor Opened by the CI janitor routine (flakes, redundant tests, CI perf)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants