Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Desktop: add `Check for Updates` and `Update Now` to Settings (#7694)

oobabooga06a0d60047b1
diff --git a/studio/frontend/src/app/provider.tsx b/studio/frontend/src/app/provider.tsx
index 356cde3a57c..673fec505c1 100644
--- a/studio/frontend/src/app/provider.tsx
+++ b/studio/frontend/src/app/provider.tsx
@@ -23,6 +23,7 @@ import {
useAppearanceCustomStore,
useTheme,
} from "@/features/settings";
+import { TauriUpdateContext } from "@/hooks/tauri-update-context";
import { type BackendStatus, useTauriBackend } from "@/hooks/use-tauri-backend";
import { useTauriUpdate } from "@/hooks/use-tauri-update";
import { isTauri } from "@/lib/api-base";
@@ -210,9 +211,11 @@ function getTauriWindowMode(
function TauriUpdateLayer({
isExternalServer,
children,
+ appContent,
}: {
isExternalServer: boolean;
children?: ReactNode;
+ appContent: ReactNode;
}) {
const update = useTauriUpdate(isExternalServer);
const isUpdating =
@@ -221,21 +224,17 @@ function TauriUpdateLayer({
update.status === "installing" ||
(update.status === "error" && !update.dismissed);
- if (isUpdating) {
- return (
- <UpdateScreen
- status={update.status}
- logs={update.logs}
- progress={update.progress}
- error={update.error}
- onRetry={update.retryUpdate}
- onSkipRestart={update.skipAndRestart}
- onCopyDiagnostics={update.copyDiagnostics}
- />
- );
- }
-
- return (
+ const content = isUpdating ? (
+ <UpdateScreen
+ status={update.status}
+ logs={update.logs}
+ progress={update.progress}
+ error={update.error}
+ onRetry={update.retryUpdate}
+ onSkipRestart={update.skipAndRestart}
+ onCopyDiagnostics={update.copyDiagnostics}
+ />
+ ) : (
// Capped like the browser stack: the download panel shares it, so both must fit.
<div className="pointer-events-none fixed bottom-4 right-4 z-[9998] flex max-h-[calc(100dvh_-_2rem)] flex-col items-end gap-2">
<UpdateBanner
@@ -255,6 +254,13 @@ function TauriUpdateLayer({
{children}
</div>
);
+
+ return (
+ <TauriUpdateContext.Provider value={update}>
+ {content}
+ {appContent}
+ </TauriUpdateContext.Provider>
+ );
}
const HIDDEN_TITLEBAR_SIDEBAR_ROUTES = new Set([
@@ -430,17 +436,21 @@ function TauriWrapper({ children }: { children: ReactNode }) {
const hidesTitlebarSidebar = HIDDEN_TITLEBAR_SIDEBAR_ROUTES.has(pathname);
const content = showApp ? (
- <>
- <TauriUpdateLayer isExternalServer={isExternalServer}>
- <LlamaUpdateBanner
- positioned={false}
- enabled={!hidesTitlebarSidebar}
- />
- <DownloadManagerPanel positioned={false} />
- </TauriUpdateLayer>
- <NativeIntentDrain />
- {children}
- </>
+ <TauriUpdateLayer
+ isExternalServer={isExternalServer}
+ appContent={
+ <>
+ <NativeIntentDrain />
+ {children}
+ </>
+ }
+ >
+ <LlamaUpdateBanner
+ positioned={false}
+ enabled={!hidesTitlebarSidebar}
+ />
+ <DownloadManagerPanel positioned={false} />
+ </TauriUpdateLayer>
) : (
<StartupScreen
status={startupStatus}
diff --git a/studio/frontend/src/features/settings/components/update-studio-instructions.tsx b/studio/frontend/src/features/settings/components/update-studio-instructions.tsx
index 9854fa54e46..a45edddd0c8 100644
--- a/studio/frontend/src/features/settings/components/update-studio-instructions.tsx
+++ b/studio/frontend/src/features/settings/components/update-studio-instructions.tsx
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+import { Button } from "@/components/ui/button";
+import { useTauriUpdateController } from "@/hooks/tauri-update-context";
import { copyToClipboard } from "@/lib/copy-to-clipboard";
import { useT } from "@/i18n";
import { Tick02Icon } from "@/lib/tick-icon";
@@ -13,6 +15,7 @@ import { HugeiconsIcon } from "@hugeicons/react";
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
import type { ReactElement } from "react";
import { useEffect, useRef, useState } from "react";
+import { SettingsRow } from "./settings-row";
const STUDIO_INSTALL_UNIX_CMD =
"curl -fsSL https://unsloth.ai/install.sh | sh";
@@ -172,6 +175,87 @@ function UpdateDocsLinks(): ReactElement {
);
}
+function formatDesktopVersion(version: string): string {
+ return version.startsWith("v") ? version : `v${version}`;
+}
+
+function DesktopUpdateControl(): ReactElement | null {
+ const t = useT();
+ const update = useTauriUpdateController();
+ if (!update) return null;
+
+ const checking = update.status === "checking";
+ // A running install owns the update screen; no second "Update now".
+ const inFlight =
+ update.status === "updating-backend" ||
+ update.status === "downloading" ||
+ update.status === "installing";
+ const busy = checking || inFlight;
+ const available = update.info !== null && !checking;
+ const checkFailed = update.checkError !== null && !available;
+
+ let label: string;
+ let description: string;
+ if (checking) {
+ label = t("settings.about.update.desktopChecking");
+ description = t("settings.about.update.desktopCheckingDescription");
+ } else if (available && update.info) {
+ label = t("settings.about.update.desktopAvailable", {
+ version: formatDesktopVersion(update.info.version),
+ });
+ description = update.isExternalServer
+ ? t("settings.about.update.desktopExternalServer")
+ : update.updatePolicyMode === "manual_linux_package"
+ ? t("settings.about.update.desktopManualInstall")
+ : t("settings.about.update.desktopAvailableDescription");
+ } else if (checkFailed) {
+ label = t("settings.about.update.desktopCheckFailed");
+ // Keep the reason: it separates offline from a bad release manifest.
+ description = `${t("settings.about.update.desktopCheckFailedDescription")} ${update.checkError}`;
+ } else if (update.hasChecked) {
+ label = t("settings.about.update.desktopCurrent");
+ description = t("settings.about.update.desktopCurrentDescription");
+ } else {
+ label = t("settings.about.update.desktopReady");
+ description = t("settings.about.update.desktopReadyDescription");
+ }
+
+ const action = available
+ ? update.updatePolicyMode === "manual_linux_package"
+ ? t("settings.about.update.openReleasePage")
+ : t("settings.about.update.updateNow")
+ : checkFailed
+ ? t("settings.about.update.retryCheck")
+ : update.hasChecked
+ ? t("settings.about.update.checkAgain")
+ : t("settings.about.update.checkForUpdates");
+
+ return (
+ <SettingsRow
+ label={label}
+ description={<span aria-live="polite">{description}</span>}
+ >
+ {available && update.isExternalServer ? null : (
+ <Button
+ size="sm"
+ variant={available ? "default" : "outline"}
+ disabled={busy}
+ aria-busy={busy}
+ onClick={() => {
+ if (available) {
+ void update.installUpdate();
+ } else {
+ void update.checkForUpdate();
+ }
+ }}
+ >
+ {checking ? t("settings.about.update.checking") : action}
+ </Button>
+ )}
+ </SettingsRow>
+ );
+}
+
function ShellToggleButton({
active,
label,
@@ -247,6 +331,7 @@ export function UpdateStudioInstructions({
<p className="text-xs text-muted-foreground leading-relaxed">
{t("settings.about.update.desktopManaged")}
</p>
+ <DesktopUpdateControl />
<UpdateDocsLinks />
</div>
);
diff --git a/studio/frontend/src/hooks/tauri-update-context.ts b/studio/frontend/src/hooks/tauri-update-context.ts
new file mode 100644
index 00000000000..5f88fea5c40
--- /dev/null
+++ b/studio/frontend/src/hooks/tauri-update-context.ts
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import type { TauriUpdateController } from "@/hooks/use-tauri-update";
+import { createContext, useContext } from "react";
+
+export const TauriUpdateContext = createContext<TauriUpdateController | null>(
+ null,
+);
+
+export function useTauriUpdateController(): TauriUpdateController | null {
+ return useContext(TauriUpdateContext);
+}
diff --git a/studio/frontend/src/hooks/use-tauri-update.ts b/studio/frontend/src/hooks/use-tauri-update.ts
index 73985e4f86a..a0b42996bfd 100644
--- a/studio/frontend/src/hooks/use-tauri-update.ts
+++ b/studio/frontend/src/hooks/use-tauri-update.ts
@@ -89,6 +89,9 @@ function manualReleasePageUrl(
export function useTauriUpdate(isExternalServer = false) {
const [status, setStatus] = useState<UpdateStatus>("idle");
const [info, setInfo] = useState<UpdateInfo | null>(null);
+ const infoRef = useRef<UpdateInfo | null>(null);
+ const [hasChecked, setHasChecked] = useState(false);
+ const [checkError, setCheckError] = useState<string | null>(null);
const [progress, setProgress] = useState(0);
const progressRef = useRef(0);
const [logs, setLogs] = useState<string[]>([]);
@@ -101,8 +104,27 @@ export function useTauriUpdate(isExternalServer = false) {
const [updatePolicy, setUpdatePolicy] = useState<DesktopUpdatePolicy>(DEFAULT_UPDATE_POLICY);
const updateRef = useRef<Awaited<ReturnType<typeof checkDesktopUpdate>>>(null);
const checkedRef = useRef(false);
+ const startupScheduledRef = useRef(false);
+ const checkingRef = useRef(false);
const updatingRef = useRef(false);
+ function replaceInfo(nextInfo: UpdateInfo | null) {
+ infoRef.current = nextInfo;
+ setInfo(nextInfo);
+ }
+
+ function offerUpdate(nextInfo: UpdateInfo) {
+ const isNewOffer = infoRef.current?.version !== nextInfo.version;
+ replaceInfo(nextInfo);
+ if (isNewOffer) {
+ // Only a version the user has not seen may reopen the banner.
+ setLastFailure(null);
+ setError(null);
+ setDismissed(false);
+ }
+ setStatus("available");
+ }
+
function replaceLogs(nextLogs: string[]) {
logsRef.current = nextLogs;
setLogs(nextLogs);
@@ -140,13 +162,17 @@ export function useTauriUpdate(isExternalServer = false) {
return failure;
}
- async function resolveUpdatePolicy(): Promise<DesktopUpdatePolicy> {
- if (!isTauri) return DEFAULT_UPDATE_POLICY;
+ /** `resolved` is false when the policy is a fail-safe guess, not the real answer. */
+ async function resolveUpdatePolicy(): Promise<{
+ policy: DesktopUpdatePolicy;
+ resolved: boolean;
+ }> {
+ if (!isTauri) return { policy: DEFAULT_UPDATE_POLICY, resolved: true };
try {
const { invoke } = await import("@tauri-apps/api/core");
const policy = await invoke<DesktopUpdatePolicy>("desktop_update_policy");
setUpdatePolicy(policy);
- return policy;
+ return { policy, resolved: true };
} catch (e) {
console.warn("Desktop update policy check failed:", e);
const failSafePolicy: DesktopUpdatePolicy = {
@@ -154,32 +180,26 @@ export function useTauriUpdate(isExternalServer = false) {
mode: "manual_linux_package",
};
setUpdatePolicy(failSafePolicy);
- return failSafePolicy;
+ return { policy: failSafePolicy, resolved: false };
}
}
- async function checkManualUpdateFallback(policy: DesktopUpdatePolicy) {
+ async function checkManualUpdate(policy: DesktopUpdatePolicy) {
if (policy.mode !== "manual_linux_package") return false;
- try {
- const { invoke } = await import("@tauri-apps/api/core");
- const manualUpdate = await invoke<ManualUpdateInfo | null>(
- "check_desktop_manual_update",
- );
- if (!manualUpdate) return false;
- updateRef.current = null;
- setInfo({
- version: manualUpdate.version,
- currentVersion: manualUpdate.currentVersion,
- pypiVersion: manualUpdate.pypiVersion ?? undefined,
- body: manualUpdate.body,
- date: manualUpdate.date,
- });
- setStatus("available");
- return true;
- } catch (e) {
- console.error("Manual update metadata check failed:", e);
- return false;
- }
+ const { invoke } = await import("@tauri-apps/api/core");
+ const manualUpdate = await invoke<ManualUpdateInfo | null>(
+ "check_desktop_manual_update",
+ );
+ if (!manualUpdate) return false;
+ updateRef.current = null;
+ offerUpdate({
+ version: manualUpdate.version,
+ currentVersion: manualUpdate.currentVersion,
+ pypiVersion: manualUpdate.pypiVersion ?? undefined,
+ body: manualUpdate.body,
+ date: manualUpdate.date,
+ });
+ return true;
}
async function openManualUpdatePage(policy: DesktopUpdatePolicy, version: string) {
@@ -191,37 +211,68 @@ export function useTauriUpdate(isExternalServer = false) {
await openUrl(url);
}
- useEffect(() => {
- if (!isTauri || checkedRef.current) return;
+ async function checkForUpdate() {
+ if (checkingRef.current || updatingRef.current) return;
+ // A manual check covers startup, so the delayed timer must not repeat it.
checkedRef.current = true;
+ checkingRef.current = true;
+ setCheckError(null);
+ setStatus("checking");
- async function checkForUpdate() {
- setStatus("checking");
- const policy = await resolveUpdatePolicy();
- try {
- const update = await checkDesktopUpdate();
- if (update) {
- updateRef.current = update;
- setInfo({
- version: update.version,
- currentVersion: update.currentVersion,
- pypiVersion: rawPypiVersion(update.rawJson),
- body: update.body,
- date: update.date,
- });
- setStatus("available");
- } else if (!(await checkManualUpdateFallback(policy))) {
- setStatus("idle");
- }
- } catch (e) {
- console.error("Update check failed:", e);
- if (!(await checkManualUpdateFallback(policy))) {
+ try {
+ const { policy, resolved } = await resolveUpdatePolicy();
+
+ if (policy.mode === "manual_linux_package") {
+ // Self-gates on the real target_os, so it is authoritative even if policy is a guess.
+ if (await checkManualUpdate(policy)) return;
+ if (resolved) {
+ // latest.json has no deb/rpm key, so the in-app updater would offer an
+ // AppImage this install cannot apply. Stop instead.
+ updateRef.current = null;
+ replaceInfo(null);
setStatus("idle");
+ return;
}
+ // Guessed policy, no manual offer: macOS, Windows and AppImage land here
+ // and do have an in-app path. Fall through to it.
}
+
+ const update = await checkDesktopUpdate();
+ if (update) {
+ updateRef.current = update;
+ offerUpdate({
+ version: update.version,
+ currentVersion: update.currentVersion,
+ pypiVersion: rawPypiVersion(update.rawJson),
+ body: update.body,
+ date: update.date,
+ });
+ } else {
+ updateRef.current = null;
+ replaceInfo(null);
+ setStatus("idle");
+ }
+ } catch (e) {
+ console.error("Update check failed:", e);
+ setCheckError(String(e));
+ setStatus(infoRef.current ? "available" : "idle");
+ } finally {
+ checkingRef.current = false;
+ setHasChecked(true);
}
+ }
+ // Startup owns one delayed check; this ref keeps a per-render function out of
+ // the empty dep list. The closure reads only refs/setState, so it cannot stale.
+ const initialCheckRef = useRef(checkForUpdate);
- const timer = setTimeout(checkForUpdate, 5000);
+ useEffect(() => {
+ if (!isTauri || startupScheduledRef.current) return;
+ startupScheduledRef.current = true;
+
+ const timer = setTimeout(() => {
+ if (checkedRef.current) return;
+ void initialCheckRef.current();
+ }, 5000);
return () => clearTimeout(timer);
}, []);
@@ -232,7 +283,7 @@ export function useTauriUpdate(isExternalServer = false) {
const cleanups: (() => void)[] = [];
try {
- const policy = await resolveUpdatePolicy();
+ const { policy } = await resolveUpdatePolicy();
if (policy.mode === "manual_linux_package") {
const version = info?.version ?? updateRef.current?.version;
if (!version) return;
@@ -256,6 +307,7 @@ export function useTauriUpdate(isExternalServer = false) {
replaceLogs([]);
setUpdateProgress(0);
setError(null);
+ setCheckError(null);
setLastFailure(null);
setDismissed(false);
@@ -404,6 +456,8 @@ export function useTauriUpdate(isExternalServer = false) {
return {
status,
info,
+ hasChecked,
+ checkError,
progress,
logs,
dismissed,
@@ -414,6 +468,7 @@ export function useTauriUpdate(isExternalServer = false) {
updatePolicyMode: updatePolicy.mode,
manualReleaseUrl,
releasePageUrl,
+ checkForUpdate,
installUpdate,
retryUpdate,
skipAndRestart,
@@ -422,6 +477,8 @@ export function useTauriUpdate(isExternalServer = false) {
};
}
+export type TauriUpdateController = ReturnType<typeof useTauriUpdate>;
+
function cleanup(fns: (() => void)[]) {
for (const fn of fns) {
try {
diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.ts
index 7f5e93f8a28..276d24f762f 100644
--- a/studio/frontend/src/i18n/locales/en.ts
+++ b/studio/frontend/src/i18n/locales/en.ts
@@ -996,7 +996,30 @@ export const en = {
"If you still have the repo checkout, run the local installer from it:",
restartAfterUpdate: "Restart Unsloth after updating.",
desktopManaged:
- "The desktop app keeps its bundled backend updated and will prompt when a new version is available.",
+ "The desktop app checks for new app versions automatically. You can also check or update here at any time.",
+ desktopReady: "Desktop app updates",
+ desktopReadyDescription:
+ "Check whether a newer desktop app version is available.",
+ desktopChecking: "Checking for updates",
+ desktopCheckingDescription: "This usually takes a few seconds.",
+ desktopAvailable: "Desktop app {version} is available",
+ desktopAvailableDescription:
+ "Update now and the desktop app will restart when it finishes.",
+ desktopExternalServer:
+ "Run `unsloth studio update` from the terminal that started your server.",
+ desktopManualInstall:
+ "Open the release page to install the latest Linux package.",
+ desktopCheckFailed: "Could not check for updates",
+ desktopCheckFailedDescription: "Check your connection and try again.",
+ desktopCurrent: "Desktop app is up to date",
+ desktopCurrentDescription:
+ "Unsloth will continue checking automatically.",
+ checkForUpdates: "Check for updates",
+ checkAgain: "Check again",
+ retryCheck: "Try again",
+ checking: "Checking...",
+ updateNow: "Update now",
+ openReleasePage: "Open release page",
unknownInstall:
"Could not detect how Unsloth was installed. For installer or PyPI installs, use the commands above.",
localCheckout:
diff --git a/studio/src-tauri/src/desktop_update_policy.rs b/studio/src-tauri/src/desktop_update_policy.rs
index d186c2d01d4..a06e269cbec 100644
--- a/studio/src-tauri/src/desktop_update_policy.rs
+++ b/studio/src-tauri/src/desktop_update_policy.rs
@@ -70,19 +70,20 @@ pub(crate) async fn check_desktop_manual_update() -> Result<Option<ManualUpdateI
.timeout(std::time::Duration::from_secs(10))
.build()
.map_err(|e| e.to_string())?;
- let response = match client.get(DESKTOP_UPDATER_CHANNEL_URL).send().await {
- Ok(response) => response,
- Err(error) => {
+ let response = client
+ .get(DESKTOP_UPDATER_CHANNEL_URL)
+ .send()
+ .await
+ .map_err(|error| {
log::warn!("Manual update metadata check failed: {}", error);
- return Ok(None);
- }
- };
+ format!("Could not check for desktop updates: {error}")
+ })?;
if !response.status().is_success() {
- log::warn!(
- "Manual update metadata check returned HTTP {}",
- response.status()
- );
- return Ok(None);
+ let status = response.status();
+ log::warn!("Manual update metadata check returned HTTP {}", status);
+ return Err(format!(
+ "Could not check for desktop updates: server returned HTTP {status}"
+ ));
}
let metadata = response
diff --git a/tests/studio/test_desktop_reliability_frontend_contract.py b/tests/studio/test_desktop_reliability_frontend_contract.py
index d4bf6f155a1..bbb76ada785 100644
--- a/tests/studio/test_desktop_reliability_frontend_contract.py
+++ b/tests/studio/test_desktop_reliability_frontend_contract.py
@@ -22,6 +22,10 @@ TITLEBAR = FRONTEND / "components/tauri/window-titlebar.tsx"
NATIVE_DIALOGS = REPO / "studio/src-tauri/src/native_file_dialogs.rs"
NATIVE_CLIPBOARD = REPO / "studio/src-tauri/src/native_clipboard.rs"
TAURI_MAIN = REPO / "studio/src-tauri/src/main.rs"
+TAURI_UPDATE_CONTEXT = FRONTEND / "hooks/tauri-update-context.ts"
+TAURI_UPDATE_HOOK = FRONTEND / "hooks/use-tauri-update.ts"
+UPDATE_INSTRUCTIONS = FRONTEND / "features/settings/components/update-studio-instructions.tsx"
+DESKTOP_UPDATE_POLICY = REPO / "studio/src-tauri/src/desktop_update_policy.rs"
APP_PROVIDER = FRONTEND / "app/provider.tsx"
@@ -35,6 +39,84 @@ IMAGE = FRONTEND / "components/assistant-ui/image.tsx"
AUDIO_PLAYER = FRONTEND / "components/assistant-ui/audio-player.tsx"
+def test_desktop_update_offer_remains_actionable_from_settings():
+ provider = APP_PROVIDER.read_text(encoding = "utf-8")
+ context = TAURI_UPDATE_CONTEXT.read_text(encoding = "utf-8")
+ hook = TAURI_UPDATE_HOOK.read_text(encoding = "utf-8")
+ settings = UPDATE_INSTRUCTIONS.read_text(encoding = "utf-8")
+
+ assert "<TauriUpdateContext.Provider value={update}>" in provider
+ context_start = provider.index("<TauriUpdateContext.Provider value={update}>")
+ context_end = provider.index("</TauriUpdateContext.Provider>", context_start)
+ assert "{appContent}" in provider[context_start:context_end]
+ assert "appContent={" in provider
+ assert "useContext(TauriUpdateContext)" in context
+ # Scope these: bare substrings also match setTimeout(checkForUpdate, 5000)
+ # and the installUpdate() reset.
+ assert "checkForUpdate," in hook.split(" return {", 1)[1]
+ manual = hook.split("async function checkForUpdate()", 1)[1]
+ assert "checkedRef.current = true;" in manual.split("try {", 1)[0]
+ offer = hook.split("function offerUpdate", 1)[1].split("\n }", 1)[0]
+ assert "setDismissed(false);" in offer
+ assert "isNewOffer" in offer
+ assert "const available = update.info !== null && !checking;" in settings
+ assert "void update.installUpdate();" in settings
+ assert "void update.checkForUpdate();" in settings
+
+
+def test_desktop_update_keeps_the_in_app_path_on_a_guessed_policy():
+ """resolveUpdatePolicy fails safe to manual_linux_package on every platform.
+
+ Acting on that guess routes macOS, Windows and AppImage into the Linux-only
+ command, which returns Ok(None) off Linux, so Settings would claim the app
+ was up to date while an update was waiting.
+ """
+ hook = TAURI_UPDATE_HOOK.read_text(encoding = "utf-8")
+ policy = DESKTOP_UPDATE_POLICY.read_text(encoding = "utf-8")
+
+ assert "resolved: boolean" in hook
+ assert "resolved: false" in hook
+
+ manual_branch = hook.split("async function checkForUpdate()", 1)[1].split(
+ 'if (policy.mode === "manual_linux_package") {',
+ 1,
+ )[1]
+ give_up = manual_branch.split("checkDesktopUpdate()", 1)[0]
+ # Only a resolved policy may end the check without the in-app updater.
+ assert "if (resolved) {" in give_up
+ assert 'setStatus("idle");' in give_up
+ assert "await checkDesktopUpdate();" in manual_branch
+ # The Rust command self-gates on the real OS, so it is safe to consult first.
+ manual_cmd = policy.split("async fn check_desktop_manual_update", 1)[1]
+ assert "ManualLinuxPackage" in manual_cmd.split("{", 1)[1][:400]
+
+
+def test_settings_update_button_is_inert_while_an_install_runs():
+ settings = UPDATE_INSTRUCTIONS.read_text(encoding = "utf-8")
+
+ assert 'update.status === "updating-backend"' in settings
+ assert 'update.status === "downloading"' in settings
+ assert 'update.status === "installing"' in settings
+ assert "disabled={busy}" in settings
+ assert "aria-busy={busy}" in settings
+
+
+def test_desktop_update_check_failures_are_retryable():
+ hook = TAURI_UPDATE_HOOK.read_text(encoding = "utf-8")
+ settings = UPDATE_INSTRUCTIONS.read_text(encoding = "utf-8")
+ policy = DESKTOP_UPDATE_POLICY.read_text(encoding = "utf-8")
+
+ assert "setCheckError(String(e));" in hook
+ assert "update.checkError !== null" in settings
+ assert 't("settings.about.update.retryCheck")' in settings
+ # The reason must reach the user, not just the console.
+ assert "${update.checkError}" in settings
+ assert "server returned HTTP {status}" in policy
+ request = policy.split("let response = client", 1)[1].split("let metadata", 1)[0]
+ assert ".map_err(" in request
+ assert "return Ok(None);" not in request
+
+
def test_file_actions_route_through_native_commands_only_in_tauri():
helper = NATIVE_FILES.read_text(encoding = "utf-8")
history = CHAT_EXPORT.read_text(encoding = "utf-8")