Repository navigation
Conversation
Settings > Transcription > Custom Vocabulary shows an add or remove, and writes it to the local copy in AssistantSettings, before PATCH /v1/users/transcription-preferences answers. When that PATCH failed, updateTranscriptionPreferences only logged the error. The pane and the local copy kept a list the account never stored: the word looked saved, live transcription (which reads the account's list) never used it, and the next Settings load dropped it without a message. A failed vocabulary save now puts the list the account last confirmed (read by the Settings load, or returned by the last successful save) back in the pane and the local copy, and shows an error under the field. A failure that a newer edit has superseded changes nothing, because that edit's save sends the whole list again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
The production change here is correct and nicely scoped; leaving formal approval to a human maintainer because it changes how user vocabulary data is restored and shown. Verified per file:
USER IMPACT: when saving a custom vocabulary change fails (offline, server error), Settings now puts the previous list back and shows "Couldn't save your vocabulary change. Try again." instead of silently keeping a change the account never stored. Still wanted from a reviewer: nothing blocking — the two observations above are optional polish; the behavior itself is well covered by the new tests. Human maintainer sign-off wanted for the restore-on-failure UX direction (what the pane shows after a failed save is a small product call); no security concerns found in the diff itself. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
Git-on-my-level
left a comment
There was a problem hiding this comment.
Verdict: the production change is correct and nicely scoped; nothing blocking. Formal approval stays with a human maintainer for this surface.
Findings, file by file:
- SettingsContentView+SettingsUpdates.swift — the core. TranscriptionVocabularySaver.save() maps the PATCH outcome to .saved(stored:)/.failed(restore:)/.superseded. On success, savedVocabularyList is set from the list the account returns, so the pane's baseline is what the server holds, not what it optimistically displayed. On failure, the guard on transcriptionVocabularyRevision means an older save never clobbers a newer edit's list (that edit's save re-sends the whole list). The nil-vocabulary branch keeps the old single-request language-mode path — behavior there is unchanged.
- SettingsContentView+BillingHelpers.swift (+1) — sets savedVocabularyList when loadBackendSettings() shows the account's list, giving the restore a correct baseline; without it the failure path would only show the error.
- SettingsPage.swift (+4) — savedVocabularyList/vocabularySaveError @State with accurate doc comments; nil-means-unread semantics handled in the saver.
- SettingsContentView+Transcription.swift (+7) — error caption styled like the existing captions, with an accessibilityIdentifier ("vocabulary-save-error") for UI testing.
- TranscriptionVocabularySaverTests.swift — six cases: failed add, failed removal, failure before the account list is read, a confirmation landing mid-flight, superseded-by-newer-edit, and success. Good coverage of the race semantics.
- changelog/unreleased/20261019-vocabulary-save-failure.json — accurate user-facing fragment.
One non-blocking nit: on .saved you don't re-check isLatestEdit, so a slow older save completing after a newer one sets savedVocabularyList to the older list. Since the account then holds whichever PATCH landed last, the value stays consistent under last-write-wins; just noting the ordering assumption.
UX: this is the point of the PR — a failed save now visibly reverts and explains itself instead of silently pretending. Security: same authenticated PATCH, no new inputs or surfaces. Blast radius: macOS Settings ▸ Transcription pane only. Related: #22356 covers the complementary load-failure case; the author reports a trial merge is clean, worth a re-check at merge time.
Still wanted as a reviewer: nothing blocking; a UI-level assertion on the error caption would be nice-to-have.
USER IMPACT: When saving a custom vocabulary change fails (offline, server error, expired session), macOS Settings now puts the list back to what the account actually holds and shows "Couldn't save your vocabulary change. Try again." instead of silently showing the change as saved and dropping it later.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
kodjima33
left a comment
There was a problem hiding this comment.
Desktop bug fix (owner-override): puts the vocabulary list back on save failure instead of silently losing it. CLEAN, CI green, tests added.
…led save (#22780) (#22798) Daily Summary, Store Recordings, and Private Cloud Sync bind their switch directly to the value shown on screen. A failed save (offline, server error, expired session) was only logged: the switch stayed on the side the user picked while the account kept its old value, and the next Settings load quietly flipped it back with no message — for Store Recordings/Private Cloud Sync this means a user believes they changed a privacy-relevant setting when the account never stored the change. #22403 fixed the same symptom for Custom Vocabulary by tracking the value the account last confirmed and restoring it on failure. This extracts that pattern into a small, directly testable BooleanSettingSaver and applies it to the three toggles. Tested: added BooleanSettingSaverTests (new file) exercising save/restore through the production save function with a fake account that can refuse a write; xcrun swift build succeeds; swift-format lint clean.
What changed and why
Fixes #22402
In Settings > Transcription > Custom Vocabulary on macOS, adding or removing a word changes the list on screen and the local copy in
AssistantSettingsright away.updateTranscriptionPreferences(vocabulary:)then sends the whole list toPATCH /v1/users/transcription-preferencesin a detachedTask. When that request failed (offline, a server error, an expired session), thecatchonly logged it. The pane and the local copy kept a list the account never stored, so the word looked saved. Live transcription never used it, because a listen session loads the vocabulary from the account. The next Settings load showed the account's list again and the word was gone, with no message. A failed removal had the same problem.savedVocabularyList).loadBackendSettings()sets it when it shows the account's list, and each successful save sets it from the list the account returns.AssistantSettings.transcriptionVocabularyRevisionmoved on). That edit's save sends the whole list again, this change included, so its result decides what the pane shows.TranscriptionVocabularySaver, in the shape ofTranscriptionLanguageWriter, so it can be tested without the view. Language-mode saves (updateTranscriptionPreferences(singleLanguageMode:)) send the same request as before.My open #22356 fixes the other half: an add or remove made when the list failed to load wiped the account's list. The two PRs change different lines, a trial merge of both branches is clean, and with both, #22356's
saveVocabulary(_:)still goes through this save path. #22354 is the same save-failure fix on mobile. With my open #22401, the backend refuses a list over 100 terms with a 400 instead of trimming it; on macOS that refusal now also puts the list back and shows the error.Product invariants affected
none
How it was verified
e963f8af08).addVocabularyWord()andremoveVocabularyWord(_:)editvocabularyList;saveVocabulary()writes it toAssistantSettings.shared.transcriptionVocabularyand callsupdateTranscriptionPreferences(vocabulary:), whosecatchonly calledlogError.APIClient.updateTranscriptionPreferencesthrows when the PATCH or its follow-up GET fails. On the backend,set_user_transcription_preferencesreplacestranscription_preferences.vocabulary(first 100 terms), andlisten_session_bootstrapreads the account's transcription preferences for each listen session.loadBackendSettings()writes the account's list over the pane and the local copy.swift-format602.0.0:formatandlint --stricton the changed Swift files are clean (the commit hook also ran it, with no changes).xcrun swiftc -parseon them is clean.updateTranscriptionPreferences(on a stubViewwith 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, Swift 6.4): clean. This was not a build of the app.check_desktop_ux_contract.py,check_brand_ui.pyandcheck_desktop_test_quality.pypass on the change.ci:fullruns the new tests and the full desktop Swift suite.Tests
desktop/macos/Desktop/Tests/TranscriptionVocabularySaverTests.swift, in the style ofTranscriptionLanguageWriteOrderTests. Its fake account replaces its whole list on every save, like the backend, and refuses saves while offline.testFailedSavePutsBackTheListTheAccountHolds: Settings read["alpha"], the pane shows["alpha", "omi"], and the save fails.["alpha"]must go back.testFailedRemovalPutsBackTheRemovedWord: the same for a removal.testFailureIsReportedEvenBeforeSettingsReadTheAccount: with no confirmed list, nothing goes back but the failure is still reported.testFailurePutsBackAListConfirmedWhileTheSaveRan: a save confirmed while this one was in flight is what goes back.testFailureIsLeftToANewerEditandtestSavedListIsTheListTheAccountHoldscover the superseded and success paths.The tests use the new type, so they do not compile on main. The old code treated a failed save like a stored one (the edited list stayed and no error showed); expressed as these outcomes, that fails the first four tests. They run in CI and have not been run locally.
Changelog:
desktop/macos/changelog/unreleased/20261019-vocabulary-save-failure.json.UI evidence
UI-Evidence: none -- one caption line under the vocabulary field, styled like the recap-depth save error; no simulator or device here, and the save outcomes are covered by the hermetic tests above
Failure class (fixes)
Failure-Class: FC-refused-mutation-bool-confirmed-as-success
Same contract as #22354 on mobile: a UI that shows a save must act on what the save reported. Here the helper throws instead of returning
false.🤖 Generated with Claude Code