Repository navigation
App: enforce asset policy check in default_paths - #535
pushkarreddyy wants to merge 3 commits into
Conversation
Technical Verification & Implementation DetailsContext & Root CauseIn Changes & Diff
Git Log Line & Verification
|
Call for Testing & Maintainer ReviewCommunity verification on CLI commands (
@Marvisak: Ready for maintainer review and merge when convenient! |
|
Heads-up: with this merged, #115's census tests fail (they pass the crate's own |
|
Thanks for the heads-up and verification @KevinPratap! You're spot on: passing files inside the repository (like |
mercuryVM
left a comment
There was a problem hiding this comment.
Tested 8cc7bd2 on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (266 passed, 0 failed).
The code does what it says, but I'm not convinced the check belongs on these paths:
ensure_outside_repois there to keep derived data and title files from being written into the repo: the config's data, cache and game directories, so nothing proprietary gets committed by accident.default_pathsfeeds three read-only analysis commands (census,shader-info,translate). Reading a path inside the repo can't put title data into it.- The only things that can legitimately sit inside the repo are synthetic, policy-compliant files (test containers, fixtures someone writes for a bug report). After this change,
victory shader-info ./my-synthetic.dxbcfrom a checkout is refused with an asset-policy error, which reads as an accusation. - Configured
game_dirandtest_titlesare already checked where the config is resolved (show_configreports them, andsubdirenforces it for derived directories).
If the goal is to stop people storing a game inside the checkout, a warning when a configured game_dir resolves inside the repo would make that point without blocking reads. Comment rather than a change request, since this is a policy call for the maintainers.
AI-assisted (Claude Code).
|
Thanks @mercuryVM for the insightful architectural distinction! You are completely right: read-only analysis tools (\census, \shader-info, \ ranslate) need to inspect synthetic in-repo test fixtures (like \ ests/fixtures\ or #115's test cases) without triggering an asset policy error. Hard-blocking reads inside the repo was conflating read-only analysis with writing derived data. I've updated the branch in commit \ebfa8ae\ so that:
|
mercuryVM
left a comment
There was a problem hiding this comment.
Re-tested ebfa8ae on Windows 11, RTX 5070, MSVC: cargo test -p victory 3 passed, including default_paths_accepts_cli_paths.
This resolves my earlier point that the check blocked synthetic in-tree inputs: explicit CLI paths are now taken as given. But the PR now no longer enforces anything for configured paths. Its title says "enforce asset policy check in default_paths", and the code now does the opposite:
main.rs(default_paths): agame_dir/test_titlesfrom config that resolves inside the checkout now only printsPOLICY WARNINGto stderr and carries on. Before this commit it was an error. The asset policy (README,policy.rs) is a refusal, not a warning, and a configured game folder inside the repo is the case it exists for.- If the goal is "CLI fixtures may live in-tree", keep the configured-path check as
ensure_outside_repo(p)?and exempt only explicit CLI paths, which this commit already does. Then the PR title and behaviour line up. It's a maintainer policy call, so leaving it as a comment.
AI-assisted (Claude Code).
|
Thanks @mercuryVM! You're completely right on aligning behavior and intent: the core requirement of Rule #1 is that configured directories in I've updated the branch in commit
The PR title, behavior, and policy guarantees now align completely. |
catminou4
left a comment
There was a problem hiding this comment.
Static review (app crate doesn't build on macOS — the known host_resource cfg issue, fixed by #235/#523 — so nothing here was compiled or run).
The logic is correct: default_paths returns CLI paths early (Ok(paths)) before the configured-paths branch, so the new ensure_outside_repo loop only guards paths coming from victory.toml/env — matching the asset policy (CLI paths may be synthetic in-tree fixtures, configured paths must stay outside the repo). That matches the existing config command's POLICY VIOLATION reporting.
One test-quality nit: default_paths_rejects_configured_inside_repo doesn't call default_paths at all — it calls victory_core::ensure_outside_repo directly, so the new loop in default_paths itself has no coverage (testing it needs a Config::load with a config file, which is env-dependent). The other two tests do exercise default_paths properly. Non-blocking.
4307207 to
f6585cc
Compare
…CLI paths Applied as the net diff of upstream PR Marvisak#535 (head f6585cc), 3 commits: f6585cc,57a61f9e,093471d6.
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>
|
Automated triage for the maintainers. Needs work. The new head
With a concrete case the guard protects and a test of that branch, this would be ready for a maintainer's look. CI: passing. Generated by Claude Code |
f6585cc to
21323ad
Compare
Motivation
apps/victory/src/main.rs:default_pathsresolves paths supplied either via the command line or fromvictory.toml(game_dirandtest_titles). Previously, it returned these paths without validating that they are outside the repository according to VIctory's asset policy (Rule #1).While
show_configlogged policy violations, commands relying ondefault_paths(census,shader-info,translate) did not enforcevictory_core::ensure_outside_repo(&p).Solution
default_pathswithvictory_core::ensure_outside_repo(p)?prior to returning.apps/victory/src/main.rsverifying that paths inside the repository are rejected and paths outside the repository are accepted.No game files used.