Core: report unreadable implicit configuration files #1795

Open
VlREX wants to merge 1 commit from upstream-pr/1796 into main
VlREX commented 2026-11-24 22:45:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by VlREX on 2026-11-24T22:45:05Z.


No description provided.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5481584923 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1796). Originally posted by [VlREX](https://github.com/VlREX) on 2026-11-24T22:45:05Z. --- _No description provided._
catminou4 commented 2026-11-24 23:05:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T23:05:48Z.

Review: APPROVED


Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae).

cargo test -p victory-core --locked → 13 passed, 0 failed. read_config_file distinguishes missing-implicit (optional) from missing-explicit (required) config — missing_implicit_config_is_optional_but_explicit_is_required covers both.

<!-- greyfinch-sync:Marvisak/VIctory:review:6048826107 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1796#pullrequestreview-6048826107). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T23:05:48Z. **Review:** APPROVED --- Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae). cargo test -p victory-core --locked → 13 passed, 0 failed. read_config_file distinguishes missing-implicit (optional) from missing-explicit (required) config — missing_implicit_config_is_optional_but_explicit_is_required covers both.
Marvisak commented 2026-11-25 02:06:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:36:24Z.


Automated triage for the maintainers.

Merge candidate (worth a look). Now that it merges cleanly: in victory-core/src/config.rs, Config::load used to check path.is_file() first, so an implicit ./victory.toml that exists but can't be read (a directory, permission denied) was silently ignored, and a directory named by VICTORY_CONFIG was reported as "does not exist". The new read_config_file treats only NotFound on the implicit path as optional and reports every other read error with the path; an explicit path keeps failing, now with the OS error. I checked that tempfile is already a dev-dependency of victory-core, that the downcast in the UTF-8 test works through anyhow's context, and that main's later explicit_config_path handling is kept. CI: passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149742535 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1796#issuecomment-7149742535). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T01:36:24Z. --- <!-- victory-triage v1 head=200dc3205557a691a251132b313168e29193aede verdict=merge-candidate at=2026-11-25T15:33:00Z --> Automated triage for the maintainers. **Merge candidate (worth a look).** Now that it merges cleanly: in `victory-core/src/config.rs`, `Config::load` used to check `path.is_file()` first, so an implicit `./victory.toml` that exists but can't be read (a directory, permission denied) was silently ignored, and a directory named by `VICTORY_CONFIG` was reported as "does not exist". The new `read_config_file` treats only `NotFound` on the implicit path as optional and reports every other read error with the path; an explicit path keeps failing, now with the OS error. I checked that `tempfile` is already a dev-dependency of `victory-core`, that the downcast in the UTF-8 test works through anyhow's context, and that `main`'s later `explicit_config_path` handling is kept. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
oddmaniv commented 2026-11-25 09:06:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oddmaniv on 2026-11-25T08:14:19Z.


Independent native Windows verification of this PR at 5edb19078fa0df07bb178bb97323630dac679afe, plus separately recorded integration results:

Original PR head

  • Clean, production-unmodified checkout: cargo test --locked -p victory-core passed 13 tests. Workspace Clippy with all targets passed both default and all-features configurations, warnings denied; asset policy passed.
  • A separate checkout at the same head added only synthetic integration-test instrumentation. Four public Config::load() entry-point cases passed: a directory at implicit victory.toml produces a read error; a missing implicit file remains optional; a missing explicit file errors; and a valid implicit file loads. Each case ran in an isolated child process through cargo test --locked -p victory-core --test config_implicit <case> -- --exact --nocapture. Production files were unchanged, and the tested fixture bytes matched the local fixture.

Historical main-based integration, not a claim about today's main

  • Main base: 4118f33b3910f6b6b738216d6a66e8b355502b28; originating PR head: 5edb19078fa0df07bb178bb97323630dac679afe.
  • Without the PR adaptation, the same entry-point suite produced 3 passes and 1 failure: the implicit-directory case.
  • With the adaptation, all 4 entry-point tests and 15 core unit tests passed. Both workspace Clippy configurations, changed-file formatting and asset policy passed.
  • The adaptation retained main's newer explicit_config_path() handling while applying the author's configuration-read change. It was a separate local integration tree, not an edit to the author's branch; it does not replace testing the original PR head. No additional production fix is being claimed.

The main-integration evidence was collected earlier; the original-head checks above were subsequently added to close that verification gap. No full workspace test suite, game or GPU execution was performed. These results cover the synthetic cases listed, not all filesystem error conditions or gameplay behavior.

Credit to @VlREX for the production change. AI assistance was used for the additional test instrumentation and verification.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7156780597 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1796#issuecomment-7156780597). Originally posted by [oddmaniv](https://github.com/oddmaniv) on 2026-11-25T08:14:19Z. --- Independent native Windows verification of this PR at `5edb19078fa0df07bb178bb97323630dac679afe`, plus separately recorded integration results: **Original PR head** - Clean, production-unmodified checkout: `cargo test --locked -p victory-core` passed 13 tests. Workspace Clippy with all targets passed both default and all-features configurations, warnings denied; asset policy passed. - A separate checkout at the same head added only synthetic integration-test instrumentation. Four public `Config::load()` entry-point cases passed: a directory at implicit `victory.toml` produces a read error; a missing implicit file remains optional; a missing explicit file errors; and a valid implicit file loads. Each case ran in an isolated child process through `cargo test --locked -p victory-core --test config_implicit <case> -- --exact --nocapture`. Production files were unchanged, and the tested fixture bytes matched the local fixture. **Historical main-based integration, not a claim about today's main** - Main base: `4118f33b3910f6b6b738216d6a66e8b355502b28`; originating PR head: `5edb19078fa0df07bb178bb97323630dac679afe`. - Without the PR adaptation, the same entry-point suite produced 3 passes and 1 failure: the implicit-directory case. - With the adaptation, all 4 entry-point tests and 15 core unit tests passed. Both workspace Clippy configurations, changed-file formatting and asset policy passed. - The adaptation retained main's newer `explicit_config_path()` handling while applying the author's configuration-read change. It was a separate local integration tree, not an edit to the author's branch; it does not replace testing the original PR head. No additional production fix is being claimed. The main-integration evidence was collected earlier; the original-head checks above were subsequently added to close that verification gap. No full workspace test suite, game or GPU execution was performed. These results cover the synthetic cases listed, not all filesystem error conditions or gameplay behavior. Credit to @VlREX for the production change. AI assistance was used for the additional test instrumentation and verification.
fuzeofficlal commented 2026-11-26 18:47:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T18:47:29Z.

Review: APPROVED


Verified 200dc3205557a691a251132b313168e29193aede cleanly merged onto main (63bcca43) on Windows 11 x64:

  • read_config_file (crates/victory-core/src/config.rs:125-133) preserves main's explicit_config_path() handling, ignores only ErrorKind::NotFound on the implicit path, and surfaces unreadable paths, directory paths, invalid UTF-8, and missing explicit VICTORY_CONFIG files with path context.
  • cargo test -p xtask --locked policy::tests::repository_passes_policy: 1 passed (asset policy: 191 files ok).
  • cargo clippy --locked -p victory-core --all-targets -- -D warnings: clean.
  • cargo test --locked -p victory-core --lib: 16 passed, 0 failed (including all three new config::tests cases).

Minor formatting nit: rustfmt --edition 2024 --check crates/victory-core/src/config.rs flags wrapping on config.rs:129-130. Ready to merge.

<!-- greyfinch-sync:Marvisak/VIctory:review:6079150462 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1796#pullrequestreview-6079150462). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T18:47:29Z. **Review:** APPROVED --- Verified `200dc3205557a691a251132b313168e29193aede` cleanly merged onto `main` (`63bcca43`) on Windows 11 x64: - `read_config_file` (`crates/victory-core/src/config.rs:125-133`) preserves `main`'s `explicit_config_path()` handling, ignores only `ErrorKind::NotFound` on the implicit path, and surfaces unreadable paths, directory paths, invalid UTF-8, and missing explicit `VICTORY_CONFIG` files with path context. - `cargo test -p xtask --locked policy::tests::repository_passes_policy`: `1 passed` (`asset policy: 191 files ok`). - `cargo clippy --locked -p victory-core --all-targets -- -D warnings`: clean. - `cargo test --locked -p victory-core --lib`: `16 passed, 0 failed` (including all three new `config::tests` cases). Minor formatting nit: `rustfmt --edition 2024 --check crates/victory-core/src/config.rs` flags wrapping on `config.rs:129-130`. Ready to merge.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1796:upstream-pr/1796'
git switch 'upstream-pr/1796'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1796'
git switch 'upstream-pr/1796'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1796'
git switch 'upstream-pr/1796'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1796'
git switch 'main'
git merge --squash 'upstream-pr/1796'
git switch 'main'
git merge --ff-only 'upstream-pr/1796'
git switch 'main'
git merge 'upstream-pr/1796'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!1795
No description provided.