VICTORY_WRITE_SITES: refuse a file inside the source tree (#33) #89

Manually merged
github merged 1 commit from github-bot/gh-89 into main 2026-11-26 08:21:45 +00:00 AGit
Owner

@⁠sharan104 on GitHub · 2026-11-26 02:51 UTC · original
sharan104:fix/33-write-sites-outside-repo → main · +39 −4 · 3 files · 1 commits · merged 2026-11-26 08:17 UTC

Fixes #33.

VICTORY_WRITE_SITES writes <title module> <offset> lines, which are game-derived, and opened the path as given. With scripts/play.ps1's working directory a relative name landed in the checkout, and (as the issue's follow-up comment shows) cargo xtask policy would accept a small .txt of that shape. It was the one writer that skipped ensure_outside_repo.

What changes:

  • titlewrite::learn now resolves the file once through victory_core::ensure_outside_repo and keeps the answer in a OnceLock. A refused path gets one warn! and no more threads are started for it. The check runs on the spawned thread, as the write already did, not under the title's fault.
  • victory-gpu depends on victory-core directly (no cycle: victory-core has no workspace dependencies, and it was already built for victory-gpu through victory-pipeline; victory-loader calls the same function directly). Cargo.lock gains the one edge.
  • New test sites_are_not_written_into_the_source_tree: a path under CARGO_MANIFEST_DIR is refused, a temp path accepted.

Tests: cargo test -p victory-gpu --locked (327 passed, 0 failed, 34 ignored). cargo build --locked -p victory --features diagnostics builds. No new Clippy warnings in titlewrite.rs.

Note: the refusal is decided once per process, so changing the variable mid-run has no effect (the variable is read at startup in practice).

🤖 Generated with Claude Code

**@⁠sharan104** on GitHub · 2026-11-26 02:51 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/89) `sharan104:fix/33-write-sites-outside-repo` → `main` · +39 −4 · 3 files · 1 commits · merged 2026-11-26 08:17 UTC Fixes #33. `VICTORY_WRITE_SITES` writes `<title module> <offset>` lines, which are game-derived, and opened the path as given. With `scripts/play.ps1`'s working directory a relative name landed in the checkout, and (as the issue's follow-up comment shows) `cargo xtask policy` would accept a small `.txt` of that shape. It was the one writer that skipped `ensure_outside_repo`. What changes: - `titlewrite::learn` now resolves the file once through `victory_core::ensure_outside_repo` and keeps the answer in a `OnceLock`. A refused path gets one `warn!` and no more threads are started for it. The check runs on the spawned thread, as the write already did, not under the title's fault. - `victory-gpu` depends on `victory-core` directly (no cycle: `victory-core` has no workspace dependencies, and it was already built for `victory-gpu` through `victory-pipeline`; `victory-loader` calls the same function directly). `Cargo.lock` gains the one edge. - New test `sites_are_not_written_into_the_source_tree`: a path under `CARGO_MANIFEST_DIR` is refused, a temp path accepted. Tests: `cargo test -p victory-gpu --locked` (327 passed, 0 failed, 34 ignored). `cargo build --locked -p victory --features diagnostics` builds. No new Clippy warnings in `titlewrite.rs`. Note: the refusal is decided once per process, so changing the variable mid-run has no effect (the variable is read at startup in practice). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The file holds places in the title's code, which is game-derived, and was
opened wherever the variable pointed: with scripts/play.ps1's working
directory a relative name landed in the checkout, and cargo xtask policy
accepts a small .txt of that shape. The path now goes through
victory_core::ensure_outside_repo, as every other writer's does. It is
looked at once, on the thread that writes and not under the title's fault,
and kept in a OnceLock: a refused file is said once with a warning, and no
thread is started for it again.

victory-gpu depends on victory-core directly now (no cycle: victory-core
has no workspace dependencies, and it was already built through
victory-pipeline).

Fixes #33

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:31:59 +00:00
Author
Owner

@⁠avatarmanz on GitHub · 2026-11-26 07:55 UTC · original

Merged into main in the next push (tests pass); thanks.

**@⁠avatarmanz** on GitHub · 2026-11-26 07:55 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/89#issuecomment-7185988451) Merged into main in the next push (tests pass); thanks.
github manually merged commit e102fca1c6 into main 2026-11-26 08:21:45 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.