victory config returns success despite asset-policy violations #831
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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!
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 returnedOk(()).Updating
show_configto track whether any configured directory triggered anensure_outside_repoviolation, and returningErr(...)/std::process::ExitCode::FAILUREif violations were detected while preserving existing stdout diagnostics.Preparing a clean, verified branch with unit tests on fork.
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!
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:
9cac897based onmain(ffe310e)Changes (
apps/victory/src/main.rs):check_config_policy(cfg: &victory_core::Config) -> Result<()>which accumulates policy violations fromcfg.game_dir,cfg.test_titles,cfg.cache_dir, andcfg.data_dir.anyhow::ensure!(violations == 0, ...)is evaluated, causingvictory configto return exit code 1 if violations exist.check_config_policy_rejects_violation: asserts error return whengame_diris insideCARGO_MANIFEST_DIR.check_config_policy_accepts_clean_config: assertsOk(())on valid external directories.Verification:
cargo xtask policyclean).rustfmt --edition 2024.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!
Imported from Marvisak/VIctory. Originally posted by Louisreed on 2026-11-24T13:03:20Z.
Fix on a fork:
github.com/Louisreed/VIctory@1928032(branchfix/831-config-policy-exit)show_config()now writes eachPOLICY VIOLATIONto 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.rsruns 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 andcargo xtask policyare 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)
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
mainatffe310e. All three fix the bug. With a violating path,victory configexits 1 instead of 0.Setup: Linux host. I cross-compiled for
x86_64-pc-windows-msvcwithlld-linkand the MSVC CRT/SDK fromxwin, 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'sCARGO_BIN_EXE_victorypick up another branch's binary.a91e4db9cac8971928032cargo test -p victory)maincheck_config_policy, which the branch adds)victory configwithVICTORY_CACHE_DIRinside the treeError: configuration failed the asset policy checkError: 1 asset policy violation(s) found in configurationError: 1 configured path(s) violate the asset policycargo clippy -p victory --all-targets --locked -- -D warningscargo fmt --check,cargo xtask policyFor reference, the same
victory configrun onmainprintsPOLICY VIOLATION: …and exits 0.Differences between the three:
VICTORY_CONFIG, and it places.victory-rootmarkers there. That makes it independent of where the repo is checked out. It addstempfileas a dev-dependency (already a workspace dependency, and--lockedpasses) and adds a README note.check_config_policy, and only that function is tested. Nothing checks the binary's exit status end to end. The tests also constructvictory_core::Configwith a struct literal, so they will need updating wheneverConfiggains a field../victory.tomlis 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.
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!
victory configexits nonzero on an asset policy violation #1828Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T03:49:05Z.
Automated triage for the maintainers. Confirmed on
main.show_config()inapps/victory/src/main.rsprintsPOLICY VIOLATION: ...for a configured path inside the repository but always returnsOk(()), sovictory configexits 0. Open PR #1830 ("victory configexits nonzero on an asset policy violation") addresses this. Three fork branches here (kyle7908a91e4db, pushkarreddyy9cac897, Louisreed1928032) 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
victory configexits nonzero on an asset policy violation #1828