CLI: report incomplete shader directory scans #517

Open
Dathinel wants to merge 5 commits from upstream-pr/517 into main
Dathinel commented 2026-11-24 04:23:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dathinel on 2026-11-24T04:23:54Z.


Both shader-info and translate exit 0 when a scan root is missing. This makes an incomplete batch look like a successful scan of an empty directory.

Report each traversal error on stderr, keep scanning accessible inputs, and exit 1 after printing the partial summary. A readable empty directory still exits 0. Scripts that use the exit status can now detect partial results.

Reproduce with cargo run -p victory -- shader-info missing-dir or cargo run -p victory -- translate missing-dir, using a path that does not exist. On Windows 11 with Rust 1.98.1, both returned 0 on d2a4bae and 1 with this patch.

cargo test --locked -p victory --test shader_paths checks that both commands count a synthetic container between two missing roots and report both paths. The workspace suite passed (265 passed, 4 ignored).

#254 moves the traversal loop in translate; combining the changes requires resolving that hunk. #115 covers census.

Codex implemented and tested the change. Claude Code independently reviewed the final diff.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5466049023 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/517). Originally posted by [Dathinel](https://github.com/Dathinel) on 2026-11-24T04:23:54Z. --- Both `shader-info` and `translate` exit 0 when a scan root is missing. This makes an incomplete batch look like a successful scan of an empty directory. Report each traversal error on stderr, keep scanning accessible inputs, and exit 1 after printing the partial summary. A readable empty directory still exits 0. Scripts that use the exit status can now detect partial results. **Reproduce** with `cargo run -p victory -- shader-info missing-dir` or `cargo run -p victory -- translate missing-dir`, using a path that does not exist. On Windows 11 with Rust 1.98.1, both returned 0 on `d2a4bae` and 1 with this patch. `cargo test --locked -p victory --test shader_paths` checks that both commands count a synthetic container between two missing roots and report both paths. The workspace suite passed (265 passed, 4 ignored). #254 moves the traversal loop in `translate`; combining the changes requires resolving that hunk. #115 covers `census`. Codex implemented and tested the change. Claude Code independently reviewed the final diff.
mercuryVM commented 2026-11-24 10:00:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T10:00:34Z.

Review: APPROVED


Tested 5f21114 on Windows 11, RTX 5070, MSVC: the workspace passes (196 outside victory-shader), including tests/shader_paths.rs.

  • Safety screen: the Cargo.toml and Cargo.lock changes only add tempfile as a dev-dependency of apps/victory. It is already a workspace dependency used by other crates' tests, so the lockfile only gains the edge and no new package.
  • Reporting traversal errors, keeping the scan going, and then failing with "scan incomplete" after the summary is the right behaviour for batch scripts. Suppressing the "none found" hint when the emptiness came from errors avoids a misleading message.
  • scan_entries is shared by both commands. #115 does the same for census, with a depth-0 hard error instead. The two are slightly inconsistent (fail fast versus finish then fail), which is worth aligning eventually, but not in this PR.

No issues found.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6037150444 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/517#pullrequestreview-6037150444). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T10:00:34Z. **Review:** APPROVED --- Tested 5f21114 on Windows 11, RTX 5070, MSVC: the workspace passes (196 outside `victory-shader`), including `tests/shader_paths.rs`. - Safety screen: the `Cargo.toml` and `Cargo.lock` changes only add `tempfile` as a dev-dependency of `apps/victory`. It is already a workspace dependency used by other crates' tests, so the lockfile only gains the edge and no new package. - Reporting traversal errors, keeping the scan going, and then failing with "scan incomplete" after the summary is the right behaviour for batch scripts. Suppressing the "none found" hint when the emptiness came from errors avoids a misleading message. - `scan_entries` is shared by both commands. #115 does the same for `census`, with a depth-0 hard error instead. The two are slightly inconsistent (fail fast versus finish then fail), which is worth aligning eventually, but not in this PR. No issues found. AI-assisted (Claude Code).
catminou4 commented 2026-11-24 12:48:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T12:48:53Z.

Review: COMMENTED


Triage: this and #534 attack the same problem (shader/translate scan input failures) with different designs. Comparison for whoever reviews:

  • #517 (this one): shared scan_entries helper counting walk errors, hard failure at the end (anyhow::ensure!(walk_errors == 0)), missing root surfaces as a traversal error, integration test drives the real victory binary (tests/shader_paths.rs, exit code 1, stderr names both bad inputs), and Cargo.lock is updated.
  • #534: per-file errors collected and printed but the command still exits 0; missing root is a hard anyhow::ensure!; unit tests in shader.rs/translate.rs; Cargo.lock NOT updated → breaks --locked builds (verified locally, see my review there).

Semantic difference that matters: #517 fails the entire scan if any traversal error occurs anywhere in the tree (one unreadable file in a big dump kills the run); #534 only fails on a missing root and merely reports per-file errors. For a diagnostic CLI over multi-GB title dumps I'd mildly prefer #534's distinction, but #517's integration test and lockfile are stronger as submitted.

Not verifiable on macOS (app crate doesn't build here); both diffs read correctly statically.

<!-- greyfinch-sync:Marvisak/VIctory:review:6039465829 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/517#pullrequestreview-6039465829). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T12:48:53Z. **Review:** COMMENTED --- Triage: this and #534 attack the same problem (shader/translate scan input failures) with different designs. Comparison for whoever reviews: - **#517** (this one): shared `scan_entries` helper counting walk errors, hard failure at the end (`anyhow::ensure!(walk_errors == 0)`), missing root surfaces as a traversal error, integration test drives the real `victory` binary (`tests/shader_paths.rs`, exit code 1, stderr names both bad inputs), and **Cargo.lock is updated**. - **#534**: per-file errors collected and printed but the command still exits 0; missing root is a hard `anyhow::ensure!`; unit tests in shader.rs/translate.rs; **Cargo.lock NOT updated** → breaks `--locked` builds (verified locally, see my review there). Semantic difference that matters: #517 fails the entire scan if *any* traversal error occurs anywhere in the tree (one unreadable file in a big dump kills the run); #534 only fails on a missing root and merely reports per-file errors. For a diagnostic CLI over multi-GB title dumps I'd mildly prefer #534's distinction, but #517's integration test and lockfile are stronger as submitted. Not verifiable on macOS (app crate doesn't build here); both diffs read correctly statically.
geiyiliyabumo commented 2026-11-24 14:04:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T13:38:29Z.


Independent review on Windows 11 x64 / MSVC (merged PR head 5f21114 into current main; reviewed the full origin/main..HEAD diff, clean auto-merge on translate.rs).

Verified:

  • cargo run --locked -p xtask -- policy -> "asset policy: 155 files ok" (rule #1 clean: the new fixture is a tempfile tempdir + a synthetic DXBC header built in code, no game data)
  • cargo clippy --workspace --all-targets --locked -- -D warnings -> clean
  • cargo test -p victory --locked -> 2/2 pass, incl. new shader_commands_report_missing_roots_and_scan_the_rest

Looks correct and well scoped. scan_entries now counts (and prints) every WalkDir error; both shader-info and translate emit a non-zero exit via anyhow::ensure! when any traversal error occurred, while still printing the partial results first (best-effort output + honest exit code). Suppressing the "(none found...)" hint on an incomplete scan avoids reporting a failed scan as empty. The new test is hermetic/synthetic - it clears VICTORY_PAIRS so no GPU/D3D12 is needed - and checks exit 1, both missing roots, the exact count (2), and that the valid file is still scanned.

Non-blocking observations:

  • Only WalkDir traversal errors are counted. Per-file std::fs::read(...) and entry.metadata() failures are still silently skipped, so an exit 0 can in principle still mask individual unreadable files. If exhaustive completeness is the goal, those could feed the same counter.
  • census.rs:35-37 still uses filter_map(Result::ok) and silently drops the same walkdir errors. Out of scope for a shader-scan PR, but consider aligning it for consistency.
  • Behavior change worth noting to callers: both commands now exit 1 on any traversal error (previously 0). Deliberate and desirable.
  • Minor: no positive assertion that a fully-clean scan still returns 0 (guards against the new ensure! firing on a good run).

No blocking issues - nice, focused fix.

AI-assisted; synthetic tests only, no game files.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7133122587 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/517#issuecomment-7133122587). Originally posted by [geiyiliyabumo](https://github.com/geiyiliyabumo) on 2026-11-24T13:38:29Z. --- Independent review on Windows 11 x64 / MSVC (merged PR head 5f21114 into current main; reviewed the full origin/main..HEAD diff, clean auto-merge on translate.rs). Verified: - cargo run --locked -p xtask -- policy -> "asset policy: 155 files ok" (rule #1 clean: the new fixture is a tempfile tempdir + a synthetic DXBC header built in code, no game data) - cargo clippy --workspace --all-targets --locked -- -D warnings -> clean - cargo test -p victory --locked -> 2/2 pass, incl. new shader_commands_report_missing_roots_and_scan_the_rest Looks correct and well scoped. scan_entries now counts (and prints) every WalkDir error; both shader-info and translate emit a non-zero exit via anyhow::ensure! when any traversal error occurred, while still printing the partial results first (best-effort output + honest exit code). Suppressing the "(none found...)" hint on an incomplete scan avoids reporting a failed scan as empty. The new test is hermetic/synthetic - it clears VICTORY_PAIRS so no GPU/D3D12 is needed - and checks exit 1, both missing roots, the exact count (2), and that the valid file is still scanned. Non-blocking observations: - Only WalkDir traversal errors are counted. Per-file std::fs::read(...) and entry.metadata() failures are still silently skipped, so an exit 0 can in principle still mask individual unreadable files. If exhaustive completeness is the goal, those could feed the same counter. - census.rs:35-37 still uses filter_map(Result::ok) and silently drops the same walkdir errors. Out of scope for a shader-scan PR, but consider aligning it for consistency. - Behavior change worth noting to callers: both commands now exit 1 on any traversal error (previously 0). Deliberate and desirable. - Minor: no positive assertion that a fully-clean scan still returns 0 (guards against the new ensure! firing on a good run). No blocking issues - nice, focused fix. *AI-assisted; synthetic tests only, no game files.*
Dathinel commented 2026-11-24 20:03:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dathinel on 2026-11-24T19:25:29Z.


Thanks @geiyiliyabumo. Added the clean-directory case in bab15db. Both shader-info . and translate . must exit 0 and count the one synthetic container in the directory. The mixed-input case still requires exit 1 and checks that both missing paths are reported.

To reproduce, run cargo test --locked -p victory --test shader_paths. On Windows/MSVC, forcing either command to return 1 on a clean scan failed the new assertion. With the patch integrated locally against ffe310e, the workspace suite passed (343 passed, 6 ignored), as did both Clippy configurations from CI.

For the overlap discussion, #115 covers census. At 29046af, #534 also includes the lockfile change and tests empty directories. The test here exercises the CLI on a populated directory.

AI-assisted. All fixtures for this test are synthetic.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7142075940 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/517#issuecomment-7142075940). Originally posted by [Dathinel](https://github.com/Dathinel) on 2026-11-24T19:25:29Z. --- Thanks @geiyiliyabumo. Added the clean-directory case in bab15db. Both `shader-info .` and `translate .` must exit 0 and count the one synthetic container in the directory. The mixed-input case still requires exit 1 and checks that both missing paths are reported. To reproduce, run `cargo test --locked -p victory --test shader_paths`. On Windows/MSVC, forcing either command to return 1 on a clean scan failed the new assertion. With the patch integrated locally against `ffe310e`, the workspace suite passed (343 passed, 6 ignored), as did both Clippy configurations from CI. For the overlap discussion, #115 covers census. At `29046af`, #534 also includes the lockfile change and tests empty directories. The test here exercises the CLI on a populated directory. AI-assisted. All fixtures for this test are synthetic.
Marvisak commented 2026-11-25 01:07:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:23:20Z.


Automated triage for the maintainers.

Needs work: needs the maintainer's decision. The new head d8cd94a drops the tempfile dev-dependency: the test makes its own fresh directory, and Cargo.toml/Cargo.lock are untouched. That point is resolved, and #534 has been closed, so there is no competing change any more.

The code reads correctly. scan_entries in apps/victory/src/shader.rs reports and counts walkdir errors. shader::run and translate::run print their partial results and then fail through anyhow::ensure!, and the "(none found…)" hint is suppressed on an incomplete scan.

One point the earlier comment should have named: apps/victory/tests/shader_paths.rs runs the crate's own victory binary through std::process::Command (CARGO_BIN_EXE_victory). That is the usual pattern for a Rust integration test and the risk is low. Still, new code that starts a process needs a maintainer's sign-off under the triage rules, so I am leaving that decision to the maintainer and not asking you to change it. Unreadable files and failed metadata() calls are still skipped silently; that is not a blocker.

CI: passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148457483 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/517#issuecomment-7148457483). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:23:20Z. --- <!-- victory-triage v1 head=d8cd94a253924ebf0e6203c00680d534a6382c92 verdict=needs-work at=2026-11-25T07:25:12Z --> Automated triage for the maintainers. **Needs work: needs the maintainer's decision.** The new head `d8cd94a` drops the `tempfile` dev-dependency: the test makes its own fresh directory, and `Cargo.toml`/`Cargo.lock` are untouched. That point is resolved, and #534 has been closed, so there is no competing change any more. The code reads correctly. `scan_entries` in `apps/victory/src/shader.rs` reports and counts `walkdir` errors. `shader::run` and `translate::run` print their partial results and then fail through `anyhow::ensure!`, and the "(none found…)" hint is suppressed on an incomplete scan. One point the earlier comment should have named: `apps/victory/tests/shader_paths.rs` runs the crate's own `victory` binary through `std::process::Command` (`CARGO_BIN_EXE_victory`). That is the usual pattern for a Rust integration test and the risk is low. Still, new code that starts a process needs a maintainer's sign-off under the triage rules, so I am leaving that decision to the maintainer and not asking you to change it. Unreadable files and failed `metadata()` calls are still skipped silently; that is not a blocker. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Dathinel commented 2026-11-25 01:08:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dathinel on 2026-11-25T00:43:39Z.


Resolved the conflicts in 0749a8e by integrating main@4118f33. The shader pack listing and translation progress from main are preserved.

On Windows/MSVC, cargo test --locked -p victory --test shader_paths failed on unmodified main with the added test (a partial scan exited 0) and passed after the fix. Both Clippy configurations passed. The PR CI run and the main CI run fail the same two shader tests: gathers_at_a_level_match_the_hardware and permutes_read_the_lane_named_and_zero_from_lanes_left_out.

AI-assisted; the scan regression uses a synthetic fixture.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148812025 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/517#issuecomment-7148812025). Originally posted by [Dathinel](https://github.com/Dathinel) on 2026-11-25T00:43:39Z. --- Resolved the conflicts in `0749a8e` by integrating `main@4118f33`. The shader pack listing and translation progress from main are preserved. On Windows/MSVC, `cargo test --locked -p victory --test shader_paths` failed on unmodified main with the added test (a partial scan exited 0) and passed after the fix. Both Clippy configurations passed. The [PR CI run](https://github.com/Marvisak/VIctory/actions/runs/45519901804) and the [main CI run](https://github.com/Marvisak/VIctory/actions/runs/45517792242) fail the same two shader tests: `gathers_at_a_level_match_the_hardware` and `permutes_read_the_lane_named_and_zero_from_lanes_left_out`. AI-assisted; the scan regression uses a synthetic fixture.
andrewpozdnakov7-jpg commented 2026-11-28 20:30:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T20:30:07Z.


I checked d8cd94a with the shader-cache warm-up change in #3789. Combined b3f4a47 keeps both exact PR heads and uses your scan_entries helper for shader-info, ordinary translate and translate --cache.

Both of your scan cases pass on current main. The warm-up regression reports two absent roots, caches the accessible generated container's result, and returns 1. A clean repeat gets one cache hit and returns 0. All 20 CLI tests, both strict CLI Clippy configurations and the asset policy passed.

You or the maintainer can use the combined branch if the changes land together. Please retain the Git authors on cherry-pick or rebase.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7245331463 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/517#issuecomment-7245331463). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T20:30:07Z. --- I checked d8cd94a with the shader-cache warm-up change in #3789. [Combined b3f4a47](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/b3f4a47c535094cbf4c5f25c704a84b00a48a9ee) keeps both exact PR heads and uses your scan_entries helper for shader-info, ordinary translate and translate --cache. Both of your scan cases pass on current main. The warm-up regression reports two absent roots, caches the accessible generated container's result, and returns 1. A clean repeat gets one cache hit and returns 0. All 20 CLI tests, both strict CLI Clippy configurations and the asset policy passed. You or the maintainer can use the combined branch if the changes land together. Please retain the Git authors on cherry-pick or rebase. AI-assisted with OpenAI Codex.
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/517:upstream-pr/517'
git switch 'upstream-pr/517'

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/517'
git switch 'upstream-pr/517'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/517'
git switch 'upstream-pr/517'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/517'
git switch 'main'
git merge --squash 'upstream-pr/517'
git switch 'main'
git merge --ff-only 'upstream-pr/517'
git switch 'main'
git merge 'upstream-pr/517'
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!517
No description provided.