Summary
AppConfig::save() writes directly to the final config path with fs::write, unlike binding persistence which already uses a temporary file plus atomic replacement.
A process interruption or write failure can therefore leave config.json truncated or otherwise unreadable. save_settings also synchronizes the OS autostart state before persisting the config, so a later config-write failure can leave the OS setting and stored preference out of sync.
Expected outcome
Make settings persistence durable and keep external side effects consistent with the stored config.
Acceptance criteria
- write config through a temporary file and replace the destination only after a successful write/sync
- clean up temporary files on failure
- preserve the existing AppData migration behavior
- order or compensate autostart changes so a failed config save does not silently leave OS state inconsistent with persisted settings
- return actionable errors when persistence or autostart synchronization fails
- add regression coverage for safe config replacement where practical
Possible direction
Reuse or extract the same safe-write pattern already used by bindings.json rather than maintaining two subtly different persistence strategies.
Likely files
crates/core/src/config/mod.rs
apps/tauri/src-tauri/src/commands.rs
- potentially a small shared persistence helper
Summary
AppConfig::save()writes directly to the final config path withfs::write, unlike binding persistence which already uses a temporary file plus atomic replacement.A process interruption or write failure can therefore leave
config.jsontruncated or otherwise unreadable.save_settingsalso synchronizes the OS autostart state before persisting the config, so a later config-write failure can leave the OS setting and stored preference out of sync.Expected outcome
Make settings persistence durable and keep external side effects consistent with the stored config.
Acceptance criteria
Possible direction
Reuse or extract the same safe-write pattern already used by
bindings.jsonrather than maintaining two subtly different persistence strategies.Likely files
crates/core/src/config/mod.rsapps/tauri/src-tauri/src/commands.rs