Skip to content

Version settings.json and voices.json, and set unreadable or newer files aside (D-61) - #61

Merged
eddybean merged 1 commit into
mainfrom
feat/settings-schema-version
Nov 28, 2026
Merged

eddybean merged 1 commit into
mainfrom
feat/settings-schema-version

Conversation

@eddybean

Copy link
Copy Markdown
Owner

What

  • stored.rs (new): shared loader for the app's own JSON files. It reads the format version and upgrades an older file one step at a time with that file's migrate.
    • An unreadable file (not JSON, wrong shape, failed migration) is renamed to <name>.broken-<unix secs> before the app goes on with defaults.
    • A newer file is copied to <name>.v<N>-<unix secs> (once) and read as far as this build understands it.
  • settings.json: SETTINGS_VERSION = 1, a migrate hook, and #[serde(flatten)] extra, so members a newer version added survive a save.
  • voices.json: now {"version": 1, "voices": [...]}. The old bare list reads as v0 and is upgraded on the next save. Each Voice keeps unknown members too.
  • .vsproj: a migrate step on load, beside the existing TooNew refusal.
  • take_startup_notices command: the UI shows what loading found (the path of a file set aside) as an error notice at start.
  • Docs: decision record D-61, plus notes in the decisions index, architecture.md and CLAUDE.md.

Why

  • settings.json had a version that nothing read. When it failed to parse (a damaged file, or a future breaking change), lib.rs saved first-run settings over it, and the user's profiles were lost silently.
  • voices.json had no version. When it failed to parse, the library opened empty and the next new voice overwrote the list.
  • Members added by a newer build were dropped when an older build saved.

Notes for review

  • Adding a member with a serde default still needs no version bump. Bump the version, with a migrate step, only when a change would read an older file wrongly.
  • When an older build saves a newer file, it writes its own version, so a newer build migrates again. The .v<N>-… copy keeps the original. See D-61 for the alternatives.
  • catalog.json (the override) is not covered: it already falls back to the bundled catalog, and nothing writes to it.
  • Verified with npm run check, including new unit tests in stored.rs, settings.rs and voices.rs. I did not see the startup notice in the running app.

🤖 Generated with Claude Code

…les aside (D-61)

settings.json had a version nothing read: when it failed to parse, the app
saved first-run settings over it and the user's profiles were lost.
voices.json was a bare list with no version: when it failed to parse, the
next new voice overwrote the list.

- stored.rs: shared loader. Reads the format version, upgrades an older file
  one step at a time with the file's migrate, moves an unreadable file to
  <name>.broken-<secs> and copies a newer one to <name>.v<N>-<secs> before
  going on, and returns a notice for the user.
- settings.json: SETTINGS_VERSION, migrate, and extra members kept.
- voices.json: now {version, voices}; the bare list reads as v0. Voices
  keep unknown members too.
- .vsproj: a migrate step on load beside the existing TooNew check.
- take_startup_notices: the UI shows the notices at start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eddybean
eddybean merged commit d85bb8f into main Nov 28, 2026
6 checks passed
@eddybean
eddybean deleted the feat/settings-schema-version branch November 28, 2026 14:59
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