diff --git a/backend/crates/gateway-admin/src/model/system.rs b/backend/crates/gateway-admin/src/model/system.rs index 7e777980f..4e4c3da7f 100644 --- a/backend/crates/gateway-admin/src/model/system.rs +++ b/backend/crates/gateway-admin/src/model/system.rs @@ -54,7 +54,7 @@ pub struct SystemVersion { pub build_time: String, pub deployment_mode: String, pub update_channel: String, - pub latest_version: String, + pub latest_version: Option, pub has_update: bool, pub update_cached: bool, pub update_warning: Option, @@ -67,7 +67,7 @@ pub struct SystemVersion { pub struct SystemUpdateDetail { pub policy: SystemUpdatePolicy, pub current_version: String, - pub latest_version: String, + pub latest_version: Option, pub has_update: bool, pub deployment_mode: String, pub build_type: String, diff --git a/backend/crates/gateway-admin/tests/use_case/system/service.rs b/backend/crates/gateway-admin/tests/use_case/system/service.rs index fcd4090c9..c17677511 100644 --- a/backend/crates/gateway-admin/tests/use_case/system/service.rs +++ b/backend/crates/gateway-admin/tests/use_case/system/service.rs @@ -32,7 +32,7 @@ impl SystemOperations for RecordingSystemOperations { deployment_mode: "source".to_owned(), update_channel: "stable".to_owned(), - latest_version: "1.0.0".to_owned(), + latest_version: None, has_update: false, update_cached: false, update_warning: None, @@ -50,7 +50,7 @@ impl SystemOperations for RecordingSystemOperations { available_channels: vec![gateway_admin::model::system::SystemUpdateChannel::Stable], }, current_version: "1.0.0".to_owned(), - latest_version: "1.0.0".to_owned(), + latest_version: None, has_update: false, deployment_mode: "source".to_owned(), build_type: "source".to_owned(), diff --git a/backend/crates/gateway-api/src/admin/system.rs b/backend/crates/gateway-api/src/admin/system.rs index ddc3b22cc..1a60c03ef 100644 --- a/backend/crates/gateway-api/src/admin/system.rs +++ b/backend/crates/gateway-api/src/admin/system.rs @@ -86,7 +86,7 @@ struct SystemVersionView { deployment_mode: String, deployment_mode_label: String, update_channel: String, - latest_version: String, + latest_version: Option, has_update: bool, update_cached: bool, update_warning: Option, @@ -114,7 +114,7 @@ impl From for SystemVersionView { struct SystemUpdateDetailView { policy: SystemUpdatePolicy, current_version: String, - latest_version: String, + latest_version: Option, has_update: bool, deployment_mode: String, deployment_mode_label: String, diff --git a/backend/crates/gateway-api/tests/admin/system.rs b/backend/crates/gateway-api/tests/admin/system.rs index a40a6883c..96deeff9d 100644 --- a/backend/crates/gateway-api/tests/admin/system.rs +++ b/backend/crates/gateway-api/tests/admin/system.rs @@ -216,7 +216,7 @@ impl SystemOperations for ProgressSystem { available_channels: vec![SystemUpdateChannel::Stable, SystemUpdateChannel::Beta], }, current_version: "0.1.0".into(), - latest_version: "0.2.0".into(), + latest_version: Some("0.2.0".into()), has_update: true, deployment_mode: "docker".into(), build_type: "release".into(), diff --git a/backend/crates/gateway-api/tests/support/mod.rs b/backend/crates/gateway-api/tests/support/mod.rs index b99ec9aec..eeb5db3c1 100644 --- a/backend/crates/gateway-api/tests/support/mod.rs +++ b/backend/crates/gateway-api/tests/support/mod.rs @@ -96,7 +96,7 @@ impl SystemOperations for VersionSystem { deployment_mode: "binary".to_owned(), update_channel: "release".to_owned(), - latest_version: "3.8.0".to_owned(), + latest_version: Some("3.8.0".to_owned()), has_update: true, update_cached: true, update_warning: Some("internal-update-warning".to_owned()), diff --git a/backend/crates/gateway-host/src/system_update/discovery.rs b/backend/crates/gateway-host/src/system_update/discovery.rs index 9bc673c58..e33300856 100644 --- a/backend/crates/gateway-host/src/system_update/discovery.rs +++ b/backend/crates/gateway-host/src/system_update/discovery.rs @@ -13,9 +13,7 @@ use yaml_rust2::Yaml; use super::diagnostics::Diagnostics; use super::metadata::{Metadata, published_version}; -use super::release::{ - GitHubRelease, base_update_detail, detail_from_release, update_target_allowed, -}; +use super::release::{GitHubRelease, base_update_detail, update_target_allowed}; use super::{OperationError, SystemUpdateConfig, conflict, upstream}; const NORMAL: Duration = Duration::from_secs(1200); @@ -155,11 +153,14 @@ impl ReleaseCache { let (mut detail, target) = candidate(config, channel, &index)?; detail.cached = cached; if check != Check::Summary || detail.has_update { - let (release, reused) = self.exact(config, &target, age, diagnostics).await?; + let (release, reused) = self + .exact(config, &target, detail.has_update, age, diagnostics) + .await?; if let Some(release) = release && check != Check::Summary { - detail = detail_from_release(config, &release, channel); + detail.release_url.clone_from(&release.html_url); + detail.notes = release.body.clone().or_else(|| release.name.clone()); } detail.cached = cached && reused; } @@ -173,6 +174,7 @@ impl ReleaseCache { &self, config: &SystemUpdateConfig, target: &Version, + has_update: bool, age: Duration, diagnostics: &Diagnostics, ) -> Result<(Option>, bool), OperationError> { @@ -191,8 +193,12 @@ impl ReleaseCache { entries.push_back((target.clone(), Arc::clone(&slot))); slot }; - slot.get(age, self.metadata.release(config, target), diagnostics) - .await + slot.get( + age, + self.metadata.release(config, target, has_update), + diagnostics, + ) + .await } pub(super) async fn install( @@ -209,10 +215,10 @@ impl ReleaseCache { .get(Duration::ZERO, self.metadata.index(config), diagnostics) .await?; let (detail, target) = candidate(config, channel, &index)?; - if !detail.has_update || detail.latest_version != confirmed { + if !detail.has_update || detail.latest_version.as_deref() != Some(confirmed) { return Err(conflict("远端最新版本已变化,请重新检查并确认")); } - self.exact(config, &target, Duration::ZERO, diagnostics) + self.exact(config, &target, true, Duration::ZERO, diagnostics) .await? .0 .ok_or_else(|| upstream("发布索引指向的 Release 不存在")) @@ -231,11 +237,7 @@ fn candidate( .map_err(|_| conflict("当前版本号无效"))?; let target = published_version(index, ¤t, channel)?; let mut detail = base_update_detail(config, channel, None, None); - if update_target_allowed(¤t, &target, channel) { - detail.latest_version = target.to_string(); - detail.has_update = true; - Ok((detail, target)) - } else { - Ok((detail, current)) - } + detail.latest_version = Some(target.to_string()); + detail.has_update = update_target_allowed(¤t, &target, channel); + Ok((detail, target)) } diff --git a/backend/crates/gateway-host/src/system_update/metadata.rs b/backend/crates/gateway-host/src/system_update/metadata.rs index 803b30fcf..43cba6968 100644 --- a/backend/crates/gateway-host/src/system_update/metadata.rs +++ b/backend/crates/gateway-host/src/system_update/metadata.rs @@ -83,6 +83,7 @@ impl Metadata { &self, config: &SystemUpdateConfig, version: &Version, + has_update: bool, ) -> Result>, OperationError> { let mut url = Url::parse(&config.github_api_base).map_err(|_| invalid("发行查询地址无效"))?; @@ -109,7 +110,7 @@ impl Metadata { if release.tag_name != tag || release.draft || release.prerelease != prerelease { return Err(upstream("GitHub 发行身份与发布索引不符")); } - if config.version.trim_start_matches('v') != version { + if has_update { release.install_assets(&version, &config.github_api_base)?; } Ok(Some(Arc::new(release))) diff --git a/backend/crates/gateway-host/src/system_update/release.rs b/backend/crates/gateway-host/src/system_update/release.rs index 0ed52a675..439daa3ee 100644 --- a/backend/crates/gateway-host/src/system_update/release.rs +++ b/backend/crates/gateway-host/src/system_update/release.rs @@ -72,36 +72,6 @@ impl GitHubRelease { } } -pub(crate) fn detail_from_release( - config: &SystemUpdateConfig, - release: &GitHubRelease, - channel: UpdateChannel, -) -> SystemUpdateDetail { - let unsupported_reason = config.update_support_error(); - let latest_version = normalize_version(&release.tag_name); - let has_update = validate_update_target(&config.version, &latest_version, channel).is_ok(); - if unsupported_reason.is_some() - || (!has_update && latest_version != normalize_version(&config.version)) - { - return base_update_detail(config, channel, unsupported_reason, None); - } - SystemUpdateDetail { - policy: update_policy(config, channel), - current_version: config.version.clone(), - latest_version, - has_update, - deployment_mode: config.deployment_mode.clone(), - build_type: config.build_type.clone(), - release_url: release.html_url.clone(), - notes: release.body.clone().or_else(|| release.name.clone()), - cached: false, - update_supported: true, - unsupported_reason: None, - warning: None, - retry_at: None, - } -} - pub(crate) fn confirmed_target(target: Option) -> Result { let target = target.ok_or_else(|| conflict("请先确认目标版本"))?; let target = normalize_version(&target); @@ -364,14 +334,14 @@ pub(super) fn base_update_detail( SystemUpdateDetail { policy: update_policy(config, channel), current_version: config.version.clone(), - latest_version: config.version.clone(), + latest_version: None, has_update: false, deployment_mode: config.deployment_mode.clone(), build_type: config.build_type.clone(), release_url: None, notes: None, cached: false, - update_supported: unsupported_reason.is_none() && warning.is_none(), + update_supported: unsupported_reason.is_none(), unsupported_reason, warning: warning.map(|error| error.message().to_owned()), retry_at: warning.and_then(OperationError::retry_at), diff --git a/backend/crates/gateway-host/tests/system_update/channels.rs b/backend/crates/gateway-host/tests/system_update/channels.rs index cb25d5b10..dbf52f29d 100644 --- a/backend/crates/gateway-host/tests/system_update/channels.rs +++ b/backend/crates/gateway-host/tests/system_update/channels.rs @@ -30,7 +30,7 @@ async fn temporary_channel_should_filter_future_releases_without_changing_runnin .update_detail(SystemUpdateCheck::Detail, Some(channel)) .await .expect("detail"); - assert_eq!(detail.latest_version, target); + assert_eq!(detail.latest_version.as_deref(), Some(target)); assert_eq!(detail.policy.channel, channel); assert_eq!( detail.policy.available_channels, @@ -42,11 +42,11 @@ async fn temporary_channel_should_filter_future_releases_without_changing_runnin .await .expect("cached"); assert!(cached.cached); - assert_eq!(cached.latest_version, target); + assert_eq!(cached.latest_version.as_deref(), Some(target)); } let version = service.version().await.expect("default check"); assert_eq!(version.update_channel, "stable"); - assert_eq!(version.latest_version, "1.1.0"); + assert_eq!(version.latest_version.as_deref(), Some("1.1.0")); assert!(!fixture.state().exists(), "检查通道不能写入实例偏好"); let requests = server.received_requests().await.expect("requests"); assert_eq!(requests.len(), 5); @@ -56,17 +56,27 @@ async fn temporary_channel_should_filter_future_releases_without_changing_runnin async fn reopening_should_infer_running_channel_and_switching_to_stable_should_not_downgrade() { let server = MockServer::start().await; let fixture = Fixture::new(); - fixture.mount_release_once(&server, "1.0.0").await; + mount_index(&server, fixture_index("1.0.0")).await; + Mock::given(path("/repos/owner/repository/releases/tags/v1.0.0")) + .respond_with(release_response("1.0.0", Vec::new())) + .mount(&server) + .await; let mut config = fixture.config(&format!("{}/repos", server.uri())); config.version = "1.1.0-beta.1".into(); let service = ProcessSystemOperations::new(CancellationToken::new(), config.clone()); - let temporary = service - .update_detail(SystemUpdateCheck::Refresh, Some(Stable)) - .await - .expect("view stable"); - assert_eq!(temporary.policy.channel, Stable); - assert!(!temporary.has_update); - assert_eq!(temporary.latest_version, "1.1.0-beta.1"); + for check in [SystemUpdateCheck::Summary, SystemUpdateCheck::Refresh] { + let temporary = service + .update_detail(check, Some(Stable)) + .await + .expect("view stable"); + assert_eq!(temporary.policy.channel, Stable); + assert!(!temporary.has_update); + assert_eq!(temporary.latest_version.as_deref(), Some("1.0.0")); + assert_eq!( + temporary.notes.is_some(), + check != SystemUpdateCheck::Summary + ); + } assert_eq!( service .update_detail(SystemUpdateCheck::Detail, None) @@ -231,7 +241,7 @@ async fn inferred_prerelease_policy_should_follow_future_minor_and_patch_release .await .expect("check"); assert!(detail.has_update); - assert_eq!(detail.latest_version, target); + assert_eq!(detail.latest_version.as_deref(), Some(target)); assert_eq!( complete_update(&service, target).await.operation.status, SystemOperationStatus::Succeeded diff --git a/backend/crates/gateway-host/tests/system_update/discovery.rs b/backend/crates/gateway-host/tests/system_update/discovery.rs index 9ea602bd5..f48d7ae8b 100644 --- a/backend/crates/gateway-host/tests/system_update/discovery.rs +++ b/backend/crates/gateway-host/tests/system_update/discovery.rs @@ -78,7 +78,7 @@ async fn discovery_request_budget_is_constant_under_load() { .update_detail(SystemUpdateCheck::Summary, None) .await .unwrap(); - assert_eq!(summary.latest_version, target); + assert_eq!(summary.latest_version.as_deref(), Some(target.as_str())); assert!(summary.notes.is_none()); assert_eq!(server.received_requests().await.unwrap().len(), 2); @@ -96,7 +96,7 @@ async fn discovery_request_budget_is_constant_under_load() { } while let Some(detail) = callers.join_next().await { let detail = detail.unwrap(); - assert_eq!(detail.latest_version, target); + assert_eq!(detail.latest_version.as_deref(), Some(target.as_str())); assert_eq!(detail.notes.as_deref(), Some("notes")); } for _ in 0..64 { @@ -199,6 +199,10 @@ async fn api_cooldown_is_shared_and_summary_does_not_advertise_an_unverified_rel .await .unwrap(); assert!(first.warning.is_some()); + assert!(first.update_supported); + assert!(first.unsupported_reason.is_none()); + assert!(!first.has_update); + assert!(first.latest_version.is_none()); let retry_at = first.retry_at.expect("限流应提供重试时间"); assert!((298..=300).contains(&(retry_at - chrono::Utc::now()).num_seconds())); for _ in 0..32 { @@ -306,7 +310,11 @@ async fn install_rechecks_even_a_warm_candidate_and_never_downloads_a_changed_ta .await .unwrap(); assert!(detail.has_update); - let status = complete_update(&service, &detail.latest_version).await; + let status = complete_update( + &service, + detail.latest_version.as_deref().expect("confirmed target"), + ) + .await; assert_eq!(status.operation.status, SystemOperationStatus::Failed); assert!(status.operation.error.unwrap().contains("重新检查并确认")); assert_eq!(server.received_requests().await.unwrap().len(), 3); diff --git a/backend/crates/gateway-host/tests/system_update/release.rs b/backend/crates/gateway-host/tests/system_update/release.rs index 1c2cf42d0..25ec9baf4 100644 --- a/backend/crates/gateway-host/tests/system_update/release.rs +++ b/backend/crates/gateway-host/tests/system_update/release.rs @@ -59,7 +59,7 @@ async fn update_detail_should_withhold_updates_for_source_builds() { .update_detail(SystemUpdateCheck::Refresh, None) .await .expect("detail"); - assert_eq!(detail.latest_version, "1.0.0"); + assert!(detail.latest_version.is_none()); assert!(!detail.update_supported); assert!(detail.unsupported_reason.is_some()); assert!(!detail.has_update); @@ -107,10 +107,7 @@ async fn update_checks_should_follow_stage_promotion_and_experimental_isolation( .await .expect("detail"); assert_eq!(detail.has_update, allowed, "{current} -> {target}"); - assert_eq!( - detail.latest_version, - if allowed { target } else { current } - ); + assert_eq!(detail.latest_version.as_deref(), allowed.then_some(target)); assert_eq!(detail.notes.is_some(), allowed); assert_eq!(detail.release_url.is_some(), allowed); assert_eq!(detail.warning.is_none(), allowed); @@ -161,7 +158,7 @@ async fn update_detail_should_keep_current_release_notes_without_allowing_reinst .update_detail(SystemUpdateCheck::Refresh, None) .await .expect("current release"); - assert_eq!(detail.latest_version, current); + assert_eq!(detail.latest_version.as_deref(), Some(current)); assert!(!detail.has_update); assert!(detail.update_supported); assert_eq!( @@ -193,15 +190,15 @@ async fn update_detail_should_keep_current_release_notes_without_allowing_reinst #[tokio::test] async fn update_checks_should_ignore_downgrades_unknown_stages_and_build_metadata() { - for (current, target) in [ - ("3.12.0-beta.2", "3.12.0-beta.1"), - ("3.12.0", "3.12.0+new-build"), - ("3.12.0-beta.1+aaa", "3.12.0-beta.1+zzz"), - ("3.12.0", "3.11.0"), - ("3.12.0-alpha.1", "3.12.0-preview.2"), - ("3.12.0-alpha.1", "3.12.0-beta"), - ("3.12.0-alpha.1", "3.12.0-beta.0"), - ("3.12.0-alpha.1", "3.12.0-beta.2.extra"), + for (current, target, published) in [ + ("3.12.0-beta.2", "3.12.0-beta.1", true), + ("3.12.0", "3.12.0+new-build", true), + ("3.12.0-beta.1+aaa", "3.12.0-beta.1+zzz", true), + ("3.12.0", "3.11.0", true), + ("3.12.0-alpha.1", "3.12.0-preview.2", false), + ("3.12.0-alpha.1", "3.12.0-beta", false), + ("3.12.0-alpha.1", "3.12.0-beta.0", false), + ("3.12.0-alpha.1", "3.12.0-beta.2.extra", false), ] { let server = MockServer::start().await; let fixture = Fixture::new(); @@ -214,9 +211,12 @@ async fn update_checks_should_ignore_downgrades_unknown_stages_and_build_metadat .await .expect("detail"); assert!(!detail.has_update, "{current} -> {target}"); - assert_eq!(detail.latest_version, current); - assert!(detail.notes.is_none()); - assert!(detail.release_url.is_none()); + assert_eq!( + detail.latest_version.as_deref(), + published.then_some(target) + ); + assert_eq!(detail.notes.is_some(), published); + assert_eq!(detail.release_url.is_some(), published); } } diff --git a/deploy/README.md b/deploy/README.md index 9a7b3900a..8d82a8ded 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -1002,7 +1002,7 @@ alpha、beta、rc、exp 在 GitHub 标记为 Pre-release,不覆盖 GitHub Late 在线更新要求官方构建且起始版本不低于 **v3.18.1**,版本选择遵循上述规则;源码等非官方构建返回不支持原因,不提供可用更新。 不满足在线更新条件时,使用完整发行包或镜像[手动部署](#镜像升级与源码构建)。 点击「下载更新」后,操作日志显示下载、校验与安装过程,完成后显示「待重启」及待生效版本。点击「立即重启」后才使用新程序。 -「当前版本」始终表示正在运行的版本,「通道最新」表示所选通道的检查结果 +「当前版本」表示正在运行的版本,「通道最新」显示所选通道已发布的版本。通道版本较低时仍显示其版本号,并提示无可用更新 手动更换镜像或程序后,更新器会核对安装文件并校准历史状态,不以旧成功记录推断需要重启。 运行期间检测到外部文件变动或文件缺失时会报告异常,需要核对完整发行包并重启服务后再检查。 diff --git a/docs/api.md b/docs/api.md index b3a6a3d6c..e786b95e2 100644 --- a/docs/api.md +++ b/docs/api.md @@ -3415,18 +3415,19 @@ Provider metadata 分别保留 `requestedServiceTier` 与 `upstreamServiceTier` | `GET` | `/api/admin/system/restart/check` | 无 | 只读检查重启目标与启用插件 | | `POST` | `/api/admin/system/restart` | `{ confirmation? }` | 复核兼容性风险确认并重启,保留插件启用配置 | -版本接口只读本地构建和通道摘要,缓存未就绪时返回 `updateCached=false`。`updateChannel` 按运行版本推导,为 `stable`、`alpha`、`beta`、`rc`、`exp` 或 `unknown` +版本接口只读本地构建和通道摘要,缓存未就绪时返回 `updateCached=false`、`latestVersion=null`。`updateChannel` 按运行版本推导,为 `stable`、`alpha`、`beta`、`rc`、`exp` 或 `unknown` 详情与安装接口的 `channel` 只对本次操作有效,省略时取运行通道。响应的 `policy` 包含 `channel` 和 `availableChannels`。普通实例可选 `stable`、`rc`、`beta`、`alpha`,实验实例仅可选 `exp`。 未知枚举值返回参数错误。禁用通道、跨实验线、跨大版本、降级或同版本重装返回 `40901`。安装时同时提交已确认的 `channel` 和 `targetVersion`,服务端按[升级规则](../deploy/README.md#版本命名与升级规则)复核目标 | 详情查询结果 | `hasUpdate` | `latestVersion` | `releaseUrl`、`notes` | | --- | --- | --- | --- | -| 有可安装的更高版本 | `true` | 候选版本 | 候选 Release 信息 | -| 无可升级候选 | `false` | 当前版本 | 当前 Release 信息,未找到时为空 | -| 构建不支持在线更新 | `false` | 当前版本 | 为空。跳过 Release 查询,通过 `updateSupported=false` 与 `unsupportedReason` 返回原因 | +| 通道发布了可安装的更高版本 | `true` | 通道发布版本 | 该版本的 Release 信息 | +| 通道版本等于或低于当前版本 | `false` | 通道发布版本 | 该版本的 Release 信息,运行版本缺少公开说明时为空 | +| 构建或部署配置不支持在线更新 | `false` | `null` | 为空,通过 `unsupportedReason` 返回原因 | +| 发布信息检查失败 | `false` | `null` | 为空,通过 `warning` 返回原因 | -`summaryOnly=true` 优先于 `refresh`,按发布索引检查版本,仅对更高候选核对公开 Release 和当前平台附件;`notes`、`releaseUrl` 为空。详情或摘要检查失败时返回 `warning` 和 `hasUpdate=false`,此时 `latestVersion` 不代表已确认的通道版本。GitHub 限流时,`retryAt` 为最早可重试的 RFC 3339 时间,`retryAtDisplay` 按部署时区展示;其他情况两者均为 `null`。 +`summaryOnly=true` 优先于 `refresh`,按发布索引检查版本,仅对更高候选核对公开 Release 和当前平台附件;`notes`、`releaseUrl` 为空。`updateSupported` 表示当前构建和部署配置是否支持在线更新,远端检查失败时仍保留此能力。GitHub 限流时,`retryAt` 为最早可重试的 RFC 3339 时间,`retryAtDisplay` 按部署时区展示;其他情况两者均为 `null`。 普通查询缓存 20 分钟,手动刷新最短间隔为 60 秒;临时错误缓存 60 秒,限流按来源退避。 目标变化须重新检查并确认。下载与校验见[在线更新](../deploy/README.md#管理端在线更新) diff --git a/frontend/src/api/modules/settings/system.ts b/frontend/src/api/modules/settings/system.ts index 5e3a675a3..5de0010b9 100644 --- a/frontend/src/api/modules/settings/system.ts +++ b/frontend/src/api/modules/settings/system.ts @@ -15,7 +15,7 @@ export interface SystemVersion { deploymentMode: string deploymentModeLabel: string updateChannel: string - latestVersion: string + latestVersion: string | null hasUpdate: boolean updateCached: boolean updateWarning: string | null @@ -24,7 +24,7 @@ export interface SystemVersion { export interface SystemUpdateDetail { policy: SystemUpdatePolicy currentVersion: string - latestVersion: string + latestVersion: string | null hasUpdate: boolean deploymentMode: string deploymentModeLabel: string diff --git a/frontend/src/layout/components/system-update-modal/index.vue b/frontend/src/layout/components/system-update-modal/index.vue index 5f9b32765..501a2710d 100644 --- a/frontend/src/layout/components/system-update-modal/index.vue +++ b/frontend/src/layout/components/system-update-modal/index.vue @@ -159,7 +159,7 @@ async function handleCheckUpdates(force = true) { async function handleUpdateRequest() { const detail = updateInfo.value - if (!canUpdate.value || !detail) + if (!canUpdate.value || !detail?.latestVersion) return try { const result = await updateNow(detail.latestVersion, detail.policy.channel)