CLI: report shader scan input failures #534

Closed
Quat3rnion wants to merge 3 commits from upstream-pr/534 into main
Quat3rnion commented 2026-11-24 04:35:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Quat3rnion on 2026-11-24T04:35:06Z.


What

victory shader-info and victory translate discarded WalkDir errors and
silently skipped metadata and file-read failures. A mistyped explicit path
exited successfully with zero shader counts, and a failed read in a mixed
scan quietly undercounted coverage. Both commands now reject a path that does
not exist and report per-file input errors; an empty directory still scans
successfully.

An AI tool wrote part of this change.

Tested

  • Linux: cargo test --workspace: 168 passed, 0 failed, 3 ignored. Four CLI-level regressions: missing and empty-directory paths for both commands, asserting a named diagnostic and a nonzero result only for the missing path.
  • Windows cross-build: cargo check --target x86_64-pc-windows-gnu --workspace --tests passes. No Windows host here.
  • cargo xtask policy passes (150 files ok). No game files or data from them were added.

Checklist

  • Workspace tests and Windows cross-check pass.
  • cargo xtask policy passes. No game files or data from them were added.
  • AI authorship is disclosed above.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6574695199 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/534). Originally posted by [Quat3rnion](https://github.com/Quat3rnion) on 2026-11-24T04:35:06Z. --- ## What `victory shader-info` and `victory translate` discarded `WalkDir` errors and silently skipped metadata and file-read failures. A mistyped explicit path exited successfully with zero shader counts, and a failed read in a mixed scan quietly undercounted coverage. Both commands now reject a path that does not exist and report per-file input errors; an empty directory still scans successfully. An AI tool wrote part of this change. ## Tested - Linux: `cargo test --workspace`: 168 passed, 0 failed, 3 ignored. Four CLI-level regressions: missing and empty-directory paths for both commands, asserting a named diagnostic and a nonzero result only for the missing path. - Windows cross-build: `cargo check --target x86_64-pc-windows-gnu --workspace --tests` passes. No Windows host here. - `cargo xtask policy` passes (150 files ok). No game files or data from them were added. ## Checklist - [x] Workspace tests and Windows cross-check pass. - [x] `cargo xtask policy` passes. No game files or data from them were added. - [x] AI authorship is disclosed above.
geiyiliyabumo commented 2026-11-24 12:04:40 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T11:48:43Z.


Independent verification & code review on Windows 11 Pro (build 26100, Rust 1.98.1), cleanly merged onto main (ffe310e):

  • cargo xtask policy: PASS (154 files ok)
  • cargo test -p victory --locked: 5 passed, 0 failed (including all 4 new scan/translation missing-path and empty-dir tests)
  • cargo clippy --workspace --all-targets --locked -- -D warnings: FAIL (2 errors)

Findings

  • CI blocker (clippy::items-after-test-module): Both new test modules are placed before non-test items in their files, which fails clippy --all-targets -- -D warnings:
    1. apps/victory/src/shader.rs:244 (mod tests appears before format_instruction at line 265)
    2. apps/victory/src/translate.rs:156 (mod scan_tests appears before pub fn run and helpers at lines 177–717)
  • Moving both test modules to the bottom of their respective files (or merging scan_tests into translate.rs's existing trailing test module if present) resolves the CI failure. The scan error-reporting logic itself looks clean and useful.

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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7130582519 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/534#issuecomment-7130582519). Originally posted by [geiyiliyabumo](https://github.com/geiyiliyabumo) on 2026-11-24T11:48:43Z. --- Independent verification & code review on Windows 11 Pro (build 26100, Rust `1.98.1`), cleanly merged onto `main` (`ffe310e`): - `cargo xtask policy`: PASS (`154 files ok`) - `cargo test -p victory --locked`: **5 passed, 0 failed** (including all 4 new scan/translation missing-path and empty-dir tests) - `cargo clippy --workspace --all-targets --locked -- -D warnings`: **FAIL** (2 errors) ### Findings - **CI blocker (`clippy::items-after-test-module`)**: Both new test modules are placed before non-test items in their files, which fails `clippy --all-targets -- -D warnings`: 1. `apps/victory/src/shader.rs:244` (`mod tests` appears before `format_instruction` at line 265) 2. `apps/victory/src/translate.rs:156` (`mod scan_tests` appears before `pub fn run` and helpers at lines 177–717) - Moving both test modules to the bottom of their respective files (or merging `scan_tests` into `translate.rs`'s existing trailing test module if present) resolves the CI failure. The scan error-reporting logic itself looks clean and useful. *AI-assisted; synthetic tests only, no game files.*
catminou4 commented 2026-11-24 13:01:31 +00:00 (Migrated from github.com)

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

Review: CHANGES_REQUESTED


Blocking issue, verified locally: this adds tempfile as a dev-dependency of apps/victory but does not update Cargo.lock. Test-merged with current main (ffe310e) and ran cargo metadata --locked →

error: cannot update the lock file .../Cargo.lock because --locked was passed to prevent this

So any --locked build/test (clippy CI uses --locked) fails until the lockfile is regenerated (cargo update -p victory --offline or just cargo check once and commit the lock). #517 solves the same problem and does include the lockfile update — see my triage comment there.

Design note for the maintainer's pick between this and #517: this PR's semantics are "missing root = hard error, per-file walk/read errors = report and continue (exit 0)"; #517's are "any traversal error fails the whole scan (exit 1)". I find this PR's distinction more practical for scanning large title dumps, but the unit tests here don't exercise translate.rs's scan (only shader.rs) and the app crate doesn't build on macOS, so I couldn't run them — the tests look correct statically.

<!-- greyfinch-sync:Marvisak/VIctory:review:6039465519 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/534#pullrequestreview-6039465519). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T12:48:52Z. **Review:** CHANGES_REQUESTED --- Blocking issue, verified locally: this adds `tempfile` as a dev-dependency of `apps/victory` but does **not** update `Cargo.lock`. Test-merged with current main (`ffe310e`) and ran `cargo metadata --locked` → ``` error: cannot update the lock file .../Cargo.lock because --locked was passed to prevent this ``` So any `--locked` build/test (clippy CI uses `--locked`) fails until the lockfile is regenerated (`cargo update -p victory --offline` or just `cargo check` once and commit the lock). #517 solves the same problem and *does* include the lockfile update — see my triage comment there. Design note for the maintainer's pick between this and #517: this PR's semantics are "missing root = hard error, per-file walk/read errors = report and continue (exit 0)"; #517's are "any traversal error fails the whole scan (exit 1)". I find this PR's distinction more practical for scanning large title dumps, but the unit tests here don't exercise `translate.rs`'s scan (only shader.rs) and the app crate doesn't build on macOS, so I couldn't run them — the tests look correct statically.
DenRakEiw commented 2026-11-24 14:04:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T14:00:22Z.

Review: COMMENTED


Tested merged cleanly onto main (ffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC):

  • cargo test -p victory: 5 passed, 0 failed (a_missing_scan_path_is_an_error, an_empty_scan_directory_succeeds, a_missing_translation_path_is_an_error, an_empty_translation_directory_succeeds, loader_lock_is_reentrant_and_exclusive)
  • cargo xtask policy: ok
  • cargo clippy -p victory --all-targets: 2 clippy::items_after_test_module warnings:
    • apps/victory/src/shader.rs:244: mod tests is defined before fn format_instruction(...)
    • apps/victory/src/translate.rs:156: mod scan_tests is defined before pub fn run(...) and the remaining functions

Moving both #[cfg(test)] modules to the bottom of their respective files will clear both clippy warnings for CI.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6040561270 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/534#pullrequestreview-6040561270). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-24T14:00:22Z. **Review:** COMMENTED --- Tested merged cleanly onto `main` (`ffe310e`) on Windows 11 x64 (Rust 1.98.1 MSVC): - `cargo test -p victory`: **5 passed, 0 failed** (`a_missing_scan_path_is_an_error`, `an_empty_scan_directory_succeeds`, `a_missing_translation_path_is_an_error`, `an_empty_translation_directory_succeeds`, `loader_lock_is_reentrant_and_exclusive`) - `cargo xtask policy`: ok - **`cargo clippy -p victory --all-targets`:** 2 `clippy::items_after_test_module` warnings: - `apps/victory/src/shader.rs:244`: `mod tests` is defined before `fn format_instruction(...)` - `apps/victory/src/translate.rs:156`: `mod scan_tests` is defined before `pub fn run(...)` and the remaining functions Moving both `#[cfg(test)]` modules to the bottom of their respective files will clear both clippy warnings for CI. AI-assisted (Gemini 4 Neon).
Quat3rnion commented 2026-11-24 15:03:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Quat3rnion on 2026-11-24T14:06:55Z.


Fixed the blocking issue: committed the Cargo.lock update that records tempfile as a dev-dependency of apps/victory (new head 54b4402). cargo metadata --locked now succeeds, and I rebased onto current main (ffe310e). cargo test --workspace --no-fail-fast passes: 222 passed, 0 failed. Thanks for the clear triage — I kept this PR's semantics of 'missing root = hard error, per-file walk/read errors = report and continue' as you noted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7133862121 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/534#issuecomment-7133862121). Originally posted by [Quat3rnion](https://github.com/Quat3rnion) on 2026-11-24T14:06:55Z. --- Fixed the blocking issue: committed the `Cargo.lock` update that records `tempfile` as a dev-dependency of `apps/victory` (new head `54b4402`). `cargo metadata --locked` now succeeds, and I rebased onto current main (`ffe310e`). `cargo test --workspace --no-fail-fast` passes: 222 passed, 0 failed. Thanks for the clear triage — I kept this PR's semantics of 'missing root = hard error, per-file walk/read errors = report and continue' as you noted.
Quat3rnion commented 2026-11-24 15:03:57 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Quat3rnion on 2026-11-24T14:19:37Z.


@geiyiliyabumo Thanks for the Windows clippy run. Fixed the clippy::items-after-test-module blocker in new head 29046af7: format_instruction now sits before shader.rs's test module, and scan_tests moved to the bottom of translate.rs. cargo test -p victory --locked passes all 4 scan/translation tests; cargo test --workspace --no-fail-fast passes 222/0. Could you re-run cargo clippy --workspace --all-targets --locked -- -D warnings on Windows when you get a chance?

<!-- greyfinch-sync:Marvisak/VIctory:comment:7134193383 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/534#issuecomment-7134193383). Originally posted by [Quat3rnion](https://github.com/Quat3rnion) on 2026-11-24T14:19:37Z. --- @geiyiliyabumo Thanks for the Windows clippy run. Fixed the `clippy::items-after-test-module` blocker in new head `29046af7`: `format_instruction` now sits before `shader.rs`'s test module, and `scan_tests` moved to the bottom of `translate.rs`. `cargo test -p victory --locked` passes all 4 scan/translation tests; `cargo test --workspace --no-fail-fast` passes 222/0. Could you re-run `cargo clippy --workspace --all-targets --locked -- -D warnings` on Windows when you get a chance?
geiyiliyabumo commented 2026-11-24 15:04:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T14:31:26Z.


Re-verified new head 29046af merged onto main ffe310e on Windows 11 x64 MSVC:

  • cargo xtask policy: PASS (154 files ok)
  • cargo clippy --workspace --all-targets --locked -- -D warnings: PASS (0 warnings — both clippy::items-after-test-module blockers are resolved)
  • cargo clippy --workspace --all-targets --features diagnostics --locked -- -D warnings: PASS (0 warnings)
  • cargo test -p victory --locked: PASS (all unit + scan/translation tests green)

Looks clean and ready to merge!

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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7134515278 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/534#issuecomment-7134515278). Originally posted by [geiyiliyabumo](https://github.com/geiyiliyabumo) on 2026-11-24T14:31:26Z. --- Re-verified new head `29046af` merged onto `main` `ffe310e` on Windows 11 x64 MSVC: - `cargo xtask policy`: **PASS** (`154 files ok`) - `cargo clippy --workspace --all-targets --locked -- -D warnings`: **PASS** (0 warnings — both `clippy::items-after-test-module` blockers are resolved) - `cargo clippy --workspace --all-targets --features diagnostics --locked -- -D warnings`: **PASS** (0 warnings) - `cargo test -p victory --locked`: **PASS** (all unit + scan/translation tests green) Looks clean and ready to merge! *AI-assisted; synthetic tests only, no game files.*
pickles976 commented 2026-11-24 19:04:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pickles976 on 2026-11-24T18:38:43Z.


The GPU Loc Sig mystery closes from the exe side — the name is encrypted, the watchdog IS the consumer, and the question changes. Decoding the function that owns the watchdog site (+0x23cf620, hash-matched copy):

call +0x2483ea0                     ; freshness/tick source → edx
<12 bytes 3b 45 4b 17 44 68 5d 1b 4f 66 65 ff, each + (12−i) at runtime>  → "GPU Loc Sig\0"
mov [result slot], 1                ; expected state
mov edx, tick; call +0x2215950      ; resolve the debug parameter "GPU Loc Sig"
cmp byte [rsp+0x34], 1
jne +0x23cf683                      ; null-write, imm 4d8bd421 — THE watchdog death

Three consequences, largest first:

  1. It was never a timer. The "watchdog" is a named-validation gate: every run ends because a debug parameter called GPU Loc Sig does not read as 1. That is why every string scan whiffed — the name is built by a 12-byte rolling obfuscation at runtime, so it appears in no .rdata and no binary grep, exactly matching both prior negative results (this board: 7333478d not a file constant; xcl side: "GPU Loc Sig" not in strings, yet it shows up in live debug-parameter logs — the log prints the deobfuscated name).
  2. Your 7333478d write is the same parameter's value channel — bvironn, your log captured writes to GPU Loc Sig with value 7333478d where the gate demands 1. Ask for the whole write-sequence of that name (every value + timestamp + call stack, if cheap): if some run ever shows 1 landing, that run is the first success condition ever observed; if it only ever shows signature-shaped values like 7333478d, the title is computing a location/completion signature that never matches, and the emulator-side diff target becomes what feeds that signature — GPU-visible placement of completed work, which sits precisely on top of the #549 read-too-early class and the never-completing-PSO class alike.
  3. The resolver +0x2215950 lives in the +0x2215xxx debug-parameter cluster whose global (+0x71b6348) and null-callback consumers are already on the kill-map — the gate and the two null-callback stops share the parameter service, consistent with one reporting/validation subsystem.

The 30 s stop→death gap stays measured and real, but its meaning moves from "heartbeat timeout" to "the signature-update deadline for the current step". Kill-map update: +0x23cf683 = GPU Loc Sig != 1 gate, trap imm 4d8bd421, obfuscated-name producer verified byte-exact (0x1b5d6844174b453b+0xff65664f, rolling +12..+1).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7140934833 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/534#issuecomment-7140934833). Originally posted by [pickles976](https://github.com/pickles976) on 2026-11-24T18:38:43Z. --- **The `GPU Loc Sig` mystery closes from the exe side — the name is encrypted, the watchdog IS the consumer, and the question changes.** Decoding the function that owns the watchdog site (`+0x23cf620`, hash-matched copy): ``` call +0x2483ea0 ; freshness/tick source → edx <12 bytes 3b 45 4b 17 44 68 5d 1b 4f 66 65 ff, each + (12−i) at runtime> → "GPU Loc Sig\0" mov [result slot], 1 ; expected state mov edx, tick; call +0x2215950 ; resolve the debug parameter "GPU Loc Sig" cmp byte [rsp+0x34], 1 jne +0x23cf683 ; null-write, imm 4d8bd421 — THE watchdog death ``` Three consequences, largest first: 1. **It was never a timer.** The "watchdog" is a **named-validation gate**: every run ends because a debug parameter called `GPU Loc Sig` does not read as `1`. That is why every string scan whiffed — the name is built by a 12-byte rolling obfuscation at runtime, so it appears in no `.rdata` and no binary grep, exactly matching both prior negative results (this board: `7333478d` not a file constant; xcl side: "GPU Loc Sig" not in strings, yet it shows up in live debug-parameter logs — the log prints the **deobfuscated** name). 2. **Your `7333478d` write is the same parameter's value channel** — bvironn, your log captured writes to `GPU Loc Sig` with value `7333478d` where the gate demands `1`. Ask for the whole write-sequence of that name (every value + timestamp + call stack, if cheap): if some run ever shows `1` landing, that run is the first success condition ever observed; if it only ever shows signature-shaped values like `7333478d`, the title is computing a location/completion signature that never matches, and the emulator-side diff target becomes *what feeds that signature* — GPU-visible placement of completed work, which sits precisely on top of the #549 read-too-early class and the never-completing-PSO class alike. 3. **The resolver `+0x2215950` lives in the `+0x2215xxx` debug-parameter cluster** whose global (`+0x71b6348`) and null-callback consumers are already on the kill-map — the gate and the two null-callback stops share the parameter service, consistent with one reporting/validation subsystem. The 30 s stop→death gap stays measured and real, but its meaning moves from "heartbeat timeout" to "the signature-update deadline for the current step". Kill-map update: `+0x23cf683` = `GPU Loc Sig != 1` gate, trap imm `4d8bd421`, obfuscated-name producer verified byte-exact (`0x1b5d6844174b453b`+`0xff65664f`, rolling +12..+1).
upstream-sync closed this pull request 2026-11-25 00:05:36 +00:00
Marvisak commented 2026-11-25 00:06:58 +00:00 (Migrated from github.com)

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


Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #517. Same change as #517 (report missing or unreadable scan inputs in shader-info and translate), larger and with read errors still exiting 0; #517 is the tighter one.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148100472 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/534#issuecomment-7148100472). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:04:02Z. --- Automated triage for the maintainers. Closing because another open pull request covers the same change. See #517. Same change as #517 (report missing or unreadable scan inputs in shader-info and translate), larger and with read errors still exiting 0; #517 is the tighter one. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

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!534
No description provided.