diff --git a/apps/web/src/components/sidebar/updateEverything.logic.test.ts b/apps/web/src/components/sidebar/updateEverything.logic.test.ts index 58328dbc1eeeb..75f537f6727be 100644 --- a/apps/web/src/components/sidebar/updateEverything.logic.test.ts +++ b/apps/web/src/components/sidebar/updateEverything.logic.test.ts @@ -45,6 +45,20 @@ function machine( }; } +// A desktop-mode server the desktop app cannot control, such as a WSL backend or an older app. +function withoutDesktopControl(base: UpdateEverythingMachine): UpdateEverythingMachine { + return { + ...base, + serverConfig: { + ...base.serverConfig!, + environment: { + ...base.serverConfig!.environment, + capabilities: { repositoryIdentity: true, serverSelfUpdate: "desktop-managed" }, + }, + }, + }; +} + describe("collectServerUpdateTargets", () => { it("updates remote servers that can move to the target and names every skipped one", () => { const { targets, skipped } = collectServerUpdateTargets( @@ -67,6 +81,7 @@ describe("collectServerUpdateTargets", () => { machine("current", "0.0.50", "boot-service"), machine("current-offline", "0.0.50", "boot-service", { connected: false }), machine("manual", "0.0.40", undefined), + withoutDesktopControl(machine("wsl-backend", "0.0.40", "desktop-managed")), ], "0.0.50", ); @@ -82,6 +97,7 @@ describe("collectServerUpdateTargets", () => { ["no-scope", "no permission"], ["busy", "already updating"], ["manual", "needs a manual update"], + ["wsl-backend", "update T3 Code on that machine"], ]); }); @@ -215,15 +231,9 @@ describe("collectChannelSwitchTargets", () => { host(machine("service", "0.1.2", "boot-service"), 70), // A Stable tag built a migration the latest Nightly does not have yet. host(machine("ahead", "0.1.3", "boot-service"), 73), - machine("old-desktop", "0.1.2", "desktop-managed", { - serverConfig: { - ...machine("old-desktop", "0.1.2", "desktop-managed").serverConfig!, - environment: { - ...machine("old-desktop", "0.1.2", "desktop-managed").serverConfig!.environment, - capabilities: { repositoryIdentity: true, serverSelfUpdate: "desktop-managed" }, - }, - }, - }), + withoutDesktopControl(machine("old-desktop", "0.1.2", "desktop-managed")), + // Already on Nightly, so it needs an update rather than a channel switch. + withoutDesktopControl(machine("behind-desktop", OLD_NIGHTLY, "desktop-managed")), machine("current", NIGHTLY, "boot-service"), // The server refuses a track its policy rules out, so the dialog skips it up front. managedHost(host(machine("no-nightly", "0.1.2", "boot-service"), 70)), @@ -239,7 +249,8 @@ describe("collectChannelSwitchTargets", () => { "ahead", `its database has changes ${NIGHTLY} does not support yet; stay on Stable until Nightly has them`, ], - ["old-desktop", "needs a newer desktop app"], + ["old-desktop", "change the update track on that machine"], + ["behind-desktop", "update T3 Code on that machine"], [ "no-nightly", "Example Corp manages T3 Code updates. Only stable releases can be installed.", diff --git a/apps/web/src/components/sidebar/updateEverything.logic.ts b/apps/web/src/components/sidebar/updateEverything.logic.ts index cbbd3baa7c776..818ec4d35f49a 100644 --- a/apps/web/src/components/sidebar/updateEverything.logic.ts +++ b/apps/web/src/components/sidebar/updateEverything.logic.ts @@ -66,6 +66,10 @@ export interface SkippedMachine { readonly reason: string; } +// Desktop servers without the desktop control fd (older apps, WSL backends: wsl.exe cannot pass +// fds) cannot be updated from here, and their desktop app is not necessarily the stale part. +const UPDATE_ON_THAT_MACHINE = "update T3 Code on that machine"; + /** Skip current and app-hosted servers; the latter update with the app and would relaunch mid-run. * Desktop-managed servers use their own feed. Each server's updater checks that it can install the * release before it restarts, so no registry precheck runs here. */ @@ -109,7 +113,7 @@ export function collectServerUpdateTargets( continue; } if (selfUpdate === "desktop-managed" && !desktopAppUpdate) { - skip("needs a newer desktop app"); + skip(UPDATE_ON_THAT_MACHINE); continue; } const serverVersion = config.environment.serverVersion; @@ -336,7 +340,7 @@ function trackSwitchMove( if (selfUpdate === null) return { skip: "needs a manual update" }; if (selfUpdate !== "desktop-managed") return { selfUpdate }; if (config.environment.capabilities.desktopAppChannelSwitch !== true) { - return { skip: "needs a newer desktop app" }; + return { skip: sameTrack ? UPDATE_ON_THAT_MACHINE : "change the update track on that machine" }; } // Squirrel.Mac renames the bundle for the new track and then cannot relaunch it. if (!sameTrack && config.environment.platform.os === "darwin") {