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
github-bot wants to merge 4 commits from github-bot/gh-283 into main AGit
Owner

@⁠sharan104 on GitHub · 2026-11-26 14:21 UTC · original
sharan104:fix/capture-audit → main · +58 −4 · 8 files · 4 commits · open

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

**@⁠sharan104** on GitHub · 2026-11-26 14:21 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/283) `sharan104:fix/capture-audit` → `main` · +58 −4 · 8 files · 4 commits · open `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)
The capture folder holds PNG pictures of the title's frames and of its
render targets (VICTORY_DUMP_TARGETS), and lists of its draws per frame:
screenshots, which docs/asset-policy.md names as game-derived. The folder
was used wherever the variable pointed, so a relative name with
scripts/play.ps1's working directory (the repository root) put them in the
checkout, and cargo xtask policy accepts the .txt lists. The folder now
goes through victory_core::ensure_outside_repo once, where it is first
read, as VICTORY_WRITE_SITES does since effa1dc: a refused folder is said
with a warning, and every capture writer sees no folder and saves nothing.

The new test fails with the check left out (the folder inside the crate
comes back) and passes with it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A timeline's Chrome trace and summary name places in the title's code
(samples of its threads and the sites of its waits, as module+offset), the
same kind of data as VICTORY_WRITE_SITES, which effa1dc put behind the
asset-policy check. The timeline file was written wherever the variable
pointed, so a relative name with scripts/play.ps1's working directory (the
repository root) put both files in the checkout, where cargo xtask policy
accepts a .json and a .txt of text. report::write now calls
victory_core::ensure_outside_repo on the file first and says with a
warning that nothing is written when it is refused.

The new test fails without the check (both files appear in the crate) and
passes with it; a file outside is still written.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Four more writers took a path from a variable and wrote what comes from
the title there without the asset-policy check, so with scripts/play.ps1's
working directory (the repository root) a relative name put it in the
checkout:

- VICTORY_POP_FOLDER (popwatch): pictures of the title's frames;
- VICTORY_MEMORY_DUMP (memory): copies of the title's memory arenas;
- VICTORY_FAULT_BOOK (faultbook): places in the title's code and memory
  that fault;
- VICTORY_LIGHT_PROBE (lightprobe): values read out of the title's
  exposure programs, frame by frame.

Each now asks crate::switch::outside_repo once, where its path is first
read, and keeps the answer: a refused path is said with one warning and
nothing is written (the feature stays off). VICTORY_CAPTURE and
VICTORY_TIMELINE use the same helper now instead of their own copies;
titlewrite's VICTORY_WRITE_SITES keeps its own. VICTORY_SHADER_SAVE
(pipeline.rs) needs the same and is left out here only because an open
change moves that block; VICTORY_TEXTURE_STORE is left to a change of
its own.

The helper's test fails with the check left out (a folder inside the
crate comes back) and passes with it; the timeline's test covers a
writer end to end.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:22:25 +00:00
github-bot changed title from victory-gpu: six diagnostics writers refuse a path inside the source tree (capture, timeline, pop, memory dump, fault book, light probe) to victory-gpu: seven diagnostics writers refuse a path inside the source tree (capture, timeline, pop, memory dump, fault book, light probe, texture store) 2026-11-26 14:34:20 +00:00
The texture store writes the title's textures, detiled, into the folder
the variable names; it now goes through crate::switch::outside_repo like
the other diagnostic writers, before the folder is made. A refused folder
is said once and the store stays off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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/283/head:github-bot/gh-283'
git switch 'github-bot/gh-283'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-283'
git switch 'github-bot/gh-283'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-283'
git switch 'github-bot/gh-283'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-283'
git switch 'main'
git merge --squash 'github-bot/gh-283'
git switch 'main'
git merge --ff-only 'github-bot/gh-283'
git switch 'main'
git merge 'github-bot/gh-283'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.