Skip to content

fix(wgsl): resolve tmpdir symlink before comparing webpack fileDependencies on macOS - #382

Merged
matiasngf merged 2 commits into
vercel-labs:mainfrom
ColinL-code:fix/webpack-real-test-macos-realpath
Sep 1, 2026
Merged

fix(wgsl): resolve tmpdir symlink before comparing webpack fileDependencies on macOS#382
matiasngf merged 2 commits into
vercel-labs:mainfrom
ColinL-code:fix/webpack-real-test-macos-realpath

Conversation

@ColinL-code

@ColinL-code ColinL-code commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Diagnosis

The "addDependency wiring" test in webpack-real.test.ts asserts that stats.compilation.fileDependencies contains the transitively-imported helper.wgsl. On macOS this assertion fails, even though the loader correctly registers the dependency.

This is because os.tmpdir() on macOS returns a path under /var/folders/..., but /var is itself a symlink to /private/var. Webpack's resolver follows symlinks by default, so fileDependencies records the resolved /private/var/folders/.../helper.wgsl path, while the test compares against the un-resolved /var/folders/.../helper.wgsl it wrote the fixture to. So the string comparison fails even though the file is tracked properly.

Fix

Resolve the expected path with fs.realpath before comparing.

Evidence (before / after)

Before (macOS, node v22.22.2):

AssertionError: expected false to be true
 ❯ packages/wgsl/tests/webpack-real.test.ts:78:64

After: all 5 tests in webpack-real.test.ts pass.

Gates run (macOS, Node 22.22.2)

Gate Result
pnpm typecheck
pnpm test:fast ✅ 766 passed / 76 skipped

Notes

No changeset included since this is a test-only change, no published package behavior affected.

@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

@ColinL-code is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@matiasngf matiasngf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the test-only path canonicalization and its security impact. The change correctly resolves macOS /var → /private/var path differences without altering production behavior. Targeted webpack test passes locally (5/5).

@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
vgpu Ready Ready Preview, v0 Sep 1, 2026 1:16pm UTC
@matiasngf

Copy link
Copy Markdown
Collaborator

@ColinL-code can you please sign your commit?

image
@ColinL-code
ColinL-code force-pushed the fix/webpack-real-test-macos-realpath branch from 3a3b62e to 5c873f0 Compare September 1, 2026 03:14
@ColinL-code

Copy link
Copy Markdown
Contributor Author

Signed my commit

@matiasngf
matiasngf enabled auto-merge September 1, 2026 13:15
@matiasngf
matiasngf merged commit 671d1be into vercel-labs:main Sep 1, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants