From f02fd26f03b071f0a331723a339cfdb41c795479 Mon Sep 17 00:00:00 2001
From: Samuel K <69881238+skevetter@users.noreply.github.com>
Date: Mon, 5 Oct 2026 17:39:38 -0600
Subject: [PATCH] fix(desktop): simplify settings updates UI
---
.../lib/components/update/UpdatesPanel.svelte | 37 ++--
.../components/update/UpdatesPanel.test.ts | 177 +++++++++++++++++-
.../src/lib/components/update/channel.test.ts | 8 +-
.../src/lib/components/update/channel.ts | 9 -
.../renderer/src/pages/SettingsPage.svelte | 50 -----
.../renderer/src/pages/SettingsPage.test.ts | 18 +-
6 files changed, 213 insertions(+), 86 deletions(-)
diff --git a/desktop/src/renderer/src/lib/components/update/UpdatesPanel.svelte b/desktop/src/renderer/src/lib/components/update/UpdatesPanel.svelte
index 0557686311..250776190e 100644
--- a/desktop/src/renderer/src/lib/components/update/UpdatesPanel.svelte
+++ b/desktop/src/renderer/src/lib/components/update/UpdatesPanel.svelte
@@ -130,12 +130,11 @@ onMount(async () => {
{#if installedVersion}
Installed: v{installedVersion}
{/if}
- {channelLabel(releaseChannel)} channel
{:else if s.state === "available"}
Devsy {s.availableVersion} is available
- Installed v{installedVersion || "unknown"} ยท {channelLabel(releaseChannel)} channel
+ Installed v{installedVersion || "unknown"}
{:else if s.state === "downloading"}
Downloading Devsy {s.availableVersion}
@@ -155,7 +154,6 @@ onMount(async () => {
{#if installedVersion}
Version {installedVersion}
{/if}
- {channelLabel(releaseChannel)} channel
{:else if s.code === "dev-mode"}
Updates run in packaged builds
@@ -173,7 +171,6 @@ onMount(async () => {
{#if installedVersion}
Installed: v{installedVersion}
{/if}
- {channelLabel(releaseChannel)} channel
{#if lastChecked}
Last checked at {fmtTime(lastChecked)}
{/if}
@@ -184,7 +181,6 @@ onMount(async () => {
{#if installedVersion}
Version {installedVersion}
{/if}
- {channelLabel(releaseChannel)} channel
{#if lastChecked}
Last checked at {fmtTime(lastChecked)}
{/if}
@@ -235,7 +231,7 @@ onMount(async () => {
-
+
{#each CHANNELS as c (c.value)}
-
{c.cadence}
{/each}
@@ -260,23 +255,31 @@ onMount(async () => {
-
-
+
-
Download updates automatically
-
- Updates download in the background; you choose when to restart.
+
+
+ Restart Devsy when you're ready to install.
-
setAutoUpdate(v)} />
+ setAutoUpdate(v)}
+ />
-
- Devsy {appVersion ? `v${appVersion}` : "version unavailable"}
- {channelLabel(releaseChannel)} channel
-
+
+
+
+
+
- Current version
+ - {appVersion ? `v${appVersion}` : "Unavailable"}
+
+
({
getAppVersion: (...a: unknown[]) => getAppVersion(...a),
@@ -16,6 +19,7 @@ vi.mock("$lib/ipc/commands.js", () => ({
checkForUpdates: (...a: unknown[]) => checkForUpdates(...a),
downloadUpdate: (...a: unknown[]) => downloadUpdate(...a),
installUpdate: (...a: unknown[]) => installUpdate(...a),
+ setAutoDownload: (...a: unknown[]) => setAutoDownload(...a),
}))
const toastSuccess = vi.fn()
@@ -34,6 +38,7 @@ vi.mock("$lib/ipc/events.js", async (importOriginal) => {
return { ...mod, onUpdateStatus: async () => () => {} }
})
+import { autoUpdate } from "$lib/stores/settings.js"
import { __setForTest, initUpdateStore } from "$lib/stores/updates.svelte.js"
import UpdatesPanel from "./UpdatesPanel.svelte"
@@ -56,6 +61,11 @@ async function renderPanel(channel: "stable" | "beta") {
await tick()
await Promise.resolve()
await tick()
+ await waitFor(() => {
+ expect(
+ cardButton(channel === "beta" ? /Preview/ : /Stable/),
+ ).toHaveAttribute("aria-checked", "true")
+ })
}
describe("UpdatesPanel channel switching", () => {
@@ -68,7 +78,7 @@ describe("UpdatesPanel channel switching", () => {
})
afterEach(() => {
- document.body.innerHTML = ""
+ cleanup()
})
it("switches immediately and confirms via toast on a normal upgrade", async () => {
@@ -125,10 +135,10 @@ describe("UpdatesPanel status display", () => {
})
afterEach(() => {
- document.body.innerHTML = ""
+ cleanup()
})
- it("renders up-to-date state with installed version and channel", async () => {
+ it("renders up-to-date state with the installed version and current version row", async () => {
getAppVersion.mockResolvedValue("1.17.0")
getReleaseChannel.mockResolvedValue("stable")
await initUpdateStore()
@@ -140,7 +150,10 @@ describe("UpdatesPanel status display", () => {
expect(document.body.textContent).toMatch(/devsy is up to date/i)
expect(document.body.textContent).toMatch(/version 1\.17\.0/i)
- expect(document.body.textContent).toMatch(/stable channel/i)
+ expect(document.body.textContent).not.toMatch(/stable channel/i)
+ expect(
+ screen.getByText("Current version").nextElementSibling,
+ ).toHaveTextContent("v1.17.0")
})
it("renders available update with both installed and available versions", async () => {
@@ -234,6 +247,9 @@ describe("UpdatesPanel status display", () => {
expect(document.body.textContent).toMatch(
/no releases on this channel yet/i,
)
+ await waitFor(() =>
+ expect(document.body.textContent).toMatch(/preview channel/i),
+ )
})
it("renders error notice for malformed-version failures and does not claim up to date", async () => {
@@ -262,3 +278,154 @@ describe("UpdatesPanel status display", () => {
expect(retryBtn).toBeTruthy()
})
})
+
+describe("UpdatesPanel preferences", () => {
+ beforeEach(() => {
+ getAppVersion.mockReset()
+ getReleaseChannel.mockReset()
+ setReleaseChannel.mockReset()
+ setAutoDownload.mockReset()
+ setAutoDownload.mockResolvedValue(undefined)
+ autoUpdate.set(true)
+ localStorage.setItem("devsy-auto-update", "true")
+ })
+
+ afterEach(() => {
+ cleanup()
+ })
+
+ it("renders compact, named release channel choices with selection state", async () => {
+ await renderPanel("beta")
+
+ expect(
+ screen.getByRole("radiogroup", { name: "Release channel" }),
+ ).toBeTruthy()
+ expect(screen.getByRole("radio", { name: "Stable" })).toHaveAttribute(
+ "aria-checked",
+ "false",
+ )
+ expect(screen.getByRole("radio", { name: "Preview" })).toHaveAttribute(
+ "aria-checked",
+ "true",
+ )
+ expect(document.body.textContent).not.toMatch(
+ /released on a regular schedule|updated frequently/i,
+ )
+ })
+
+ it("names and describes automatic downloading and persists a toggle", async () => {
+ await renderPanel("stable")
+
+ const toggle = screen.getByRole("switch", {
+ name: "Automatically download updates",
+ })
+ expect(toggle).toHaveAccessibleDescription(
+ "Restart Devsy when you're ready to install.",
+ )
+ expect(toggle).toHaveAttribute("aria-checked", "true")
+ expect(document.body.textContent).not.toMatch(/update behavior/i)
+
+ toggle.click()
+ await tick()
+ await Promise.resolve()
+
+ expect(toggle).toHaveAttribute("aria-checked", "false")
+ expect(setAutoDownload).toHaveBeenCalledWith(false)
+ })
+
+ it("restores the automatic download preference when persistence fails", async () => {
+ await renderPanel("stable")
+ const failure = new Error("Unable to save auto-download preference")
+ setAutoDownload.mockRejectedValueOnce(failure)
+ const warning = vi.spyOn(console, "warn").mockImplementation(() => {})
+ const toggle = screen.getByRole("switch", {
+ name: "Automatically download updates",
+ })
+
+ try {
+ toggle.click()
+ await tick()
+ await waitFor(() => {
+ expect(warning).toHaveBeenCalledWith(
+ "[settings] setAutoDownload failed; rolled back:",
+ failure,
+ )
+ expect(toggle).toHaveAttribute("aria-checked", "true")
+ })
+
+ expect(setAutoDownload).toHaveBeenCalledWith(false)
+ expect(get(autoUpdate)).toBe(true)
+ expect(localStorage.getItem("devsy-auto-update")).toBe("true")
+ } finally {
+ warning.mockRestore()
+ }
+ })
+
+ it("shows the running app version even when a different update is available", async () => {
+ await renderPanel("stable")
+ __setForTest({
+ state: "available",
+ currentVersion: "1.2.3",
+ availableVersion: "2.0.0",
+ })
+ await tick()
+
+ const term = screen.getByText("Current version")
+ expect(term.tagName).toBe("DT")
+ expect(term.nextElementSibling?.tagName).toBe("DD")
+ expect(term.nextElementSibling).toHaveTextContent("v1.2.3")
+ })
+
+ it("shows Unavailable when the running app version cannot be loaded", async () => {
+ getAppVersion.mockRejectedValue(new Error("Version unavailable"))
+ getReleaseChannel.mockResolvedValue("stable")
+ await initUpdateStore()
+ __setForTest({
+ state: "available",
+ currentVersion: "1.2.3",
+ availableVersion: "2.0.0",
+ })
+ render(UpdatesPanel)
+ await tick()
+ await Promise.resolve()
+ await tick()
+
+ expect(
+ screen.getByText("Current version").nextElementSibling,
+ ).toHaveTextContent("Unavailable")
+ })
+
+ it.each([
+ "checking",
+ "available",
+ "idle",
+ "not-eligible",
+ "up-to-date",
+ "not-available",
+ ] as const)(
+ "omits redundant channel metadata from the %s status",
+ async (state) => {
+ await renderPanel("stable")
+ if (state === "available") {
+ __setForTest({
+ state,
+ currentVersion: "1.2.3",
+ availableVersion: "2.0.0",
+ })
+ } else if (state === "not-eligible") {
+ __setForTest({
+ state: "not-available",
+ currentVersion: "1.2.3",
+ code: "not-eligible",
+ })
+ } else {
+ __setForTest({ state, currentVersion: "1.2.3" })
+ }
+ await tick()
+
+ const status = screen.getByRole("region", { name: "Update status" })
+ expect(status.textContent).not.toMatch(/stable channel|preview channel/i)
+ expect(status.textContent).toMatch(/1\.2\.3/)
+ },
+ )
+})
diff --git a/desktop/src/renderer/src/lib/components/update/channel.test.ts b/desktop/src/renderer/src/lib/components/update/channel.test.ts
index a9e03dc1a5..3b5590f197 100644
--- a/desktop/src/renderer/src/lib/components/update/channel.test.ts
+++ b/desktop/src/renderer/src/lib/components/update/channel.test.ts
@@ -14,9 +14,11 @@ describe("channel labels", () => {
expect(CHANNELS.map((c) => c.value)).toEqual(["stable", "beta"])
})
- it("flags Preview as unstable", () => {
- expect(CHANNELS.find((c) => c.value === "beta")?.unstable).toBe(true)
- expect(CHANNELS.find((c) => c.value === "stable")?.unstable).toBe(false)
+ it("exposes the channel choices without redundant presentation copy", () => {
+ expect(CHANNELS).toEqual([
+ { value: "stable", label: "Stable" },
+ { value: "beta", label: "Preview" },
+ ])
})
})
diff --git a/desktop/src/renderer/src/lib/components/update/channel.ts b/desktop/src/renderer/src/lib/components/update/channel.ts
index 2679d6ba19..c773e2e2bb 100644
--- a/desktop/src/renderer/src/lib/components/update/channel.ts
+++ b/desktop/src/renderer/src/lib/components/update/channel.ts
@@ -6,25 +6,16 @@ import type { ReleaseChannel } from "$lib/ipc/commands.js"
export interface ChannelMeta {
value: ReleaseChannel
label: string
- cadence: string
- description: string
- unstable: boolean
}
export const CHANNELS: ChannelMeta[] = [
{
value: "stable",
label: "Stable",
- cadence: "Released on a regular schedule",
- description: "Production-ready builds, tested before release.",
- unstable: false,
},
{
value: "beta",
label: "Preview",
- cadence: "Updated frequently",
- description: "Early access to new features. May be unstable.",
- unstable: true,
},
]
diff --git a/desktop/src/renderer/src/pages/SettingsPage.svelte b/desktop/src/renderer/src/pages/SettingsPage.svelte
index 3d323bf329..8446c2c237 100644
--- a/desktop/src/renderer/src/pages/SettingsPage.svelte
+++ b/desktop/src/renderer/src/pages/SettingsPage.svelte
@@ -169,11 +169,6 @@ function saveLocal(key: keyof LocalOptions, value: string | boolean) {
;(local as unknown as Record)[key] = value
trackEngagement("settings_changed", { setting: key })
}
-
-function toggleLocal(key: keyof LocalOptions) {
- const current = local[key]
- saveLocal(key, !current)
-}
@@ -450,50 +445,5 @@ function toggleLocal(key: keyof LocalOptions) {
-
-
diff --git a/desktop/src/renderer/src/pages/SettingsPage.test.ts b/desktop/src/renderer/src/pages/SettingsPage.test.ts
index 584452a49b..979d412260 100644
--- a/desktop/src/renderer/src/pages/SettingsPage.test.ts
+++ b/desktop/src/renderer/src/pages/SettingsPage.test.ts
@@ -33,7 +33,7 @@ describe("SettingsPage layout", () => {
expect(screen.getByText("Failures only")).toBeTruthy()
})
- it("renders all settings sections as one page without section navigation links", () => {
+ it("renders supported settings sections as one page without section navigation links", () => {
render(SettingsPage)
expect(
@@ -53,9 +53,23 @@ describe("SettingsPage layout", () => {
"Appearance",
"Updates",
"Secret security",
- "Advanced",
]) {
expect(screen.getByRole("heading", { name, level: 2 })).toBeTruthy()
}
})
+
+ it("omits legacy Advanced controls that have no runtime consumers", () => {
+ render(SettingsPage)
+
+ expect(screen.queryByRole("heading", { name: "Advanced" })).toBeNull()
+ expect(document.querySelector("#advanced")).toBeNull()
+ for (const label of [
+ /experimental features may be unstable/i,
+ /multiple devcontainer detection/i,
+ /additional cli flags/i,
+ /additional environment variables/i,
+ ]) {
+ expect(screen.queryByText(label)).toBeNull()
+ }
+ })
})