fix: sync preferences.json when switching ASR provider#552
Open
PINKIIILQWQ wants to merge 2 commits into
Open
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.