Skip to content

macOS Custom Vocabulary: adding a word when the saved list failed to load replaces the whole list with that word #22355

Closed

Description

@apoorvdarshan

Summary

In the macOS app, Settings > Transcription > Custom Vocabulary saves the whole list on every add or remove: PATCH /v1/users/transcription-preferences with vocabulary: [...]. The backend stores that list as the account's vocabulary (set_user_transcription_preferences writes transcription_preferences.vocabulary = vocabulary[:100]). Phone, web and Mac all edit this same list.

The pane does not wait for the account's list before it saves. SettingsContentView.loadBackendSettings() first shows the local copy (AssistantSettings.shared.transcriptionVocabulary, kept in UserDefaults), then reads several settings in one try await. If any of those reads fails, the pane keeps showing the local copy. The local copy is only filled by a successful Settings load, so it is empty on a new Mac or after a reinstall, and out of date after edits on the phone or the web.

addVocabularyWord() appends to the list on screen and saveVocabulary() sends it as the whole list. The account's list becomes the local copy plus the new word, and every other saved word is gone. No error is shown. removeVocabularyWord() has the same problem. So does an edit made while the load is still running: the revision guard then discards the load's result, so the pane keeps the local copy too.

Steps to reproduce

  1. Save a few words in Custom Vocabulary on the phone or the web.
  2. Sign in on a Mac that has not loaded them yet (new install or reinstall).
  3. Open Settings > Transcription and add a word while the Settings load is still running, or after it failed (for example one of its requests returned an error or timed out, and the network is back).

Deterministic: make any request in loadBackendSettings() fail (for example GET /v1/users/daily-summary-settings), then add a word.

Expected: the saved words are kept, or nothing is saved while the list is unknown.

Actual: the account's vocabulary is just the new word (or the stale local list plus it). The phone and the web show the same loss.

Code (current main)

  • desktop/macos/Desktop/Sources/MainWindow/Pages/Settings/Components/SettingsContentView+BillingHelpers.swift: loadBackendSettings() seeds the list from the local copy (~line 853) and only replaces it when every request succeeds (~lines 871-907).
  • desktop/macos/Desktop/Sources/MainWindow/Pages/Settings/Sections/SettingsContentView+Transcription.swift: addVocabularyWord(), removeVocabularyWord() and saveVocabulary() (~lines 383-411).
  • backend/database/users.py: set_user_transcription_preferences.

Same problem as #15243 on the web (fixed by #15244) and #22308 on mobile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions