Repository navigation
fix(desktop): keep the vocabulary list when it failed to load - #22356
Conversation
Custom Vocabulary saves the whole list: the backend replaces the account's vocabulary with the list it is sent. Settings > Transcription shows the local copy in AssistantSettings until loadBackendSettings() has read the account's list, and kept showing it when that load failed or was still running. The copy is empty on a new Mac or after a reinstall, and out of date after edits on the phone or the web, so adding a word saved the copy plus that word and erased every other word on the account. Removing a word did the same. Edits now go through TranscriptionVocabularyWriter. It applies an edit to the pane's list only once that list came from the account, and otherwise reads the account's list first. If that read fails, nothing is saved and the typed word stays in the field. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Verdict: this is a correct, well-scoped fix for the vocabulary data-loss bug in #22355 — verified against the diff, no blocking issues. One non-blocking UX note below. Correctness:
Consistency: same rule as the merged web fix #15244 and the mobile fix #22309 — a list not read from the account is never saved back as the whole list. Good cross-platform alignment. UX: when the account list can't be read, an add now silently no-ops (log only, word kept in the field). Acceptable parity with the other platforms; a future follow-up could surface a small inline error so users know why nothing happened. Blast radius: desktop/macos Settings pane only; the change strictly narrows when the full-list PATCH is sent. If wrong, the failure mode is a skipped edit rather than data loss. USER IMPACT: adding or removing a custom vocabulary word no longer silently erases your other saved words when Settings hasn't loaded the account list yet; if that list can't be loaded, the edit simply isn't saved and the word stays in the input field. Nothing blocking from my side. Optional nice-to-have: an inline hint when a save is skipped due to a failed read. Human maintainer sign-off needed before merge — this edits the account-wide vocabulary persistence path (user-data surface). by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Verdict: correct, well-scoped fix for a real data-loss path — nothing blocking; leaving formal approval to a human maintainer since this changes an account-data persistence flow. Per-file findings:
UX: the word now stays in the field when the save can't happen — visible, and the right trade. Blast radius: only the macOS Settings > Transcription > Custom Vocabulary pane; worst case if wrong is a skipped edit, not data loss. Data handling: this strictly narrows what gets written to the account's vocabulary. Consistency: same rule as #15244 (web) and #22309 (mobile); #22403 covers the save-failure path on a different code path, no overlap with this diff. USER IMPACT: adding or removing a custom vocabulary word on macOS no longer silently erases your other saved words when Settings hasn't loaded them yet; if the list can't be read, the word stays in the input so you can retry. Still want as a reviewer: nothing blocking — optional polish would be a pane-level test for the isReadingVocabulary drop-during-read path, since the current tests exercise the writer in isolation. Ready for maintainer merge review. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
Automated review: scoped bug fix, CI green, root-caused, test-covered. Approving per policy.
What changed and why
Fixes #22355
Custom Vocabulary saves the whole list: every add or remove sends the full list to
PATCH /v1/users/transcription-preferences, and the backend stores it as the account's vocabulary. Settings > Transcription on macOS shows the local copy inAssistantSettingsuntilloadBackendSettings()has read the account's list. That load reads several settings in onetry await, so when any of them fails the pane keeps the local copy, and it also shows that copy while the load is still running. The copy is empty on a new Mac or after a reinstall, and out of date after edits on the phone or the web. Adding a word then saved the copy plus the word, so the account's list became just that word (or the stale list plus it) and the other saved words were gone, with no error. Removing a word had the same problem.vocabularyLoadedFromAccount).loadBackendSettings()clears it when it shows the local copy and sets it once the account's list arrives.TranscriptionVocabularyWriter, next toTranscriptionLanguageWriterin the same file. It edits the pane's list only once that list came from the account. Otherwise it reads the account's list first (getTranscriptionPreferences). If that read fails, nothing is saved and the typed word stays in the field. Only one read runs at a time; an edit made during it is ignored.This is the same rule as #15244 on web and #22309 on mobile: a list that was not read from the account is never saved back as the whole list. Like mobile, macOS reads the list at edit time instead of disabling the field, because the Settings load is all-or-nothing: one unrelated failed request would otherwise block vocabulary edits until Settings is opened again.
Product invariants affected
none
How it was verified
b343f3303a).loadBackendSettings()setsvocabularyListfromAssistantSettings.shared.transcriptionVocabulary, then awaits the daily summary, language, recording, private cloud sync and transcription preference requests together. On any failure it only clears the loading flag.addVocabularyWord()appended tovocabularyList, andsaveVocabulary()sent it throughupdateTranscriptionPreferences(vocabulary:)toAPIClient.updateTranscriptionPreferences, which PATCHes the full list. On the backend,update_transcription_preferences_endpointcallsset_user_transcription_preferences, which writestranscription_preferences.vocabulary = vocabulary[:100]. Apart from the automation bridge'svocabulary_set_terms, only a successful Settings load fills the local copy.xcrun swiftc -parseon the changed Swift files and the new test: clean. The commit hook ran the pinnedswift-format602.0.0 on them, with no changes, andlint --strictwith the same binary is clean.Viewwith the same@Stateproperties) and the new test class in a scratch file, with the target's flags (-swift-version 6 -strict-concurrency=complete -warnings-as-errors): clean. This was not a build of the app.ci:fullruns the new tests and the full desktop Swift suite.Tests
desktop/macos/Desktop/Tests/TranscriptionVocabularyWriterTests.swift, in the style ofTranscriptionLanguageWriteOrderTests. Its fake account replaces its whole list on every save, like the backend.testAddSavesNothingWhenTheAccountListCannotBeRead: empty local copy and a failed read. The old behavior saved["omi"].testAddReadsTheAccountListFirstSoItsWordsAreKept: stale copy["alpha"], account["alpha", "beta"]. Saves["alpha", "beta", "omi"]; the old behavior saved["alpha", "omi"].testRemoveSavesNothingWhenTheAccountListCannotBeReadandtestRemoveReadsTheAccountListFirstSoTheOtherWordsAreKept: the old behavior saved[].testLoadedListIsEditedWithoutReadingTheAccountAgainandtestAddingAWordAlreadyOnTheListSavesNothingkeep the loaded path and the duplicate check as they were.I wrote the tests to fail without the fix: applying the edit to the pane's list as it stands, which is what the pane did, fails the four tests with a list that did not come from the account. They run in CI and have not been run locally.
Changelog:
desktop/macos/changelog/unreleased/20261019-vocabulary-load-failure.json.UI evidence
UI-Evidence: none -- no layout or visual change; what gets saved is covered by the hermetic tests above, and no simulator or device was available here
Failure class (fixes)
Failure-Class: none
🤖 Generated with Claude Code