Files
benilla-octo/crates/benilla-app/src/cvars
Sam SungandClaude Opus 5.5 b065554f4b config.toml saves one quiet second after a change, not only on the exit frame, and a unit test resolves no state folder unless it pins BENILLA_HOME (#625)
`save_config` was registered only on the exit frame, so its "one quiet second" leg never ran, and a crash or kill lost every setting changed in the session. 1.12.1's `SaveConfig` (`0x63d980`) also writes on entering the world (`0x46b6f6`) and on leaving it (`0x490c35`-`0x490c64`), not only at shutdown (`0x63daf0`).

- `save_config_when_quiet` runs in `Last`, before `OnAppExit`, after every `Update` writer of the registry. It saves once the registry has been dirty for one quiet second (`SAVE_QUIET`).
- `save_config_on_exit` keeps the exit-frame flush, unchanged.
- `write_config` is the atomic write both share.
- Under `cfg(test)`, `local_state::home()` resolves nothing unless `BENILLA_HOME` is pinned. The quiet save gives tests a write path they never had, and it could otherwise reach the primary checkout's real `benilla-config/`. The resolution tests read `resident_home()`.

`a_change_saves_after_one_quiet_second_with_no_exit` fails without the quiet registration. `a_test_without_an_override_has_no_state_folder` fails without the test guard. Built and gated on macOS.

Fixes #618

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 18:50:38 +07:00
..