victory config: exit nonzero on an asset-policy violation (port of upstream #1830) #1327

Closed
github-bot wants to merge 1 commit from github-bot/gh-1327 into main AGit
Owner

@⁠CwWwWwW on GitHub · 2026-11-26 15:33 UTC · original
CwWwWwW:port/config-policy-exit → main · +46 −0 · 1 files · 1 commits · closed without merging

Problem

victory config prints POLICY VIOLATION: ... for each configured path the asset policy refuses (a game_dir, test title, cache_dir or data_dir inside the repository), but still returns Ok(()) and exits 0. A script or user checking the configuration cannot tell the asset policy was violated, although the repository requires those paths to stay outside it (nothing from the game may be committed).

Upstream VIctory fixed this in commit 834d643 (pull request #1830, by Ingenioer); this is that fix ported to the fork.

Change

  • The policy loop moves into check_policy(cfg), counts violations, and returns an error (anyhow ensure) naming the count when there is one.
  • show_config ends with check_policy(&cfg), so victory config exits nonzero for a violated policy, like every other failed command.
  • Same output lines as before for violations; no other command changed.

Tests

  • New config_check_passes_paths_outside_the_repository and config_check_fails_a_path_inside_the_repository (a game_dir under CARGO_MANIFEST_DIR).
  • cargo test -p victory --locked: 3 passed, 0 failed.
  • cargo clippy -p victory --all-targets --locked -- -D warnings: clean.
  • No game or GPU needed.

(CI note: the check job on main is currently red on the asset-policy violation; #1322 fixes that, after which this can be rebased.)

**@⁠CwWwWwW** on GitHub · 2026-11-26 15:33 UTC · [original](https://github.com/fxceless/victory-fork/pull/1327) `CwWwWwW:port/config-policy-exit` → `main` · +46 −0 · 1 files · 1 commits · closed without merging ## Problem victory config prints POLICY VIOLATION: ... for each configured path the asset policy refuses (a game_dir, test title, cache_dir or data_dir inside the repository), but still returns Ok(()) and exits 0. A script or user checking the configuration cannot tell the asset policy was violated, although the repository requires those paths to stay outside it (nothing from the game may be committed). Upstream VIctory fixed this in commit 834d643 (pull request #1830, by Ingenioer); this is that fix ported to the fork. ## Change - The policy loop moves into check_policy(cfg), counts violations, and returns an error (anyhow ensure) naming the count when there is one. - show_config ends with check_policy(&cfg), so victory config exits nonzero for a violated policy, like every other failed command. - Same output lines as before for violations; no other command changed. ## Tests - New config_check_passes_paths_outside_the_repository and config_check_fails_a_path_inside_the_repository (a game_dir under CARGO_MANIFEST_DIR). - cargo test -p victory --locked: 3 passed, 0 failed. - cargo clippy -p victory --all-targets --locked -- -D warnings: clean. - No game or GPU needed. (CI note: the check job on main is currently red on the asset-policy violation; #1322 fixes that, after which this can be rebased.)
Ported from upstream VIctory commit 834d643 (pull request #1830,
Ingenioer): victory config printed a POLICY VIOLATION line for each
configured path inside the repository but still exited 0, so a script or
a user checking the configuration could not tell the asset policy was
violated (the repository says such paths must never hold game data).

The policy check is now its own function, counts the violations and fails
with "N configured path(s) violate the asset policy" when there is one;
victory config then exits nonzero like every other failed command.

Test: config_check_passes_paths_outside_the_repository and
config_check_fails_a_path_inside_the_repository (a game_dir under
CARGO_MANIFEST_DIR). cargo test -p victory: 3 passed, 0 failed;
cargo clippy -p victory --all-targets -- -D warnings: clean.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 15:35:20 +00:00
github-bot closed this pull request 2026-11-26 15:52:06 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.