diff --git a/apps/dashboard/src/app/(dashboard)/layout.tsx b/apps/dashboard/src/app/(dashboard)/layout.tsx index abb88ac76..cc8c81f0c 100644 --- a/apps/dashboard/src/app/(dashboard)/layout.tsx +++ b/apps/dashboard/src/app/(dashboard)/layout.tsx @@ -173,10 +173,9 @@ export default async function DashboardLayout({ children }: { children: React.Re hostDomain={deploymentInfo.hostDomain} >
- {/* Update + platform-status surface — full app width, ABOVE the sidebar. - Renders nothing unless there's an advisory / platform notice (SaaS: - partial outage, maintenance) / available update / what's-new, so it - adds no chrome when idle. */} + {/* Full-width update surface. Managed Cloud shows workload security; + Desktop and self-hosted also show installation updates, operator + notices and what's new. Empty state adds no chrome. */} {children}
diff --git a/apps/dashboard/src/components/updates/useUpdates.requests.test.tsx b/apps/dashboard/src/components/updates/useUpdates.requests.test.tsx index 743d047a3..611d94b00 100644 --- a/apps/dashboard/src/components/updates/useUpdates.requests.test.tsx +++ b/apps/dashboard/src/components/updates/useUpdates.requests.test.tsx @@ -64,6 +64,7 @@ async function mount() { ); } const releaseRequests = () => fetcher.mock.calls.filter(([url]) => String(url).includes("github")); +const noticeRequests = () => fetcher.mock.calls.filter(([url]) => String(url).endsWith("/notices")); beforeEach(async () => { vi.resetModules(); @@ -154,17 +155,17 @@ describe("advisory dismissal within an app session", () => { expect(state[0].state?.advisories).toEqual([critical, next]); }); - it("also shares dismissal for operator notices in the cloud dashboard", async () => { + it("also shares dismissal for verified security notices in the cloud dashboard", async () => { delete window.desktop; deployment.selfHosted = false; - // Every consumer receives its own readable response body. - fetcher.mockImplementation( - async () => new Response(JSON.stringify({ advisories: [critical] })), - ); + feed.overview = affectedOverview; await mount(); expect(check).toHaveBeenCalledOnce(); - expect(state[0].state?.advisories).toEqual([critical]); - await act(async () => state[0].dismissAdvisory(critical.id)); + expect(state[0].state?.advisories).toEqual([ + expect.objectContaining({ title: "Affected runtime", severity: "critical" }), + ]); + const noticeId = state[0].state!.advisories[0].id; + await act(async () => state[0].dismissAdvisory(noticeId)); await act(async () => state[1].reload()); expect(state[0].state?.advisories).toEqual([]); expect(state[1].state?.advisories).toEqual([]); @@ -192,6 +193,37 @@ afterEach(async () => { }); describe("release check requests (#661)", () => { + it.each([false, true])("only loads verified security for a new Cloud session (affected=%s)", async (affected) => { + delete window.desktop; + deployment.selfHosted = false; + const release = { + ...critical, id: "legacy-release", severity: "recommended", announce: false, affects: "*", + title: "OpenShip 0.9.0 is released", target: { type: "platform" }, + action: { kind: "open-url", label: "View release notes", url: "https://github.com/oblien/openship/releases/tag/v0.9.0" }, + }; + check.mockResolvedValue({ ...snapshot, manifest: { advisories: [release] } }); + fetcher.mockImplementation(async () => new Response(JSON.stringify({ advisories: [release, critical] }))); + if (affected) feed.overview = affectedOverview; + await mount(); + expect(noticeRequests()).toHaveLength(0); + expect(state[0].state?.advisories).toEqual(affected + ? [expect.objectContaining({ title: "Affected runtime", severity: "critical" })] + : []); + expect(state[0].state?.updateAvailable).toBe(false); + expect(state[0].latest).toBeNull(); + expect(localStorage.length).toBe(0); + }); + + it.each(["desktop", "selfhosted"])("keeps release and operator announcements for %s", async (mode) => { + if (mode === "selfhosted") delete window.desktop; + const release = { ...critical, id: "release-notice", severity: "recommended" as const }; + check.mockResolvedValue({ ...snapshot, manifest: { advisories: [release] } }); + fetcher.mockImplementation(async () => new Response(JSON.stringify({ advisories: [critical] }))); + await mount(); + expect(noticeRequests().length).toBeGreaterThan(0); + expect(state[0].state?.advisories.map((notice) => notice.id)).toEqual([critical.id, release.id]); + }); + it.each(["desktop", "selfhosted", "cloud"])( "scopes signed control-plane advisories correctly in %s", async (mode) => { diff --git a/apps/dashboard/src/components/updates/useUpdates.ts b/apps/dashboard/src/components/updates/useUpdates.ts index 120c3c79c..c4f436f34 100644 --- a/apps/dashboard/src/components/updates/useUpdates.ts +++ b/apps/dashboard/src/components/updates/useUpdates.ts @@ -304,10 +304,8 @@ function runtimeNotices(overview: SecurityOverview, scope: string): RuntimeAdvis return [...notices.values()]; } -// The SaaS advisory source: operator-pushed platform notices from our own API -// (partial outage, maintenance, upgrade advisories), returned in the SAME -// manifest shape as the GitHub advisory feed so the shared banner renders both -// identically. Same-origin on the SaaS; never throws (offline → no notices). +// Operator announcements for Desktop and self-hosted instances. Managed Cloud's +// update banner uses verified workload-security notices, so it skips this feed. async function fetchNotices(): Promise { try { const res = await fetch(`${getRestApiBaseUrl()}/notices`, { @@ -426,7 +424,7 @@ export function useUpdates(): UseUpdates { const [prefs, remote, notices] = await Promise.all([ getPrefs(), fetchRemote(requestKey), - fetchNotices(), + mode === "cloud" ? Promise.resolve({ advisories: [] }) : fetchNotices(), ]); if (!isCurrent()) return; setCurrentVersion(current); diff --git a/docs/dashboard-design.md b/docs/dashboard-design.md index bae3d6b4f..c71a2d330 100644 --- a/docs/dashboard-design.md +++ b/docs/dashboard-design.md @@ -174,6 +174,9 @@ The banner settings menu can hide runtime security banners, including critical o for the current browser/account/workspace. Settings → Notifications restores them. Keep this visibility choice separate from security checks, notification delivery and per-project automatic-refresh consent. Operator maintenance notices stay independent. +Managed Cloud's global update banner shows only verified workload-security notices. +It skips installation releases, upgrade prompts and the operator-announcements feed; +Desktop and self-hosted instances retain those feeds. When the signed advisory has no patched release in the observed runtime's major, show the required version-change guidance and open the existing saved deployment configuration. Do not offer another image refresh as a fix or silently upgrade a major.