victory config returns success despite asset-policy violations #831

Closed
opened 2026-11-26 04:14:02 +00:00 by github-bot · 8 comments
Owner

@⁠kyle7908 on GitHub · 2026-11-24 11:47 UTC · original

I've prepared a small fix that makes victory config return a nonzero exit status when a configured path violates the asset policy, while preserving all existing diagnostics.

I've added two regression tests using synthetic temporary directories and updated the README.

Windows CI results:

344 tests passed

0 failed

6 ignored

Both Clippy checks passed

No game files or game-derived data were used.

Draft PR: https://github.com/kyle7908/VIctory/pull/1

Windows CI: https://github.com/kyle7908/VIctory/actions/runs/45386195867

As upstream pull requests are currently restricted to collaborators, what would be your preferred way to receive this patch?

Thanks!

**@⁠kyle7908** on GitHub · 2026-11-24 11:47 UTC · [original](https://github.com/Marvisak/VIctory/issues/831) I've prepared a small fix that makes victory config return a nonzero exit status when a configured path violates the asset policy, while preserving all existing diagnostics. I've added two regression tests using synthetic temporary directories and updated the README. Windows CI results: 344 tests passed 0 failed 6 ignored Both Clippy checks passed No game files or game-derived data were used. Draft PR: https://github.com/kyle7908/VIctory/pull/1 Windows CI: https://github.com/kyle7908/VIctory/actions/runs/45386195867 As upstream pull requests are currently restricted to collaborators, what would be your preferred way to receive this patch? Thanks!
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:14:02 +00:00
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-24 12:06 UTC · original

Claiming this issue.

In apps/victory/src/main.rs, show_config() inspects the configured directories and prints policy status, but previously always returned Ok(()).

Updating show_config to track whether any configured directory triggered an ensure_outside_repo violation, and returning Err(...) / std::process::ExitCode::FAILURE if violations were detected while preserving existing stdout diagnostics.

Preparing a clean, verified branch with unit tests on fork.

**@⁠pushkarreddyy** on GitHub · 2026-11-24 12:06 UTC · [original](https://github.com/Marvisak/VIctory/issues/831#issuecomment-7130980345) Claiming this issue. In `apps/victory/src/main.rs`, `show_config()` inspects the configured directories and prints policy status, but previously always returned `Ok(())`. Updating `show_config` to track whether any configured directory triggered an `ensure_outside_repo` violation, and returning `Err(...)` / `std::process::ExitCode::FAILURE` if violations were detected while preserving existing stdout diagnostics. Preparing a clean, verified branch with unit tests on fork.
Author
Owner

@⁠kyle7908 on GitHub · 2026-11-24 12:08 UTC · original

Hi! Thanks for your interest.

I've actually already implemented the fix described in this issue, including two regression tests and a README update.

The full Windows CI suite has passed with 344 tests passed and zero failures.

The existing implementation is available here:
https://github.com/kyle7908/VIctory/pull/1

I'm currently awaiting maintainer guidance on submitting the patch upstream, since pull requests are restricted to collaborators.

Just mentioning this to avoid duplicating work. Thanks!

**@⁠kyle7908** on GitHub · 2026-11-24 12:08 UTC · [original](https://github.com/Marvisak/VIctory/issues/831#issuecomment-7131033173) Hi! Thanks for your interest. I've actually already implemented the fix described in this issue, including two regression tests and a README update. The full Windows CI suite has passed with 344 tests passed and zero failures. The existing implementation is available here: https://github.com/kyle7908/VIctory/pull/1 I'm currently awaiting maintainer guidance on submitting the patch upstream, since pull requests are restricted to collaborators. Just mentioning this to avoid duplicating work. Thanks!
Author
Owner

@⁠Louisreed on GitHub · 2026-11-24 13:03 UTC · original · edited 2026-11-24 13:07 UTC

Fix on a fork: github.com/Louisreed/VIctory@1928032 (branch fix/831-config-policy-exit)

show_config() now writes each POLICY VIOLATION to stderr, counts them, and returns an error (N configured path(s) violate the asset policy) so the command exits non-zero.

Tests: new apps/victory/tests/config_policy.rs runs the built binary with cache/data dirs outside the repo (succeeds), one inside (fails, 1 counted) and both inside (fails, 2 counted). cargo test -p victory, clippy and cargo xtask policy are clean. No game data used.

Happy to adjust if you'd prefer a different shape. I can't open a PR since they're collaborator-only.

(Sorry didn't see the comments before submitting, ignore if you want. I'll crack on with something else)

**@⁠Louisreed** on GitHub · 2026-11-24 13:03 UTC · [original](https://github.com/Marvisak/VIctory/issues/831#issuecomment-7132284949) · edited 2026-11-24 13:07 UTC Fix on a fork: https://github.com/Louisreed/VIctory/commit/1928032 (branch [`fix/831-config-policy-exit`](https://github.com/Louisreed/VIctory/tree/fix/831-config-policy-exit)) `show_config()` now writes each `POLICY VIOLATION` to stderr, counts them, and returns an error (`N configured path(s) violate the asset policy`) so the command exits non-zero. Tests: new `apps/victory/tests/config_policy.rs` runs the built binary with cache/data dirs outside the repo (succeeds), one inside (fails, 1 counted) and both inside (fails, 2 counted). `cargo test -p victory`, clippy and `cargo xtask policy` are clean. No game data used. Happy to adjust if you'd prefer a different shape. I can't open a PR since they're collaborator-only. (Sorry didn't see the comments before submitting, ignore if you want. I'll crack on with something else)
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-24 12:57 UTC · original · edited 2026-11-24 14:22 UTC

Hi @⁠kyle7908! Thanks for the heads up!

Looks like our comments crossed paths at almost the exact same minute. Since you had the branch, regression tests, and full CI suite passing on https://github.com/kyle7908/VIctory/pull/1 first, I am more than happy to step aside and yield to your implementation.

Fully support landing your PR once maintainers merge or collaborator permissions reopen!

**@⁠pushkarreddyy** on GitHub · 2026-11-24 12:57 UTC · [original](https://github.com/Marvisak/VIctory/issues/831#issuecomment-7132142434) · edited 2026-11-24 14:22 UTC Hi @⁠kyle7908! Thanks for the heads up! Looks like our comments crossed paths at almost the exact same minute. Since you had the branch, regression tests, and full CI suite passing on https://github.com/kyle7908/VIctory/pull/1 first, I am more than happy to step aside and yield to your implementation. Fully support landing your PR once maintainers merge or collaborator permissions reopen!
Author
Owner

@⁠pushkarreddyy on GitHub · 2026-11-24 12:09 UTC · original · edited 2026-11-24 14:22 UTC

Verified Patch Ready on Fork

The implementation is verified and ready on my fork:

Changes (apps/victory/src/main.rs):

  • Added check_config_policy(cfg: &victory_core::Config) -> Result<()> which accumulates policy violations from cfg.game_dir, cfg.test_titles, cfg.cache_dir, and cfg.data_dir.
  • Emits stdout diagnostics as before, but ensures anyhow::ensure!(violations == 0, ...) is evaluated, causing victory config to return exit code 1 if violations exist.
  • Added unit tests:
    • check_config_policy_rejects_violation: asserts error return when game_dir is inside CARGO_MANIFEST_DIR.
    • check_config_policy_accepts_clean_config: asserts Ok(()) on valid external directories.

Verification:

  • Rule #1 asset policy compliant (cargo xtask policy clean).
  • Formatted with rustfmt --edition 2024.
  • ready for review or merge when PR permissions reopen.
**@⁠pushkarreddyy** on GitHub · 2026-11-24 12:09 UTC · [original](https://github.com/Marvisak/VIctory/issues/831#issuecomment-7131044896) · edited 2026-11-24 14:22 UTC ### Verified Patch Ready on Fork The implementation is verified and ready on my fork: - **Branch:** https://github.com/pushkarreddyy/VIctory/tree/fix/config-policy-exit-status - **Commit:** [`9cac897`](https://github.com/pushkarreddyy/VIctory/commit/9cac897) based on `main` (`ffe310e`) #### Changes (`apps/victory/src/main.rs`): - Added `check_config_policy(cfg: &victory_core::Config) -> Result<()>` which accumulates policy violations from `cfg.game_dir`, `cfg.test_titles`, `cfg.cache_dir`, and `cfg.data_dir`. - Emits stdout diagnostics as before, but ensures `anyhow::ensure!(violations == 0, ...)` is evaluated, causing `victory config` to return exit code 1 if violations exist. - Added unit tests: - `check_config_policy_rejects_violation`: asserts error return when `game_dir` is inside `CARGO_MANIFEST_DIR`. - `check_config_policy_accepts_clean_config`: asserts `Ok(())` on valid external directories. #### Verification: - Rule #1 asset policy compliant (`cargo xtask policy` clean). - Formatted with `rustfmt --edition 2024`. - ready for review or merge when PR permissions reopen.
Author
Owner

@⁠winne42 on GitHub · 2026-11-24 18:48 UTC · original

I tested the three fork fixes posted here side by side, each on top of main at ffe310e. All three fix the bug. With a violating path, victory config exits 1 instead of 0.

Setup: Linux host. I cross-compiled for x86_64-pc-windows-msvc with lld-link and the MSVC CRT/SDK from xwin, then ran the tests under Wine 10.0. This is not a native Windows run. Each branch had its own target directory, because a shared one lets an integration test's CARGO_BIN_EXE_victory pick up another branch's binary.

kyle7908 a91e4db pushkarreddyy 9cac897 Louisreed 1928032
Branch's own tests (cargo test -p victory) 2/2 pass 2/2 pass (unit) 3/3 pass
Same tests on unfixed main 1 of 2 fails, as expected n/a (they call check_config_policy, which the branch adds) 2 of 3 fail, as expected
victory config with VICTORY_CACHE_DIR inside the tree exit 1, Error: configuration failed the asset policy check exit 1, Error: 1 asset policy violation(s) found in configuration exit 1, Error: 1 configured path(s) violate the asset policy
cargo clippy -p victory --all-targets --locked -- -D warnings pass pass pass
cargo fmt --check, cargo xtask policy pass, 155 files ok pass, 155 files ok pass, 155 files ok

For reference, the same victory config run on main prints POLICY VIOLATION: … and exits 0.

Differences between the three:

  • kyle7908: Violations stay on stdout. The integration test runs the built binary from a temp directory with its own VICTORY_CONFIG, and it places .victory-root markers there. That makes it independent of where the repo is checked out. It adds tempfile as a dev-dependency (already a workspace dependency, and --locked passes) and adds a README note.
  • pushkarreddyy: The check moves into check_config_policy, and only that function is tested. Nothing checks the binary's exit status end to end. The tests also construct victory_core::Config with a struct literal, so they will need updating whenever Config gains a field.
  • Louisreed: Violations move from stdout to stderr, and the error includes a violation count. Stderr is a reasonable place for them, but it changes the output beyond what this issue asks for. The tests point the cache and data directories inside the repo via env vars and run from the temp directory so no ./victory.toml is read.

kyle7908's branch looks like the best one to merge: it was first, makes the smallest behaviour change, and its test checks the binary's exit status. Louisreed's violation count would be easy to add on top if wanted.

AI-assisted (Claude Code). Tests were synthetic, with no game files.

**@⁠winne42** on GitHub · 2026-11-24 18:48 UTC · [original](https://github.com/Marvisak/VIctory/issues/831#issuecomment-7141177930) I tested the three fork fixes posted here side by side, each on top of `main` at `ffe310e`. All three fix the bug. With a violating path, `victory config` exits 1 instead of 0. **Setup:** Linux host. I cross-compiled for `x86_64-pc-windows-msvc` with `lld-link` and the MSVC CRT/SDK from `xwin`, then ran the tests under Wine 10.0. This is not a native Windows run. Each branch had its own target directory, because a shared one lets an integration test's `CARGO_BIN_EXE_victory` pick up another branch's binary. | | kyle7908 [`a91e4db`](https://github.com/kyle7908/VIctory/commit/a91e4dba5e28a44bb54c8a30af61bd2978faf3d8) | pushkarreddyy [`9cac897`](https://github.com/pushkarreddyy/VIctory/commit/9cac89713fc2949b5831333f2d4049b27c892b4e) | Louisreed [`1928032`](https://github.com/Louisreed/VIctory/commit/1928032f69720396cc7938a84d44b16d5f3ebf8a) | |---|---|---|---| | Branch's own tests (`cargo test -p victory`) | 2/2 pass | 2/2 pass (unit) | 3/3 pass | | Same tests on unfixed `main` | 1 of 2 fails, as expected | n/a (they call `check_config_policy`, which the branch adds) | 2 of 3 fail, as expected | | `victory config` with `VICTORY_CACHE_DIR` inside the tree | exit 1, `Error: configuration failed the asset policy check` | exit 1, `Error: 1 asset policy violation(s) found in configuration` | exit 1, `Error: 1 configured path(s) violate the asset policy` | | `cargo clippy -p victory --all-targets --locked -- -D warnings` | pass | pass | pass | | `cargo fmt --check`, `cargo xtask policy` | pass, 155 files ok | pass, 155 files ok | pass, 155 files ok | For reference, the same `victory config` run on `main` prints `POLICY VIOLATION: …` and exits 0. **Differences between the three:** - **kyle7908:** Violations stay on stdout. The integration test runs the built binary from a temp directory with its own `VICTORY_CONFIG`, and it places `.victory-root` markers there. That makes it independent of where the repo is checked out. It adds `tempfile` as a dev-dependency (already a workspace dependency, and `--locked` passes) and adds a README note. - **pushkarreddyy:** The check moves into `check_config_policy`, and only that function is tested. Nothing checks the binary's exit status end to end. The tests also construct `victory_core::Config` with a struct literal, so they will need updating whenever `Config` gains a field. - **Louisreed:** Violations move from stdout to stderr, and the error includes a violation count. Stderr is a reasonable place for them, but it changes the output beyond what this issue asks for. The tests point the cache and data directories inside the repo via env vars and run from the temp directory so no `./victory.toml` is read. kyle7908's branch looks like the best one to merge: it was first, makes the smallest behaviour change, and its test checks the binary's exit status. Louisreed's violation count would be easy to add on top if wanted. _AI-assisted (Claude Code). Tests were synthetic, with no game files._
Author
Owner

@⁠kyle7908 on GitHub · 2026-11-24 18:58 UTC · original

Thanks for taking the time to independently test and compare all three implementations. Really appreciate the thorough analysis and verification under Wine.

Keeping the behavioural changes minimal and testing the actual binary's exit status were intentional design decisions, so it's great to see those validated independently.

Happy to make any further adjustments requested by the maintainers. Thanks again!

**@⁠kyle7908** on GitHub · 2026-11-24 18:58 UTC · [original](https://github.com/Marvisak/VIctory/issues/831#issuecomment-7141417419) Thanks for taking the time to independently test and compare all three implementations. Really appreciate the thorough analysis and verification under Wine. Keeping the behavioural changes minimal and testing the actual binary's exit status were intentional design decisions, so it's great to see those validated independently. Happy to make any further adjustments requested by the maintainers. Thanks again!
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 03:49 UTC · original

Automated triage for the maintainers. Confirmed on main. show_config() in apps/victory/src/main.rs prints POLICY VIOLATION: ... for a configured path inside the repository but always returns Ok(()), so victory config exits 0. Open PR #1830 ("victory config exits nonzero on an asset policy violation") addresses this. Three fork branches here (kyle7908 a91e4db, pushkarreddyy 9cac897, Louisreed 1928032) do the same, and winne42 compared them above. Pull requests are open to everyone again (see #717). Please check #1830 before opening another one.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 03:49 UTC · [original](https://github.com/Marvisak/VIctory/issues/831#issuecomment-7152268783) <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-24T18:58:40Z at=2026-11-25T03:49:04Z --> Automated triage for the maintainers. Confirmed on `main`. `show_config()` in `apps/victory/src/main.rs` prints `POLICY VIOLATION: ...` for a configured path inside the repository but always returns `Ok(())`, so `victory config` exits 0. Open PR #1830 ("`victory config` exits nonzero on an asset policy violation") addresses this. Three fork branches here (kyle7908 `a91e4db`, pushkarreddyy `9cac897`, Louisreed `1928032`) do the same, and winne42 compared them above. Pull requests are open to everyone again (see #717). Please check #1830 before opening another one. --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory#831
No description provided.