Skip to content

fix: use atomic write for tui.toml config to prevent corruption#6

Open
hobostay wants to merge 1 commit into
MoonshotAI:mainfrom
hobostay:fix/atomic-tui-config-write
Open

fix: use atomic write for tui.toml config to prevent corruption#6
hobostay wants to merge 1 commit into
MoonshotAI:mainfrom
hobostay:fix/atomic-tui-config-write

Conversation

@hobostay
Copy link
Copy Markdown

Summary

  • saveTuiConfig was writing directly to the target file, risking corruption on crash/power loss
  • Now uses the same write-to-temp-then-rename pattern as writeJsonFile in persistence.ts
  • On crash, the temp file is left behind (harmless) rather than a truncated config file

Test plan

  • Verify config saves and loads correctly
  • Confirm temp file is cleaned up on error

🤖 Generated with Claude Code

saveTuiConfig was writing directly to the target file. If the process
crashed or lost power mid-write, tui.toml would be truncated and the
user's theme, editor, and notification preferences silently lost on
next startup. Now uses the same write-to-temp-then-rename pattern as
writeJsonFile in persistence.ts.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant