fix(gui-client): allow legacy settings to parse new format#9418
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR ensures that after migrating settings to the new format, legacy settings structs can still parse the updated JSON, preventing silent fallbacks to defaults.
- Added a
serde(alias)onauth_base_urlto accept the old"auth_url"key. - Introduced a test verifying that
AdvancedSettingsLegacycan deserialize the new format without errors.
Comments suppressed due to low confidence (2)
rust/gui-client/src-tauri/src/settings.rs:315
- The test only checks that parsing doesn't panic but doesn't verify that fields map correctly. Add assertions comparing fields of the deserialized
AdvancedSettingsLegacyto the originalAdvancedSettings::default()values to ensure the alias works as intended.
serde_json::from_str::<AdvancedSettingsLegacy>(&new_format).unwrap();
rust/gui-client/src-tauri/src/settings.rs:45
- [nitpick] Consider adding a comment above this alias to explain that it's intended to maintain compatibility with legacy JSON field names, which helps future maintainers understand the migration rationale.
#[serde(alias = "auth_url")]
Member
Author
|
Confirmed to fix the problem: #9417 (comment) |
jamilbk
approved these changes
Jun 5, 2025
Member
|
Ah I did not test upgrades. |
d6c68d1 to
c097047
Compare
Member
Author
Upgrades aren't the issue. Reading the migrated format is because we always expected the old format on startup. |
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.
As part of the introduction of General settings, we split up "Advanced settings" and also renamed one of the fields. Upon first start, the settings are migrated to the new format. What we failed to notice is that one the next subsequent start, the legacy settings struct will fail to parse the now migrated configuration and fall back to the default. This then appears as if the settings are not getting saved.
Resolves: #9417