Skip to content

wesl.toml symlinks and wesl.toml nesting#193

Merged
k2d222 merged 5 commits into
webgpu-tools:mainfrom
mighdoll:feat/some-symlinks
May 19, 2026
Merged

wesl.toml symlinks and wesl.toml nesting#193
k2d222 merged 5 commits into
webgpu-tools:mainfrom
mighdoll:feat/some-symlinks

Conversation

@mighdoll
Copy link
Copy Markdown
Contributor

@mighdoll mighdoll commented Mar 23, 2026

the first commit fixes an issue I found testing lygia.
basically, the effort to handle pathological wesl.toml configs with overlapping glob patterns was overeager. It followed symlinks as a way to identify overlaps, but exclude patterns are in the language of sources, not symlink targets.

the second commit mostly obsoletes the first commit by manually walking the fs tree. The second commit also implements sub directory wesl.toml files as proposed in spec webgpu-tools/wesl-spec#172. We haven't discussed that one yet, so the implementation here is speculative.

webgpu-tools#185 includes a test case for a pathological wesl.toml config with overlapping globs

previously, we deduplicated for that by using canonical fs paths, following symlinks
to absolute paths. But pnpm uses symlinks inside node_modules/,
so absolute paths might not match user exclude paths in wesl.toml. This broke in
lygia when I was using a link: dependency for development.

In this commit we switch to using lexical path normalization for deduplication,
processing '.' and '..' in paths. That way user exclude paths match.

And if a user wants to intentionally duplicate a file or path with a symlink,
they can now do that too.
Comment thread crates/wesl/src/wesl_toml.rs Outdated
Comment thread crates/wesl/src/wesl_toml.rs Outdated
r#"
edition = "2026_pre"
root = "./shaders/"
include = ["./shaders/**/*.wesl", "./shaders/../shaders/**/*.wesl"]
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.

is this no longer a valid test case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's always been a somewhat pathological user configuration, but it's still a valid test case..
The scanning approach fixes it architecturally though,
so it would be reasonable to remove the test case to remove a little test bulk.
preference?

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.

would be good to have at least one test to check that you can't access files outside of the project root using ... Maybe one too for valid uses of ... Or perhaps forbid .. entirely, as you said it's pathological.

@k2d222 k2d222 merged commit 9cf3717 into webgpu-tools:main May 19, 2026
9 checks passed
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.

2 participants