Skip to content

Fix preserve settings during migrations#52676

Merged
probably-neb merged 6 commits intozed-industries:mainfrom
OmChillure:fix-preserve-settings-during-migrations
Mar 30, 2026
Merged

Fix preserve settings during migrations#52676
probably-neb merged 6 commits intozed-industries:mainfrom
OmChillure:fix-preserve-settings-during-migrations

Conversation

@OmChillure
Copy link
Copy Markdown
Contributor

@OmChillure OmChillure commented Mar 29, 2026

Context

update_settings_file deletes unrelated settings when the settings file contains deprecated keys that need migration. For example, changing the model from the Agent Panel overwrites the entire agent block instead of just updating default_model.

The root cause is that edits_for_update used parse_json_with_comments (strict parser), which returns Err on deprecated/unknown fields. The error is swallowed by log_err(), falling back to Default::default() (empty settings). The diff then sees everything as new and replaces the entire block.

The fix switches to parse_json (the fallible/lenient parser), which returns Some(parsed_value) even when deprecated fields are present - the same pattern already used by parse_and_migrate_zed_settings.

Fixes #41344

How to Review

Single-file change in settings_store.rs, focus on edits_for_update . Compare with parse_and_migrate_zed_settings (line 702) which already uses the same parse_json approach.

Self-Review Checklist

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Video

Screencast.from.2026-03-21.00-36-12.webm

Note : Reopens previous work from closed PR #52081 (fork was deleted)

Release Notes:

  • Fixed settings being overwritten when updating a single setting via UI while the settings file contains deprecated keys.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 29, 2026
@zed-community-bot zed-community-bot bot added the guild Pull requests by someone in Zed Guild. NOTE: the label application is automated via github actions label Mar 29, 2026
@zed-codeowner-coordinator zed-codeowner-coordinator bot requested review from a team, danilo-leal and probably-neb and removed request for a team March 29, 2026 16:40
@MrSubidubi MrSubidubi removed the request for review from danilo-leal March 29, 2026 16:56
@probably-neb
Copy link
Copy Markdown
Collaborator

Thanks!

@probably-neb probably-neb merged commit b48dd02 into zed-industries:main Mar 30, 2026
44 checks passed
@probably-neb
Copy link
Copy Markdown
Collaborator

@zed-zippy approved

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

Labels

cla-signed The user has signed the Contributor License Agreement guild Pull requests by someone in Zed Guild. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

update_settings_file deletes settings if settings file needs to be migrated

4 participants