Repository navigation
test(npm): isolate mock registry faults from inherited cache - #575
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
| }) | ||
| const timeout = setTimeout(() => child.kill(), 20_000) | ||
| try { | ||
| const [code, stdout, stderr] = await Promise.all([ |
There was a problem hiding this comment.
SUGGESTION: Awaiting child.exited while concurrently reading stdout/stderr can deadlock under heavy output
If the child writes more than the OS pipe buffer before the streams are drained, the child blocks on writing and child.exited never resolves until the 20 s kill timer fires, producing a slow failure. Drain stdout/stderr (or read them before awaiting exit) so output cannot back-pressure the child.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Previous Review Summary (commit 36824e2)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 36824e2)Status: 1 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (2 files)
Reviewed by free · Input: 27.1K · Output: 3.9K · Cached: 135.7K |
Issue for this PR
Closes #574
Type of change
What does this PR do?
Isolate the core mock-registry tests from inherited npm settings. An inherited npm_config_cache overrides their project .npmrc, letting an already-cached tarball bypass the injected HTTP500, broken connection or stall. All three tests then return Success instead of Failure.
The wrapper runs the original 10-test fixture suite in a bounded child with npm/HOME/proxy environment isolated before npm imports. Per-test hooks alone cannot undo @npmcli/agent cached proxy environment. The child uses private empty user/global npmrc files; the host environment is never mutated by the wrapper. Tarball error tests now assert a tarball was requested, and interruption waits for the real tarball request instead of assuming 100ms reaches the stall. A bounded subprocess regression runs the fixture with a hostile inherited registry, npmrc and shared-cache setting. Production npm precedence is unchanged.
How did you verify your code works?
Proxy review: the old hooks-only head failed with inherited dead HTTP(S)_PROXY. Updated hostile regression includes uppercase/lowercase proxy variables and empty NO_PROXY, while the wrapper removes them before npm import. The Kilo Promise.all pipe deadlock suggestion was independently refuted: both streams drain concurrently and a 32MiB-per-stream stress completed. No cosmetic pipe change was made.
This does not fix or explain #560's historical FETCH_ABORTED/Turbo crash.
Screenshots / recordings
Not a UI change.
Checklist