Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(desktop): prevent Windows arm64 update downgrades (#10749)

Multica Eve44f5346e1ef0
diff --git a/apps/desktop/src/main/updater.test.ts b/apps/desktop/src/main/updater.test.ts
index 1750fc6f4f..4c271e0340 100644
--- a/apps/desktop/src/main/updater.test.ts
+++ b/apps/desktop/src/main/updater.test.ts
@@ -25,10 +25,15 @@ const ctx = vi.hoisted(() => ({
}));
vi.mock("electron-updater", () => {
+ let channel: string | undefined;
const autoUpdater = {
autoDownload: false,
autoInstallOnAppQuit: false,
- channel: undefined as string | undefined,
+ get channel() { return channel; },
+ set channel(value: string | undefined) {
+ channel = value;
+ this.allowDowngrade = true;
+ },
allowDowngrade: false,
on: vi.fn((event: string, handler: Handler) => {
const handlers = ctx.handlers.get(event) ?? [];
@@ -69,6 +74,19 @@ import {
} from "./updater";
import { updaterPreferencesPath } from "./updater-preferences";
+it("disables downgrades after selecting the Windows arm64 channel", async () => {
+ vi.stubGlobal("process", { ...process, platform: "win32", arch: "arm64" });
+ vi.resetModules();
+ try {
+ await import("./updater");
+ expect(autoUpdater.channel).toBe("latest-arm64");
+ expect(autoUpdater.allowDowngrade).toBe(false);
+ } finally {
+ vi.unstubAllGlobals();
+ vi.resetModules();
+ }
+});
+
describe("macOS x64 update channel", () => {
it("does not touch established architecture paths", () => {
for (const [platform, arch] of [
diff --git a/apps/desktop/src/main/updater.ts b/apps/desktop/src/main/updater.ts
index df416004f7..5c84dfa3fd 100644
--- a/apps/desktop/src/main/updater.ts
+++ b/apps/desktop/src/main/updater.ts
@@ -26,6 +26,7 @@ autoUpdater.autoInstallOnAppQuit = true;
// `latest-arm64.yml` instead of the x64 metadata.
if (process.platform === "win32" && process.arch === "arm64") {
autoUpdater.channel = "latest-arm64";
+ autoUpdater.allowDowngrade = false;
}
interface ChannelConfigurableUpdater {