Test victory config policy exit status through the CLI #3074
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!3074
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3074"
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?
@kyle7908 on GitHub · 2026-11-26 06:29 UTC · original
kyle7908:test/config-policy-cli→main· +149 −0 · 1 files · 2 commits · openSummary
Add process-level regression coverage for
victory configas a follow-up to #1830 and #831. Thanks to Ingenioeren for the production fix and for [inviting me to submit the CLI tests separately](#1830). These tests come from my earlier work in kyle7908/VIctory@a91e4dba5e, recovered from local commit10ebac0.The tests launch Cargo's built
victoryexecutable in a temporary directory. They cover clean paths, a singlegame_dirviolation, a singletest_titleviolation, and multiple cache/data violations.They check the actual exit code, the resolved configuration and per-path diagnostics on stdout, and the counted error summary on stderr.
Following reviewer feedback, the tests now use unique temporary directories through
std::env::temp_dir(), with reliable cleanup and no additional dependencies.Both
Cargo.tomlandCargo.lockmatch upstreammain. The PR changes onlyapps/victory/tests/config.rs. #1830's production implementation is unchanged.Validation
49761f9), the clean case passed and all three violation cases failed because the executable printed the policy diagnostics but exited0.mainat63bcca4, all 41 tests invictory,victory-core, andxtaskpassed, including all four new CLI cases.--all-features.-D warningsfor all targets under default and all features.git diff --check, and staged and full asset-policy checks passed.311a72c.Local validation covered the relevant packages on Windows. The fixtures contain only temporary TOML, directories and empty repository markers. No game files or game-derived data were used.
AI disclosure. OpenAI Codex assisted with recovering the patch, source review, implementation, validation and preparation of this description.
@kyle7908 on GitHub · 2026-11-26 06:37 UTC · original
@kotekompotek Thanks for the thorough review and approval! Really appreciate your time.
@kotekompotek on GitHub · 2026-11-26 06:34 UTC · original · approved these changes
Verified: real end-to-end coverage — spawns CARGO_BIN_EXE_victory in a tempdir, asserts exit 0 vs 1, the exact one-line stderr summary (Option iterator eq trick is neat), each resolved path on stdout, and one POLICY VIOLATION line per marked dir. Env scrubbing covers the overrides that would make it nondeterministic.
@Marvisak on GitHub · 2026-11-26 08:23 UTC · original
Automated triage for the maintainers.
Verdict: needs work. This needs the maintainer's decision. The tests in
apps/victory/tests/config.rscheck what they should against main'sshow_config/check_policy(apps/victory/src/main.rs) andvictory_core::ensure_outside_repo:POLICY VIOLATION:lines;N configured path(s) violate the asset policysummary;.victory-rootmarker.That is useful coverage of rule 1.
The PR adds a dev-dependency (
tempfile) toapps/victory/Cargo.tomland changesCargo.lock. Triage leaves dependency changes to the maintainer, even for a crate already in the workspace. The existing CLI tests (tests/census.rs) need no extra crate. A unique directory understd::env::temp_dir(), removed at the end, would avoid the dependency. That change, or the maintainer's approval oftempfilehere, would make this a merge candidate.CI:
checkpassing.Generated by Claude Code
@kyle7908 on GitHub · 2026-11-26 08:32 UTC · original
Thanks for flagging the dependency concern.
I've removed
tempfileand switched the four CLI tests to unique directories understd::env::temp_dir(), following the existing census test convention. All four tests and their assertions are preserved, and bothCargo.tomlandCargo.locknow match upstreammain.All 41 relevant tests passed locally on Windows, including the four CLI cases with all features enabled. Temporary-directory cleanup, formatting, Clippy and asset-policy checks also passed.
The latest hosted Windows CI check is now passing.
Thanks again for the review!
@fuzeofficlal on GitHub · 2026-11-26 08:56 UTC · original · approved these changes
Verified
311a72c3locally on Windows 11 x64:cargo clippy --all-targets --locked -- -D warningsand--all-features: clean (0.77s/3.57s).cargo test -p xtask --locked policy::tests::repository_passes_policy: 1 passed, 0 failed (0.34s).cargo test -p victory -p victory-core -p xtask --locked: 41 passed, 0 failed (22invictoryincluding all 4tests/config.rscases,13invictory-core,6inxtask,2.73s).cargo test -p victory --all-features --locked: 22 passed, 0 failed (2.64s).rustfmt --edition 2024 --check apps/victory/tests/config.rs: clean.Cargo.tomlandCargo.locknow matchmaincleanly, leavingapps/victory/tests/config.rsas the sole file.ScratchDirallocates unique per-test directories atomically viacreate_dirretry withAtomicUsize+ PID + timestamp and cleans up cleanly inDropwithout masking test panics. (Optional nit: in thepanicking()branch ofDrop,let _ = writeln!(std::io::stderr(), ...);avoids any theoretical double-panic if stderr write fails.)LGTM.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.