mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
settings: Remove settings field from HTTP context_servers (#48003)
HTTP context servers don’t support the settings field, so remove it during migration to avoid confusion. Other context server types are unaffected. Closes #44786. https://github.com/user-attachments/assets/4cabf405-c9e7-4d6e-a43d-f642fc4771e0 Release Notes: - Removed deprecated key from HTTP `context_servers` --------- Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de> Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
This commit is contained in:
parent
bfc34a620b
commit
47059dc578
3 changed files with 86 additions and 0 deletions
|
|
@ -334,3 +334,9 @@ pub(crate) mod m_2026_04_10 {
|
|||
|
||||
pub(crate) use settings::rename_web_search_to_search_web;
|
||||
}
|
||||
|
||||
pub(crate) mod m_2026_04_15 {
|
||||
mod settings;
|
||||
|
||||
pub(crate) use settings::remove_settings_from_http_context_servers;
|
||||
}
|
||||
|
|
|
|||
19
crates/migrator/src/migrations/m_2026_04_15/settings.rs
Normal file
19
crates/migrator/src/migrations/m_2026_04_15/settings.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
use anyhow::Result;
|
||||
use serde_json::Value;
|
||||
|
||||
pub fn remove_settings_from_http_context_servers(settings: &mut Value) -> Result<()> {
|
||||
if let Some(obj) = settings.as_object_mut() {
|
||||
if let Some(context_servers) = obj.get_mut("context_servers") {
|
||||
if let Some(servers) = context_servers.as_object_mut() {
|
||||
for (_, server) in servers.iter_mut() {
|
||||
if let Some(server_obj) = server.as_object_mut() {
|
||||
if server_obj.contains_key("url") {
|
||||
server_obj.remove("settings");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -250,6 +250,7 @@ pub fn migrate_settings(text: &str) -> Result<Option<String>> {
|
|||
MigrationType::Json(migrations::m_2026_03_30::make_play_sound_when_agent_done_an_enum),
|
||||
MigrationType::Json(migrations::m_2026_04_01::restructure_profiles_with_settings_key),
|
||||
MigrationType::Json(migrations::m_2026_04_10::rename_web_search_to_search_web),
|
||||
MigrationType::Json(migrations::m_2026_04_15::remove_settings_from_http_context_servers),
|
||||
];
|
||||
run_migrations(text, migrations)
|
||||
}
|
||||
|
|
@ -4980,4 +4981,64 @@ mod tests {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_remove_settings_from_http_context_servers() {
|
||||
assert_migrate_settings(
|
||||
&r#"
|
||||
{
|
||||
"context_servers": {
|
||||
"http_server": {
|
||||
"url": "https://example.com/mcp",
|
||||
"settings": {}
|
||||
},
|
||||
"http_server_with_headers": {
|
||||
"url": "https://example.com/mcp",
|
||||
"headers": {
|
||||
"Authorization": "Bearer token"
|
||||
},
|
||||
"settings": {}
|
||||
},
|
||||
"extension_server": {
|
||||
"settings": {
|
||||
"foo": "bar"
|
||||
}
|
||||
},
|
||||
"stdio_server": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "some-server"]
|
||||
}
|
||||
}
|
||||
}
|
||||
"#
|
||||
.unindent(),
|
||||
Some(
|
||||
&r#"
|
||||
{
|
||||
"context_servers": {
|
||||
"http_server": {
|
||||
"url": "https://example.com/mcp"
|
||||
},
|
||||
"http_server_with_headers": {
|
||||
"url": "https://example.com/mcp",
|
||||
"headers": {
|
||||
"Authorization": "Bearer token"
|
||||
}
|
||||
},
|
||||
"extension_server": {
|
||||
"settings": {
|
||||
"foo": "bar"
|
||||
}
|
||||
},
|
||||
"stdio_server": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "some-server"]
|
||||
}
|
||||
}
|
||||
}
|
||||
"#
|
||||
.unindent(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue