fix(desktop): save provider/config to global user config, surviving workspace switch#2516
Merged
Merged
Conversation
…orkspace switch Desktop settings went through applyConfigChange -> cfg.Save(), and Save() targets SourcePath(): the cwd reasonix.toml when present, otherwise it creates a project-level one. So providers configured in the desktop app were written per-project and vanished after switching the working folder. Providers/keys/language are account-level: load and save the user-global config (~/.config/reasonix/config.toml) directly via LoadForEdit + SaveTo, exposing config.UserConfigPath(). The CLI-facing project semantics of config.Save() are unchanged.
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.
Problem
Providers configured in the desktop app disappear after switching the working folder.
Root cause: desktop settings flow through
applyConfigChange→config.Load()→cfg.Save(), andSave()writes toSourcePath()— the cwd'sreasonix.tomlif present, otherwise it creates a project-levelreasonix.toml. So providers were written per-project.PickWorkspacethen doesos.Chdir(newDir)+config.Load(), and the new directory has no suchreasonix.toml, so the providers are gone.Fix
Providers, API keys, and language are account-level, not per-project.
applyConfigChangenow loads and saves the user-global config (~/.config/reasonix/config.toml) directly viaLoadForEdit+SaveTo, instead of the cwd-dependentSave(). Addedconfig.UserConfigPath()for this.config.Save()'s project-level semantics are left intact for the CLI (reasonix setup).Note
Providers already written into a project
reasonix.tomlwon't auto-migrate — re-saving them once in the desktop app now writes them to the global config.Verification
go build+go vetpass for both the main module (internal/config) and the desktop module (settings_app typechecks against the newUserConfigPath).