[pr-fix][memory] darner config: physical_pages_dir is printed and policy-checked; DARNER_HOME documented and tested #315

Open
ElGibbone wants to merge 1 commit from elgibbone/config-env-and-check into main AGit
First-time contributor

What it changes

  • The problem on main: read from the code only. darner config printed and policy-checked game_dir, test titles, cache_dir and data_dir, but not physical_pages_dir. default_dir read DARNER_HOME, LOCALAPPDATA, XDG_CACHE_HOME and HOME straight from the process, so Config::resolve's tests could not control them, and an empty LOCALAPPDATA gave a relative darner\cache path.

Config::configured_paths() lists every resolved path, physical_pages_dir included; darner config prints it when set and checks it with the others.

default_dir reads through the same env closure as the rest of Config::resolve, and an empty LOCALAPPDATA, XDG_CACHE_HOME or HOME counts as unset (the next one is used).

darner.example.toml documents DARNER_HOME.

New tests: darner_home_sets_default_cache_and_data_below_file_and_dir_overrides, empty_home_and_system_base_vars_fall_through, configured_paths_include_page_files_when_set (darner-core) and config_policy_checks_physical_pages_dir (darner app).

How it was tested

  • Tested revision: 121ae5c
  • Commands and results (macOS aarch64, toolchain 1.98.1):
    • cargo test -p darner-core --locked: 36 passed, 0 failed
    • cargo clippy -p darner-core --all-targets --locked -- -D warnings, and with --all-features: clean
    • cargo xwin clippy --target x86_64-pc-windows-msvc -p darner-core --all-targets --locked -- -D warnings, and with --all-features: clean
    • cargo xwin clippy --target x86_64-pc-windows-msvc -p darner --all-targets --locked -- -D warnings: clean
    • cargo xtask policy: 555 files ok
    • The darner app's tests do not build on macOS (darner-game), so config_policy_checks_physical_pages_dir was compiled by clippy but not run.
  • Changes a default: no. Only when LOCALAPPDATA, XDG_CACHE_HOME or HOME is set but empty does the default folder change (from a relative darner\<name> to the next variable).
  • Gates run on that revision: the two clippy gates and cargo test on darner-core, Windows-target clippy on darner-core and the darner app. Not --workspace, not on Windows.
  • Gameplay: not run in the game.
  • Hardware dependence: none.
  • Coverage gaps: the darner app test not run; nothing run on Windows.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only). Not run in the game: it changes darner config output and the default folder lookup only; I have no Windows machine.
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: several open PRs change apps/darner/src/main.rs (#47, #48, #80, #130, #140, #146, #164, #205, #267, #302); none touches show_config or the config code.
  • Replaces or overlaps: none found
## What it changes - The problem on main: read from the code only. darner config printed and policy-checked game_dir, test titles, cache_dir and data_dir, but not physical_pages_dir. default_dir read DARNER_HOME, LOCALAPPDATA, XDG_CACHE_HOME and HOME straight from the process, so Config::resolve's tests could not control them, and an empty LOCALAPPDATA gave a relative `darner\cache` path. Config::configured_paths() lists every resolved path, physical_pages_dir included; darner config prints it when set and checks it with the others. default_dir reads through the same env closure as the rest of Config::resolve, and an empty LOCALAPPDATA, XDG_CACHE_HOME or HOME counts as unset (the next one is used). darner.example.toml documents DARNER_HOME. New tests: darner_home_sets_default_cache_and_data_below_file_and_dir_overrides, empty_home_and_system_base_vars_fall_through, configured_paths_include_page_files_when_set (darner-core) and config_policy_checks_physical_pages_dir (darner app). ## How it was tested - Tested revision: 121ae5c - Commands and results (macOS aarch64, toolchain 1.98.1): - `cargo test -p darner-core --locked`: 36 passed, 0 failed - `cargo clippy -p darner-core --all-targets --locked -- -D warnings`, and with `--all-features`: clean - `cargo xwin clippy --target x86_64-pc-windows-msvc -p darner-core --all-targets --locked -- -D warnings`, and with `--all-features`: clean - `cargo xwin clippy --target x86_64-pc-windows-msvc -p darner --all-targets --locked -- -D warnings`: clean - `cargo xtask policy`: 555 files ok - The darner app's tests do not build on macOS (darner-game), so config_policy_checks_physical_pages_dir was compiled by clippy but not run. - Changes a default: no. Only when LOCALAPPDATA, XDG_CACHE_HOME or HOME is set but empty does the default folder change (from a relative `darner\<name>` to the next variable). - Gates run on that revision: the two clippy gates and cargo test on darner-core, Windows-target clippy on darner-core and the darner app. Not --workspace, not on Windows. - Gameplay: not run in the game. - Hardware dependence: none. - Coverage gaps: the darner app test not run; nothing run on Windows. ## Checklist - [ ] I ran this change in the game, or say below why it can't be (docs, tests only). Not run in the game: it changes darner config output and the default folder lookup only; I have no Windows machine. - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: several open PRs change apps/darner/src/main.rs (#47, #48, #80, #130, #140, #146, #164, #205, #267, #302); none touches show_config or the config code. - Replaces or overlaps: none found
Routes Config::resolve's default directory lookup through its env closure, ignores empty system base-directory variables before falling back, checks and prints physical_pages_dir in darner config when set, and documents DARNER_HOME in darner.example.toml.
ElGibbone changed title from Validate physical_pages_dir in darner config and test DARNER_HOME precedence to [pr-fix][memory] darner config: physical_pages_dir is printed and policy-checked; DARNER_HOME documented and tested 2026-12-04 14:41:55 +00:00
First-time contributor

Independent Windows build, gate, and code-read review of 121ae5c9100f (full head 121ae5c9100fdc127fcd0c1e3fe83b9d15dfbbb1), based on main f3840d73d3504c30218debfbc8795b9225447317. Not run in-game.

Environment

  • Windows 11 Pro 26H2 (build 26300.10075), Intel Core i9-14900K, NVIDIA RTX A2000 12GB (driver 621.47), Rust 1.98.1 (x86_64-pc-windows-msvc), MSVC 19.44.35230.

Measured results

  • Gate 1 (cargo clippy --workspace --all-targets --locked -- -D warnings): PASS.
  • Gate 2 (cargo clippy --workspace --all-targets --all-features --locked -- -D warnings): PASS.
  • cargo xtask policy: PASS (asset policy: 555 files ok).
  • cargo test --locked -p darner-core: PASS (34 passed; 0 failed; 0 ignored).
  • cargo test --locked -p darner --bin darner config_policy_checks_physical_pages_dir: PASS (1 passed; 0 failed; 0 ignored; 149 filtered out).
  • Full workspace test gate (cargo test --workspace --locked) was not run; focused config tests were run instead.

Code-read audit

  • Config::resolve keeps explicit DARNER_CACHE_DIR / DARNER_DATA_DIR ahead of TOML and computed defaults, passes the same environment provider into default_dir, and still rejects data paths inside the cache (crates/darner-core/src/config.rs:98-129). default_dir honors non-empty DARNER_HOME, then the prior LOCALAPPDATA/XDG_CACHE_HOME/HOME search order while skipping empty values (config.rs:246-259); the tests exercise precedence and empty-value fallthrough (config.rs:465-544).
  • configured_paths includes game, physical-page, test-title, cache, and data paths (config.rs:166-174). show_config displays physical_pages_dir when enabled and sends that complete set through the existing policy reporter (apps/darner/src/main.rs:946-968); the added test verifies an in-repository page directory is the single reported violation (main.rs:1120-1137).
  • The new examples document how DARNER_HOME relocates the default base while preserving the explicit cache/data override variables (darner.example.toml:3-25). The added test also verifies system-base fallback and a clear error when no non-empty base is available (config.rs:516-544).

No blocking issue found.

Verdict: PASS.

AI-assisted: yes (GitHub Copilot, Auto mode).

Independent Windows build, gate, and code-read review of `121ae5c9100f` (full head `121ae5c9100fdc127fcd0c1e3fe83b9d15dfbbb1`), based on `main` `f3840d73d3504c30218debfbc8795b9225447317`. Not run in-game. ### Environment - Windows 11 Pro 26H2 (build 26300.10075), Intel Core i9-14900K, NVIDIA RTX A2000 12GB (driver 621.47), Rust 1.98.1 (`x86_64-pc-windows-msvc`), MSVC 19.44.35230. ### Measured results - Gate 1 (`cargo clippy --workspace --all-targets --locked -- -D warnings`): **PASS**. - Gate 2 (`cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`): **PASS**. - `cargo xtask policy`: **PASS** (`asset policy: 555 files ok`). - `cargo test --locked -p darner-core`: **PASS** (`34 passed; 0 failed; 0 ignored`). - `cargo test --locked -p darner --bin darner config_policy_checks_physical_pages_dir`: **PASS** (`1 passed; 0 failed; 0 ignored; 149 filtered out`). - Full workspace test gate (`cargo test --workspace --locked`) was not run; focused config tests were run instead. ### Code-read audit - `Config::resolve` keeps explicit `DARNER_CACHE_DIR` / `DARNER_DATA_DIR` ahead of TOML and computed defaults, passes the same environment provider into `default_dir`, and still rejects data paths inside the cache (`crates/darner-core/src/config.rs:98-129`). `default_dir` honors non-empty `DARNER_HOME`, then the prior LOCALAPPDATA/XDG_CACHE_HOME/HOME search order while skipping empty values (`config.rs:246-259`); the tests exercise precedence and empty-value fallthrough (`config.rs:465-544`). - `configured_paths` includes game, physical-page, test-title, cache, and data paths (`config.rs:166-174`). `show_config` displays `physical_pages_dir` when enabled and sends that complete set through the existing policy reporter (`apps/darner/src/main.rs:946-968`); the added test verifies an in-repository page directory is the single reported violation (`main.rs:1120-1137`). - The new examples document how `DARNER_HOME` relocates the default base while preserving the explicit cache/data override variables (`darner.example.toml:3-25`). The added test also verifies system-base fallback and a clear error when no non-empty base is available (`config.rs:516-544`). No blocking issue found. **Verdict: PASS.** AI-assisted: yes (GitHub Copilot, Auto mode).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/315/head:elgibbone/config-env-and-check'
git switch 'elgibbone/config-env-and-check'

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 'elgibbone/config-env-and-check'
git switch 'elgibbone/config-env-and-check'
git rebase 'main'
git switch 'main'
git merge --ff-only 'elgibbone/config-env-and-check'
git switch 'elgibbone/config-env-and-check'
git rebase 'main'
git switch 'main'
git merge --no-ff 'elgibbone/config-env-and-check'
git switch 'main'
git merge --squash 'elgibbone/config-env-and-check'
git switch 'main'
git merge --ff-only 'elgibbone/config-env-and-check'
git switch 'main'
git merge 'elgibbone/config-env-and-check'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!315
No description provided.