From 02fbafcda603bc3b6d63e2a0f778650b44f02436 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Thu, 27 Nov 2025 14:46:43 +0100 Subject: [PATCH] release_version: Do not use prerelease field (#43669) - **release_channel: Do not use prerelease channel for build id** Prerelease channel specifiers always compare as less than to non-prerelease, which led to 2 auto-update bugs fixed in https://github.com/zed-industries/zed/pull/43595 and https://github.com/zed-industries/zed/pull/43611. We'll use a dot-delimited build specifiers in form: release-channel.build_number.sha1 instead - **auto_update: Do not display full build metadata in update notification** Release Notes: - N/A --- Cargo.lock | 1 + crates/auto_update_ui/Cargo.toml | 1 + crates/auto_update_ui/src/auto_update_ui.rs | 4 +++- crates/release_channel/src/lib.rs | 12 ++++++++++-- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f10c2e1d13210d67d16d584637c0fb7b71d61eec..8d4baa2e5221c23ff57a227a94dae4ae3859ec83 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1380,6 +1380,7 @@ dependencies = [ "http_client", "markdown_preview", "release_channel", + "semver", "serde", "serde_json", "smol", diff --git a/crates/auto_update_ui/Cargo.toml b/crates/auto_update_ui/Cargo.toml index 0e31f94f5ee268cdc3274dea747bd0b05d9c80eb..2b1421e35dcbcf6fac40cd0e97a3dc839da58d9e 100644 --- a/crates/auto_update_ui/Cargo.toml +++ b/crates/auto_update_ui/Cargo.toml @@ -20,6 +20,7 @@ gpui.workspace = true http_client.workspace = true markdown_preview.workspace = true release_channel.workspace = true +semver.workspace = true serde.workspace = true serde_json.workspace = true smol.workspace = true diff --git a/crates/auto_update_ui/src/auto_update_ui.rs b/crates/auto_update_ui/src/auto_update_ui.rs index aeaa6ae93e635a6cab1487400fb58bd7be1bc6e1..6c32ee3b6c9b9c4974a287ff0e9a988472cecf3b 100644 --- a/crates/auto_update_ui/src/auto_update_ui.rs +++ b/crates/auto_update_ui/src/auto_update_ui.rs @@ -148,7 +148,9 @@ pub fn notify_if_app_was_updated(cx: &mut App) { let should_show_notification = should_show_notification.await?; if should_show_notification { cx.update(|cx| { - let version = updater.read(cx).current_version(); + let mut version = updater.read(cx).current_version(); + version.build = semver::BuildMetadata::EMPTY; + version.pre = semver::Prerelease::EMPTY; let app_name = ReleaseChannel::global(cx).display_name(); show_app_notification( NotificationId::unique::(), diff --git a/crates/release_channel/src/lib.rs b/crates/release_channel/src/lib.rs index e84bf91c1db5e891abae0aeb67089cc40b1ec009..65201ccc46caccdf4912b69fa296d468dfdea95d 100644 --- a/crates/release_channel/src/lib.rs +++ b/crates/release_channel/src/lib.rs @@ -90,11 +90,19 @@ impl AppVersion { } else { pkg_version.parse().expect("invalid version in Cargo.toml") }; + let mut pre = String::from(RELEASE_CHANNEL.dev_name()); + if let Some(build_id) = build_id { - version.pre = semver::Prerelease::new(&build_id).expect("Invalid build identifier"); + pre.push('.'); + pre.push_str(&build_id); } + if let Some(sha) = commit_sha { - version.build = semver::BuildMetadata::new(&sha.0).expect("Invalid build metadata"); + pre.push('.'); + pre.push_str(&sha.0); + } + if let Ok(build) = semver::BuildMetadata::new(&pre) { + version.build = build; } version