Config: an empty VICTORY_CONFIG means unset (port of VIctory#363) #52
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/52"
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 uiliannn/VItoriaBr. Originally posted by lcg007xd-c on 2026-11-25T20:53:42Z.
What
Config::loadtreated an emptyVICTORY_CONFIGas an explicit path.PathBuf::from("")is not a file, so startup aborted with "VICTORY_CONFIG points at , which does not exist". The other path variables already treat an empty value as unset. This one now does too:VICTORY_CONFIG=falls back to./victory.toml(or to no config file), and a non-empty value still selects that exact file.This comes up with launchers and scripts that always export the variable, sometimes empty.
Port
Cherry-pick (
-x) ofgithub.com/Marvisak/VIctory@fd44561from upstream https://github.com/Marvisak/VIctory/pull/363. Enzo Souza Duarte is still the commit author. It applied cleanly.Test
empty_config_env_is_ignoredcovers the empty and non-empty cases through the newexplicit_config_pathhelper. The helper is new, so the test doesn't compile against the old code. The old behaviour is the bug:std::env::var_osreturnedSome(""), which was used as the path.How this was checked (Linux, no Windows PC or game files)
cargo clippy -p victory-core -p victory-pe -p victory-pipeline -p victory-shader -p victory-formats -p victory-game -p xtask --all-targets --locked -- -D warnings, thencargo teston the same crates (rebased on currentmain).cargo clippywith the same crates and--target x86_64-pc-windows-msvc(check only, no link) is clean.rustfmt --checkis clean on the changed file.Not tested: Windows runtime, GPU (D3D12/DXIL validation) and the game itself.
🤖 Generated with Claude Code
Imported from uiliannn/VItoriaBr. Originally posted by lmouz823-lang on 2026-11-28T04:10:54Z.
I can take native Windows configuration-entry validation at exact head
cd78a0d9cf5da2f5a98f79b3f15af33dd7a6b7ef. I will run the existing empty-config regression, then exercise public Config::load in separate processes for unset, explicitly empty, custom-file and missing-file cases. The probe will report the actual environment value so empty and unset are distinguishable. I will compare the empty-value case with the old call-site behavior, restore and rerun, then report the exact native results and limits here. AI-assisted with Codex.Imported from uiliannn/VItoriaBr. Originally posted by lmouz823-lang on 2026-11-28T04:17:28Z.
Native Windows/MSVC validation completed on exact head
cd78a0d9cf5da2f5a98f79b3f15af33dd7a6b7ef, using Windows 11 build 26200 and Rust 1.98.1 in the default test profile.The exact
config::tests::empty_config_env_is_ignoredtest passes, and the completevictory-core --libsuite passes 15/15, with zero failed, ignored or filtered tests.I also exercised the public
victory_core::Config::load()entry point through a tiny external probe. Each scenario runs in a fresh process and external working directory. The driver clears inheritedVICTORY_*variables, uses test-owned configuration and LOCALAPPDATA paths, and supplies empty values through Python's subprocess environment dictionary. The probe prints and asserts the actualstd::env::var_os("VICTORY_CONFIG"), the selected source and the parsed game/cache/data markers.victory.tomlpresentNone, loadsvictory.tomland its markersvictory.tomlpresentSome(""), loadsvictory.tomland its markerscustom.toml, both files presentcustom.tomland its distinct markersmissing.toml, default file presentNone, source is None and default directories resolve under test LOCALAPPDATASome(""), same default resolutionThe negative control restores only the old
Config::loadselection line, leaving the helper and unit test intact. The helper unit test still passes, while both genuinely-empty public-entry scenarios fail withVICTORY_CONFIG points at ..., which does not existand exit 101. The other four scenarios retain their expected behavior. This checks that the fix is wired into the public entry point.After restoring the exact-head bytes, cleaning this task's core package and rebuilding both test and probe, the exact unit test, full 15-test library and all six public-entry scenarios pass again. Final source bytes match the head, the worktree is clean, and
git diff --checkpasses. This validation required no additional repository patch.AI assistance from Codex covered the probe, execution, independent review and this report.
External probe source and reproduction
Public-entry reproduction
Check out PR head
cd78a0d9cf5da2f5a98f79b3f15af33dd7a6b7ef. Create a separate probe directory outside the checkout containingCargo.toml,src/main.rsandpublic-probe-matrix.pyfrom the blocks below. Replace<checkout>in the manifest with the absolute checkout path using forward slashes.The driver runs six independent child processes with synthetic configuration, clears inherited VICTORY variables, and verifies the exact empty-value state reported by Rust. It uses a fresh temporary working directory and test-owned LOCALAPPDATA. The probe calls the public API and checks the selected source and all path markers.
Set
$probeDirto the external probe directory, then run the commands below with Rust 1.98.1 and Python 3 available.For the negative control, replace only the
Config::loadselection line withlet explicit = std::env::var_os("VICTORY_CONFIG").map(PathBuf::from);, retain the helper and unit test, rebuild the probe, and run the matrix. The first explicit-empty case exits 101. Restore the PR line, clean the task-specific core build and rebuild to repeat the passing matrix.Cargo.toml
src/main.rs
public-probe-matrix.py
Pull request closed