Commit Graph
1 Commits
Author SHA1 Message Date
poli0981andClaude Opus 5.5 4a4e887134 fix(storage): atomic, corruption-tolerant, thread-safe local stores
All six JSON stores (config, history, recipes, profiles, user commands, settings import/export)
go through a shared JsonFile helper:
- Writes land in a temporary file that atomically replaces the original, so a crash or power loss
  mid-save can no longer truncate config.json (which silently reset every setting, including the
  accepted terms) or wipe history/recipes/profiles.
- A corrupt file is kept as name.corrupt-<timestamp>.json before defaults are used, instead of
  being overwritten on the next save; locked or unreadable files no longer crash startup.
- Background save failures are logged rather than thrown; a user-chosen export path still
  reports its error, and import files are never renamed.
- Every store serializes access with a lock and hands out copies, not its live list.
- config.json uses a source-generated serializer with the same PascalCase/enum-name format; loads
  repair null lists, unknown enum values and blank ids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 20:23:01 +07:00