Skip to content

Fix settings migrations for nested platform/channel/profile keys#48550

Merged
rtfeldman merged 19 commits intomainfrom
pr/fix-nested-settings-migrations
Feb 6, 2026
Merged

Fix settings migrations for nested platform/channel/profile keys#48550
rtfeldman merged 19 commits intomainfrom
pr/fix-nested-settings-migrations

Conversation

@rtfeldman
Copy link
Contributor

@rtfeldman rtfeldman commented Feb 6, 2026

Previously, some settings migrations only operated on root-level keys and missed settings nested under platform keys (macos, linux, etc.), channel keys (nightly, stable, etc.), or profile blocks. This fixes migrations to recurse into those nested locations.

Also fixes m_2026_02_02 to gracefully skip when edit_predictions is not an object (e.g. true) instead of bailing and aborting the entire migration chain.

Release Notes:

  • Fixed settings migrations to correctly handle settings nested under platform, channel, or profile keys.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 6, 2026
@rtfeldman rtfeldman changed the title Fix existing settings migrations for nested platform/channel/profile keys Fix settings migrations for nested platform/channel/profile keys Feb 6, 2026
…channel override keys in migrations

- Add strum EnumIter + IntoStaticStr derives to ReleaseChannel
- Add SupportedPlatform enum with EnumIter
- Make gpui and semver optional deps behind a 'gpui' feature
- Replace hardcoded PLATFORM_AND_CHANNEL_KEYS in migrations with
  ReleaseChannel::iter() and SupportedPlatform::iter()
- Remove test case that expected non-object edit_predictions to skip
@zelenenka zelenenka added the staff Pull requests authored by a current member of Zed staff label Feb 6, 2026
The IntoStaticStr derive was not used anywhere. EnumIter is kept
as it is used by the settings migrations.
…ined

Add test cases to test_move_edit_prediction_provider_to_edit_predictions and
test_migrate_experimental_sweep_mercury that verify migrations work correctly
when the same setting appears simultaneously at the root level, inside a
platform override (e.g. macos/linux), and inside a profile.
Update the doc comment to make it clear the returned values are the
JSON keys used in settings files for platform-specific overrides.
The branch had changed .log_err() to .ok() and replaced
expr.log_err() with let _ = expr, which silently discards errors.
Per project rules, errors should never be silently discarded.
Restore all affected call sites to use .log_err() and re-add the
util::ResultExt import.
…rplate

Both m_2026_02_02 and m_2026_02_03 had identical code for iterating over
the root settings object, platform/channel overrides, and profile
settings. Extract this into a shared migrate_nested_settings() helper in
the migrations module that takes a callback and applies it to each
nested settings map.
…migrations

Refactor make_file_finder_include_ignored_an_enum and
make_relative_line_numbers_an_enum to use the migrate_nested_settings
helper so they correctly handle platform, release-channel, and profile
override objects.

Each migration now extracts its core logic into a migrate_one helper
that operates on a single Map, and delegates to migrate_nested_settings
to apply it across all nested scopes.

Added tests for platform overrides and profile settings for both
migrations.
Replace the release_channel dependency (which required feature-gating
gpui and touching 40+ Cargo.toml files) with a simple inlined constant
of the override keys used in settings JSON.
…oded strings

Feature-gate gpui/semver as optional in release_channel (default on),
add SupportedPlatform enum and strum::EnumIter derives. The migrator
uses a direct path dep with default-features = false to avoid pulling
in gpui, so no other crate's Cargo.toml needs to change.

Also updates m_2025_11_25::remove_context_server_source to use
migrate_nested_settings so context_servers.*.source is removed from
platform, release-channel, and profile overrides too.
Add migrate_nested_language_setting helper that composes both nesting
strategies: for each level (root, platform overrides, release-channel
overrides, profiles), it applies the migration to the value itself and
to each language under its 'languages' key.

Update m_2025_10_01, m_2025_10_02, and m_2025_10_16 to use it. Remove
the now-unused migrate_language_setting.
Extract platform and release-channel override fields from
UserSettingsContent into PlatformOverrides and ReleaseChannelOverrides
structs with #[serde(flatten)]. Each struct exposes an OVERRIDE_KEYS
constant listing its field names.

The migrator imports these constants from settings_content directly,
so the override keys used in migrations are always in sync with the
actual settings struct fields. This removes the release_channel and
strum dependencies from the migrator, and reverts release_channel
back to its original state (no feature gating needed).
Add a settings_overrides! macro in settings_content that generates
the struct definition, OVERRIDE_KEYS const, and get_by_key accessor
from a single field list. The field names appear exactly once.

for_os() and for_release_channel() now use get_by_key() instead of
hand-written match arms with duplicated key strings.
@rtfeldman rtfeldman force-pushed the pr/fix-nested-settings-migrations branch from 6e7f718 to a2d2644 Compare February 6, 2026 16:23
…nguage_setting -> migrate_language_setting

Drop the 'nested' qualifier since all migrations should handle
overrides by default.
/// Migrate language settings,
/// calls `migrate_fn` with the top level object as well as all language settings under the "languages" key
/// Fails early if `migrate_fn` returns an error at any point
pub fn migrate_language_setting(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is now in migrator.rs (and is revised)

@rtfeldman rtfeldman marked this pull request as ready for review February 6, 2026 16:48
@rtfeldman rtfeldman enabled auto-merge (squash) February 6, 2026 16:48
@rtfeldman rtfeldman merged commit 4f8ff64 into main Feb 6, 2026
28 checks passed
@rtfeldman rtfeldman deleted the pr/fix-nested-settings-migrations branch February 6, 2026 16:50
naaiyy added a commit to Glass-HQ/Glass that referenced this pull request Feb 16, 2026
Key changes:
- LSP folding ranges support (zed-industries#48611) - textDocument/foldingRange with custom fold text
- LSP refactoring (zed-industries#48604) - extracted document_colors, code_lens, folding_ranges into modules
- Crate graph restructuring (zed-industries#48602) - terminal moved closer to editor
- Side-by-side diff searching (zed-industries#48539) and OpenExcerpts for LHS (zed-industries#48438)
- SplittableEditor: sync custom blocks between RHS/LHS (zed-industries#48575)
- Thinking effort for Zed/OpenAI providers (zed-industries#48545, zed-industries#48605)
- Agent default_model.enable_thinking setting (zed-industries#48536)
- Configurable LSP timeout setting (zed-industries#44745)
- PaneSearchBarCallbacks global (search bar setup extracted from vim)
- Settings migrations for nested platform/channel/profile keys (zed-industries#48550)
- Shell parser: I/O redirects, here-documents, compound commands (zed-industries#48635)
- Hardened tool authorization: sensitive settings, deferred ops (zed-industries#48641)
- rm security bypass fixes (zed-industries#48640, zed-industries#48647)
- MCP tool name parsing fix: newline delimiter (zed-industries#48636)
- Canonicalize --user-data-dir path (zed-industries#48470)
- Fix text_threads_dir XDG spec compliance (zed-industries#45771)
- Buffer font for folds (zed-industries#48652)
- Multibuffer toolbar layout shift fix (zed-industries#48472)
- Editor: tabs bitmask syncing (zed-industries#48366)

Conflict resolution:
- collab tests: deleted (collab removed)
- util/archive.rs, util/shell.rs: deleted (extracted to Obsydian)
- copilot_ui/sign_in.rs: kept native_button style
- editor_tests.rs: merged imports (kept MoveItemToPaneInDirection, added ViewId/FollowEvent)
- lsp_store.rs: took upstream refactored imports, added FoldingRangeData, removed collab imports
- main.rs: added PaneSearchBarCallbacks, removed vim::init

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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 staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants