Repository navigation
test(cli): run the Core rebuild through cmd.exe on Windows - #11051
Conversation
The node global setup rebuilds a stale Core with execFileSync('pnpm').
On Windows pnpm is a pnpm.cmd batch file, which execFileSync can't start
without a shell, so the setup dies with "spawnSync pnpm ENOENT" and no CLI
test runs whenever Core's sources are newer than its build.
Route the call through cmd.exe /d /s /c on win32, the same way the
vibe-tests helpers do since meta#5841 and meta#5843. Every argument is a literal,
so this avoids shell: true and its DEP0190 warning. Other platforms are
unchanged.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Thanks for tracking this down. Routing the rebuild through cmd.exe /d /s /c on Windows matches what internal/vibe-tests already does, and the macOS/Linux path is unchanged. One existing test needs an update before this can merge.
Blocking
packages/cli/foundation/doc-compiler/doc-loads.test.mjs("lists each one with exactly the sites it has") now fails:buildCore()has twoexecFileSynccalls, and the file's entry lists one (ensure-core-built.mjs runs [child_process.execFileSync ×2], listed [child_process.execFileSync]).
Next step: pick the executable and its arguments by platform and keep a single execFileSync(file, fileArgs, options) call, which passes the test as it is, or change the entry to child_process.execFileSync ×2.
[Automated review]
doc-loads.test.mjs lists each file's child_process sites, and the platform branch had made two. Pick the executable and its arguments by platform and keep the single call.
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet; a maintainer adds the ci:run label so CI runs.
Routing the Core rebuild through cmd.exe /d /s /c pnpm on Windows fixes the setup failure while macOS and Linux keep the same pnpm call, and the single execFileSync call keeps doc-loads.test.mjs green. Nothing else needs to change here. As an optional follow-up, authoring-migration.tsc.test.mjs still calls pnpm directly and hits the same Windows error.
[Automated review]
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Changes requested: one fix before this can merge.
- Found by CI: the required
lintcheck fails at "Check Changeset coverage" becausepackages/cli/clients/cli/commands/ensure-core-built.mjsships in the@astryxdesign/clitarball (itsfilesincludeclients), so please add a Changeset naming'@astryxdesign/cli': patchwith a[chore]summary, as #8567's.changeset/core-build-freshness.mddid for this helper.
Routing the rebuild through cmd.exe /d /s /c pnpm on Windows looks right, and macOS and Linux keep the same call. Please also correct the description's "nothing here ships to consumers" and "CI impact: none" lines, which this CI run contradicts.
[Automated review]
ensure-core-built.mjs ships in the @astryxdesign/cli tarball, so the change needs a CLI patch changeset, as meta#8567's did for this helper.
There was a problem hiding this comment.
Approved pending CI: CI is still running on this head.
The new @astryxdesign/cli Changeset covers ensure-core-built.mjs, so the Changeset coverage check now passes, and routing the Core rebuild through cmd.exe /d /s /c pnpm on Windows keeps macOS and Linux on the same call as before.
- Optional: the description still says the coverage check "reports nothing here ships to consumers, so no changeset" and "CI impact: none"; updating those two lines would match the Changeset this head adds.
|
Added the changeset in ddf4d84 ( You're right about the description. My earlier coverage run was against an uncommitted tree, so it compared nothing. I've corrected the "nothing here ships" and "CI impact" lines. I'll leave |
Maintainer impact
On Windows, the CLI test suite can't start once Core's sources are newer than its build. That happens after any pull, branch switch or edit under
packages/core. Since #8567 the node global setup rebuilds a stale Core withexecFileSync('pnpm', …), and that call fails before a single test runs:The usual ways of getting pnpm on Windows (corepack,
npm i -g pnpm, the standalone installer's shims) put apnpm.cmdbatch file on PATH.execFileSynccan't start a batch file without a shell. A barepnpmisn't resolved throughPATHEXT, so you getENOENT, andpnpm.cmdgivesEINVAL(Node refuses batch files without a shell since the CVE-2024-27980 fix).The only workaround today is building Core by hand before every test run, which isn't obvious from the error.
Intended invariant
The node global setup rebuilds a Core build older than its sources before the workers start (#8567). That should hold on every platform contributors use, not only where
pnpmis a real executable.Change
In
buildCore(), onwin32only, runcmd.exe /d /s /c pnpm -F @astryxdesign/core buildinstead ofpnpmdirectly. This is the same patterninternal/vibe-testsalready uses (#5841, #5843). The arguments are literals, so we avoidshell: trueand itsDEP0190warning. Options (cwd,stdio: 'pipe', timeout) are unchanged, and macOS/Linux take exactly the old path.The two other bare
execFileSync('pnpm', …)calls are in.github/scripts/(visual-gate/lib/sources.mjs,cli-api-types-verify.mjs), which only run on Linux runners. I left them alone to keep this to the one call that blocks local test runs.Evidence
Failure before the change: Windows 10, Node 24.22.1, pnpm 11.10.0 available only as
pnpm.cmdon PATH. Touchedpackages/core/src/index.ts(mtime only) so the setup sees a stale build, then:→
Error: spawnSync pnpm ENOENTfrombuildCore(trace above), no tests run.Success after the change: same PATH, touched the same file again, same command. The setup rebuilt Core (the
dist/astryx.cssmarker went from older than the touched source to newer) and the run finished:A failing build still fails:
execFileSync('cmd.exe', ['/d', '/s', '/c', 'pnpm', '-F', '@astryxdesign/core', 'run', 'no-such-script'])throws withstatus 1, so a broken Core build still stops the setup instead of being swallowed bycmd.exe.Product/runtime behavior verified unchanged: the file is a test helper (called by the node global setup and the build-theme suites), but it ships in the
@astryxdesign/clitarball becausefilesincludesclients. So it has a[chore]CLI patch changeset (.changeset/windows-core-rebuild.md), as test(cli): the node suites rebuild a Core build older than its sources #8567 did for this helper.changeset-coverage.mjs pr --base origin/mainnow reports it ships to@astryxdesign/cliand is named. No CLI command changes behavior.CI impact: no workflow or job changes. On Linux CI the rebuild runs the same
pnpmcommand as before. The changeset is what the requiredlintjob checks for.Scope
Components: CLI test setup (
packages/cli/clients/cli/commands/ensure-core-built.mjs)Testing
pnpm.cmdon PATH.pnpm exec prettier --checkandpnpm exec eslinton the changed file: clean.pnpm -F @astryxdesign/cli typecheck:strict: no errors in this file. The only errors are two existingassets/templatesimports of@astryxdesign/theme-neutral/built, which need that package built locally.pnpm check:changesetsandchangeset-coverage.mjs pr --base origin/mainpass on the head.execFileSync('pnpm', args, options)call as before.