Skip to content

test(repro): Windows reproducer for the npm pack hang (#1130) - #1148

Merged
jimhoyd merged 3 commits into
mainfrom
claude/windows-npm-pack-timeout-z7pnhl
Oct 7, 2026
Merged

jimhoyd merged 3 commits into
mainfrom
claude/windows-npm-pack-timeout-z7pnhl

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Jimmy · project thread

Problem and change

Before: #1130 (npm pack --ignore-scripts --json in test/prepare.test.ts wrote its JSON on Windows Node 24, then hit the 30 s timeout) had no way to be reproduced on demand, and its cause was unknown.

After: scripts/repro/npm-pack-hang.ts reproduces that pack on the same fixture as many times as you ask, with an optional CPU load, using today's spawn (sync), the pre-#1135 spawn (legacy) or an async spawn that separates the child's exit from its pipes closing. A preloaded npm-trace.mjs records every stdout and stderr write and callback, the process.exit call and the exit event. A stalled run prints that trace, npm's debug log and the Windows process tree.

What it found: across 5,600 runs on windows-latest (Node 24.21.0, npm 11.19.0), none stalled or failed, whether they used the current spawn, the old one or ran under load. Node's spawn_sync.cc signals the child only if it has not already exited. The original status: null therefore means npm itself was still running at 30 s, and a grandchild holding the pipes is ruled out. The root cause is still unconfirmed. #1135's diagnostics remain in place, so a recurrence will report the signal, the elapsed time and both streams. The test, its assertions and its timeout are unchanged.

How: two temporary Windows workflow rounds ran the reproducer. That workflow has been removed, and scripts/repro/README.md documents the script and these results.

Verification

  • 5,600 Windows runs as described above, all exiting 0.
  • npm run lint, npm run typecheck, npm run typecheck:tooling and npm run check:docs pass locally. test/workflows.test.ts and test/ci-workflow.test.ts pass with the temporary workflow removed.

Compatibility and security

Diagnostic scripts only. They are not run by npm test and are not part of the published archive. No runtime, YAML or API change.

  • Changes match the documented portable contract; docs/examples are updated where needed.
  • Relevant tests and package checks pass, or limitations are explained above.
  • No credentials, customer data or private project material are included.
  • Runtime/starter changes remain aligned where applicable.

Refs #1130

🤖 Generated with Claude Code

https://claude.ai/code/session_01QeDRi91XaadWk1KdAbzvcB

Temporary diagnostic: runs npm pack --ignore-scripts --json on the
prepare.test.ts fixture hundreds of times on Windows Node 24, with an
appendFileSync trace preloaded into each npm child, to see whether npm
stalls before process.exit, inside it, or exits while its pipes stay open.

Refs #1130

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QeDRi91XaadWk1KdAbzvcB
@jimhoyd jimhoyd self-assigned this Oct 7, 2026
claude added 2 commits October 7, 2026 19:50
The first Windows round (1,600 npm packs with the #1135 spawn, some
under CPU load) never stalled: worst run 2.8 s. This round reproduces the
spawn the test used when it failed (default stdio with a stdin pipe, no
quiet npm settings) 4,000 times, and runs the failing shard 3/3 at the
commit before #1135 fifteen times.

Refs #1130

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QeDRi91XaadWk1KdAbzvcB
…ducer (#1130)

Two Windows rounds found no stall: 5,600 npm pack runs on Node 24.21.0
with npm 11.19.0, under the current spawn, the pre-#1135 spawn and CPU
load, all exited 0 well inside the timeout. The temporary pull_request
workflow is removed; scripts/repro/README.md records the reproducer, what
a null spawnSync status proves (npm itself had not exited), and the
results.

Refs #1130

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QeDRi91XaadWk1KdAbzvcB
@jimhoyd jimhoyd changed the title test(npm): fix the Windows npm pack hang in prepare.test.ts (#1130) test(repro): Windows reproducer for the npm pack hang (#1130) Oct 7, 2026
@jimhoyd
jimhoyd marked this pull request as ready for review October 7, 2026 20:28
@jimhoyd
jimhoyd merged commit a181143 into main Oct 7, 2026
21 checks passed
@jimhoyd
jimhoyd deleted the claude/windows-npm-pack-timeout-z7pnhl branch October 7, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants