Skip to content

test: resolve the Windows temp directory to its long name - #9573

Merged
juliusmarminge merged 1 commit into
windows-tests/temp-cleanupfrom
windows-tests/short-tempdir
Sep 4, 2026
Merged

test: resolve the Windows temp directory to its long name#9573
juliusmarminge merged 1 commit into
windows-tests/temp-cleanupfrom
windows-tests/short-tempdir

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Sep 4, 2026

Copy link
Copy Markdown
Member

GitHub's Windows runners set TEMP to the 8.3 short form
(C:\Users\RUNNER~1...), and every path that goes through git or realpath
comes back in the long form, so equality checks between a temp directory and
its canonical form fail. A shared setup file, run by every package's vitest
config, points TEMP/TMP at the long form once so os.tmpdir() and everything
built on it agree with the canonical spelling.

bootstrap.test opens the platform null device instead of /dev/null and skips
the FIFO case, since Windows has neither.

Part of the Windows test-suite stack rooted at #9564; the manual Windows lane comes from #9538.

Model: Claude Fable 5 in Claude Code.

🤖 Generated with Claude Code

Note

Resolve Windows temp directory to long name in test setup

  • Adds longTempDir.ts, which on win32 resolves the canonical long form of the temp directory and assigns it to TEMP and TMP; non-Windows hosts and resolution failures are left unchanged
  • Wires this setup module into the root, desktop, web, and client-runtime Vite test configs via an absolute path or package subpath export in package.json
  • Updates bootstrap.test.ts to select the platform-specific null device (NUL vs /dev/null) and skips the FIFO timeout test on Windows
  • Behavioral Change: Windows test runs now see long-form TEMP/TMP paths; if resolution fails the environment is untouched

Macroscope summarized 5032af7.


Note

Low Risk
Test-only environment and platform-guard changes; production runtime behavior is unchanged aside from optional Vitest setup on Windows.

Overview
Adds shared Vitest setup longTempDir.ts that on win32 rewrites TEMP and TMP to the canonical long path from realpathSync, so os.tmpdir() matches git/realpath spelling on GitHub Windows runners (8.3 short names). The module is exported from @t3tools/shared and registered in the root, desktop, web, and client-runtime Vite test configs (server inherits it via mergeConfig with its existing git setup).

bootstrap.test.ts uses NUL vs /dev/null for null-device FD tests and skipIf(windowsHost) on the FIFO timeout case because Windows lacks mkfifo.

Reviewed by Cursor Bugbot for commit 5032af7. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.6 KiB 15.1 KiB
Codex Thread snapshot wire 7.0 KiB 7.3 KiB
Codex Live turn WebSocket wire 6.6 KiB 7.8 KiB
Codex Live turn WebSocket decoded 57.1 KiB 66.4 KiB
Codex Live turn messages 10 21
Claude Total thread wire 13.5 KiB 15.1 KiB
Claude Thread snapshot wire 7.0 KiB 7.3 KiB
Claude Live turn WebSocket wire 6.5 KiB 7.8 KiB
Claude Live turn WebSocket decoded 57.8 KiB 66.4 KiB
Claude Live turn messages 9 21

Baseline: unavailable · PR result: 5032af7 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 113.8 KiB
  • Claude decoded thread snapshot: 114.5 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@juliusmarminge
juliusmarminge force-pushed the windows-tests/short-tempdir branch from 961dded to 9680435 Compare September 4, 2026 03:20
@juliusmarminge
juliusmarminge force-pushed the windows-tests/short-tempdir branch from 9680435 to e13884f Compare September 4, 2026 03:22
@juliusmarminge
juliusmarminge force-pushed the windows-tests/short-tempdir branch 2 times, most recently from 992061d to 6c57fd2 Compare September 4, 2026 04:54
@juliusmarminge
juliusmarminge force-pushed the windows-tests/short-tempdir branch from 6c57fd2 to dae7042 Compare September 4, 2026 07:20
@juliusmarminge
juliusmarminge force-pushed the windows-tests/short-tempdir branch from dae7042 to 7fb0412 Compare September 4, 2026 07:20
@juliusmarminge
juliusmarminge force-pushed the windows-tests/short-tempdir branch from 7fb0412 to 1fc7279 Compare September 4, 2026 07:28
@juliusmarminge
juliusmarminge force-pushed the windows-tests/short-tempdir branch from 1fc7279 to 42fa62e Compare September 4, 2026 07:32
@juliusmarminge
juliusmarminge marked this pull request as ready for review September 4, 2026 07:35
@macroscopeapp

macroscopeapp Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This is a focused, test-only Windows portability change that canonicalizes temporary directories and avoids unsupported POSIX test primitives, with no product-path behavior changes. The new shared test setup also adds a file-level suppression for an Effect static-analysis diagnostic, warranting explicit human review.

No code changes detected at 5032af7. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

@ylcn91

ylcn91 commented Sep 4, 2026

Copy link
Copy Markdown

Same failure on macOS, from the other side: os.tmpdir() is /var/folders/… and anything canonicalised comes back as /private/var/folders/…. On a Mac from today's main:

FAIL  src/entrypoint.test.ts > isEntrypoint > matches through a symlinked entrypoint, as npm and npx install it
AssertionError: expected false to be true

FAIL  src/provider/Layers/CursorProvider.test.ts > Cursor skills > discovers recursive project skills with project precedence
-     "path": "/var/folders/…/T/cursor-skills-workspace-s4PxXA/.cursor/skills/internal/SKILL.md",
+     "path": "/private/var/folders/…/T/cursor-skills-workspace-s4PxXA/.cursor/skills/internal/SKILL.md",

#9400 and #9401 fix those two in place by resolving the temp dir before asserting (#9389, #9388). Your setup file would cover them as well: with TMPDIR pointed at realpathSync.native(os.tmpdir()) and the tests untouched, both files pass (30/30), same as with the two patches applied.

So if you would rather drop the win32 guard in longTempDir.ts and set TMPDIR on darwin too, I am happy to close #9400/#9401 in favour of this one, or to fold that change into here, whichever you prefer.

@juliusmarminge
juliusmarminge force-pushed the windows-tests/short-tempdir branch 2 times, most recently from e166947 to 88a2b95 Compare September 4, 2026 17:48
@juliusmarminge
juliusmarminge force-pushed the windows-tests/short-tempdir branch 2 times, most recently from 46825fd to 04684f5 Compare September 4, 2026 18:07
GitHub's Windows runners set TEMP to the 8.3 short form
(C:\Users\RUNNER~1\...), and every path that goes through git or realpath
comes back in the long form, so equality checks between a temp directory and
its canonical form fail. A shared setup file, run by every package's vitest
config, points TEMP/TMP at the long form once so os.tmpdir() and everything
built on it agree with the canonical spelling.

bootstrap.test opens the platform null device instead of /dev/null and skips
the FIFO case, since Windows has neither.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@juliusmarminge
juliusmarminge force-pushed the windows-tests/short-tempdir branch from 04684f5 to 5032af7 Compare September 4, 2026 20:26
@juliusmarminge
juliusmarminge merged commit 9fa54ee into main Sep 4, 2026
35 of 46 checks passed
@juliusmarminge
juliusmarminge deleted the windows-tests/short-tempdir branch September 4, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants