Config: victory config exits nonzero on an asset policy violation #1830
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1830
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1830/head"
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?
@Ingenioeren on GitHub · 2026-11-24 23:07 UTC · original
Ingenioeren:fix/831-config-policy-exit→main· +45 −0 · 1 files · 1 commits · merged 2026-11-25 21:51 UTCWhat
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
victory configexits nonzero on an asset policy violation f148f00511@Marvisak on GitHub · 2026-11-25 06:32 UTC · original · edited 2026-11-25 11:21 UTC
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
@Ingenioeren on GitHub · 2026-11-25 06:37 UTC · original
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.
@kyle7908 on GitHub · 2026-11-25 09:54 UTC · original
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!
@Ingenioeren on GitHub · 2026-11-25 10:00 UTC · original
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.
@kyle7908 on GitHub · 2026-11-25 10:07 UTC · original
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!