Skip to content

Config: ignore an empty VICTORY_CONFIG - #363

Merged
Marvisak merged 1 commit into
Marvisak:mainfrom
enzoduarte1:config/empty-config-env
Nov 25, 2026
Merged

Marvisak merged 1 commit into
Marvisak:mainfrom
enzoduarte1:config/empty-config-env

Conversation

@enzoduarte1

@enzoduarte1 enzoduarte1 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What

Config::load treats an empty VICTORY_CONFIG as an explicit path: PathBuf::from("") is not a file, so startup fails with VICTORY_CONFIG points at , which does not exist. The other path variables in resolve ignore empty values; PR #341 makes VICTORY_TEST_TITLES consistent with them.

The environment lookup now goes through a small helper that filters empty values, so VICTORY_CONFIG= falls back to ./victory.toml (or no config file) instead of aborting. A non-empty value still selects that exact file. A unit test covers empty and non-empty values.

Tested

  • Windows 11, Rust 1.98.1, x86_64-pc-windows-gnu (this machine has no MSVC linker).
  • cargo test -p victory-core: 9 passed, 0 failed.
  • cargo test --workspace --exclude victory-loader: all suites passed.
  • cargo clippy -p victory-core --all-targets -- -D warnings: clean.
  • cargo clippy --workspace --all-targets: finishes successfully; it still reports the pre-existing warnings that PR Chore: clear two workspace Clippy errors #355 fixes.
  • rustfmt --edition 2024 --check crates/victory-core/src/config.rs and git diff --check: clean.
  • cargo xtask policy: 151 files ok. No game files or data taken from them were added.
  • Not tested: cargo test -p victory-loader --test load_probe. Its fixture passes MSVC's /DELAYLOAD link flag, which MinGW's linker rejects here; the same failure occurs on unmodified main. cargo fmt --all --check also has unrelated pre-existing diffs, so no other files were reformatted.

Checklist

  • cargo fmt, cargo clippy --workspace --all-targets and cargo test --workspace pass — see the toolchain limitations above; the changed crate is clean.
  • cargo xtask policy passes. The change adds no game files or data taken from them (docs/asset-policy.md).
  • If an AI tool wrote part of this change, the description says so: an AI tool assisted with the code and test; I reviewed and ran them.

@SkippySteve

Copy link
Copy Markdown

Thanks for this. The bug is real: on main, VICTORY_CONFIG= is turned into PathBuf::from(""), and startup stops with VICTORY_CONFIG points at , which does not exist. The fix is right too.

What I checked

  • On the PR head (4874c3f), Linux, cargo test -p victory-core config: 5 passed, including the new empty_config_env_is_ignored.
  • The new helper takes an env closure, the same way resolve does, so the test doesn't change the process environment. Good.

This overlaps with #241
#241 (Core host UX: XDG data dir, config-relative paths) already has this fix. Its explicit_config does the same .filter(|v| !v.is_empty()) on VICTORY_CONFIG, and the module docs now say "a variable that is set but empty counts as unset". Its test victory_config_expands_tilde_and_ignores_empty covers the empty value. It also expands a leading ~ and gives a clearer error when the value names a folder.

The two PRs change the same lines of Config::load, so merging one gives the other a conflict in crates/victory-core/src/config.rs. I checked this with a trial merge.

Suggestion

Either way, nothing needs to change in this PR.

@enzoduarte1

Copy link
Copy Markdown
Contributor Author

Thanks for checking this. Agreed: if PR 241 lands first, this change is redundant and can be closed; otherwise it can land on its own and PR 241 can drop its copy of the filter. I will leave the call to the maintainers — nothing needs changing here.

@ghost ghost mentioned this pull request Nov 24, 2026

@mercuryVM mercuryVM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested 4874c3f on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (265 passed, 0 failed).

An empty VICTORY_CONFIG now means unset, the same rule the other path variables in resolve already follow (env_path filters empty values). A non-empty value is still taken as the exact file, so a mistyped path still fails loudly. The helper takes the env lookup as a closure, matching how resolve is tested.

No issues found.

AI-assisted (Claude Code).

mercuryVM added a commit to mercuryVM/VIctory that referenced this pull request Nov 24, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@enzoduarte1
enzoduarte1 force-pushed the config/empty-config-env branch from 4874c3f to fd44561 Compare November 24, 2026 14:21
yourmomsbasement pushed a commit to yourmomsbasement/VIctory_Dev that referenced this pull request Nov 24, 2026
Merges Marvisak#188 Marvisak#213 Marvisak#214 Marvisak#219 Marvisak#221 Marvisak#311 Marvisak#324 Marvisak#363 Marvisak#406 Marvisak#454 Marvisak#529 Marvisak#560 Marvisak#708 Marvisak#937
Marvisak#941 Marvisak#963 Marvisak#1111 Marvisak#1159 Marvisak#1304 Marvisak#1306 onto main (ffe310e), each head unchanged,
no conflicts.

One change of mine: the long-format import descriptor code Marvisak#963 adds nests
`if size == 0` in an `if let`, which clippy::collapsible_if rejects under
-D warnings; it is now one `if let ... && size == 0` (clippy --fix, no
change of behaviour).

cargo clippy --workspace --all-targets --locked -- -D warnings, with and
without --all-features, is clean and cargo test --workspace --locked passes
(388 passed, 7 ignored; main has 342 passed, 6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
@Marvisak
Marvisak merged commit d763582 into Marvisak:main Nov 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants