Skip to content

Fix two latent Windows faults in packages/ui - #179

Merged
jimhoyd merged 1 commit into
mainfrom
claude/fix-windows-url-pathname
Sep 19, 2026
Merged

jimhoyd merged 1 commit into
mainfrom
claude/fix-windows-url-pathname

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator

main went red on all three windows-latest legs after #177 merged. Four
tests failed, all in packages/ui.

None of it is migration damage. These are bugs ui always had; its own
verify.yml ran ubuntu-latest only, so this code had never been executed on
Windows. Core's matrix runs the full OS cross product on push to main and
found them immediately — the same pattern as CodeQL scanning these packages for
the first time.

Test Cause
list, eject, preview (test/cli.test.ts) new URL('..', import.meta.url).pathname is /D:/a/urlcode/... on Windows — leading slash, forward slashes, not a valid path. spawnSync fails and status is null, not 0.
packed tarball (test/package.test.ts) execFileSync('npm', …) is ENOENT on Windows: npm is npm.cmd, which execFileSync will not resolve without a shell.

Both fixes use idioms core already had — fileURLToPath, and the
process.platform === 'win32' ? 'npm.cmd' : 'npm' check from
scripts/build-candidate.ts. Nothing else under packages/ spawns npm or
reads .pathname off a file URL.

Note this PR's own checks run Linux-only by design, so they cannot confirm the
Windows fix; the push-to-main run after merge is what proves it.

🤖 Generated with Claude Code

main went red on all three windows-latest legs after #177 merged. Four tests
failed, all in ui, and none of them are migration damage -- they are bugs ui
always had. Its own verify.yml ran ubuntu-latest only, so nothing had ever
executed this code on Windows. Core's matrix runs the full OS cross product on
push to main and found them on first contact.

test/cli.test.ts passed `new URL('..', import.meta.url).pathname` as a spawn
cwd. On Windows that is "/D:/a/urlcode/..." -- leading slash, forward slashes,
not a valid path -- so spawnSync failed and status came back null instead of 0.
Three tests died on it. fileURLToPath is the correct conversion and is what
core already uses.

test/package.test.ts called execFileSync('npm', ...), which is ENOENT on
Windows because npm is npm.cmd and execFileSync does not resolve it without a
shell. scripts/build-candidate.ts already had the platform check; this now
matches it.

Nothing else in packages/ spawns npm or reads .pathname off a file URL.

To be clear about the CI behavior, since main being red looks alarming: this is
the documented design. ci.yml runs the Node axis on Linux for pull requests and
the full three-OS cross product on push to main, and says so -- "platform-
specific faults (path case, symlinks, separators) still get caught, just one
push to main later where the full cross product runs." Fixing forward is the
intended flow, not a gap.

Co-Authored-By: Claude Opus 5 <[email protected]>
@jimhoyd
jimhoyd merged commit cc582f2 into main Sep 19, 2026
10 checks passed
@jimhoyd
jimhoyd deleted the claude/fix-windows-url-pathname branch September 19, 2026 23:21
jimhoyd added a commit that referenced this pull request Sep 19, 2026
Follow-up to #179. Naming npm.cmd got past ENOENT and into EINVAL: since the CVE-2024-27980 fix, Node refuses to spawn a .cmd without shell: true. Runs npm-cli.js under the current Node instead, the idiom scripts/pack-sources.mjs already uses.
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.

1 participant