Config: recreate xcl.toml only on NotFound and resolve memory mode case-insensitively (#106) #237

Closed
github-bot wants to merge 1 commit from gh-pr/237/head into gh-pr/237/base
Owner

@⁠slopgobblercobbler on GitHub · 2026-11-23 21:45 UTC · original
slopgobblercobbler:fix/config-load-resolve → main · +57 −6 · 1 files · 1 commits · closed without merging

Addresses #106 (Config robustness & resolution):

  1. In Config::load_or_create, only recreate xcl.toml when err.kind() == ErrorKind::NotFound. On read, permission, or syntax errors, the user's existing file is preserved rather than overwritten with default settings.
  2. In Config::resolve, match memory mode values "auto" and "advanced" case-insensitively with whitespace trimmed.

What is in it

  • crates/xcl/src/config.rs:
    • load_or_create error branching check.
    • resolve string normalization (trim().to_ascii_lowercase()).
    • Unit tests: load_or_create_only_creates_on_not_found_and_preserves_on_errors and title_memory_is_read_in_any_case.

Tested

  • cargo test -p xcl -- config (16 passed, 0 failed).
  • Full workspace test suite: cargo test --workspace (603 passed, 0 failed).
  • Windows 11 x64, MSVC toolchain.

Not tested

  • Non-UTF8 configuration file encoding.

AI use

  • Developed with Antigravity swarm coordinator & dedicated author/verifier agents (author-config, verify-config). Verified and reviewed independently.
**@⁠slopgobblercobbler** on GitHub · 2026-11-23 21:45 UTC · [original](https://github.com/xcl-dev/xcl/pull/237) `slopgobblercobbler:fix/config-load-resolve` → `main` · +57 −6 · 1 files · 1 commits · closed without merging Addresses #106 (Config robustness & resolution): 1. In `Config::load_or_create`, only recreate `xcl.toml` when `err.kind() == ErrorKind::NotFound`. On read, permission, or syntax errors, the user's existing file is preserved rather than overwritten with default settings. 2. In `Config::resolve`, match memory mode values `"auto"` and `"advanced"` case-insensitively with whitespace trimmed. **What is in it** - `crates/xcl/src/config.rs`: - `load_or_create` error branching check. - `resolve` string normalization (`trim().to_ascii_lowercase()`). - Unit tests: `load_or_create_only_creates_on_not_found_and_preserves_on_errors` and `title_memory_is_read_in_any_case`. **Tested** - `cargo test -p xcl -- config` (16 passed, 0 failed). - Full workspace test suite: `cargo test --workspace` (603 passed, 0 failed). - Windows 11 x64, MSVC toolchain. **Not tested** - Non-UTF8 configuration file encoding. **AI use** - Developed with Antigravity swarm coordinator & dedicated author/verifier agents (`author-config`, `verify-config`). Verified and reviewed independently.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:17:06 +00:00
github-bot closed this pull request 2026-11-26 04:17:06 +00:00
Author
Owner

@⁠MesshM on GitHub · 2026-11-24 04:33 UTC · original

Test run of 6ad1cea4c1fce69ad41c4532f48c77691230fb5a on AMD RDNA4. I merged it onto current main 64b3f35 locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 702 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 661 passed, 0 failed, 21 ignored
  • 0 SKIPPED; load_or_create_only_creates_on_not_found_and_preserves_on_errors and title_memory_is_read_in_any_case pass.

Review: Only NotFound recreates xcl.toml; a read or syntax error now returns an error and leaves the user's file alone, and the memory mode is trimmed and lower-cased before it is matched. I found nothing to change.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

**@⁠MesshM** on GitHub · 2026-11-24 04:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/237#issuecomment-7122134057) Test run of `6ad1cea4c1fce69ad41c4532f48c77691230fb5a` on AMD RDNA4. I merged it onto current `main` `64b3f35` locally (clean merge) and tested that tree. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug - `cargo build --workspace` + `cargo test --workspace -- --test-threads=4` on the merge: **702 passed, 0 failed, 41 ignored**, exit code 0; `xcl` lib tests 661 passed, 0 failed, 21 ignored - **0 `SKIPPED`**; `load_or_create_only_creates_on_not_found_and_preserves_on_errors` and `title_memory_is_read_in_any_case` pass. **Review:** Only `NotFound` recreates `xcl.toml`; a read or syntax error now returns an error and leaves the user's file alone, and the memory mode is trimmed and lower-cased before it is matched. I found nothing to change. **Not tested:** no retail title or regression run (I have no unpacked game), no `XCL_SAMPLE_*` tests, release build; the PR's head on its old base was not run, only its merge onto `main`. Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
Author
Owner

@⁠ivall on GitHub · 2026-11-24 11:17 UTC · original

Closing because the two changes are already on main: ea4bd62 preserves the config on read errors and 6cb71db handles title_memory case-insensitively. Thank you for the contribution.

**@⁠ivall** on GitHub · 2026-11-24 11:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/237#issuecomment-7129898740) Closing because the two changes are already on main: ea4bd62 preserves the config on read errors and 6cb71db handles title_memory case-insensitively. Thank you for the contribution.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.