Skip to content

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

Closed
CwWwWwW wants to merge 1 commit into
fxceless:mainfrom
CwWwWwW:port/config-policy-exit
Closed

CwWwWwW wants to merge 1 commit into
fxceless:mainfrom
CwWwWwW:port/config-policy-exit

Conversation

@CwWwWwW

@CwWwWwW CwWwWwW commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

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.)

…1830)

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.
@CwWwWwW CwWwWwW closed this Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant