victory config: a policy violation fails the command (#301) #340

Manually merged
github merged 1 commit from github-bot/gh-340 into a-publier 2026-11-27 00:57:56 +00:00 AGit
Owner

@⁠TinkerBell-90 on GitHub · 2026-11-26 20:59 UTC · original
TinkerBell-90:config-policy-fails → a-publier · +31 −7 · 1 files · 1 commits · merged 2026-11-26 22:30 UTC

Fixes #301.

victory config printed POLICY VIOLATION: ... on stdout and still returned Ok, so it exited 0 on the configuration ensure_outside_repo exists to refuse. The check now goes through a small check_policy that writes each violation to stderr and returns an error when there is one, so the command exits 1, as victory translate and the other commands that use the path already stop. The resolved values still print first, on stdout.

Tested on Linux, the app built for x86_64-pc-windows-gnu and run under Wine 10, on top of a-publier at cd8dfc0. No game files: game_dir was not set, only VICTORY_CACHE_DIR and VICTORY_DATA_DIR. Nothing was run in game.

  • VICTORY_CACHE_DIR inside the source tree: before, the violation on stdout and exit code 0; after, the violation on stderr, Error: 1 policy violation(s) and exit code 1.
  • Both paths outside the tree: exit code 0 before and after, same stdout.
  • New test config_check_fails_on_a_path_inside_the_repo (one path outside, the same inside path twice: two violations). 23/23 tests of the app pass under Wine. With the old behaviour put back (no error at the end), the test fails on unwrap_err.
  • cargo clippy --no-deps -p victory --all-targets --target x86_64-pc-windows-gnu -- -D warnings is clean, and rustfmt has nothing to say about the added lines.

AI-assisted.

**@⁠TinkerBell-90** on GitHub · 2026-11-26 20:59 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/340) `TinkerBell-90:config-policy-fails` → `a-publier` · +31 −7 · 1 files · 1 commits · merged 2026-11-26 22:30 UTC Fixes #301. `victory config` printed `POLICY VIOLATION: ...` on stdout and still returned `Ok`, so it exited 0 on the configuration `ensure_outside_repo` exists to refuse. The check now goes through a small `check_policy` that writes each violation to stderr and returns an error when there is one, so the command exits 1, as `victory translate` and the other commands that use the path already stop. The resolved values still print first, on stdout. Tested on Linux, the app built for `x86_64-pc-windows-gnu` and run under Wine 10, on top of `a-publier` at `cd8dfc0`. No game files: `game_dir` was not set, only `VICTORY_CACHE_DIR` and `VICTORY_DATA_DIR`. Nothing was run in game. - `VICTORY_CACHE_DIR` inside the source tree: before, the violation on stdout and exit code 0; after, the violation on stderr, `Error: 1 policy violation(s)` and exit code 1. - Both paths outside the tree: exit code 0 before and after, same stdout. - New test `config_check_fails_on_a_path_inside_the_repo` (one path outside, the same inside path twice: two violations). 23/23 tests of the app pass under Wine. With the old behaviour put back (no error at the end), the test fails on `unwrap_err`. - `cargo clippy --no-deps -p victory --all-targets --target x86_64-pc-windows-gnu -- -D warnings` is clean, and rustfmt has nothing to say about the added lines. AI-assisted.
The check printed "POLICY VIOLATION" on stdout and returned Ok, so the
command exited 0 on exactly the configuration it exists to refuse, and
a script running `victory config || exit 1` went on. Each violation now
goes to stderr and the command ends with an error, as the commands that
would use the path already do. The resolved values still print first.

Fixes #301.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:01:56 +00:00
github manually merged commit 77bb051930 into a-publier 2026-11-27 00:57:56 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.