Repository navigation
translate: refuse a VICTORY_EMIT_DUMP directory inside the repo - #664
Conversation
translate writes emitted DXIL and validator reports to the VICTORY_EMIT_DUMP directory. Both are derived from the game's shaders, but the directory was never checked against the source tree. With VICTORY_EMIT_DUMP=. run from the checkout, the .txt reports land in the repo, and git and cargo xtask policy both let them through. Check the directory once at the start of translate::run, as Config already does for the cache and data directories. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LAKSHYA-cmd-tech
left a comment
There was a problem hiding this comment.
LGTM! Tested on Windows 11 with MSVC Rust 1.98.1. cargo test -p victory passed cleanly (2 passed), with emit_dump_inside_repo_is_refused verifying that VICTORY_EMIT_DUMP is prevented from targeting the source checkout in compliance with docs/asset-policy.md.
catminou4
left a comment
There was a problem hiding this comment.
Verified locally on macOS 26 arm64, rustc 1.98.1 (aarch64-apple-darwin, rust-toolchain.toml):
Main does not compile the app crate on macOS (known host_resource cfg issue, fixed by #235/#523), so I merged #235's head locally (uncommitted, additive conflict in translate.rs resolved by keeping both new modules) purely to run the tests:
cargo check -p victory --locked: cleancargo test -p victory --locked: 1 passed, 0 failed — the newemit_dump_inside_repo_is_refusedtest runs and passes on macOS, confirming the repo-refusal path works outside Windows too.
Approving.
|
Built and ran this on Windows, since the description says it couldn't be: Windows 11, Rust 1.98.1, debug, head
|
|
Independent Windows check of
The new CLI fixture verifies that Only source-built synthetic fixtures were used. AI-assisted verification. |
…nside the repo
Merges Marvisak#115 Marvisak#151 Marvisak#238 Marvisak#353 Marvisak#378 Marvisak#476 Marvisak#482 Marvisak#535 Marvisak#649 Marvisak#664 Marvisak#1177 onto main (ffe310e), each head unchanged, no conflicts. One change of mine: Marvisak#378 turns the duplicate check in translate.rs into a nested `if !seen.insert(..) { if !list { .. } }`, which clippy::collapsible_if rejects under -D warnings; it is now one `if !seen.insert(..) && !list` (clippy --fix, same behaviour). cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features, is clean and cargo test --workspace --locked passes (354 passed, 6 ignored; main has 342 passed, 6 ignored). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nside the repo
…40-111a Shaders: round v_mad_f16 / v_mac_f16 product to f16 before add (Marvisak#440)
What
victory translatewrites shader dumps to theVICTORY_EMIT_DUMPdirectory:--list, every emitted shader as<dir>/<label>.dxil;--validate, up to 3 failures per validator reason as<dir>/<reason>_<n>.dxiland<dir>/<reason>_<n>.txt. The.txtholds the shader label (including the game file path) and the validator's full output.The directory was passed straight to
std::fs::writeand never checked withvictory_core::ensure_outside_repo. docs/asset-policy.md lists shader dumps as game-derived and says every writer of derived data must make that check.Bad behaviour, from the repo root:
This writes the dumps into the checkout.
*.dxilis git-ignored, but*.txtis not, andcargo xtask policy --stagedallows small ASCII.txtfiles. Sogit add -Astages the validator reports and the policy check passes them.Change:
translate::runnow callsensure_outside_repoonVICTORY_EMIT_DUMPbefore it starts, so this run fails with the usual "refusing to use ... inside the VIctory source tree" error. It fails early whenever the variable points into the repo, even when neither--listnor--validateis given and nothing would be written. Every dump write is reached fromrun, so one check covers both write sites. Added a test,emit_dump_inside_repo_is_refused, that points the variable at the crate directory, expectsPolicyError::InsideRepo, then unsets the variable.Out of scope: three other dump switches write game-derived data without this check,
VICTORY_CAPTURE(crates/victory-gpu/src/capture.rs),VICTORY_XMA_DUMP(crates/victory-hle/src/modules/audio.rs) andVICTORY_AUDIO_CAPTURE(crates/victory-hle/src/modules/audio/capture.rs). This PR does not cover them.Verification
cargo clippy -p victory --tests --target x86_64-pc-windows-msvc, with and without--features diagnostics: no warnings invictory. One warning invictory-hle(xmem.rs:747) is already on main.rustfmt --edition 2024 --check apps/victory/src/translate.rs: clean.cargo test -p victory-core policy: 4 passed. These cover theensure_outside_repobehaviour the new test relies on.runwalks the missing input path, finds nothing and returnsOk.victory translateagainst a game.No game data used.
🤖 Generated with Claude Code