fix: revert execNpm import in check-env.cjs, keep the diagnosis improvement

The execNpm-routing redesign (previous commit) broke every real CI job:
check-env.cjs runs as its own standalone "Environment check" step BEFORE
`npm ci` / `npm run build:lib` -- a deliberate pre-flight, run before
there is even a node_modules to build with. Its require of
../gsd-core/bin/lib/shell-command-projection.cjs (a tsc-compiled artifact
that plain does not exist at that point in the pipeline) crashed with
MODULE_NOT_FOUND on every platform, immediately, confirmed via the real
CI log. My own local gsd-test run never caught this because it doesn't
replicate that exact pre-build step ordering.

Reverted the cross-module require entirely; check-env.cjs is back to a
self-contained spawnSync(npmCmd, ...) call, no requires reaching into
gsd-core/bin/lib. Kept the two things actually worth keeping from that
detour:
  - the 15_000ms timeout (matches execNpm's own default elsewhere in this
    repo -- not invented, an existing precedent -- vs. the original 10s
    that failed twice under real Windows CI contention);
  - computing `timedOut` via `error.code === 'ETIMEDOUT'` inline (the
    same canonical, cross-platform-correct predicate that seam uses),
    rather than the earlier signal === 'SIGTERM' check, which that seam's
    own docstring documents as platform-fragile with a Windows-specific
    false-negative risk.

Manually verified check-env.cjs runs correctly with gsd-core/bin/lib
temporarily removed entirely (simulating the real pre-npm-ci CI
ordering) before re-running gsd-test, since this repo blocks local
node --test.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
sim
2026-09-09 07:23:00 -04:00
parent 1cd17cc3d6
commit 8731a90be6
3 changed files with 63 additions and 34 deletions

View File

@@ -11,11 +11,17 @@
* now correctly reports "timed out under CI load" for exactly that case.
*
* describeNpmVersionCheckFailure is the extracted, pure reason-selection
* logic operating on execNpm's SpawnResultOutput shape (the canonical
* OS-shell-projection seam, src/shell-command-projection.cts). Kept in
* scripts/lib/ (not scripts/check-env.cjs itself, which runs its CLI
* unconditionally on require) so it can be required directly here without
* triggering a real environment check.
* logic. It takes a plain result object shaped like this repo's canonical
* OS-shell-projection seam's SpawnResultOutput (execNpm,
* src/shell-command-projection.cts) -- same `timedOut` (error.code ===
* 'ETIMEDOUT') semantics -- but check-env.cjs computes that shape inline
* rather than importing the seam itself: that seam's compiled output
* (gsd-core/bin/lib/*.cjs) does not exist yet when check-env.cjs runs as
* its own standalone pre-`npm ci` CI step (an earlier version of this fix
* imported it directly and crashed every real CI job with
* MODULE_NOT_FOUND). Kept in scripts/lib/ (not scripts/check-env.cjs
* itself, which runs its CLI unconditionally on require) so it can be
* required directly here without triggering a real environment check.
*/
const { describe, test } = require('node:test');