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

Merged
sharan104 merged 1 commit from upstream-pr/89 into main 2026-11-26 08:17:50 +00:00
sharan104 commented 2026-11-26 02:51:26 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by sharan104 on 2026-11-26T02:51:26Z.


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

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:6618441044 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/89). Originally posted by [sharan104](https://github.com/sharan104) on 2026-11-26T02:51:26Z. --- 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)
avatarmanz commented 2026-11-26 07:55:40 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by avatarmanz on 2026-11-26T07:55:40Z.


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

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7185988451 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/89#issuecomment-7185988451). Originally posted by [avatarmanz](https://github.com/avatarmanz) on 2026-11-26T07:55:40Z. --- Merged into main in the next push (tests pass); thanks.
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!89
No description provided.