Skip to content

fix(vibe-tests): run pnpm through cmd.exe on Windows in fixture-suite - #5841

Merged
cixzhang merged 1 commit into
meta:mainfrom
HelloOjasMutreja:fix/vibe-tests-spawnsync-pnpm-windows
Sep 3, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
HelloOjasMutreja:fix/vibe-tests-spawnsync-pnpm-windows

Conversation

@HelloOjasMutreja

Copy link
Copy Markdown
Contributor

Problem

internal/vibe-tests/src/fixture-suite.mjs calls spawnSync('pnpm', ...) in two places (workspacePackagePaths, and the pnpm install/typecheck/build calls in buildFixture). On Windows, pnpm is a .cmd batch file, and spawnSync can only execute a batch file through a shell:

  • A bare 'pnpm' fails with ENOENT — Node never resolves it through PATHEXT without a shell.
  • An explicit 'pnpm.cmd' still fails, with EINVAL — batch files need a shell even called by their exact name.

Since a failed spawn (status: null, error: ENOENT) leaves result.stderr as undefined rather than a string, the actual failure was masked by a confusing second crash: TypeError: Cannot read properties of undefined (reading 'trim').

This blocks check:fixtures (recently added to check:repo, which runs on every pnpm check:repo and in the pre-commit hook via lint-staged/husky) on Windows entirely — every commit fails at this step regardless of what it touches.

Fix

Added a spawnPnpmSync(args, options) helper: shells through cmd.exe /d /s /c pnpm ... on win32, calls pnpm directly elsewhere. Every call site here passes hardcoded argument literals, never user input, so this avoids Node's DEP0190 shell-argument-escaping deprecation warning that plain spawnSync(..., {shell: true}) would otherwise emit on every run.

Also hardened the error-message fallback (result.stderr ?? result.error?.message ?? '') so a genuine future spawn failure reports the real error instead of crashing on .trim().

Testing

  • node internal/vibe-tests/scripts/fixture-suite.mjs verify — passes cleanly (previously crashed) with no deprecation warnings.
  • Fail-first verified: internal/vibe-tests/src/fixture-suite.test.mjs's existing validates provenance, manifests, hashes, package pins, and isolation test (which calls validateCanonicalSuite(), exercising the crashing path) fails against the unfixed source with the exact reported symptom, and passes with the fix — no new test needed, this one already covers it.
  • npx vitest run internal/vibe-tests/src/fixture-suite.test.mjs — 21/21 pass.

This file is excluded from the main eslint config (.mjs outside packages/cli), so no lint step applies.

Found while investigating an unrelated PR — noticed the same unguarded spawnSync('pnpm', ...) pattern also exists in fixture-browser.mjs and setup-test/run-setup.mjs; flagging that separately rather than expanding this PR's scope.

pnpm is a .cmd batch file on Windows, which spawnSync can only execute
through a shell — a bare 'pnpm' fails with ENOENT (never resolved
through PATHEXT) and an explicit 'pnpm.cmd' fails with EINVAL (batch
files need a shell even named exactly). Every pnpm call here already
passes hardcoded argument literals, never user input, so shelling out
via cmd.exe /c directly (rather than spawnSync's shell:true) avoids
Node's shell-argument-escaping deprecation warning while fixing the
actual crash: workspacePackagePaths threw a confusing
'Cannot read properties of undefined (reading trim)' instead of the
real error, because a failed spawn (status: null, error: ENOENT)
leaves result.stderr undefined rather than a string.

This blocked every commit on Windows once check:fixtures landed in
check:repo — verified check:fixtures now passes and the existing
fail-first regression test (fixture-suite.test.mjs) covers it.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 1, 2026
@vercel

vercel Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 1, 2026 8:28pm UTC

Request Review

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Sep 1, 2026
@HelloOjasMutreja
HelloOjasMutreja marked this pull request as ready for review September 1, 2026 20:50
github-actions Bot added a commit that referenced this pull request Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

Preview availability: Storybook and Sandbox were not published for this CI run.

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | View full report

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is a clean compatibility fix. The direct cmd.exe invocation matches Node’s documented Windows batch-file path and keeps the shell boundary limited to literal arguments.

[Reviewed by Robohands]

@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Sep 3, 2026
@cixzhang
cixzhang merged commit 0274067 into meta:main Sep 3, 2026
31 checks passed
josephfarina pushed a commit that referenced this pull request Sep 4, 2026
…#5841)

pnpm is a .cmd batch file on Windows, which spawnSync can only execute
through a shell — a bare 'pnpm' fails with ENOENT (never resolved
through PATHEXT) and an explicit 'pnpm.cmd' fails with EINVAL (batch
files need a shell even named exactly). Every pnpm call here already
passes hardcoded argument literals, never user input, so shelling out
via cmd.exe /c directly (rather than spawnSync's shell:true) avoids
Node's shell-argument-escaping deprecation warning while fixing the
actual crash: workspacePackagePaths threw a confusing
'Cannot read properties of undefined (reading trim)' instead of the
real error, because a failed spawn (status: null, error: ENOENT)
leaves result.stderr undefined rather than a string.

This blocked every commit on Windows once check:fixtures landed in
check:repo — verified check:fixtures now passes and the existing
fail-first regression test (fixture-suite.test.mjs) covers it.
cixzhang pushed a commit that referenced this pull request Nov 11, 2026
* test(cli): run the Core rebuild through cmd.exe on Windows

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 #5841 and #5843. Every argument is a literal,
so this avoids shell: true and its DEP0190 warning. Other platforms are
unchanged.

* test(cli): keep the Core rebuild to one execFileSync call

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.

* chore(changeset): note the Windows Core rebuild in the CLI release

ensure-core-built.mjs ships in the @astryxdesign/cli tarball, so the
change needs a CLI patch changeset, as #8567's did for this helper.

This branch was successfully deployed

1 active deployment
Preview — 70be1131 Deployed Sep 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants