CLI: report incomplete shader directory scans #517

Open
github-bot wants to merge 5 commits from github-bot/gh-517 into main AGit
Owner

@⁠Dathinel on GitHub · 2026-11-24 04:23 UTC · original
Dathinel:fix/report-shader-traversal-errors → main · +93 −10 · 3 files · 5 commits · open

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.

**@⁠Dathinel** on GitHub · 2026-11-24 04:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/517) `Dathinel:fix/report-shader-traversal-errors` → `main` · +93 −10 · 3 files · 5 commits · open 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:06:51 +00:00
Author
Owner

@⁠geiyiliyabumo on GitHub · 2026-11-24 13:38 UTC · original

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.

**@⁠geiyiliyabumo** on GitHub · 2026-11-24 13:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/517#issuecomment-7133122587) 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.*
Author
Owner

@⁠Dathinel on GitHub · 2026-11-24 19:25 UTC · original

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.

**@⁠Dathinel** on GitHub · 2026-11-24 19:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/517#issuecomment-7142075940) 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.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:23 UTC · original · edited 2026-11-25 07:25 UTC

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

**@⁠Marvisak** on GitHub · 2026-11-25 00:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/517#issuecomment-7148457483) · edited 2026-11-25 07:25 UTC <!-- 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)_
Author
Owner

@⁠Dathinel on GitHub · 2026-11-25 00:43 UTC · original

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.

**@⁠Dathinel** on GitHub · 2026-11-25 00:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/517#issuecomment-7148812025) 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.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/517/head:github-bot/gh-517'
git switch 'github-bot/gh-517'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-517'
git switch 'github-bot/gh-517'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-517'
git switch 'github-bot/gh-517'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-517'
git switch 'main'
git merge --squash 'github-bot/gh-517'
git switch 'main'
git merge --ff-only 'github-bot/gh-517'
git switch 'main'
git merge 'github-bot/gh-517'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!517
No description provided.