From a01c7d3cb5491cc5c0728dfc2cc0878ae9d45071 Mon Sep 17 00:00:00 2001 From: Aqil Aziz Date: Thu, 14 May 2026 04:30:25 +0700 Subject: [PATCH] fix(updater): quiet passive check failures (#1685) --- app/src-tauri/src/lib.rs | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/app/src-tauri/src/lib.rs b/app/src-tauri/src/lib.rs index b081d52ea..2e2ed5508 100644 --- a/app/src-tauri/src/lib.rs +++ b/app/src-tauri/src/lib.rs @@ -330,6 +330,15 @@ struct AppUpdateInfo { body: Option, } +fn no_app_update_available(current_version: String) -> AppUpdateInfo { + AppUpdateInfo { + current_version, + available: false, + available_version: None, + body: None, + } +} + /// Probe the updater endpoint and report whether a newer shell build is available. /// Does NOT download or install. Pair with `apply_app_update` to actually upgrade. #[tauri::command] @@ -359,16 +368,13 @@ async fn check_app_update(app: tauri::AppHandle) -> Result { log::info!("[app-update] no update available"); - Ok(AppUpdateInfo { - current_version, - available: false, - available_version: None, - body: None, - }) + Ok(no_app_update_available(current_version)) } Err(e) => { - log::warn!("[app-update] check failed: {e}"); - Err(format!("update check failed: {e}")) + log::warn!( + "[app-update] check failed; treating as no update available for this probe: {e}" + ); + Ok(no_app_update_available(current_version)) } } } @@ -2519,6 +2525,16 @@ mod tests { // _check_runtime::(); // Would require importing } + #[test] + fn no_app_update_available_result_is_quiet_unavailable() { + let info = no_app_update_available("0.53.43".to_string()); + + assert_eq!(info.current_version, "0.53.43"); + assert!(!info.available); + assert!(info.available_version.is_none()); + assert!(info.body.is_none()); + } + /// Verify tray logging patterns exist (grep-friendly) #[test] fn tray_setup_logging_patterns_exist() {