Skip to content

CLI: report shader scan input failures - #534

Closed
Quat3rnion wants to merge 3 commits into
Marvisak:mainfrom
Quat3rnion:victory-shader-scan-errors
Closed

Quat3rnion wants to merge 3 commits into
Marvisak:mainfrom
Quat3rnion:victory-shader-scan-errors

Conversation

@Quat3rnion

Copy link
Copy Markdown
Contributor

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.

@Quat3rnion
Quat3rnion force-pushed the victory-shader-scan-errors branch from b7d0ab9 to e1680af Compare November 24, 2026 07:25
@geiyiliyabumo

Copy link
Copy Markdown
Contributor

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 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 DenRakEiw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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).

shader-info and translate used filter_map(Result::ok) over WalkDir and silently skipped metadata and read failures, so a mistyped explicit path exited successfully with zero shaders and a mixed scan undercounted coverage. Reject a path that does not exist, report per-file errors, and add CLI-level tests for a missing path and an empty directory.
@Quat3rnion

Copy link
Copy Markdown
Contributor Author

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
Quat3rnion force-pushed the victory-shader-scan-errors branch from e1680af to 54b4402 Compare November 24, 2026 14:06
@Quat3rnion

Copy link
Copy Markdown
Contributor Author

@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

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown

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 CI: add Dependabot configuration for GitHub Actions and Cargo #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).

@Marvisak

Copy link
Copy Markdown
Owner

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.

@Marvisak Marvisak closed this Nov 25, 2026
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.

6 participants