Repository navigation
npm e2e: stop Yarn dying of EPIPE when a grep -q closes its pipe - #468
Merged
Merged
Conversation
grep -q exits at its first match, so a client that writes after it writes into a closed pipe. Yarn dies of that (EPIPE, an unhandled error), and with pipefail `yarn npm whoami | grep -q` failed the merge queue's run of #465 although the whoami was right. The whoami, the two npm view checks and the dist-tag ls check now capture the output and compare it, the way the script's other checks do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BaGpNGgkQV54XvgL5D9ay2
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 24, 2026
Member
Author
|
The merge queue's run of this PR (run 776) failed one check, The test gives an entry a 100 ms lifetime and expects it still live on the very next call. On a runner busy with the parallel test binaries, more than 100 ms passed between the two calls, so the entry had expired and the loader ran again. No fix for it exists yet. One that keeps the test's meaning with half-second margins (about 5 s instead of 0.8 s): - assert_eq!(load(Duration::from_millis(100)).await, 1);
- assert_eq!(load(Duration::from_millis(100)).await, 1, "still live");
- tokio::time::sleep(Duration::from_millis(200)).await;
- assert_eq!(load(Duration::from_secs(60)).await, 2, "expired at 100 ms");
- tokio::time::sleep(Duration::from_millis(300)).await;
- assert_eq!(load(Duration::from_secs(60)).await, 2, "capped at the TTL");
- tokio::time::sleep(Duration::from_millis(300)).await;
- assert_eq!(load(Duration::from_secs(60)).await, 3, "expired at 500 ms");
+ // TTL 3 s (the `Duration::from_millis(500)` above becomes `from_secs(3)`).
+ assert_eq!(load(Duration::from_secs(1)).await, 1);
+ assert_eq!(load(Duration::from_secs(1)).await, 1, "still live");
+ tokio::time::sleep(Duration::from_millis(1500)).await;
+ assert_eq!(load(Duration::from_secs(60)).await, 2, "expired at 1 s");
+ tokio::time::sleep(Duration::from_secs(1)).await;
+ assert_eq!(load(Duration::from_secs(60)).await, 2, "capped at the TTL");
+ tokio::time::sleep(Duration::from_millis(2500)).await;
+ assert_eq!(load(Duration::from_secs(60)).await, 3, "expired at 3 s");It belongs in a pull request of its own, not in this one. Re-queueing this PR should pass, since the race rarely hits. Generated by Claude Code |
1 task
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.
The
npm-e2ejob (from #463) can fail on a race in its own script, as it did in the merge queue's run of #465. That run had the same tree that had passed on #465's own PR run.node yarn.js npm whoami | grep -q "$admin_user":grep -qexits at its first match. When Yarn writes another line after that, it writes into a closed pipe, dies of the unhandledEPIPE, and withset -o pipefailthe check fails although the whoami was right. Whether Yarn's last write lands before or after grep exits is timing, hence the intermittent failure.Change
.github/scripts/npm-e2e.shnow reads a client's output whole and then compares it, as its other checks already do ([ "$(npm whoami …)" = … ]). The same applies to the other checks that piped a client intogrep -q:yarn npm whoami;npm view … version | grep -qxchecks;npm dist-tag ls … | grep -q legacy && fail. Besides the race, that check passed silently whennpm dist-tag lsitself failed.No server code changes, so there is no changelog fragment.
Tests
.github/scripts/npm-e2e.shlocally with npm 11.21, pnpm 11.5 and Yarn 4 (fetched by the script): passed.bash -non the script.Generated by Claude Code