Skip to content

[vite-plugin] fix: resolve temp dir to long form in E2E tests (Windows)#14140

Merged
petebacondarwin merged 1 commit into
mainfrom
pbd/fix-vite-e2e-windows-shortpath
Jun 1, 2026
Merged

[vite-plugin] fix: resolve temp dir to long form in E2E tests (Windows)#14140
petebacondarwin merged 1 commit into
mainfrom
pbd/fix-vite-e2e-windows-shortpath

Conversation

@petebacondarwin
Copy link
Copy Markdown
Contributor

No tracking issue; surfaced via the Windows Vite Plugin E2E job spiking to ~100% failure rate on 2026-06-01.

Vite 8.0.16 (published 2026-06-01 09:50 UTC) and its v6/v7 backports introduced a security fix (vitejs/vite#22572, GHSA-fx2h-pf6j-xcff) that rejects paths containing ~ or : to prevent path traversal via NTFS Alternate Data Streams and Windows 8.3 short names.

On Windows GitHub Actions runners, os.tmpdir() returns:

C:\Users\RUNNER~1\AppData\Local\Temp

(RUNNER~1 is the 8.3 short form of runneradmin.) Our Vite plugin E2E suite seeds every fixture under that path via fs.mkdtemp(path.join(os.tmpdir(), "vite-plugin-")) in e2e/global-setup.ts, so every Windows E2E test now fails immediately with:

Error: Failed to load url /api/index.ts
  (resolved id: C:/Users/RUNNER~1/AppData/Local/Temp/vite-plugin-j5N8yD/basic/pnpm/api/index.ts) in

Counts at the time of writing:

Day Successes Failures
May 31 9 0
Jun 1 (so far) 11* 12

*the "passes" on Jun 1 after the regression are turbo remote-cache hits, not real runs.

This change resolves the temp dir to its real long-form path with fs.realpath() before passing it to fs.mkdtemp(). The expanded path no longer contains ~, so Vite accepts it. No behaviour change on macOS/Linux (where realpath(os.tmpdir()) either returns the same path or follows the /var/private/var symlink on macOS, which is the correct full path anyway).

This matches the existing pattern in packages/workers-utils/src/test-helpers/run-in-tmp.ts, which already wraps mkdtempSync in realpathSync.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because: this fixes the E2E test harness itself — the existing E2E suite is the test. The CI run on this PR (Windows job in particular) is the verification. No new test could meaningfully cover "the test harness chooses a path Vite accepts" beyond running the suite.
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: internal CI/test infrastructure fix with no user-visible behaviour change.

Vite 8.0.16 (and the v6/v7 backports) rejects paths containing `~` or `:` as
a security fix for GHSA-fx2h-pf6j-xcff (path traversal via NTFS Alternate
Data Streams and Windows 8.3 short names — see
vitejs/vite#22572).

On Windows GitHub Actions runners, `os.tmpdir()` returns
`C:\Users\RUNNER~1\AppData\Local\Temp` (the 8.3 short form of
`runneradmin`), so every fixture path created under it now fails Vite's new
check, causing every Windows E2E test to fail immediately with
`Failed to load url /api/index.ts` during dev server startup.

Resolving the temp dir via `fs.realpath()` expands the short name to its
long form before `fs.mkdtemp()`, which Vite accepts. No behaviour change on
macOS/Linux.
@petebacondarwin petebacondarwin added the no-changeset-required Skip PR check for valid changeset label Jun 1, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 1, 2026

⚠️ No Changeset found

Latest commit: a7f51f0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Jun 1, 2026

LGTM

github run

@workers-devprod workers-devprod requested review from a team and james-elicx and removed request for a team June 1, 2026 12:22
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Jun 1, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

Copy link
Copy Markdown
Contributor

@workers-devprod workers-devprod left a comment

Choose a reason for hiding this comment

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

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Jun 1, 2026
@petebacondarwin petebacondarwin enabled auto-merge (squash) June 1, 2026 12:27
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 1, 2026

create-cloudflare

npm i https://pkg.pr.new/cloudflare/workers-sdk/create-cloudflare@14140

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/deploy-helpers@14140

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/kv-asset-handler@14140

miniflare

npm i https://pkg.pr.new/cloudflare/workers-sdk/miniflare@14140

@cloudflare/pages-shared

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/pages-shared@14140

@cloudflare/unenv-preset

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/unenv-preset@14140

@cloudflare/vite-plugin

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/vite-plugin@14140

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/vitest-pool-workers@14140

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/workers-editor-shared@14140

@cloudflare/workers-utils

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/workers-utils@14140

wrangler

npm i https://pkg.pr.new/cloudflare/workers-sdk/wrangler@14140

@cloudflare/wrangler-bundler

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/wrangler-bundler@14140

commit: a7f51f0

@petebacondarwin petebacondarwin merged commit 33c3176 into main Jun 1, 2026
60 of 64 checks passed
@petebacondarwin petebacondarwin deleted the pbd/fix-vite-e2e-windows-shortpath branch June 1, 2026 12:34
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changeset-required Skip PR check for valid changeset

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants