diff --git a/dashboard/e2e/models-switch.spec.ts b/dashboard/e2e/models-switch.spec.ts index 7ea5a4e8..602dbdd9 100644 --- a/dashboard/e2e/models-switch.spec.ts +++ b/dashboard/e2e/models-switch.spec.ts @@ -201,8 +201,8 @@ for (const width of [1440, 390]) { await expect(banner).toContainText("Coderhelm only checks"); // No override for a model the release calls. await expect(banner.getByRole("button", { name: "Skip this check" })).toHaveCount(0); - await expect(page.getByRole("button", { name: "Update now to v1.3.0" })).toBeDisabled(); - await expect(page.getByTestId("update-readiness")).toContainText("Update to v1.3.0 needs your action"); + await expect(page.getByRole("button", { name: /^Update to/ })).toHaveCount(0); + await expect(page.getByTestId("update-status")).toHaveAttribute("data-state", "needs-action"); await noSidewaysScroll(page, width); await shot(page, "update-blocked-system", width); @@ -214,7 +214,7 @@ for (const width of [1440, 390]) { // Accepted in the console: Check again clears it. state.blocked = false; - await onSetup.getByRole("button", { name: "Check again" }).click(); + await onSetup.getByRole("button", { name: "Re-run the model check" }).click(); await expect(page.getByTestId("update-needs-action")).toHaveCount(0); expect(calls.some((c) => c.path === "/api/system/update-check")).toBe(true); }); @@ -227,6 +227,6 @@ test("while the release's signature is checked, the update waits and says so", a await expect(page.getByTestId("update-checking")).toContainText("Checking v1.3.0 before it can be applied"); await expect(page.getByTestId("update-needs-action")).toHaveCount(0); state.pending = false; - await page.getByTestId("update-checking").getByRole("button", { name: "Check again" }).click(); + await page.getByTestId("update-checking").getByRole("button", { name: "Re-run the model check" }).click(); await expect(page.getByTestId("update-checking")).toHaveCount(0); }); diff --git a/dashboard/e2e/selfhost.spec.ts b/dashboard/e2e/selfhost.spec.ts index b27c7a49..af162d5f 100644 --- a/dashboard/e2e/selfhost.spec.ts +++ b/dashboard/e2e/selfhost.spec.ts @@ -290,14 +290,15 @@ for (const [name, viewport] of [["desktop", { width: 1280, height: 800 }], ["pho await page.goto("/settings/system/"); const status = page.getByTestId("update-status"); await expect(status).toHaveAttribute("data-state", "available"); - await expect(status).toContainText("You're on v1.2.0 · v2.0.0 is available"); - await expect(status).toContainText("Major: read the notes"); + await expect(status).toContainText("v2.0.0 is available"); + await expect(status).toContainText("You're on v1.2.0."); + await expect(status).toContainText("Major release"); await expect(page.getByTestId("version-facts")).toContainText("abc1234def"); await expect(page.getByTestId("release-notes")).toContainText("A new thing."); await expect(page.getByTestId("update-history")).toContainText("health check failed after deploying v1.1.5"); await expect(page.getByTestId("update-history")).toContainText("auto-update window"); - await page.getByRole("button", { name: "Update now to v2.0.0" }).click(); + await page.getByRole("button", { name: "Update to v2.0.0" }).click(); await expect.poll(() => systemCalls.map((c) => c.path)).toContain("/api/system/update"); // No version: the updater reads GitHub first and installs the newest release at that moment. expect(systemCalls.find((c) => c.path === "/api/system/update")!.body).toEqual({}); @@ -370,7 +371,7 @@ for (const [name, viewport] of [["1440", { width: 1440, height: 1000 }], ["390", test.describe(`install checks at ${name}px`, () => { test.use({ viewport }); - test("Setup: failing checks say what, why and how to fix; Check again after the fix shows them passing", async ({ page }) => { + test("Setup: failing checks say what, why and how to fix; Re-run checks after the fix shows them passing", async ({ page }) => { const { checksState } = await setup(page, SELF, { signedIn: true, provider: "bedrock" }); await page.goto("/settings/setup/"); const checks = page.getByTestId("install-checks"); @@ -393,7 +394,7 @@ for (const [name, viewport] of [["1440", { width: 1440, height: 1000 }], ["390", // The person fixes both, then checks again: no reload. checksState.fixed = true; - await checks.getByRole("button", { name: "Check again" }).click(); + await checks.getByRole("button", { name: "Re-run checks" }).click(); await expect(checks.getByTestId("install-checks-summary")).toContainText("0 need a fix"); await expect(checks).toContainText("Nothing needs a fix"); await expect(perms).toHaveAttribute("data-status", "pass"); @@ -402,34 +403,31 @@ for (const [name, viewport] of [["1440", { width: 1440, height: 1000 }], ["390", await page.screenshot({ path: `${SHOTS}/setup-passing-${name}.png`, fullPage: true }); }); - test("System: update readiness lists what blocks an update, with its fix, and holds Update now", async ({ page }) => { + test("System: a failing check holds the update, and Install health lists it with its fix", async ({ page }) => { await setup(page, SELF, { signedIn: true, blocked: true }); await page.goto("/settings/system/"); - const r = page.getByTestId("update-readiness"); - await expect(r.locator('[data-severity="block"]')).toContainText("Blocks the update"); - await expect(r.locator('[data-severity="block"]')).toContainText("isn't verified yet"); - await expect(r.locator('[data-severity="block"]').getByTestId("fix-command")).toContainText("dkim.amazonses.com"); - await expect(r.locator('[data-severity="warn"]')).toContainText("Read first"); - await expect(page.getByRole("button", { name: "Update now to v2.0.0" })).toBeDisabled(); - await expect(page.locator("#update-blocked")).toContainText("Fix what blocks the update"); + const status = page.getByTestId("update-status"); + await expect(status).toHaveAttribute("data-state", "blocked"); + await expect(page.getByTestId("update-blocked")).toContainText("Fix the install check marked Stops updates below"); + await expect(page.getByRole("button", { name: /^Update to/ })).toHaveCount(0); + const h = page.getByTestId("install-health"); + await expect(h).toHaveAttribute("data-state", "failing"); + await expect(page.getByTestId("health-summary")).toHaveText("2 checks fail"); + await expect(h.locator("#check-email_identity")).toContainText("Stops updates"); + await expect(h.locator("#check-email_identity").getByTestId("fix-command")).toContainText("dkim.amazonses.com"); await expect(page.getByTestId("history-next-step")).toContainText("Back on v1.1.0; your data is untouched"); const width = await page.evaluate(() => document.documentElement.scrollWidth); expect(width).toBeLessThanOrEqual(viewport.width); await page.screenshot({ path: `${SHOTS}/system-preflight-blocked-${name}.png`, fullPage: true }); }); - test("System: ready to update when nothing blocks", async ({ page }) => { + test("System: a major release's notes are said in the status, not as a health problem", async ({ page }) => { await setup(page, SELF, { signedIn: true }); await page.goto("/settings/system/"); - const r = page.getByTestId("update-readiness"); - await expect(r.locator('[data-severity="block"]')).toHaveCount(0); - // A warning (the major release's notes) opens it, as something to read, not a stop. - await expect(r).toHaveAttribute("data-state", "attention"); - await expect(r).toContainText("Read before updating"); - await expect(r).not.toContainText("What stops an update"); - await expect(r.getByTestId("doctor-summary").first()).toContainText("checks fine"); - await expect(r.getByTestId("doctor-summary").first()).not.toContainText("failing"); - await expect(page.getByRole("button", { name: "Update now to v2.0.0" })).toBeEnabled(); + await expect(page.getByTestId("update-major")).toContainText("read them below first"); + const h = page.getByTestId("install-health"); + await expect(h).not.toContainText("major release"); + await expect(page.getByRole("button", { name: "Update to v2.0.0" })).toBeEnabled(); await page.screenshot({ path: `${SHOTS}/system-preflight-ready-${name}.png`, fullPage: true }); }); }); @@ -538,7 +536,7 @@ test("System: an update still being prepared shows that, before the change set h await page.goto("/settings/system/"); const card = page.getByTestId("native-update"); await expect(card).toContainText("Preparing the update to v2.0.0"); - await expect(page.getByTestId("update-status")).toHaveAttribute("data-state", "updating"); + await expect(page.getByTestId("update-status")).toHaveAttribute("data-state", "preparing"); await expect(page.getByTestId("native-update-progress")).toContainText("Step 1 of 2"); await expect(card).toContainText("Nothing to do yet"); await expect(page.getByTestId("native-update-summary")).toHaveCount(0); @@ -562,7 +560,7 @@ test("System: a running one-stack update says so, with nothing to do and no cons await page.goto("/settings/system/"); const card = page.getByTestId("native-update"); await expect(card).toContainText("Updating to v2.0.0"); - await expect(page.getByTestId("native-update-summary")).toContainText("8 changes (2 to add, 5 to change, 1 to remove) in Api, Worker"); + await expect(page.getByTestId("native-update-summary")).toContainText("It changes 8 resources (2 to add, 5 to change, 1 to remove) in Api, Worker"); await expect(card).not.toContainText("Execute"); await expect(page.getByTestId("native-update-apply")).toHaveCount(0); await expect(page.getByRole("button", { name: "Update to v2.0.0" })).toHaveCount(0); @@ -672,7 +670,7 @@ for (const [name, viewport] of [["desktop", { width: 1280, height: 800 }], ["pho await page.goto("/settings/system/"); const status = page.getByTestId("update-status"); await expect(status).toHaveAttribute("data-state", "available"); - await expect(status).toContainText("You're on v1.2.0 · v2.0.0 is available"); + await expect(status).toContainText("v2.0.0 is available"); await expect(status.getByRole("button", { name: "Update to v2.0.0" })).toBeEnabled(); const notes = page.getByTestId("release-notes"); @@ -696,7 +694,6 @@ for (const [name, viewport] of [["desktop", { width: 1280, height: 800 }], ["pho await expect(facts).toContainText("us-east-1"); await expect(page.getByTestId("version-details")).toContainText("Automatic updates are off"); - await expect(page.getByTestId("update-readiness")).toHaveAttribute("data-state", "attention"); const width = await page.evaluate(() => document.documentElement.scrollWidth); expect(width).toBeLessThanOrEqual(viewport.width); await page.screenshot({ path: `${SHOTS}/system-version-available-${name}.png`, fullPage: true }); @@ -714,7 +711,7 @@ for (const [name, viewport] of [["desktop", { width: 1280, height: 800 }], ["pho await page.goto("/settings/system/"); const status = page.getByTestId("update-status"); await expect(status).toHaveAttribute("data-state", "failed"); - await expect(status).toContainText("The update to v2.0.0 didn't work"); + await expect(status).toContainText("The update to v2.0.0 didn't finish"); await expect(status).toContainText("Nothing changed: you're still on v1.2.0"); await expect(page.getByTestId("update-failed-reason")).not.toContainText("arn:aws"); // The raw AWS text only under Technical details. @@ -722,8 +719,7 @@ for (const [name, viewport] of [["desktop", { width: 1280, height: 800 }], ["pho await expect(page.locator("#version").getByText("Technical details", { exact: true })).toHaveCount(1); await page.locator("#version").getByText("Technical details", { exact: true }).click(); await expect(page.getByTestId("update-failed-raw")).toContainText("UPDATE_ROLLBACK_COMPLETE"); - await expect(page.getByTestId("update-readiness")).not.toContainText("didn't succeed"); - await expect(page.getByTestId("update-readiness")).not.toContainText("Fix what the history says"); + await expect(page.getByTestId("install-health")).not.toContainText("didn't succeed"); await status.getByTestId("update-retry").click(); await expect.poll(() => systemCalls.map((c) => c.path)).toContain("/api/system/update"); const width = await page.evaluate(() => document.documentElement.scrollWidth); @@ -755,7 +751,7 @@ for (const [name, viewport] of [["desktop", { width: 1280, height: 800 }], ["pho await expect(status).toContainText("Updating to v2.0.0"); await expect(status).toContainText("Started"); await expect(status.getByRole("progressbar")).toBeVisible(); - await expect(page.getByTestId("update-readiness")).not.toContainText("already running"); + await expect(page.getByTestId("install-health")).not.toContainText("already running"); await page.screenshot({ path: `${SHOTS}/system-version-updating-${name}.png`, fullPage: true }); }); @@ -780,7 +776,7 @@ for (const [name, viewport] of [["desktop", { width: 1280, height: 800 }], ["pho await expect(check).toContainText("Checked just now"); expect(systemCalls.filter((c) => c.path === "/api/system/releases/check")).toHaveLength(1); await expect(status).toHaveAttribute("data-state", "available"); - await expect(status.getByRole("button", { name: "Update now to v1.3.0" })).toBeEnabled(); + await expect(status.getByRole("button", { name: "Update to v1.3.0" })).toBeEnabled(); const width = await page.evaluate(() => document.documentElement.scrollWidth); expect(width).toBeLessThanOrEqual(viewport.width); await page.screenshot({ path: `${SHOTS}/system-version-checked-${name}.png`, fullPage: true }); @@ -802,23 +798,22 @@ for (const [name, viewport] of [["desktop", { width: 1280, height: 800 }], ["pho await page.goto("/settings/system/"); const status = page.getByTestId("update-status"); await expect(status).toHaveAttribute("data-state", "behind"); - await expect(status).toContainText("v1.3.0 is out"); + await expect(status).toContainText("v1.3.0 is out, but can't install yet"); await expect(page.locator("#version").getByRole("button", { name: /^Update/ })).toHaveCount(0); - await expect(page.getByTestId("release-check")).toContainText("Checked 10 min ago"); - await expect(page.getByTestId("release-check-error")).toContainText("couldn't reach GitHub"); + await expect(page.getByTestId("release-check")).toContainText("GitHub didn't answer the last check. It last answered 10 min ago."); }); test("up to date: green, with the version", async ({ page }) => { await setup(page, SELF, { signedIn: true, version: { latest: null, update_available: false }, onlyBlockers: [] }); await page.goto("/settings/system/"); - // Nothing blocks or warns: readiness is one line. - const r = page.getByTestId("update-readiness"); - await expect(r).toHaveAttribute("data-state", "ready"); - await expect(r).toContainText("Ready to update"); - await expect(r.getByRole("listitem")).toHaveCount(0); + // Health is its own section; nothing near the status reads like an update state. + const h = page.getByTestId("install-health"); + await expect(h).toHaveAttribute("data-state", "warning"); + await expect(page.locator("main")).not.toContainText("Ready to update"); const status = page.getByTestId("update-status"); await expect(status).toHaveAttribute("data-state", "current"); - await expect(status).toContainText("You're up to date (v1.2.0)"); + await expect(status).toContainText("You're up to date"); + await expect(status).toContainText("Coderhelm v1.2.0"); await expect(page.getByTestId("release-notes")).toHaveCount(0); await page.screenshot({ path: `${SHOTS}/system-version-current-${name}.png`, fullPage: true }); }); diff --git a/dashboard/e2e/update-states.spec.ts b/dashboard/e2e/update-states.spec.ts new file mode 100644 index 00000000..1a7c8835 --- /dev/null +++ b/dashboard/e2e/update-states.spec.ts @@ -0,0 +1,372 @@ +import { expect, test, type Page, type Route } from "@playwright/test"; +import fs from "node:fs"; +import path from "node:path"; + +// Settings, then System, Version and Install health: every state the page +// can be in, each with one headline, one line of detail and one thing to do. +// Updates and the install's own health are two separate things: "You're up +// to date" never sits next to anything that reads like an update state. +// E2E_SHOTS_DIR saves a desktop and a phone screenshot of each state. + +const SHOTS = process.env.E2E_SHOTS_DIR || ""; +const NOW = Date.now(); +const ago = (min: number) => new Date(NOW - min * 60_000).toISOString(); +const unix = (min: number) => Math.floor((NOW - min * 60_000) / 1000); + +const pass = (key: string, group: string, label: string) => ({ key, group, label, status: "pass", detail: `${label}: fine.` }); +const CHECKS = [ + pass("url", "Install", "Web address answers"), + pass("github_keys", "GitHub", "GitHub App keys stored"), + pass("github_app", "GitHub", "GitHub accepts the app's keys"), + pass("github_permissions", "GitHub", "GitHub App permissions and events"), + pass("github_webhook", "GitHub", "GitHub webhook reaches this install"), + pass("email_identity", "Email", "Email sender verified"), + pass("email_sandbox", "Email", "Email can reach anyone"), + pass("model", "Claude", "Claude answers a test call"), + pass("dlq", "Install", "No failed events waiting"), + { key: "slack", group: "Integrations", label: "Slack", status: "skip", detail: "Not connected (optional)." }, +]; +const FAILING_EMAIL = { + key: "email_identity", group: "Email", label: "Email sender verified", status: "fail", + detail: "acme.example isn't verified yet (DKIM pending).", + why: "Email without DKIM lands in spam, and SES won't send from an unverified domain.", + fix: { text: "Add the DNS records SES lists for acme.example; SES checks them within an hour.", url: "https://console.aws.amazon.com/ses/home?region=us-east-1#/identities/acme.example" }, +}; +const WARN_SANDBOX = { + key: "email_sandbox", group: "Email", label: "Email can reach anyone", status: "warn", + detail: "This AWS account is in the SES sandbox: email only reaches verified addresses.", + why: "Invites won't reach teammates until production access is granted.", + fix: { text: "Request production access in the SES console.", url: "https://console.aws.amazon.com/ses/home?region=us-east-1#/account" }, +}; + +const NOTES = "## What changed\n\n- Faster reviews on large pull requests (#812)\n- Jira links keep their labels (#815)\n- Fixes a crash on empty repositories (#817)"; +const LATEST = { version: "v0.9.0", notes: NOTES, published_at: "2026-11-03T16:00:00Z", url: "https://example.org/releases/v0.9.0", breaking: false }; +const SETTINGS = { auto: false, channel: "stable", day: "sun", hour: 3, timezone: "UTC", majors: "ask" }; +const OK_HISTORY = [{ id: "UPDATE#1", version: "v0.8.32", from_version: "v0.8.31", actor: "auto", mode: "update", status: "succeeded", started_at: "2026-11-02T03:00:00Z", finished_at: "2026-11-02T03:14:00Z" }]; +const CS_LINK = "https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/changesets/changes?stackId=x&changeSetId=y"; +const PREPARED = { version: "v0.9.0", status: "review", counts: { add: 2, modify: 5, remove: 0 }, replacements: [], parts: ["Api", "Worker"], role: true, link: CS_LINK, id: "UPDATE#2" }; +const RAW = "Stack arn:aws:cloudformation:us-east-1:111122223333:stack/coderhelm-acme/abc is in UPDATE_ROLLBACK_COMPLETE: Resource handler returned message: AWS::Lambda::Function failed"; + +interface Mock { + version?: Record; + checks?: unknown[]; + blockers?: unknown[]; + preflightFails?: boolean; + checked?: Record; +} + +async function setup(page: Page, m: Mock) { + const calls: string[] = []; + const json = (route: Route, body: unknown, status = 200) => route.fulfill({ status, contentType: "application/json", body: JSON.stringify(body) }); + await page.route((url) => url.pathname === "/runtime-config.js", (route) => + route.fulfill({ contentType: "text/javascript", body: `window.__CODERHELM_CONFIG__ = ${JSON.stringify({ apiUrl: "", streamUrl: "", selfHosted: true, version: "v0.8.32" })};` }), + ); + await page.route((url) => !["localhost", "127.0.0.1"].includes(url.hostname), (route) => route.abort()); + let checked = false; + await page.route((url) => ["localhost", "127.0.0.1"].includes(url.hostname) && /^\/(api|auth)\//.test(url.pathname), (route) => { + const p = new URL(route.request().url()).pathname; + calls.push(p); + if (p === "/api/me") return json(route, { user_id: "u_1", team_id: "t_1", github_login: null, email: "admin@acme.example", avatar_url: "", role: "owner", auth_provider: "email", mfa_enabled: true, platform_admin: true }); + if (p === "/api/teams") return json(route, { teams: [{ team_id: "t_1", org: "acme", status: "active", current: true }] }); + if (p === "/api/banners") return json(route, { banners: [] }); + if (p === "/api/usage") return json(route, { month: "2026-11", total_tokens: 0, tokens_in: 0, tokens_out: 0, total_runs: 0, max_tokens: 0 }); + if (p === "/api/system/version" || p === "/api/system/releases/check") { + if (p.endsWith("/check")) checked = true; + return json(route, { + self_hosted: true, + current: { version: "v0.8.32", commit: "0123456789abcdef0123456789abcdef01234567", released_at: "2026-11-01T00:00:00Z", config_fingerprint: "0a3bb7ad772e" }, + latest: null, + update_available: false, + running: false, + settings: SETTINGS, + history: OK_HISTORY, + releases: { fetched_at: unix(2), stale: false, reason: null, error: null, behind: null }, + install: { stage: "acme", region: "us-east-1" }, + ...(m.version ?? {}), + ...(checked ? (m.checked ?? {}) : {}), + }); + } + if (p === "/api/system/preflight") { + if (m.preflightFails) return json(route, { error: "boom" }, 500); + return json(route, { checked_at: ago(0.2), ready: true, current: "v0.8.32", latest: null, blockers: m.blockers ?? [], checks: m.checks ?? CHECKS }); + } + if (p === "/api/system/update") return json(route, { version: "v0.9.0", actor: "admin@acme.example", status: "running" }); + return json(route, {}); + }); + return { calls }; +} + +async function shoot(page: Page, name: string) { + if (!SHOTS) return; + fs.mkdirSync(SHOTS, { recursive: true }); + for (const [w, h] of [[1280, 900], [390, 844]] as const) { + await page.setViewportSize({ width: w, height: h }); + await page.locator("#health").scrollIntoViewIfNeeded(); + await page.evaluate(() => window.scrollTo(0, 0)); + const top = await page.getByRole("heading", { name: "Version and updates" }).boundingBox(); + const end = await page.locator("#health").boundingBox(); + const y = Math.max(0, (top?.y ?? 0) - 16); + await page.screenshot({ path: path.join(SHOTS, `${name}-${w === 1280 ? "desktop" : "phone"}.png`), fullPage: true, clip: { x: 0, y, width: w, height: (end!.y + end!.height + 24) - y } }); + const width = await page.evaluate(() => document.documentElement.scrollWidth); + expect(width, `${name} fits ${w}px`).toBeLessThanOrEqual(w); + } + await page.setViewportSize({ width: 1280, height: 800 }); +} + +const status = (page: Page) => page.getByTestId("update-status"); +const health = (page: Page) => page.getByTestId("install-health"); + +test.describe("Version and updates: every state", () => { + test("up to date: one green status; health is its own section with Re-run checks", async ({ page }) => { + const { calls } = await setup(page, {}); + await page.goto("/settings/system/"); + await expect(status(page)).toHaveAttribute("data-state", "current"); + await expect(status(page)).toContainText("You're up to date"); + await expect(status(page)).toContainText("Coderhelm v0.8.32, released"); + await expect(page.getByTestId("release-check")).toContainText("Checked 2 min ago"); + await expect(page.getByRole("button", { name: "Check for updates" })).toBeVisible(); + // Nothing on the page reads like an update state but the status. + await expect(page.locator("main")).not.toContainText("Ready to update"); + await expect(page.locator("main")).not.toContainText("readiness"); + await expect(page.getByRole("button", { name: "Check again" })).toHaveCount(0); + await expect(page.getByRole("heading", { name: "Install health" })).toBeVisible(); + await expect(health(page)).toHaveAttribute("data-state", "healthy"); + await expect(page.getByTestId("health-summary")).toHaveText("All 9 checks pass"); + await expect(health(page)).toContainText("1 optional check not set up"); + await expect(page.getByTestId("release-notes")).toHaveCount(0); + await shoot(page, "01-up-to-date"); + const before = calls.filter((c) => c === "/api/system/preflight").length; + await health(page).getByRole("button", { name: "Re-run checks" }).click(); + await expect.poll(() => calls.filter((c) => c === "/api/system/preflight").length).toBe(before + 1); + expect(calls).not.toContain("/api/system/releases/check"); + }); + + test("updated just now", async ({ page }) => { + await setup(page, { version: { history: [{ ...OK_HISTORY[0], started_at: ago(18), finished_at: ago(4), actor: "admin@acme.example" }] } }); + await page.goto("/settings/system/"); + await expect(status(page)).toHaveAttribute("data-state", "current"); + await expect(status(page)).toContainText("Updated to v0.8.32"); + await expect(status(page)).toContainText("Finished 4 min ago. You're up to date."); + await shoot(page, "02-updated-just-now"); + }); + + test("auto-update on: the window is in the detail", async ({ page }) => { + await setup(page, { version: { settings: { ...SETTINGS, auto: true, timezone: "Europe/Berlin" } } }); + await page.goto("/settings/system/"); + await expect(status(page)).toContainText("New releases install by themselves Sundays at 03:00 Europe/Berlin."); + await shoot(page, "03-up-to-date-auto"); + }); + + test("update available: Update to v0.9.0, notes below, checked line", async ({ page }) => { + const { calls } = await setup(page, { version: { latest: LATEST, update_available: true } }); + await page.goto("/settings/system/"); + await expect(status(page)).toHaveAttribute("data-state", "available"); + await expect(status(page)).toContainText("v0.9.0 is available"); + await expect(status(page)).toContainText("You're on v0.8.32. v0.9.0 came out"); + await expect(page.getByTestId("release-notes")).toContainText("What changed in v0.9.0"); + await expect(health(page)).toHaveAttribute("data-state", "healthy"); + await shoot(page, "04-update-available"); + await status(page).getByRole("button", { name: "Update to v0.9.0" }).click(); + await expect.poll(() => calls).toContain("/api/system/update"); + }); + + test("update available with auto-update on", async ({ page }) => { + await setup(page, { version: { latest: LATEST, update_available: true, settings: { ...SETTINGS, auto: true } } }); + await page.goto("/settings/system/"); + await expect(status(page)).toContainText("It installs by itself Sundays at 03:00 UTC, or update now."); + }); + + test("major release: a chip, and its notes come first", async ({ page }) => { + await setup(page, { version: { latest: { ...LATEST, version: "v1.0.0", breaking: true }, update_available: true, settings: { ...SETTINGS, auto: true } } }); + await page.goto("/settings/system/"); + await expect(status(page)).toContainText("v1.0.0 is available"); + await expect(status(page)).toContainText("Major release"); + await expect(page.getByTestId("update-major")).toContainText("read them below first. Major releases wait for you, even with automatic updates on."); + await expect(status(page)).not.toContainText("installs by itself"); + await shoot(page, "05-major-release"); + }); + + test("preview channel: a chip and why", async ({ page }) => { + await setup(page, { version: { latest: { ...LATEST, version: "v0.9.0-rc.1", prerelease: true }, update_available: true, settings: { ...SETTINGS, channel: "preview" } } }); + await page.goto("/settings/system/"); + await expect(status(page)).toContainText("Preview"); + await expect(status(page)).toContainText("You get these because the channel is Preview."); + await shoot(page, "06-preview"); + }); + + test("blocked by a failing check: the status says so and points to Install health", async ({ page }) => { + await setup(page, { + version: { latest: LATEST, update_available: true }, + checks: CHECKS.map((c) => (c.key === "email_identity" ? FAILING_EMAIL : c.key === "email_sandbox" ? WARN_SANDBOX : c)), + blockers: [{ key: "email_identity", severity: "block", detail: "acme.example isn't verified yet. The update's health check would fail, so it wouldn't start.", fix: FAILING_EMAIL.fix }], + }); + await page.goto("/settings/system/"); + await expect(status(page)).toHaveAttribute("data-state", "blocked"); + await expect(status(page)).toContainText("v0.9.0 is available, but can't install yet"); + await expect(page.getByTestId("update-blocked")).toHaveText("You're on v0.8.32. Fix the install check marked Stops updates below, then update."); + await expect(status(page).getByRole("link", { name: "See what to fix" })).toHaveAttribute("href", "#health"); + await expect(page.getByRole("button", { name: /^Update to/ })).toHaveCount(0); + await expect(health(page)).toHaveAttribute("data-state", "failing"); + await expect(page.getByTestId("health-summary")).toHaveText("1 check fails"); + await expect(health(page)).toContainText("Updates won't start until it passes."); + await expect(health(page).locator("#check-email_identity")).toContainText("Stops updates"); + await expect(health(page).locator("#check-email_sandbox")).toHaveAttribute("data-status", "warn"); + await shoot(page, "07-blocked-by-health"); + }); + + test("a warning only: nothing fails, and the update isn't held", async ({ page }) => { + await setup(page, { checks: CHECKS.map((c) => (c.key === "email_sandbox" ? WARN_SANDBOX : c)) }); + await page.goto("/settings/system/"); + await expect(status(page)).toContainText("You're up to date"); + await expect(page.getByTestId("health-summary")).toHaveText("Nothing fails, 1 check needs a look"); + await shoot(page, "08-health-warning"); + }); + + test("the checks couldn't run: the doctor command and Re-run checks", async ({ page }) => { + await setup(page, { preflightFails: true }); + await page.goto("/settings/system/"); + await expect(health(page)).toContainText("Couldn't run the checks"); + await expect(health(page).getByRole("button", { name: "Re-run checks" })).toBeVisible(); + await expect(status(page)).toContainText("You're up to date"); + await shoot(page, "09-health-unavailable"); + }); + + test("the release's model check: the status is the model check", async ({ page }) => { + await setup(page, { + version: { + latest: LATEST, update_available: true, + model_check: { version: "v0.9.0", checked_at: ago(30), ok: false, provider: "bedrock", results: [{ model: "claude-sonnet-5-5", id: "us.anthropic.claude-sonnet-5-5", status: "fail", code: "terms", detail: "The terms for this model haven't been accepted in this AWS account.", fix: "Accept the terms in the Bedrock console.", url: "https://console.aws.amazon.com/bedrock/home#/modelaccess", required: true }] }, + }, + }); + await page.goto("/settings/system/"); + await expect(status(page)).toHaveAttribute("data-state", "needs-action"); + await expect(status(page)).toContainText("Update to v0.9.0 needs your action"); + await expect(status(page).getByRole("button", { name: "Re-run the model check" })).toBeVisible(); + await expect(page.getByRole("button", { name: /^Update to/ })).toHaveCount(0); + await shoot(page, "10-model-check"); + }); + + test("preparing (one stack): step 1 of 2, nothing to do", async ({ page }) => { + await setup(page, { version: { latest: LATEST, update_available: true, native: { stack: "coderhelm-acme", can_apply: true, auto_apply: true, pending: { status: "preparing", version: "v0.9.0", id: "UPDATE#2" } }, history: [{ id: "UPDATE#2", version: "v0.9.0", from_version: "v0.8.32", actor: "admin@acme.example", mode: "update", status: "preparing", started_at: ago(1) }, ...OK_HISTORY] } }); + await page.goto("/settings/system/"); + await expect(status(page)).toHaveAttribute("data-state", "preparing"); + await expect(status(page)).toContainText("Preparing the update to v0.9.0"); + await expect(status(page)).toContainText("Step 1 of 2"); + await expect(page.getByTestId("release-check")).toHaveCount(0); + await shoot(page, "11-preparing"); + }); + + test("updating (one stack): step 2 of 2, no stack name in the text", async ({ page }) => { + await setup(page, { version: { latest: LATEST, update_available: true, running: true, native: { stack: "coderhelm-acme", can_apply: true, auto_apply: true, pending: { ...PREPARED, status: "running" } }, history: [{ id: "UPDATE#2", version: "v0.9.0", from_version: "v0.8.32", actor: "admin@acme.example", mode: "update", status: "running", started_at: ago(6) }, ...OK_HISTORY] } }); + await page.goto("/settings/system/"); + await expect(status(page)).toHaveAttribute("data-state", "updating"); + await expect(status(page)).toContainText("Updating to v0.9.0"); + await expect(status(page)).toContainText("Started 6 min ago"); + await expect(status(page)).toContainText("It changes 7 resources"); + await expect(status(page)).not.toContainText("coderhelm-acme"); + await shoot(page, "12-updating"); + }); + + test("updating (older install): started, how long, keeps running", async ({ page }) => { + await setup(page, { version: { latest: LATEST, update_available: true, running: true, history: [{ id: "UPDATE#2", version: "v0.9.0", from_version: "v0.8.32", actor: "admin@acme.example", mode: "update", status: "running", started_at: ago(2) }, ...OK_HISTORY] } }); + await page.goto("/settings/system/"); + await expect(status(page)).toContainText("Updating to v0.9.0"); + await expect(status(page)).toContainText("Coderhelm keeps running v0.8.32 until it finishes"); + await expect(status(page).getByRole("progressbar")).toBeVisible(); + }); + + test("needs your OK: data and permission changes", async ({ page }) => { + await setup(page, { version: { latest: LATEST, update_available: true, native: { stack: "coderhelm-acme", can_apply: true, auto_apply: true, pending: { ...PREPARED, can_apply: true, confirm: "c".repeat(64), data_changes: ["Database.Table (AWS::DynamoDB::GlobalTable: Modify, replacement True)"], permission_changes: ["Api.NewRole (AWS::IAM::Role Add)"], admin_changes: [] } } } }); + await page.goto("/settings/system/"); + await expect(status(page)).toHaveAttribute("data-state", "review"); + await expect(status(page)).toContainText("v0.9.0 needs your OK"); + await expect(status(page).getByRole("button", { name: "Review and apply" })).toBeVisible(); + await shoot(page, "13-needs-your-ok"); + }); + + test("failed, nothing changed: Try again, health and the release page", async ({ page }) => { + await setup(page, { version: { latest: LATEST, update_available: true, history: [{ id: "UPDATE#2", version: "v0.9.0", from_version: "v0.8.32", actor: "admin@acme.example", mode: "update", status: "rolled_back", started_at: ago(50), reason: "the health check failed after deploying v0.9.0" }, ...OK_HISTORY] } }); + await page.goto("/settings/system/"); + await expect(status(page)).toHaveAttribute("data-state", "failed"); + await expect(status(page)).toContainText("The update to v0.9.0 didn't finish"); + await expect(status(page)).toContainText("Nothing changed: you're still on v0.8.32, and your data is untouched."); + await expect(page.getByTestId("update-failed-reason")).toHaveText("The health check failed after deploying v0.9.0."); + await expect(status(page).getByRole("button", { name: "Try again" })).toBeEnabled(); + await expect(status(page).getByRole("link", { name: "See install health" })).toHaveAttribute("href", "#health"); + await shoot(page, "14-failed-nothing-changed"); + }); + + test("failed partway: may not be fully working, roll back is offered; raw AWS text only in Technical details", async ({ page }) => { + await setup(page, { version: { latest: LATEST, update_available: true, history: [{ id: "UPDATE#2", version: "v0.9.0", from_version: "v0.8.32", actor: "auto", mode: "update", status: "failed", started_at: ago(50), reason: RAW }, ...OK_HISTORY] } }); + await page.goto("/settings/system/"); + await expect(status(page)).toContainText("The update to v0.9.0 stopped partway"); + await expect(status(page)).toContainText("Coderhelm may not be fully working"); + await expect(status(page)).not.toContainText("arn:aws"); + await expect(status(page).getByRole("link", { name: "Roll back" })).toHaveAttribute("href", "#history"); + await page.locator("#version").getByText("Technical details", { exact: true }).click(); + await expect(page.getByTestId("update-failed-raw")).toContainText("UPDATE_ROLLBACK_COMPLETE"); + await page.locator("#version").getByText("Technical details", { exact: true }).click(); + await shoot(page, "15-failed-partway"); + }); + + test("couldn't start: nothing changed", async ({ page }) => { + await setup(page, { version: { latest: LATEST, update_available: true, history: [{ id: "UPDATE#2", version: "v0.9.0", from_version: "v0.8.32", actor: "admin@acme.example", mode: "update", status: "not_started", started_at: ago(5), reason: "AWS refused to prepare the change" }, ...OK_HISTORY] } }); + await page.goto("/settings/system/"); + await expect(status(page)).toContainText("The update to v0.9.0 couldn't start"); + await expect(status(page)).not.toContainText("Automatic updates skip"); + }); + + test("newer release published but not listed yet", async ({ page }) => { + await setup(page, { version: { releases: { fetched_at: unix(1), stale: false, reason: null, error: null, behind: { version: "v0.9.0", reason: "not listed yet" } } } }); + await page.goto("/settings/system/"); + await expect(status(page)).toHaveAttribute("data-state", "behind"); + await expect(status(page)).toContainText("v0.9.0 is out, but can't install yet"); + await expect(page.locator("#version").getByRole("button", { name: /^Update/ })).toHaveCount(0); + await shoot(page, "16-not-listed-yet"); + }); + + test("GitHub unreachable: not 'up to date', and when GitHub last answered", async ({ page }) => { + await setup(page, { version: { releases: { fetched_at: unix(130), stale: true, reason: null, error: "GitHub is down", behind: null } } }); + await page.goto("/settings/system/"); + await expect(status(page)).toHaveAttribute("data-state", "unreachable"); + await expect(status(page)).toContainText("Couldn't check for updates"); + await expect(status(page)).not.toContainText("up to date"); + await expect(page.getByTestId("release-check")).toContainText("GitHub didn't answer the last check. It last answered 2 h ago."); + await shoot(page, "17-github-unreachable"); + }); + + test("not checked yet: Check for updates reads GitHub now", async ({ page }) => { + await setup(page, { + version: { releases: { fetched_at: null, stale: true, reason: null, error: null, behind: null } }, + checked: { latest: LATEST, update_available: true, releases: { fetched_at: unix(0), stale: false, reason: null, error: null, behind: null } }, + }); + await page.goto("/settings/system/"); + await expect(status(page)).toHaveAttribute("data-state", "not-checked"); + await expect(status(page)).toContainText("Not checked for updates yet"); + await shoot(page, "18-not-checked"); + await page.getByRole("button", { name: "Check for updates" }).click(); + await expect(status(page)).toHaveAttribute("data-state", "available"); + await expect(page.getByTestId("release-check")).toContainText("Checked just now"); + }); + + test("development build: no version to compare, no check button", async ({ page }) => { + await setup(page, { version: { current: { version: null, commit: "0123456789abcdef", released_at: null, config_fingerprint: null } } }); + await page.goto("/settings/system/"); + await expect(status(page)).toHaveAttribute("data-state", "development"); + await expect(status(page)).toContainText("Development build"); + await expect(page.getByTestId("release-check")).toHaveCount(0); + await shoot(page, "19-development"); + }); + + test("the updater didn't answer: update from your machine", async ({ page }) => { + await setup(page, { + version: { latest: LATEST, update_available: true }, + blockers: [{ key: "updater", severity: "block", detail: "The updater didn't answer, so an update can't start from here.", fix: { text: "Update from your machine instead.", command: "npx -y github:coderhelm/coderhelm-platform update" } }], + }); + await page.goto("/settings/system/"); + await expect(status(page)).toHaveAttribute("data-state", "updater-down"); + await expect(status(page)).toContainText("v0.9.0 is available, but can't install from here"); + await expect(status(page)).toContainText("coderhelm-platform update"); + await shoot(page, "20-updater-down"); + }); +}); diff --git a/dashboard/src/app/settings/setup/page.tsx b/dashboard/src/app/settings/setup/page.tsx index 59ca5ac3..c5b3900c 100644 --- a/dashboard/src/app/settings/setup/page.tsx +++ b/dashboard/src/app/settings/setup/page.tsx @@ -52,7 +52,7 @@ function Setup() { .catch(() => setModelCheck(null)); }, []); - // The first load may reuse the menu's recent result; Check again runs them afresh. + // The first load may reuse the menu's recent result; Re-run checks runs them afresh. const runChecks = useCallback((fresh = true) => { setServerState("loading"); systemChecks(fresh) @@ -112,7 +112,7 @@ function Setup() { }} />

- Open Version and updates + Open Version and updates

)} @@ -194,7 +194,7 @@ function InstallChecks({ data, state, onRecheck }: { data: SystemChecks | null;

{state === "failed" && ( @@ -211,7 +211,7 @@ function InstallChecks({ data, state, onRecheck }: { data: SystemChecks | null; ) : ( -

Each one below says what is wrong, why it matters and how to fix it. Then press Check again.

+

Each one below says what is wrong, why it matters and how to fix it. Then press Re-run checks.

)} diff --git a/dashboard/src/app/settings/system/page.tsx b/dashboard/src/app/settings/system/page.tsx index 90cb566d..4d056ae5 100644 --- a/dashboard/src/app/settings/system/page.tsx +++ b/dashboard/src/app/settings/system/page.tsx @@ -3,7 +3,7 @@ import { useCallback, useEffect, useState, type ReactNode } from "react"; import Link from "next/link"; import { api, type AutoUpdateSettings, type SystemPreflight, type SystemVersion, type UpdateBlocker, type UpdateEntry } from "@/lib/api"; -import { FixBlock } from "@/components/install-checks"; +import { CheckRow } from "@/components/install-checks"; import { DomainSection } from "@/components/domain-section"; import { HybridSection } from "@/components/hybrid-section"; import { UninstallSection } from "@/components/uninstall-section"; @@ -78,7 +78,7 @@ function timeZones(current: string): string[] { const DEFAULTS: AutoUpdateSettings = { auto: false, channel: "stable", day: "sun", hour: 3, timezone: "UTC", majors: "ask" }; -/** Settings, then System: the install's version, update readiness, updates and their history (self-hosted, install admins). */ +/** Settings, then System: the install's version, its health, updates and their history (self-hosted, install admins). */ export default function SystemPage() { const { ready, allowed } = useInstallAdmin(); if (!ready) return null; @@ -145,7 +145,7 @@ function System() { const header = (
- +
); @@ -179,11 +179,16 @@ function System() { // A prepared or applying update is shown once, in its own card, with the // one thing to do; it is never also listed as something blocking itself. const pending = data.native?.pending ?? null; - // The update itself (running, or the last try that failed) is the status - // at the top, never also a blocker of itself. - const shownBlockers = (pre?.blockers ?? []).filter((b) => b.key !== "running" && b.key !== "failed_before"); const failure = failedTry(data, pre); - const blocked = shownBlockers.some((b) => b.severity === "block"); + // What stops an update now: install checks that fail (listed under Install + // health), or an updater that didn't answer. The update itself (running, + // or its last try) and the model check have their own status, and a major + // release's notes are said in the status, so none of those repeat here. + const blockers = (pre?.blockers ?? []).filter((b) => b.severity === "block"); + const checkKeys = new Set((pre?.checks ?? []).map((c) => c.key)); + const blocking = new Set(blockers.filter((b) => checkKeys.has(b.key)).map((b) => b.key)); + const hold: UpdateHold = { checks: blocking.size, updater: blockers.find((b) => b.key === "updater") ?? null }; + const modelBlock = !!latest && data.model_check?.version === latest.version && !data.model_check.ok; const save = async () => { try { @@ -227,28 +232,37 @@ function System() { {header}
- {latest && data.model_check?.version === latest.version && ( - { - setData({ ...data, model_check: c }); - loadPreflight(); - }} - onSkip={() => start("update", true)} - /> - )}
- start("update")} onChanged={load} /> - {!data.running && !pending && } + start("update")} + onChanged={load} + onModelChecked={(c) => { + setData({ ...data, model_check: c }); + loadPreflight(); + }} + onSkipModel={() => start("update", true)} + /> + {failure && modelBlock && ( +
+ { setData({ ...data, model_check: c }); loadPreflight(); }} onSkip={() => start("update", true)} /> +
+ )} + {!data.running && !pending && data.current.version && }
{latest && !pending && } -
- -
+
+ + + @@ -355,9 +369,9 @@ function System() { {(h.status === "failed" || h.status === "rolled_back") && (

{h.status === "rolled_back" - ? `Back on ${h.from_version ?? "the previous version"}; your data is untouched. Fix what Setup lists, then update to ${h.version} again. Automatic updates skip it until then.` - : "The install may be unhealthy. Check Setup for what fails and how to fix it, or roll back below."}{" "} - Open Setup + ? `Back on ${h.from_version ?? "the previous version"}; your data is untouched. Fix what Install health lists, then update to ${h.version} again. Automatic updates skip it until then.` + : "Coderhelm may not be fully working. Fix what Install health lists, or roll back below."}{" "} + See install health

)}
@@ -450,35 +464,84 @@ function Working({ label }: { label: string }) { ); } +/** "Sundays at 03:00 UTC": when automatic updates may start, or null when they're off. */ +function windowText(s: AutoUpdateSettings | undefined): string | null { + if (!s?.auto) return null; + const day = s.day === "daily" ? "every day" : `${DAYS.find(([k]) => k === s.day)?.[1] ?? s.day}s`; + return `${day} at ${String(s.hour).padStart(2, "0")}:00 ${s.timezone.replace(/_/g, " ")}`; +} + +/** Why an update can't start now, from the preflight: failing install checks, or an updater that didn't answer. */ +interface UpdateHold { + /** Install checks that fail and stop an update (shown under Install health). */ + checks: number; + /** The updater in the AWS account didn't answer. */ + updater: UpdateBlocker | null; +} + +function plural(n: number, one: string, many = `${one}s`) { + return `${n} ${n === 1 ? one : many}`; +} + +/** The one status card: a test id and state, a headline, one line of detail, and the one thing to do. */ +function StatusCard({ state, variant, title, children, actions }: { state: string; variant: "neutral" | "info" | "success" | "warning" | "error"; title: ReactNode; children?: ReactNode; actions?: ReactNode }) { + return ( +
+ + {children} + +
+ ); +} + +/** The newest update succeeded in the last day and is what runs: "Updated to v0.8.32". */ +function recentSuccess(data: SystemVersion): UpdateEntry | null { + const newest = (data.history ?? [])[0]; + if (!newest || newest.mode === "rollback" || newest.status !== "succeeded" || newest.version !== data.current.version) return null; + const at = newest.finished_at ?? newest.started_at; + if (!at || Date.now() - new Date(at).getTime() > 24 * 3600_000) return null; + return newest; +} + /** - * The one status at the top of Version: up to date, an update to install, - * an update on its way, or the last one that didn't work, each with the one - * thing to do. + * The one status at the top of Version, about updates only (the install's + * own health is its own section): up to date, a release to install, one on + * its way, or the last one that didn't work, each with the one thing to do. */ function UpdateStatus({ data, failure, - blocked, + hold, + modelBlock, busy, onUpdate, onChanged, + onModelChecked, + onSkipModel, }: { data: SystemVersion; failure: FailedTry | null; - blocked: boolean; + hold: UpdateHold; + /** The release's model check holds it (or is still running). */ + modelBlock: boolean; busy: "" | "update" | "rollback"; onUpdate: () => void; onChanged: () => void; + onModelChecked: (c: SystemVersion["model_check"]) => void; + onSkipModel: () => void; }) { const current = data.current.version; const latest = data.latest; const pending = data.native?.pending ?? null; const on = current ?? "a development build"; + const auto = windowText(data.settings); + const preview = data.settings?.channel === "preview"; + const healthLink = See install health; if (pending) { const t = runningTry(data); return ( -
+
); @@ -488,119 +551,180 @@ function UpdateStatus({ const t = runningTry(data); const to = t?.version ?? latest?.version ?? "the new version"; return ( -
- Updating to {to}…}> -

- {t?.started_at ? <>Started

- -
-
+ Updating to {to}…}> +

+ {t?.started_at ? <>Started

+ +
); } if (failure) { - const rolledBack = failure.status !== "failed"; const plain = failure.reason && !isRawReason(failure.reason) ? sentence(failure.reason) : null; const retry = latest?.version === failure.version; + const held = modelBlock || hold.checks > 0 || !!hold.updater; + const title = + failure.status === "not_started" + ? <>The update to {failure.version} couldn't start + : failure.status === "rolled_back" + ? <>The update to {failure.version} didn't finish + : <>The update to {failure.version} stopped partway; return ( -
- The update to {failure.version} didn't work} - actions={ - <> - {retry && ( - - )} - Open Setup - {latest?.url && retry && Release page} - - } - > -

- {rolledBack - ? <>Nothing changed: you're still on {on}, and your data is untouched. - : <>It stopped partway, so this install may not be healthy. It reports {on}.} - {failure.startedAt ? <> Tried

- {plain &&

{plain}

} - {!plain &&

It stopped on an error from AWS. AWS's own message is under Technical details below.

} -

- {rolledBack - ? "Fix what Setup lists as failing, then try again." - : "Check Setup for what fails and how to fix it, or roll back under Update history."} - {failure.status !== "not_started" ? ` Automatic updates skip ${failure.version} until it works.` : ""} - {blocked ? " Something below blocks a new try; fix it first." : ""} -

-
+ + {retry && ( + + )} + {healthLink} + {failure.status === "failed" && Roll back} + + } + > +

+ {failure.status === "failed" + ? <>Coderhelm may not be fully working: it reports {on}. + : <>Nothing changed: you're still on {on}, and your data is untouched.} + {failure.startedAt ? <> Tried

+

+ {plain ?? "AWS stopped it with an error; its own message is under Technical details."} +

+

+ {held + ? "Fix what Install health lists, then try again." + : failure.status === "failed" + ? "Fix what Install health lists and try again, or roll back under Update history." + : "If Install health below lists a check that fails, fix it first."} + {failure.status !== "not_started" ? ` Automatic updates skip ${failure.version} until it works.` : ""} +

+
+ ); + } + + if (latest && modelBlock && data.model_check) { + return ( +
+
); } + if (latest && hold.updater) { + return ( + {latest.version} is available, but can't install from here}> +

You're on {on}. The updater in your AWS account didn't answer, so update from your machine instead:

+
+
+ ); + } + + if (latest && hold.checks > 0) { + return ( + {latest.version} is available, but can't install yet} + actions={See what to fix} + > +

+ You're on {on}. Fix the {hold.checks === 1 ? "install check" : `${hold.checks} install checks`} marked Stops updates below, then update. +

+
+ ); + } + if (latest) { + const majorWaits = latest.breaking && data.settings?.majors !== "auto"; return ( -
-
-

- You're on {on} · {latest.version} is available -

-

- {latest.published_at && Released } - {latest.breaking && Major: read the notes} + + {latest.version} is available + {latest.breaking && Major release} {latest.prerelease && Preview} + + } + actions={ + + } + > +

+ You're on {on}.{latest.published_at ? <> {latest.version} came out

+ {latest.breaking && ( +

+ Its notes ask you to do something before or after updating: read them below first.{auto ? " Major releases wait for you, even with automatic updates on." : ""}

- {blocked &&

Fix what blocks the update below first.

} -
- -
+ )} + {latest.prerelease &&

A preview release, before it is fully tested. You get these because the channel is Preview.

} + ); } const behind = data.releases?.behind; if (behind && current) { return ( -
- {behind.version} is out}> -

You're on {current}. GitHub's release list doesn't show {behind.version} yet, so nothing older is offered meanwhile. It shows here, with Update, once it does: Check for updates in a minute.

-
-
+ {behind.version} is out, but can't install yet}> +

You're on {current}. GitHub's release list doesn't show {behind.version} yet, which usually takes a few minutes. Check for updates again shortly.

+
); } if (!current) { return ( -
- -

It was deployed from a source checkout, not a published release, so there is no version to compare with new releases.

-
-
+ +

This install was deployed from source, not a published release, so there is no version to compare with new releases.

+
+ ); + } + + if (data.releases?.error) { + return ( + +

GitHub didn't answer, so it isn't known whether a newer release is out. You're on {current}.

+
+ ); + } + + if (data.releases && !data.releases.fetched_at) { + return ( + +

You're on {current}. Check for updates to see whether a newer release is out.

+
); } + const done = recentSuccess(data); + const channel = preview ? " on the Preview channel" : ""; return ( -
- You're up to date ({current})}> - {data.current.released_at ?

Released

: null} -
-
+ Updated to {current} : "You're up to date"}> +

+ {done + ? <>Finished

+
); } /** - * When this install last read GitHub's release list, and Check for updates - * to read it now (the updater reads at most once per 30 seconds). + * Under the status: when this install last heard from GitHub's release list, + * and Check for updates to read it now (the updater reads at most once per + * 30 seconds). */ function ReleaseCheck({ data, onChecked }: { data: SystemVersion; onChecked: (v: SystemVersion) => void }) { const { toast } = useToast(); @@ -623,17 +747,19 @@ function ReleaseCheck({ data, onChecked }: { data: SystemVersion; onChecked: (v: setChecking(false); } }; + const primary = !!r && (!r.fetched_at || !!r.error || !!r.behind) && !data.latest; return ( -
+
+ - {checking ? "Checking for updates…" : at ? <>Checked - - {r?.error && !checking && ( -

The last check couldn't reach GitHub, so this is the list from then.

- )}
); } @@ -746,68 +872,70 @@ function ReleaseNotes({ version, notes, url }: { version: string; notes: string; ); } -/** The preflight: one line when nothing stops an update; each blocker with its fix, up front, when something does. */ -function Readiness({ pre, state, onRecheck }: { pre: SystemPreflight | null; state: "loading" | "ready" | "failed"; onRecheck: () => void }) { - const failing = pre?.checks.filter((c) => c.status === "fail").length ?? 0; - const warning = pre?.checks.filter((c) => c.status === "warn").length ?? 0; - const fine = (pre?.checks.length ?? 0) - failing - warning; - const blockers: UpdateBlocker[] = pre?.blockers ?? []; - const recheck = ( - ); - const counts = pre && ( - - {`${fine} check${fine === 1 ? "" : "s"} fine`} - {warning ? `, ${warning} warning${warning === 1 ? "" : "s"}` : ""} - {failing ? `, ${failing} failing` : ""} - - ); + const dot = failing.length ? "bg-red-400" : warning.length ? "bg-amber-400" : "bg-emerald-400"; + const headline = failing.length + ? `${plural(failing.length, "check")} ${failing.length === 1 ? "fails" : "fail"}` + : warning.length + ? `Nothing fails, ${plural(warning.length, "check")} ${warning.length === 1 ? "needs" : "need"} a look` + : `All ${plural(passing, "check")} pass`; return ( -
- {state === "loading" && !pre && } +
+ {state === "loading" && !pre &&
} {state === "failed" && !pre && ( - -

Run the same checks from your machine:

-
-
- )} - {pre && blockers.length === 0 && ( -
- - - - {counts} - See every check - {recheck} +
+ +

Run the same checks from your machine:

+
+
)} - {pre && blockers.length > 0 && ( -
-

- {blockers.some((b) => b.severity === "block") ? "What stops an update" : "Read before updating"} -

-
    - {blockers.map((b) => ( -
  • -

    - {b.severity === "block" ? "Blocks the update" : "Read first"} -

    -

    {b.detail}

    - -
  • - ))} -
-

- Install checks: {counts}. + {pre && ( +

+
+

+

+

+ {failing.some((c) => blocking.has(c.key)) ? `Updates won't start until ${failing.length === 1 ? "it passes" : "they pass"}. ` : ""} + {optional ? `${plural(optional, "optional check")} not set up. ` : ""} + Checked

+
+
+ {rerun} See every check - {recheck} -

+
)} + {pre && failing.length + warning.length > 0 && ( +
    + {[...failing, ...warning].map((c) => ( + + {blocking.has(c.key) &&

    Stops updates

    } +
    + ))} +
+ )}
); } + diff --git a/dashboard/src/components/models-section.tsx b/dashboard/src/components/models-section.tsx index b1239b3d..47b3218b 100644 --- a/dashboard/src/components/models-section.tsx +++ b/dashboard/src/components/models-section.tsx @@ -263,7 +263,7 @@ export function UpdateNeedsAction({ check, onChecked, onSkip }: { check: ModelCh variant="neutral" testId="update-checking" title={`Checking ${mc.version} before it can be applied`} - actions={} + actions={} >

Coderhelm checks the release's signature, then tries each model it calls. This takes a few minutes.

@@ -289,7 +289,7 @@ export function UpdateNeedsAction({ check, onChecked, onSkip }: { check: ModelCh title={`Update to ${mc.version} needs your action`} actions={ <> - + {mc.skippable && onSkip && } } diff --git a/dashboard/src/components/native-update.tsx b/dashboard/src/components/native-update.tsx index 820d099a..e9a201a4 100644 --- a/dashboard/src/components/native-update.tsx +++ b/dashboard/src/components/native-update.tsx @@ -77,8 +77,8 @@ export function NativeUpdateCard({ <>

{startedAt ? <>Started

@@ -87,7 +87,7 @@ export function NativeUpdateCard({ )} {p.counts ? (

- A stack update to {native.stack}: {total} change{total === 1 ? "" : "s"} ({n.add} to add, {n.modify} to change, {n.remove} to remove) + It changes {total} resource{total === 1 ? "" : "s"} ({n.add} to add, {n.modify} to change, {n.remove} to remove) {p.parts?.length ? <> in {p.parts.join(", ")} : null}. {p.replacements?.length ? <> Replaced: {p.replacements.join(", ")}. : <> Nothing is replaced.}

@@ -105,10 +105,8 @@ export function NativeUpdateCard({ : "This install's stack doesn't have the deploy role yet, so this one update is executed in the AWS console by someone with administrator rights in the account. It adds the role; every update after it applies from here."}

) : p.status === "preparing" ? ( -

Nothing to do yet. Preparing takes a few minutes, then it applies.

- ) : ( -

This takes 10 to 20 minutes. This page shows the result when it finishes.

- )} +

Nothing to do yet. If it would change data or permissions, it asks you here first.

+ ) : null} {p.reason && !waiting ?

{p.reason}

: null}

{canApply ? ( @@ -119,7 +117,7 @@ export function NativeUpdateCard({ Open it in the AWS console ) : null} {p.link && (canApply || !waiting) ? ( - See the change set in AWS + See the change in the AWS console ) : null}