fix: sync preferences.json when switching ASR provider#552
Conversation
PR Reviewer Guide 🔍(Review updated until commit 3c9612e)Here are some key observations to aid the review process:
|
3760ee8 to
8e14d40
Compare
|
Persistent review updated to latest commit 8e14d40 |
8e14d40 to
754acb9
Compare
|
Persistent review updated to latest commit 754acb9 |
Same pattern as the ASR provider fix — set_active_llm_provider now also syncs to preferences.json immediately after Keychain write, so both stores stay consistent regardless of the frontend async path.
754acb9 to
3c9612e
Compare
|
Persistent review updated to latest commit 3c9612e |
|
@claude Review. |
|
Claude finished @appergb's task in 2m 9s —— View job Code Review
SummaryThe fix correctly identifies and addresses the two-step save problem. Writing Findings1. Silent failure on
|
User description
Problem
Changing the ASR provider in Settings (e.g. from whisper to volcengine) calls
set_active_asr_providerwhich only writes to the system Keychain, but does not updatepreferences.json. The preferences file update happens through a separate async path (updatePrefs→setSettings), creating a two-step save that can get out of sync.If the second step fails (or if the app is restarted before it completes),
preferences.jsonstill has the old provider, and the user sees their setting "not saved".Fix
set_active_asr_providernow also syncs the provider to preferences.json immediately after writing to Keychain, so both stores are always consistent regardless of what the frontend does.Test
PR Type
Bug fix
Description
Sync ASR provider to
preferences.jsonSync LLM provider to
preferences.jsonWarn when preference write fails
Diagram Walkthrough
File Walkthrough
commands.rs
Sync provider updates to settings fileopenless-all/app/src-tauri/src/commands.rs
CredentialsVault, also writesactive_asr_providerintopreferences.json.set_active_llm_providerto acceptCoordinatorState, thenpersists
active_llm_providerto settings too.preferences.jsonfails, instead of failingthe whole command.