[PR #4153] [MERGED] fix(verifiers): launch npm through Node on Windows #6092

Closed
opened 2026-10-31 01:11:48 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4153
Author: @N0zoM1z0
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/windows-package-npm-launch-4125


📝 Commits (2)

  • e8f7fd9 fix(verifiers): launch npm through Node on Windows
  • 2909ca5 test(verifiers): cover Windows npm fallback

📊 Changes

11 files changed (+143 additions, -49 deletions)

View changed files

📝 .github/workflows/ci.yml (+1 -0)
📝 scripts/ci/scopes.mjs (+1 -0)
📝 scripts/lib/verify-package-core.mjs (+20 -0)
📝 scripts/verify-package-install.mjs (+4 -6)
📝 scripts/verify-package-pack.mjs (+4 -8)
📝 scripts/verify-packaged-ghidra-windows.mjs (+3 -9)
📝 scripts/verify-packaged-wasm-artifact.mjs (+2 -3)
📝 scripts/verify-repository-skill.mjs (+2 -3)
📝 scripts/verify-windows-package.mjs (+10 -20)
➕ tests/boundary/process/packageNpmInvocation.test.ts (+90 -0)
📝 tests/process-global/curatedWindowsLane.test.ts (+6 -0)

📄 Description

Summary

Windows package verifiers now launch npm through its JavaScript entry point, so standard Node distributions no longer fail with spawn npm ENOENT. The shared boundary replaces every raw or duplicated package-verifier npm launcher while preserving caller-selected npm, arguments, environment, cwd, limits, and error details.

Fixes #4125.

Problem and expected behavior

execFile("npm", ...) cannot execute the npm.cmd exposed by standard Windows Node distributions. A real ordinary-user packaged-WASM lane stopped before verification even though npm_execpath named a working npm CLI. Package verifiers should resolve npm once at their process boundary and invoke the selected JavaScript entry with Node.

Change and scope

execNpm in verify-package-core.mjs is now the owner of package-verifier npm selection. It uses caller-provided npm_execpath; without one it uses Node's adjacent npm CLI on Windows and retains direct npm execution elsewhere. Seven consumers now use it, and the two Windows-specific duplicates are removed. No shell, retry, path scan, cache, or output expansion was introduced.

Contract and boundary impact

  • Semantic owner and earliest changed stage: package-verifier process launch in scripts/lib/verify-package-core.mjs.
  • Contribution scope fit and linked maintainer decision: ordinary defect fix within existing package-verifier authority; additional maintainer scope decision is not applicable.
  • CLI and MCP/tool-catalog contract: no product CLI, MCP, schema, or catalog change.
  • Provider, bridge, target-format, or platform compatibility: fixes Windows npm launch; preserves non-Windows fallback and caller-selected npm.
  • Evidence, artifact, provenance, or reconstruction contract: no product Evidence change; verification artifact ownership is preserved.
  • Target selection, authority, upstream behavior, and cleanup details: existing npm operations and their workspaces are unchanged; argument arrays remain shell-free.
  • Generated metadata, package, or installation impact: no metadata change; package verification and installation scripts share the corrected launcher.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: process-boundary tests launch a caller-selected entry from a path with spaces and, on Windows, remove npm_execpath and launch a controlled npm entry adjacent to a temporary node.exe; both verify exact arguments and cwd. The fallback test is pinned in the curated Windows lane and its anti-drift check. The existing pack-isolation regression also passes.
  • Base reproduction: #4125 records real Windows spawn npm ENOENT from the generic pack/install helpers.
  • User-visible CLI/MCP output: not applicable; verifier-only boundary.
  • Remaining proof gaps: the full packaged-WASM lane remains blocked by independent #4128, #4134, and #4136; no bypass for them is included.

The real ordinary-user Windows 11 x64 lane used Node 24.18.0/npm 11.16.0, two logical CPUs, BelowNormal priority, and a 1 GiB Job limit. Both caller-selected and no-npm_execpath fallback modes passed version and real npm pack operations with fresh caches. Their 227-byte tarballs were byte-identical and contained the expected file with spaces. Job wall was 58.431 s, sampled CPU 8.531 s, peak Job commit 128,131,072 bytes, sampled family working-set peak 183,529,472 bytes, output 740 bytes, stderr empty, and Job0. The tested helper SHA-256 equals the final rebased head's helper SHA-256.

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run check:fast — passed on final head; uncached typecheck/lint, 22.456 s.
  • npm run test:focused -- tests/boundary/process/packageNpmInvocation.test.ts tests/boundary/process/packagePackIsolation.test.ts — selected-entry and pack-isolation cases passed locally; the Windows fallback case skipped by platform.
  • npm run test:focused -- tests/boundary/process/packageNpmInvocation.test.ts tests/process-global/curatedWindowsLane.test.ts — 5 passed, 1 Windows-only skip locally; lane anti-drift coverage passed 4/4.
  • Exact-head GitHub CI — 35/35 jobs passed, including the Windows fallback test and complete verify:package:windows.
  • Codex and Greptile reviews — passed on exact head with zero unresolved threads.
  • npm run test:focused -- tests/boundary/process/releaseArtifactCanary.test.ts — 1/1 passed; installed-tarball rehearsal and catalog-drift rejection.
  • Ordinary-user Windows selected/fallback npm + real pack lane — both modes passed; source preserved, empty stderr, Job0.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: real Windows npm/package boundary; no provider behavior changed.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no shell interpolation; caller-selected executable inputs and execFile options remain explicit. The real lane used native Job ownership and left no matching process.

Author readiness

Human owner: @N0zoM1z0

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/4153 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/windows-package-npm-launch-4125` --- ### 📝 Commits (2) - [`e8f7fd9`](https://github.com/morluto/rea/commit/e8f7fd9a69eec6d1109990f649caca50dc4ebd8d) fix(verifiers): launch npm through Node on Windows - [`2909ca5`](https://github.com/morluto/rea/commit/2909ca51b85b9ebec3e2c85a13f8f9626537d821) test(verifiers): cover Windows npm fallback ### 📊 Changes **11 files changed** (+143 additions, -49 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yml` (+1 -0) 📝 `scripts/ci/scopes.mjs` (+1 -0) 📝 `scripts/lib/verify-package-core.mjs` (+20 -0) 📝 `scripts/verify-package-install.mjs` (+4 -6) 📝 `scripts/verify-package-pack.mjs` (+4 -8) 📝 `scripts/verify-packaged-ghidra-windows.mjs` (+3 -9) 📝 `scripts/verify-packaged-wasm-artifact.mjs` (+2 -3) 📝 `scripts/verify-repository-skill.mjs` (+2 -3) 📝 `scripts/verify-windows-package.mjs` (+10 -20) ➕ `tests/boundary/process/packageNpmInvocation.test.ts` (+90 -0) 📝 `tests/process-global/curatedWindowsLane.test.ts` (+6 -0) </details> ### 📄 Description ## Summary Windows package verifiers now launch npm through its JavaScript entry point, so standard Node distributions no longer fail with `spawn npm ENOENT`. The shared boundary replaces every raw or duplicated package-verifier npm launcher while preserving caller-selected npm, arguments, environment, cwd, limits, and error details. Fixes #4125. ## Problem and expected behavior `execFile("npm", ...)` cannot execute the `npm.cmd` exposed by standard Windows Node distributions. A real ordinary-user packaged-WASM lane stopped before verification even though `npm_execpath` named a working npm CLI. Package verifiers should resolve npm once at their process boundary and invoke the selected JavaScript entry with Node. ## Change and scope `execNpm` in `verify-package-core.mjs` is now the owner of package-verifier npm selection. It uses caller-provided `npm_execpath`; without one it uses Node's adjacent npm CLI on Windows and retains direct `npm` execution elsewhere. Seven consumers now use it, and the two Windows-specific duplicates are removed. No shell, retry, path scan, cache, or output expansion was introduced. ## Contract and boundary impact - Semantic owner and earliest changed stage: package-verifier process launch in `scripts/lib/verify-package-core.mjs`. - Contribution scope fit and linked maintainer decision: ordinary defect fix within existing package-verifier authority; additional maintainer scope decision is not applicable. - CLI and MCP/tool-catalog contract: no product CLI, MCP, schema, or catalog change. - Provider, bridge, target-format, or platform compatibility: fixes Windows npm launch; preserves non-Windows fallback and caller-selected npm. - Evidence, artifact, provenance, or reconstruction contract: no product Evidence change; verification artifact ownership is preserved. - Target selection, authority, upstream behavior, and cleanup details: existing npm operations and their workspaces are unchanged; argument arrays remain shell-free. - Generated metadata, package, or installation impact: no metadata change; package verification and installation scripts share the corrected launcher. Expected effects: - [x] Read existing files or captured data. - [x] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [x] Change process memory, registers, files, or configuration. - [x] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: process-boundary tests launch a caller-selected entry from a path with spaces and, on Windows, remove `npm_execpath` and launch a controlled npm entry adjacent to a temporary `node.exe`; both verify exact arguments and cwd. The fallback test is pinned in the curated Windows lane and its anti-drift check. The existing pack-isolation regression also passes. - Base reproduction: #4125 records real Windows `spawn npm ENOENT` from the generic pack/install helpers. - User-visible CLI/MCP output: not applicable; verifier-only boundary. - Remaining proof gaps: the full packaged-WASM lane remains blocked by independent #4128, #4134, and #4136; no bypass for them is included. The real ordinary-user Windows 11 x64 lane used Node 24.18.0/npm 11.16.0, two logical CPUs, BelowNormal priority, and a 1 GiB Job limit. Both caller-selected and no-`npm_execpath` fallback modes passed version and real `npm pack` operations with fresh caches. Their 227-byte tarballs were byte-identical and contained the expected file with spaces. Job wall was 58.431 s, sampled CPU 8.531 s, peak Job commit 128,131,072 bytes, sampled family working-set peak 183,529,472 bytes, output 740 bytes, stderr empty, and Job0. The tested helper SHA-256 equals the final rebased head's helper SHA-256. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run check:fast` — passed on final head; uncached typecheck/lint, 22.456 s. - `npm run test:focused -- tests/boundary/process/packageNpmInvocation.test.ts tests/boundary/process/packagePackIsolation.test.ts` — selected-entry and pack-isolation cases passed locally; the Windows fallback case skipped by platform. - `npm run test:focused -- tests/boundary/process/packageNpmInvocation.test.ts tests/process-global/curatedWindowsLane.test.ts` — 5 passed, 1 Windows-only skip locally; lane anti-drift coverage passed 4/4. - Exact-head GitHub CI — 35/35 jobs passed, including the Windows fallback test and complete `verify:package:windows`. - Codex and Greptile reviews — passed on exact head with zero unresolved threads. - `npm run test:focused -- tests/boundary/process/releaseArtifactCanary.test.ts` — 1/1 passed; installed-tarball rehearsal and catalog-drift rejection. - Ordinary-user Windows selected/fallback npm + real pack lane — both modes passed; source preserved, empty stderr, Job0. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: real Windows npm/package boundary; no provider behavior changed. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no shell interpolation; caller-selected executable inputs and `execFile` options remain explicit. The real lane used native Job ownership and left no matching process. ## Author readiness Human owner: @N0zoM1z0 - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:11:48 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6092
No description provided.