fix: reliability batch 0B — collision-resistant dictionary IDs + reference-aware history deletion - #79
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 070ee0a3dd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Err(error) => { | ||
| error!( | ||
| "History row {} was deleted, but WAV file {} could not be removed: {}", | ||
| id, file_name, error | ||
| ); | ||
| } |
There was a problem hiding this comment.
Report failed WAV deletion after dropping the row
When clear_recordings or clear_history hits a permission/IO error removing the last WAV, this branch only logs it and still returns failures: []. The frontend treats an empty failures list as success, so users can be told recordings/history were cleared while the orphaned audio file remains on disk until a later reconciliation attempt, which can fail for the same reason. Please keep adding a HistoryDeletionFailure for these non-fatal file errors even though the DB row is already gone.
Useful? React with 👍 / 👎.
Before Submitting This PR
Human Written Description
This is the data-integrity half of the reliability batch. Two things that were quietly corrupting existing user data: dictionary entry IDs collided (Arabic-only phrases all slugged to the same value, and same-millisecond batches shared a timestamp, so deleting one entry could delete several), and reprocessed history rows shared a WAV file with their parent so deleting either row killed audio the other still needed. Both are fixed without dropping any existing data.
What's in the batch
dictionary_schema_versionv2 migration repairs already-persisted duplicates in place: first occurrence keeps its ID, later duplicates get suffixed, array order and all other fields preserved, idempotent. Migration persists via forced immediate save and rolls back version/cache if the save fails (the 0A ambiguity-rejection guard remains the runtime backstop).Testing
tsc, ESLint, Prettier,cargo fmt --check, translations: all pass. No deps/lockfile/frontend-string changes.dict_shared/dict_shared-2, order preserved, stable across restart.AI Assistance
If AI was used:
🤖 Generated with Claude Code