Skip to content

Harden account and auth persistence with atomic writes#14

Open
thatdaveguy1 wants to merge 1 commit intoLampese:mainfrom
thatdaveguy1:codex/atomic-storage-writes
Open

Harden account and auth persistence with atomic writes#14
thatdaveguy1 wants to merge 1 commit intoLampese:mainfrom
thatdaveguy1:codex/atomic-storage-writes

Conversation

@thatdaveguy1
Copy link
Contributor

Why

The account database and active auth file are written directly today. If the app crashes mid-write or multiple operations overlap, that can leave accounts.json or auth.json in a partially written state.

This PR hardens those persistence paths with atomic writes, simple locking, and backup files so storage updates are more crash-resistant.

What changed

  • add shared filesystem helpers in fs_utils.rs for locked atomic writes
  • update storage.rs to use the new write path for account persistence
  • update switcher.rs to write active auth data atomically and emit .bak backups
  • ensure lockfile parent directories are created for first-run paths

Reviewer notes

  • this PR is intentionally limited to persistence safety
  • backup security mode selection and process restart behavior are handled in separate PRs

Verification

  • cargo check in src-tauri passes on this branch

@Lampese
Copy link
Owner

Lampese commented Mar 7, 2026

plz resolve the conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants