Problem
Desktop configuration is written directly to its final path. A partial write, process interruption, or disk error can leave malformed configuration. The next read may then fall back to defaults and hide the lost settings.
Evidence
- src-tauri/src/config/store.rs:25-31 reads configuration and can recover by substituting defaults.
- src-tauri/src/config/store.rs:35-85 writes the final configuration file directly instead of publishing a validated temporary file.
Proposed work
Serialize and validate the full configuration before touching the live file. Write to a temporary file in the same directory, flush it as needed, and replace the live file atomically. Preserve the prior valid file if publication fails, and report the failure to the caller.
Acceptance criteria
- Start with a failing test that simulates interruption during a configuration write.
- A failed save leaves the prior valid configuration readable.
- The application reports success only after the replacement completes.
- Temporary files are cleaned up after success and recoverable failure.
- Tests cover malformed serialized data and Windows replacement behavior.
Non-goals
- Changing the configuration schema.
- Adding cloud settings sync.
Problem
Desktop configuration is written directly to its final path. A partial write, process interruption, or disk error can leave malformed configuration. The next read may then fall back to defaults and hide the lost settings.
Evidence
Proposed work
Serialize and validate the full configuration before touching the live file. Write to a temporary file in the same directory, flush it as needed, and replace the live file atomically. Preserve the prior valid file if publication fails, and report the failure to the caller.
Acceptance criteria
Non-goals