victory-gpu: seven diagnostics writers refuse a path inside the source tree (capture, timeline, pop, memory dump, fault book, light probe, texture store) #283

Open
sharan104 wants to merge 4 commits from upstream-pr/283 into main
sharan104 commented 2026-11-26 14:21:12 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by sharan104 on 2026-11-26T14:21:12Z.


docs/asset-policy.md: everything written from the title's data must go through victory_core::ensure_outside_repo. Seven diagnostics writers in victory-gpu took a path from a variable and wrote there with no check. With scripts/play.ps1's working directory (the repository root), a relative name put the output in the checkout, where cargo xtask policy lets small text and image-free files through.

Variable Writer What it writes
VICTORY_CAPTURE capture.rs frame PNGs (screenshots), target dumps, per-frame op lists
VICTORY_TIMELINE timeline/report.rs trace and summary naming places in the title's code
VICTORY_POP_FOLDER popwatch.rs pictures of the title's frames
VICTORY_MEMORY_DUMP memory.rs copies of the title's memory arenas, page maps
VICTORY_FAULT_BOOK faultbook.rs instruction and block addresses in the title's code and memory
VICTORY_LIGHT_PROBE lightprobe.rs values read out of the title's exposure programs each frame
VICTORY_TEXTURE_STORE texstore.rs the title's textures, detiled

Fix: a shared helper, crate::switch::outside_repo(name, path) (Windows only, like the writers). Each writer calls it once where its path is first read, and keeps the answer in its existing OnceLock, or a new one where there was none. A refused path gets one warn!, nothing is written, and that feature stays off. VICTORY_CAPTURE and VICTORY_TIMELINE use the same helper. titlewrite's VICTORY_WRITE_SITES (#89) keeps its own copy.

Left out on purpose:

  • VICTORY_SHADER_SAVE (pipeline.rs) needs the same check. It's left out only because #205 moves that block, so whichever of the two merges second should add it.

Tests:

  • switch::tests::nothing_is_written_into_the_source_tree: a folder inside the crate is refused and a temp folder is accepted.
  • timeline::report::tests::a_timeline_is_not_written_into_the_source_tree: one writer end to end. Both files would land inside the crate without the check, and a file outside the repo is still written.

Both fail with the check stubbed out, and pass 10 runs out of 10 with it. The other writers read their variable inside a OnceLock, so a per-writer test would mean changing the process environment; the shared helper's test covers them instead.

Results:

  • cargo test -p victory-gpu --locked --features diagnostics passes, and so does the default build.
  • Clippy -D warnings adds nothing beyond main's existing watch.rs unnecessary_mut_passed, which #241 fixes.

🤖 Generated with Claude Code

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:6628654016 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/283). Originally posted by [sharan104](https://github.com/sharan104) on 2026-11-26T14:21:12Z. --- `docs/asset-policy.md`: everything written from the title's data must go through `victory_core::ensure_outside_repo`. Seven diagnostics writers in `victory-gpu` took a path from a variable and wrote there with no check. With `scripts/play.ps1`'s working directory (the repository root), a relative name put the output in the checkout, where `cargo xtask policy` lets small text and image-free files through. | Variable | Writer | What it writes | |---|---|---| | `VICTORY_CAPTURE` | `capture.rs` | frame PNGs (screenshots), target dumps, per-frame op lists | | `VICTORY_TIMELINE` | `timeline/report.rs` | trace and summary naming places in the title's code | | `VICTORY_POP_FOLDER` | `popwatch.rs` | pictures of the title's frames | | `VICTORY_MEMORY_DUMP` | `memory.rs` | copies of the title's memory arenas, page maps | | `VICTORY_FAULT_BOOK` | `faultbook.rs` | instruction and block addresses in the title's code and memory | | `VICTORY_LIGHT_PROBE` | `lightprobe.rs` | values read out of the title's exposure programs each frame | | `VICTORY_TEXTURE_STORE` | `texstore.rs` | the title's textures, detiled | **Fix:** a shared helper, `crate::switch::outside_repo(name, path)` (Windows only, like the writers). Each writer calls it once where its path is first read, and keeps the answer in its existing `OnceLock`, or a new one where there was none. A refused path gets one `warn!`, nothing is written, and that feature stays off. `VICTORY_CAPTURE` and `VICTORY_TIMELINE` use the same helper. `titlewrite`'s `VICTORY_WRITE_SITES` (#89) keeps its own copy. **Left out on purpose:** - `VICTORY_SHADER_SAVE` (`pipeline.rs`) needs the same check. It's left out only because #205 moves that block, so whichever of the two merges second should add it. **Tests:** - `switch::tests::nothing_is_written_into_the_source_tree`: a folder inside the crate is refused and a temp folder is accepted. - `timeline::report::tests::a_timeline_is_not_written_into_the_source_tree`: one writer end to end. Both files would land inside the crate without the check, and a file outside the repo is still written. Both fail with the check stubbed out, and pass 10 runs out of 10 with it. The other writers read their variable inside a `OnceLock`, so a per-writer test would mean changing the process environment; the shared helper's test covers them instead. **Results:** - `cargo test -p victory-gpu --locked --features diagnostics` passes, and so does the default build. - Clippy `-D warnings` adds nothing beyond main's existing `watch.rs` `unnecessary_mut_passed`, which #241 fixes. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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/283:upstream-pr/283'
git switch 'upstream-pr/283'

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