Config: victory config exits nonzero on an asset policy violation #1828
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1830"
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 Ingenioeren on 2026-11-24T23:07:07Z.
What
show_configinapps/victory/src/main.rsprintedPOLICY VIOLATION: …for each configured path inside the source tree but always returnedOk(()). I moved the policy loop intocheck_policy, which counts the violations and, after printing them all, returnsError: N configured path(s) violate the asset policy. Because of that error,victory confignow exits with 1. What it prints on stdout doesn't change, and a clean configuration still exits 0.Why
#831: a command whose description says "show the resolved configuration and check it" reported success even when the check failed. A script or CI step can't tell the two apart.
The issue thread has three fork branches for this, all from people who couldn't open PRs at the time (kyle7908, pushkarreddyy, Louisreed). This PR is written independently but has the same shape as kyle7908's, which winne42's comparison recommended: violations stay on stdout and only the exit status changes.
How tested
Windows 11, Rust 1.98.1:
cargo test --locked -p victory --bins: 3 passed. The newtests::config_check_fails_a_path_inside_the_repositoryfailed before the fix (unwrap_err()on anOkvalue) and passes after it.tests::config_check_passes_paths_outside_the_repositorypasses both before and after. The tests buildConfigwith..Default::default(), so new fields won't break them.%TEMP%so that novictory.tomlis read:VICTORY_CACHE_DIRinside the checkout, it prints the violation, thenError: 1 configured path(s) violate the asset policy, and exits 1.cargo clippy --locked -p victory --all-targets: no warnings.cargo fmt --check -p victory: clean.cargo run -p xtask -- policy --staged:1 files ok.Not tested: Linux/macOS. The change is platform-neutral.
Fixes #831
AI assistance: prepared with Claude Code, reviewed by Ingenioeren.
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T23:47:47Z.
Review: COMMENTED
Static review only: apps/Windows-only — nothing compiles on macOS; source review of the diff.
victory config exits nonzero on an unknown key: CLI validation fix. apps-side; small.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T06:32:22Z.
Automated triage for the maintainers.
Merge candidate. The head has not changed since the previous review (
f148f00).check_policyinapps/victory/src/main.rscounts thevictory_core::ensure_outside_reporefusals for the configured paths and returns an error, sovictory confignow exits nonzero on an asset-policy violation. Before this change it printed the message and still exited 0. The two unit tests check one path inside the checkout and one outside it, andConfigderivesDefault, so the struct-update syntax in them compiles.On the later discussion: the end-to-end exit-code table on Windows (0 on main and 1 with the patch for paths inside the checkout, 0 for paths outside) confirms the intended behaviour. Keeping kyle7908's CLI integration tests for a separate follow-up PR is fine. Nothing here changes the verdict. CI: no check runs on the head commit.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Ingenioeren on 2026-11-25T06:37:13Z.
I verified the CLI exit status end to end on Windows 11 with this patch applied cleanly to current
mainat940d32f. Both builds usedcargo build --locked --offline -p victory. Each invocation ofvictory configread a temporary TOML file viaVICTORY_CONFIG.f148f00, same two pathsf148f00, all paths outside the checkoutThe patched failure names both violations and reports the count on stderr. The input paths were synthetic. No game files or game process were involved.
AI-assisted verification.
Imported from Marvisak/VIctory. Originally posted by kyle7908 on 2026-11-25T09:54:16Z.
Hi @Ingenioeren,
I've reviewed PR #1830 against my earlier implementation for #831 (kyle7908/VIctory@a91e4db).
Your implementation looks solid, and I'm happy to support #1830 as the upstream fix rather than open a duplicate PR.
I also carried out an independent comparison using upstream
940d32f. Both implementations produced the expected results across 19 synthetic configuration scenarios in an isolated Linux Rust harness. This wasn't a full Windows CLI run, but my existing fork has separately passed its Windows CI suite (344 passed, 0 failed, 6 ignored).One potentially useful addition is the two CLI integration tests from my implementation. Unlike the helper-level tests currently in #1830, they exercise configuration loading, command dispatch, actual process exit status and multiple policy violations. They also pass against #1830's implementation in the isolated harness.
I'd be happy to contribute those tests and the accompanying README clarification, while retaining your production implementation and giving appropriate attribution.
Would you prefer to incorporate those additions into #1830, or would a small follow-up PR be more useful?
Thanks for your work on this!
Imported from Marvisak/VIctory. Originally posted by Ingenioeren on 2026-11-25T10:00:54Z.
Thanks for comparing them, @kyle7908. I'd rather keep this PR small so it's easy to review. Your CLI integration tests would be a good follow-up PR once this lands: they test the real exit status and the multiple-violation case, and the helper tests here don't cover either. Since they're your tests, please open that PR yourself so the credit stays with you.
Imported from Marvisak/VIctory. Originally posted by kyle7908 on 2026-11-25T10:07:15Z.
Thanks @Ingenioeren, really appreciate that!
I'll prepare the CLI integration tests locally and wait until #1830 lands before opening a focused follow-up PR against upstream main.
I'll make sure the tests cover the actual process exit status, single and multiple policy violations, and preservation of the existing diagnostics, without changing your production implementation.
Thanks again for the collaboration!