victory config returns success despite asset-policy violations #831

Closed
opened 2026-11-24 11:47:05 +00:00 by kyle7908 · 8 comments
kyle7908 commented 2026-11-24 11:47:05 +00:00 (Migrated from github.com)
Contributor

Imported from Marvisak/VIctory. Originally posted by kyle7908 on 2026-11-24T11:47:05Z.


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!

<!-- greyfinch-sync:Marvisak/VIctory:issue:6581050462 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/831). Originally posted by [kyle7908](https://github.com/kyle7908) on 2026-11-24T11:47:05Z. --- 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!
pushkarreddyy commented 2026-11-24 13:01:56 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T12:06:42Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7130980345 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/831#issuecomment-7130980345). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-11-24T12:06:42Z. --- 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.
kyle7908 commented 2026-11-24 13:01:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by kyle7908 on 2026-11-24T12:08:58Z.


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!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7131033173 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/831#issuecomment-7131033173). Originally posted by [kyle7908](https://github.com/kyle7908) on 2026-11-24T12:08:58Z. --- 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!
pushkarreddyy commented 2026-11-24 13:01:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T12:09:28Z.


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.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7131044896 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/831#issuecomment-7131044896). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-11-24T12:09:28Z. --- ### 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.
pushkarreddyy commented 2026-11-24 13:02:17 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T12:57:10Z.


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!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7132142434 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/831#issuecomment-7132142434). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-11-24T12:57:10Z. --- 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!
Louisreed commented 2026-11-24 14:04:35 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by Louisreed on 2026-11-24T13:03:20Z.


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)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7132284949 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/831#issuecomment-7132284949). Originally posted by [Louisreed](https://github.com/Louisreed) on 2026-11-24T13:03:20Z. --- 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)
winne42 commented 2026-11-24 19:04:27 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by winne42 on 2026-11-24T18:48:25Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7141177930 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/831#issuecomment-7141177930). Originally posted by [winne42](https://github.com/winne42) on 2026-11-24T18:48:25Z. --- 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._
kyle7908 commented 2026-11-24 19:04:30 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by kyle7908 on 2026-11-24T18:58:40Z.


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!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7141417419 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/831#issuecomment-7141417419). Originally posted by [kyle7908](https://github.com/kyle7908) on 2026-11-24T18:58:40Z. --- 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!
Marvisak commented 2026-11-25 04:07:05 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T03:49:05Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7152268783 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/831#issuecomment-7152268783). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T03:49:05Z. --- <!-- 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)_
Sign in to join this conversation.
No labels
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.

Reference
Marvisak/VIctory#831
No description provided.