Discover shaders and pipeline packs through file symlinks #2474

Open
DoubleD17 wants to merge 1 commit from upstream-pr/2476 into main
DoubleD17 commented 2026-11-25 14:20:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DoubleD17 on 2026-11-25T14:20:41Z.


On Marvisak main, translate, translate --cache, and pipeline pack discovery skip symbolic links to files before reading them. This adapts fxceless/victory-fork #971 to the original CLI. The shared filter accepts a link when its target is a regular file of at most 2 GiB. It preserves directory traversal and each mode's metadata handling for regular files. Synthetic tests on Windows x64 with diagnostics compared main 940d32f and candidate 9d0656c. Both translation and cache warm-up found 1/0/0 on main and 1/1/1 on the candidate across the direct file, explicit symlink, and directory containing the file symlink. Cache checks also verified persisted entries. Broken links, nested directory links, and oversized targets stayed excluded. An explicit directory link worked on both revisions. In key-listing mode, both revisions found a direct synthetic empty pack. The candidate also found it through both file-link inputs. Pack selection happened on the CPU before WARP initialization, and the test created and loaded zero pipelines.

AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6606620848 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2476). Originally posted by [DoubleD17](https://github.com/DoubleD17) on 2026-11-25T14:20:41Z. --- On Marvisak main, `translate`, `translate --cache`, and pipeline pack discovery skip symbolic links to files before reading them. This adapts [fxceless/victory-fork #971](https://github.com/fxceless/victory-fork/pull/971) to the original CLI. The shared filter accepts a link when its target is a regular file of at most 2 GiB. It preserves directory traversal and each mode's metadata handling for regular files. Synthetic tests on Windows x64 with `diagnostics` compared main `940d32f` and candidate `9d0656c`. Both translation and cache warm-up found 1/0/0 on main and 1/1/1 on the candidate across the direct file, explicit symlink, and directory containing the file symlink. Cache checks also verified persisted entries. Broken links, nested directory links, and oversized targets stayed excluded. An explicit directory link worked on both revisions. In key-listing mode, both revisions found a direct synthetic empty pack. The candidate also found it through both file-link inputs. Pack selection happened on the CPU before WARP initialization, and the test created and loaded zero pipelines. AI-assisted.
DenRakEiw commented 2026-11-25 15:03:58 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T14:34:26Z.

Review: APPROVED


Verified against origin/main (940d32f):

  • Discovering shaders and pipeline packs through file symlinks builds cleanly and passes all victory tests.
  • cargo test -p victory: 12/12 passed.
  • cargo clippy -p victory --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 183 files ok.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6059618724 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2476#pullrequestreview-6059618724). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T14:34:26Z. **Review:** APPROVED --- Verified against `origin/main` (`940d32f`): - Discovering shaders and pipeline packs through file symlinks builds cleanly and passes all `victory` tests. - `cargo test -p victory`: 12/12 passed. - `cargo clippy -p victory --all-targets -- -D warnings`: 0 warnings. - `cargo xtask policy`: 183 files ok. AI-assisted (Gemini 4 Neon).
catminou4 commented 2026-11-25 15:03:58 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T14:57:40Z.

Review: COMMENTED


Discover shaders and pipeline packs through symlinks (apps/victory). Small refactor of shader_files; can't test the apps crate on macOS until #2334 merges. Static review: the dedup-by-canonical-path logic looks right.

<!-- greyfinch-sync:Marvisak/VIctory:review:6059997476 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2476#pullrequestreview-6059997476). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T14:57:40Z. **Review:** COMMENTED --- Discover shaders and pipeline packs through symlinks (apps/victory). Small refactor of shader_files; can't test the apps crate on macOS until #2334 merges. Static review: the dedup-by-canonical-path logic looks right.
cloph-dsp commented 2026-11-25 16:09:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-25T15:42:40Z.


Independent local validation for PR #2476 (Windows, Rust 1.100.0/MSVC, head 73ef2eb, no game data): cargo test --locked -p victory --bins -> 10 tests passed, 0 failed, exit 0. CPU-only regression run; synthetic symlink discovery scenario not replayed. AI-assisted (Hy4 flash). GPU/driver N/A (CPU tooling).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167262424 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2476#issuecomment-7167262424). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-25T15:42:40Z. --- Independent local validation for PR #2476 (Windows, Rust 1.100.0/MSVC, head 73ef2eb, no game data): `cargo test --locked -p victory --bins` -> 10 tests passed, 0 failed, exit 0. CPU-only regression run; synthetic symlink discovery scenario not replayed. AI-assisted (Hy4 flash). GPU/driver N/A (CPU tooling).
Marvisak commented 2026-11-25 16:09:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:54:30Z.


Automated triage for the maintainers.

This moves the four copies of the input walk in apps/victory (shader::run, translate::run, translate::warm, prebuild::run) into one shader_files filter that also accepts a symlink whose target is a regular file of at most MAX_FILE, so linked shader files and packs are no longer skipped. By reading, each caller keeps its old metadata policy (the three CLI modes still accept an entry whose metadata cannot be read, prebuild still rejects it, shader::run still prints "skipping large file"), and links to directories are still not traversed. CI: passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167419436 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2476#issuecomment-7167419436). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T15:54:30Z. --- <!-- victory-triage v1 head=73ef2ebaaf327c5b0a43d5ba293b8a301eb33b20 verdict=merge-candidate at=2026-11-25T15:53:19Z --> Automated triage for the maintainers. This moves the four copies of the input walk in `apps/victory` (`shader::run`, `translate::run`, `translate::warm`, `prebuild::run`) into one `shader_files` filter that also accepts a symlink whose target is a regular file of at most `MAX_FILE`, so linked shader files and packs are no longer skipped. By reading, each caller keeps its old metadata policy (the three CLI modes still accept an entry whose metadata cannot be read, prebuild still rejects it, `shader::run` still prints "skipping large file"), and links to directories are still not traversed. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
kotekompotek commented 2026-11-25 17:05:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T16:54:00Z.


Semantics preserved correctly: for regular files the same is_file && len <= MAX_FILE test; for symlinks fs::metadata follows the link so a symlink to a file is now included where file_type().is_file() used to drop it — that's the advertised change. allow_missing_metadata keeps each caller's old policy (translate/warm/shader-info included them, prebuild skipped). Large-file notice only where it was before.

One gap: a symlink to a directory is still skipped — metadata.is_file() fails and WalkDir doesn't follow dir links, so game_dir trees assembled via directory junctions still aren't scanned. If that's the actual layout motivation, follow_links(true) (plus cycle protection) is the real fix; file-level symlinks alone may be enough for the reported case — worth stating which scenario prompted this.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7168700141 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2476#issuecomment-7168700141). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T16:54:00Z. --- Semantics preserved correctly: for regular files the same `is_file && len <= MAX_FILE` test; for symlinks `fs::metadata` follows the link so a symlink *to a file* is now included where `file_type().is_file()` used to drop it — that's the advertised change. `allow_missing_metadata` keeps each caller's old policy (translate/warm/shader-info included them, prebuild skipped). Large-file notice only where it was before. One gap: a symlink *to a directory* is still skipped — `metadata.is_file()` fails and WalkDir doesn't follow dir links, so `game_dir` trees assembled via directory junctions still aren't scanned. If that's the actual layout motivation, `follow_links(true)` (plus cycle protection) is the real fix; file-level symlinks alone may be enough for the reported case — worth stating which scenario prompted this.
fuzeofficlal commented 2026-11-26 03:04:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T02:05:47Z.

Review: COMMENTED


Reviewed and verified against main (63bcca43) on Windows 11 — clean consolidation and ready to merge:

  • Centralizing discovery in shader_files / scan_shader_files (apps/victory/src/shader.rs:18-52) keeps WalkDir with follow_links(false) (avoiding directory symlink loops) while resolving file symlinks via std::fs::metadata (target.is_file() && target.len() <= MAX_FILE), safely skipping broken symlinks.
  • (Minor non-blocking notes: oversized symlink targets > MAX_FILE are filtered silently without calling on_large_file unlike regular files at shader.rs:37-38, and no symlink-specific unit test is included.)

Local verification:

  • cargo test --locked -p victory: 18/18 passed (14 unit + census + census_unreadable + translate)
  • cargo clippy --locked -p victory --tests -- -D warnings (default & --all-features): 0 warnings
  • cargo xtask policy: 191 files ok
<!-- greyfinch-sync:Marvisak/VIctory:review:6067594039 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2476#pullrequestreview-6067594039). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T02:05:47Z. **Review:** COMMENTED --- Reviewed and verified against `main` (`63bcca43`) on Windows 11 — clean consolidation and ready to merge: - Centralizing discovery in `shader_files` / `scan_shader_files` (`apps/victory/src/shader.rs:18-52`) keeps `WalkDir` with `follow_links(false)` (avoiding directory symlink loops) while resolving file symlinks via `std::fs::metadata` (`target.is_file() && target.len() <= MAX_FILE`), safely skipping broken symlinks. - *(Minor non-blocking notes: oversized symlink targets `> MAX_FILE` are filtered silently without calling `on_large_file` unlike regular files at `shader.rs:37-38`, and no symlink-specific unit test is included.)* **Local verification**: - `cargo test --locked -p victory`: **18/18 passed** (`14` unit + `census` + `census_unreadable` + `translate`) - `cargo clippy --locked -p victory --tests -- -D warnings` (default & `--all-features`): 0 warnings - `cargo xtask policy`: 191 files ok
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2476:upstream-pr/2476'
git switch 'upstream-pr/2476'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2476'
git switch 'upstream-pr/2476'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2476'
git switch 'upstream-pr/2476'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2476'
git switch 'main'
git merge --squash 'upstream-pr/2476'
git switch 'main'
git merge --ff-only 'upstream-pr/2476'
git switch 'main'
git merge 'upstream-pr/2476'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!2474
No description provided.