Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: trim the runtime update card to one summary line and two actions (#14436)

oobabooga2af56e135753
diff --git a/studio/frontend/scripts/check-bundle-budget.ts b/studio/frontend/scripts/check-bundle-budget.ts
index eb0991636a9..0b12a9a9c2a 100644
--- a/studio/frontend/scripts/check-bundle-budget.ts
+++ b/studio/frontend/scripts/check-bundle-budget.ts
@@ -327,8 +327,9 @@ export const BUDGET = {
// build, Node 24, 97 chunks). Raised to that build plus the same 160 B raw / 189 B transfer margin.
// Browser store sync across windows (#14277) adds 545 B raw / 288 B transfer on top (6,872,325 B raw, 2,069,596 B
// transfer merged with main at 4962983b0, Node 24, 97 chunks). Raised to that plus the same margin.
- transferBytes: 2_069_785,
- rawBytes: 6_872_485,
+ // The runtime update card's skip and Undo (#14436) add 1,706 B raw / 424 B transfer against 444f63275c.
+ transferBytes: 2_070_209,
+ rawBytes: 6_874_191,
};
// The chunk count is reported but not budgeted. Splitting a page out of the entry raises it while lowering the
diff --git a/studio/frontend/src/components/llama-update-banner.tsx b/studio/frontend/src/components/llama-update-banner.tsx
index 84c2ab0cfde..cd68879e71f 100644
--- a/studio/frontend/src/components/llama-update-banner.tsx
+++ b/studio/frontend/src/components/llama-update-banner.tsx
@@ -34,7 +34,9 @@ import { cn } from "@/lib/utils";
import { Download } from "lucide-react";
import {
type CSSProperties,
+ type MouseEvent,
type ReactElement,
+ useCallback,
useEffect,
useRef,
useState,
@@ -200,9 +202,15 @@ export function LlamaUpdateBanner({
whisper: useNotificationFrequency("whisper") === "off",
audio: useNotificationFrequency("audio") === "off",
};
- const [changelogVersion, setChangelogVersion] = useState<string | null>(null);
+ const [detailsVersion, setDetailsVersion] = useState<string | null>(null);
+ const [skipped, setSkipped] = useState<{
+ key: string;
+ fromKeyboard: boolean;
+ message: string;
+ } | null>(null);
+ const clearSkipped = useCallback(() => setSkipped(null), []);
// listen regardless of banner preference so muting the UI does not silence cross-tab reload_required resync.
- const { status, visible, applying, apply, dismiss, snooze } =
+ const { status, visible, applying, apply, dismiss, undoDismiss, snooze } =
useLlamaUpdateCheck({
enabled,
onReloadRequired: resyncInferenceStatusAfterServerModelChange,
@@ -309,10 +317,11 @@ export function LlamaUpdateBanner({
}
setShownChannels([...shownChannels, ...fresh]);
}
- } else if (!show && shownChannels.length > 0) {
+ } else if (!(show || skipped) && shownChannels.length > 0) {
+ // the skip notice still stands for the card, so Undo can reopen it past the frequency gate.
setShownChannels([]);
}
- }, [show, tabVisible, livePref, recordKey, shownChannels]);
+ }, [show, skipped, tabVisible, livePref, recordKey, shownChannels]);
// a migration can reapply the automatic backend at the installed release.
const backendChange =
llamaRow && status?.backend_migration_available && status.to_backend
@@ -320,6 +329,28 @@ export function LlamaUpdateBanner({
: null;
const llamaVersionChanged = Boolean(llamaRow?.versionChanged);
const backendOnly = Boolean(backendChange) && !llamaVersionChanged;
+ // a skip dismisses the whole offer, so a bundle reads plural even when llama.cpp only migrates.
+ const skipLabel = bundled
+ ? "Skip these versions"
+ : backendOnly
+ ? "Skip this change"
+ : "Skip this version";
+
+ function handleSkip(event: MouseEvent<HTMLButtonElement>) {
+ const skippedTag = bundled || backendOnly ? null : primary?.latestTag;
+ const key = dismiss();
+ if (!key) {
+ return;
+ }
+ setSkipped({
+ key,
+ // detail is 0 for Enter or Space, so only keyboard users get focus moved to Undo.
+ fromKeyboard: event.detail === 0,
+ message: skippedTag
+ ? `Skipped ${label} ${skippedTag}`
+ : `Skipped the ${label} ${bundled ? "updates" : "update"}`,
+ });
+ }
// show the backend pair when a migration has no version change.
const backendPair = backendOnly
? ([
@@ -332,24 +363,38 @@ export function LlamaUpdateBanner({
backendOnly &&
status?.from_backend === "rocm" &&
status?.to_backend === "vulkan"
- ? "Vulkan is >10% faster than ROCM. No restart needed after update"
- : "No restart needed after update";
+ ? "Vulkan is >10% faster than ROCM. No restart needed"
+ : "No restart needed";
const changelogTags =
llamaRow?.versionChanged && llamaRow.installedTag && llamaRow.latestTag
? { installedTag: llamaRow.installedTag, latestTag: llamaRow.latestTag }
: null;
- const changelogKey = changelogTags
- ? `${changelogTags.installedTag}\0${changelogTags.latestTag}`
- : null;
- const changelogAvailable = Boolean(changelogKey && !status?.source_build);
- const changelogOpen =
- changelogKey !== null && changelogVersion === changelogKey;
+ const changelogAvailable = Boolean(changelogTags && !status?.source_build);
+ // a different offer starts collapsed.
+ const detailsKey = [
+ ...rows.map(
+ (row) => `${row.component}\0${row.installedTag}\0${row.latestTag}`,
+ ),
+ backendChange ?? "",
+ ].join("\n");
+ const detailsOpen = !applying && detailsVersion === detailsKey;
// the panel and its protective height floor must use the same predicate.
const changelogPanelOpen = Boolean(
- !applying && changelogAvailable && changelogOpen && changelogTags,
+ detailsOpen && changelogAvailable && changelogTags,
);
- // bundles omit a total because some components do not report a download size.
- const sizeLabel = bundled ? null : sizeLabelOf(primary?.sizeBytes);
+ const sizeLabel = sizeLabelOf(
+ rows.every((row) => row.sizeBytes && row.sizeBytes > 0)
+ ? rows.reduce((total, row) => total + (row.sizeBytes ?? 0), 0)
+ : null,
+ );
+ const summary = [
+ bundled ? label : null,
+ sizeLabel ? `${sizeLabel} download` : null,
+ backendChange ? `${backendChange} backend` : null,
+ restartNote,
+ ]
+ .filter(Boolean)
+ .join(" · ");
// use the phase record because migration and source-build offers disappear while jobs run.
const runningPhase = status?.job.runningPhase ?? null;
const phaseIndex = rows.findIndex(
@@ -387,18 +432,39 @@ export function LlamaUpdateBanner({
updateProgress,
jobSucceeded,
);
+ // a returning card or a hidden banner retires the notice.
+ useEffect(() => {
+ if (show || !enabled) {
+ setSkipped(null);
+ }
+ }, [show, enabled]);
+
+ if (!show) {
+ return skipped && enabled ? (
+ <SkippedNotice
+ message={skipped.message}
+ focusUndo={skipped.fromKeyboard}
+ positioned={positioned}
+ onUndo={() => {
+ undoDismiss(skipped.key);
+ setSkipped(null);
+ }}
+ onExpire={clearSkipped}
+ />
+ ) : null;
+ }
// opacity and transform transitions can flash during gpu layer churn.
- return show ? (
+ return (
<div
className={cn(
positioned
? "fixed bottom-4 right-4 z-[9998] w-[calc(100vw-2rem)] max-w-[calc(448px*var(--ui-space-scale,1))]"
: cn(
"pointer-events-auto flex w-[calc(100vw-2rem)] max-w-[calc(448px*var(--ui-space-scale,1))] flex-col",
- // each bundled row adds one text-xs line to the open changelog's height floor.
+ // the desktop floor plus 22px for the details toggle; each bundled row adds one text-xs line.
changelogPanelOpen
- ? "min-h-[calc(117px+(93px+18px*var(--llama-update-extra-rows,0))*var(--ui-font-scale,1))] max-[383px]:min-h-[calc(24px+(224px+18px*var(--llama-update-extra-rows,0))*var(--ui-font-scale,1))]"
+ ? "min-h-[calc(117px+(115px+18px*var(--llama-update-extra-rows,0))*var(--ui-font-scale,1))] max-[383px]:min-h-[calc(24px+(246px+18px*var(--llama-update-extra-rows,0))*var(--ui-font-scale,1))]"
: "shrink-0",
),
)}
@@ -411,32 +477,7 @@ export function LlamaUpdateBanner({
>
{/* fill the height floor even when the changelog content is short. */}
<div className="relative flex max-h-[calc(100dvh_-_2rem_-_var(--studio-window-chrome-top,0px))] min-h-0 grow flex-col overflow-hidden rounded-[24px] bg-white px-5 pb-4 pt-5 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] dark:bg-card dark:shadow-[0_8px_28px_-6px_var(--background)]">
- {applying ? null : (
- <button
- type="button"
- onClick={dismiss}
- className="absolute top-2.5 right-3 flex size-6 items-center justify-center rounded-full text-muted-foreground/60 transition-colors hover:bg-muted hover:text-foreground"
- aria-label={`Dismiss ${label} update notification`}
- >
- <svg
- aria-hidden="true"
- width="12"
- height="12"
- viewBox="0 0 14 14"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- d="M11 3L3 11M3 3l8 8"
- stroke="currentColor"
- strokeWidth="1.5"
- strokeLinecap="round"
- />
- </svg>
- </button>
- )}
-
- <div className="flex min-w-0 shrink-0 items-start gap-4 pr-6">
+ <div className="flex min-w-0 shrink-0 items-start gap-4">
<Download
aria-hidden="true"
className="mt-1 size-5 shrink-0 text-foreground"
@@ -446,21 +487,37 @@ export function LlamaUpdateBanner({
<p className="font-heading text-base font-medium text-foreground">
{title}
</p>
- {rows.map((row) => (
- <VersionLine
- key={row.component}
- row={row}
- bundled={bundled}
- backendPair={row === llamaRow ? backendPair : null}
- />
- ))}
- <p className="mt-1 text-ui-11 text-muted-foreground/70">
- {sizeLabel ? `${sizeLabel} download · ` : ""}
- {llamaVersionChanged && backendChange
- ? `${backendChange} backend · `
- : ""}
- {restartNote}
+ <p
+ className="mt-0.5 text-xs text-muted-foreground"
+ data-testid="llama-update-summary"
+ >
+ {summary}
</p>
+ {applying ? null : (
+ <button
+ type="button"
+ className="-mx-1 mt-1 block rounded px-1 text-xs font-medium text-foreground underline decoration-foreground/30 underline-offset-2 hover:decoration-foreground/70"
+ onClick={() =>
+ setDetailsVersion(detailsOpen ? null : detailsKey)
+ }
+ aria-expanded={detailsOpen}
+ data-testid="llama-update-changelog-toggle"
+ >
+ {detailsOpen ? "Hide what's new" : "What's new"}
+ </button>
+ )}
+ {detailsOpen ? (
+ <div className="mt-2" data-testid="llama-update-details">
+ {rows.map((row) => (
+ <VersionLine
+ key={row.component}
+ row={row}
+ bundled={bundled}
+ backendPair={row === llamaRow ? backendPair : null}
+ />
+ ))}
+ </div>
+ ) : null}
</div>
</div>
@@ -492,53 +549,113 @@ export function LlamaUpdateBanner({
/>
</div>
) : (
- <div
- className={cn(
- "mt-4 flex shrink-0 flex-wrap items-center gap-x-1 gap-y-2",
- changelogAvailable ? "justify-between" : "justify-end",
- )}
- >
- {changelogAvailable ? (
+ <div className="mt-4 flex shrink-0 flex-wrap items-center justify-end gap-x-1 gap-y-2">
+ {detailsOpen ? (
<Button
size="sm"
variant="ghost"
- className="-ml-2 h-auto whitespace-nowrap rounded-full px-2.5 py-2 text-ui-13 font-medium text-foreground"
- onClick={() =>
- setChangelogVersion(changelogOpen ? null : changelogKey)
- }
- aria-expanded={changelogOpen}
- data-testid="llama-update-changelog-toggle"
+ className="-ml-2 mr-auto h-auto whitespace-nowrap rounded-full px-2.5 py-2 text-ui-13 font-medium text-muted-foreground hover:text-foreground"
+ onClick={handleSkip}
+ data-testid="llama-update-skip-button"
>
- {changelogOpen
- ? "Hide what's new"
- : bundled
- ? "llama.cpp changes"
- : "Show what's new"}
+ {skipLabel}
</Button>
) : null}
- <div className="flex flex-wrap items-center justify-end gap-x-1 gap-y-2">
- <Button
- size="sm"
- variant="ghost"
- className="h-auto whitespace-nowrap rounded-full px-2.5 py-2 text-ui-13 font-medium text-foreground"
- onClick={snooze}
- data-testid="llama-update-snooze-button"
- >
- Remind me later
- </Button>
- <Button
- size="sm"
- // align the pill edge with the card padding.
- className="-mr-1 h-auto whitespace-nowrap rounded-full px-3 py-2 text-ui-13"
- onClick={handleUpdate}
- data-testid="llama-update-button"
- >
- Update
- </Button>
- </div>
+ <Button
+ size="sm"
+ variant="ghost"
+ className="h-auto whitespace-nowrap rounded-full px-2.5 py-2 text-ui-13 font-medium text-foreground"
+ onClick={snooze}
+ data-testid="llama-update-snooze-button"
+ >
+ Later
+ </Button>
+ <Button
+ size="sm"
+ // align the pill edge with the card padding.
+ className="-mr-1 h-auto whitespace-nowrap rounded-full px-3 py-2 text-ui-13"
+ onClick={handleUpdate}
+ data-testid="llama-update-button"
+ >
+ Update
+ </Button>
</div>
)}
</div>
</div>
- ) : null;
+ );
+}
+
+// long enough to read and reach Undo; hover or focus holds it open.
+const SKIPPED_NOTICE_MS = 6000;
+
+function SkippedNotice({
+ message,
+ focusUndo,
+ positioned,
+ onUndo,
+ onExpire,
+}: {
+ message: string;
+ focusUndo: boolean;
+ positioned: boolean;
+ onUndo: () => void;
+ onExpire: () => void;
+}): ReactElement {
+ const undoRef = useRef<HTMLButtonElement>(null);
+ const [hovered, setHovered] = useState(false);
+ const [focused, setFocused] = useState(false);
+ // the skip button is gone, so keyboard focus moves to Undo instead of the page.
+ useEffect(() => {
+ if (focusUndo) {
+ undoRef.current?.focus({ preventScroll: true });
+ }
+ }, [focusUndo]);
+ // expiring under focus would drop it on the page body.
+ useEffect(() => {
+ if (hovered || focused) {
+ return;
+ }
+ const timer = setTimeout(onExpire, SKIPPED_NOTICE_MS);
+ return () => clearTimeout(timer);
+ }, [hovered, focused, onExpire]);
+ return (
+ <div
+ className={cn(
+ "w-[calc(100vw-2rem)] max-w-[calc(448px*var(--ui-space-scale,1))]",
+ positioned
+ ? "fixed bottom-4 right-4 z-[9998]"
+ : "pointer-events-auto shrink-0",
+ )}
+ onMouseEnter={() => setHovered(true)}
+ onMouseLeave={() => setHovered(false)}
+ onFocus={() => setFocused(true)}
+ onBlur={(event) => {
+ if (!event.currentTarget.contains(event.relatedTarget as Node | null)) {
+ setFocused(false);
+ }
+ }}
+ data-testid="llama-update-skipped"
+ >
+ <div className="flex items-center gap-3 rounded-[24px] bg-white py-2.5 pl-5 pr-3 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] dark:bg-card dark:shadow-[0_8px_28px_-6px_var(--background)]">
+ {/* <output> carries the implicit status role, so screen readers announce the skip. */}
+ <output
+ className="block min-w-0 grow truncate text-ui-13 text-foreground"
+ title={message}
+ >
+ {message}
+ </output>
+ <Button
+ ref={undoRef}
+ size="sm"
+ variant="ghost"
+ className="h-auto shrink-0 whitespace-nowrap rounded-full px-2.5 py-2 text-ui-13 font-medium text-foreground"
+ onClick={onUndo}
+ data-testid="llama-update-undo-skip"
+ >
+ Undo
+ </Button>
+ </div>
+ </div>
+ );
}
diff --git a/studio/frontend/src/hooks/use-llama-update-check.ts b/studio/frontend/src/hooks/use-llama-update-check.ts
index 347d1a4575a..6448c268224 100644
--- a/studio/frontend/src/hooks/use-llama-update-check.ts
+++ b/studio/frontend/src/hooks/use-llama-update-check.ts
@@ -3,7 +3,6 @@
import { authFetch, getAuthToken } from "@/features/auth";
import { refreshHardwareInfo } from "@/hooks/use-hardware-info";
-import { notifyModelLifecycle } from "@/lib/model-lifecycle-events";
import {
signalRunningLlamaJob,
subscribeToLlamaJobStarted,
@@ -12,6 +11,7 @@ import {
llamaUpdateAdoptsRunningJob,
llamaUpdatePresentation,
} from "@/lib/llama-job-lifecycle";
+import { notifyModelLifecycle } from "@/lib/model-lifecycle-events";
import { useCallback, useEffect, useRef, useState } from "react";
// Initial check plus hourly reminders until dismissed or applied.
@@ -182,7 +182,8 @@ function parseStatus(value: unknown): LlamaUpdateStatus | null {
typeof s.llama_update_available === "boolean"
? s.llama_update_available
: s.update_available === true && component === "llama.cpp",
- installed_tag: typeof s.installed_tag === "string" ? s.installed_tag : null,
+ installed_tag:
+ typeof s.installed_tag === "string" ? s.installed_tag : null,
latest_tag: typeof s.latest_tag === "string" ? s.latest_tag : null,
update_size_bytes:
typeof s.update_size_bytes === "number" ? s.update_size_bytes : null,
@@ -652,9 +653,9 @@ export function useLlamaUpdateCheck({
});
}, [enabled, readStatus, surfaceIfAvailable]);
- const dismiss = useCallback(() => {
+ const dismiss = useCallback((): string | null => {
const current = statusRef.current;
- if (!current) return;
+ if (!current) return null;
const suppression: OfferSuppression = {
kind: "dismissed",
offerKey: offerKey(current),
@@ -662,8 +663,23 @@ export function useLlamaUpdateCheck({
suppressionRef.current = suppression;
publishOfferSuppression(suppression);
presentStatus(current);
+ return suppression.offerKey;
}, [presentStatus]);
+ // a later snooze or a skip of another offer is left alone.
+ const undoDismiss = useCallback(
+ (key: string) => {
+ const suppression = suppressionRef.current;
+ if (suppression?.kind !== "dismissed" || suppression.offerKey !== key) {
+ return;
+ }
+ clearSuppression();
+ const current = statusRef.current;
+ if (current) presentStatus(current);
+ },
+ [clearSuppression, presentStatus],
+ );
+
const snooze = useCallback(() => {
const current = statusRef.current;
if (!current) return;
@@ -749,6 +765,7 @@ export function useLlamaUpdateCheck({
applying: enabled && applying,
apply,
dismiss,
+ undoDismiss,
snooze,
};
}
diff --git a/studio/frontend/tests/update-banner-flex-priority.test.ts b/studio/frontend/tests/update-banner-flex-priority.test.ts
index 771acf56ecb..8797e5eb6d1 100644
--- a/studio/frontend/tests/update-banner-flex-priority.test.ts
+++ b/studio/frontend/tests/update-banner-flex-priority.test.ts
@@ -195,17 +195,17 @@ test("the llama.cpp card takes the desktop updater's floor only with its changel
LLAMA.indexOf("pointer-events-auto flex "),
LLAMA.indexOf('data-testid="llama-update-banner"'),
);
- // each bundled component after the first adds one 18px text-xs row to the shared floor.
- for (const [base, text] of [
- ["117px", "93px"],
- ["24px", "224px"],
+ // the details toggle adds 22px; each extra bundled component adds an 18px row.
+ for (const [base, text, llamaText] of [
+ ["117px", "93px", "115px"],
+ ["24px", "224px", "246px"],
]) {
assert.ok(
TAURI.includes(`min-h-[calc(${base}+${text}*var(--ui-font-scale,1))]`),
);
assert.ok(
slot.includes(
- `min-h-[calc(${base}+(${text}+18px*var(--llama-update-extra-rows,0))*var(--ui-font-scale,1))]`,
+ `min-h-[calc(${base}+(${llamaText}+18px*var(--llama-update-extra-rows,0))*var(--ui-font-scale,1))]`,
),
);
}
@@ -406,15 +406,15 @@ test("the rail's block gutter costs the cards no room", () => {
// The gutter drops the rail's box to the floor and it reaches the right edge,
// so it spans the window's resize grips, which are under it on Tailwind's scale.
// All eight: a narrow window spans the rail across the north and west targets too.
- const TITLEBAR = readSrc("components/tauri/window-titlebar.tsx");
+ const titlebar = readSrc("components/tauri/window-titlebar.tsx");
// A z-index on the toolbar would read as protection and give none: it sits inside a
// positioned, numbered header, which is a stacking context.
- const toolbar = TITLEBAR.slice(
- TITLEBAR.lastIndexOf(
+ const toolbar = titlebar.slice(
+ titlebar.lastIndexOf(
"<div",
- TITLEBAR.indexOf('aria-label="Window controls"'),
+ titlebar.indexOf('aria-label="Window controls"'),
),
- TITLEBAR.indexOf('aria-label="Window controls"'),
+ titlebar.indexOf('aria-label="Window controls"'),
);
assert.doesNotMatch(
toolbar,
@@ -431,9 +431,9 @@ test("the rail's block gutter costs the cards no room", () => {
"cursor-sw-resize",
"cursor-se-resize",
]) {
- const target = TITLEBAR.slice(
- TITLEBAR.lastIndexOf("<div", TITLEBAR.indexOf(grip)),
- TITLEBAR.indexOf("/>", TITLEBAR.indexOf(grip)),
+ const target = titlebar.slice(
+ titlebar.lastIndexOf("<div", titlebar.indexOf(grip)),
+ titlebar.indexOf("/>", titlebar.indexOf(grip)),
);
assert.doesNotMatch(
target,
diff --git a/tests/studio/playwright_update_banner_layout.py b/tests/studio/playwright_update_banner_layout.py
index 436ba2a688e..78caecfe7e8 100644
--- a/tests/studio/playwright_update_banner_layout.py
+++ b/tests/studio/playwright_update_banner_layout.py
@@ -207,6 +207,17 @@ BUNDLE_STATUS = dict(
"skip_reason": None,
},
)
+# a backend switch for llama.cpp bundled with a whisper.cpp update; one skip dismisses both.
+MIGRATION_BUNDLE_STATUS = dict(
+ LLAMA_STATUS,
+ update_available = False,
+ llama_update_available = False,
+ latest_tag = LLAMA_STATUS["installed_tag"],
+ backend_migration_available = True,
+ from_backend = "rocm",
+ to_backend = "vulkan",
+ whisper = WHISPER_STATUS["whisper"],
+)
# 921x534 and 768x500 reproduce the issue; taller viewports guard roomy layouts.
VIEWPORTS = [
@@ -883,7 +894,7 @@ LLAMA_CHANGELOG_GEOMETRY = """
const list = q('[data-testid="llama-update-changelog-list"]');
const toggle = q('[data-testid="llama-update-changelog-toggle"]');
const update = q('[data-testid="llama-update-button"]');
- const footer = update ? update.closest('div').parentElement : null;
+ const footer = update ? update.closest('div') : null;
return {
surface: rect(surface), list: rect(list), toggle: rect(toggle),
update: rect(update), footer: rect(footer),
@@ -929,6 +940,119 @@ def settle_llama_changelog(page, timeout_s: float = 3.0) -> None:
info(f"WARN the open llama.cpp changelog never held one height for 3 frames (last={last})")
+# Matches SKIPPED_NOTICE_MS in llama-update-banner.tsx, plus slack.
+SKIPPED_NOTICE_WAIT_MS = 6_000 + 1_500
+
+
+def exercise_skip_undo(page, label: str) -> None:
+ """Undo restores a card past its notification-frequency gate, and focus holds the notice open."""
+ card = page.locator('[data-testid="llama-update-banner"]')
+ notice = page.locator('[data-testid="llama-update-skipped"]')
+ toggle = page.locator('[data-testid="llama-update-changelog-toggle"]')
+ skip = page.locator('[data-testid="llama-update-skip-button"]')
+ undo = page.locator('[data-testid="llama-update-undo-skip"]')
+ check(f"{label}: the card is up before skipping", card.count() == 1)
+ if card.count() != 1:
+ return
+ toggle.click()
+ skip.click()
+ notice.wait_for(state = "visible", timeout = 5_000)
+ # whisper.cpp defaults to biweekly, so the card was recorded as shown and is no longer due.
+ undo.click()
+ try:
+ card.wait_for(state = "visible", timeout = 5_000)
+ except PlaywrightTimeoutError:
+ pass
+ check(
+ f"{label}: Undo brings back a card the frequency gate would hide",
+ card.count() == 1 and notice.count() == 0,
+ f"cards={card.count()} notices={notice.count()}",
+ )
+ if card.count() != 1:
+ return
+
+ # keyboard activation moves focus to Undo, and focus keeps the notice up.
+ skip.focus()
+ page.keyboard.press("Enter")
+ notice.wait_for(state = "visible", timeout = 5_000)
+ focused = page.evaluate("document.activeElement?.getAttribute('data-testid') ?? null")
+ check(
+ f"{label}: a keyboard skip moves focus to Undo",
+ focused == "llama-update-undo-skip",
+ f"focused={focused!r}",
+ )
+ page.mouse.move(0, 0)
+ page.wait_for_timeout(SKIPPED_NOTICE_WAIT_MS)
+ check(
+ f"{label}: the notice stays while Undo has focus",
+ notice.count() == 1,
+ f"notices={notice.count()}",
+ )
+ page.keyboard.press("Enter")
+ try:
+ card.wait_for(state = "visible", timeout = 5_000)
+ except PlaywrightTimeoutError:
+ pass
+ check(
+ f"{label}: Enter on the focused Undo restores the card",
+ card.count() == 1,
+ f"cards={card.count()}",
+ )
+ if toggle.count() == 1 and toggle.get_attribute("aria-expanded") == "true":
+ toggle.click()
+
+
+# Signs out locally and follows a client-side route change, which keeps the banner mounted.
+LEAVE_FOR_LOGIN = """
+() => {
+ localStorage.removeItem('unsloth_auth_token');
+ localStorage.removeItem('unsloth_refresh_token');
+ const index = (history.state?.__TSR_index ?? 0) + 1;
+ history.pushState({ ...history.state, __TSR_index: index }, '', '/login');
+ dispatchEvent(new PopStateEvent('popstate'));
+}
+"""
+
+
+def exercise_skip_on_auth_route(page, label: str) -> None:
+ """A skip notice must not follow the user onto a route that hides the update cards."""
+ card = page.locator('[data-testid="llama-update-banner"]')
+ notice = page.locator('[data-testid="llama-update-skipped"]')
+ check(f"{label}: the card is up before skipping", card.count() == 1)
+ if card.count() != 1:
+ return
+ page.locator('[data-testid="llama-update-changelog-toggle"]').click()
+ page.locator('[data-testid="llama-update-skip-button"]').focus()
+ page.keyboard.press("Enter")
+ notice.wait_for(state = "visible", timeout = 5_000)
+ page.evaluate(LEAVE_FOR_LOGIN)
+ page.wait_for_url("**/login", timeout = 10_000)
+ page.wait_for_timeout(500)
+ check(
+ f"{label}: the skip notice does not follow onto /login",
+ notice.count() == 0,
+ f"notices={notice.count()}",
+ )
+ page.evaluate("localStorage.removeItem('unsloth_llama_update_offer_suppression')")
+
+
+def check_bundled_skip_label(page, label: str) -> None:
+ """A skip dismisses the whole offer, so a bundle with a backend switch names it in the plural."""
+ toggle = page.locator('[data-testid="llama-update-changelog-toggle"]')
+ check(f"{label}: the card is up", toggle.count() == 1)
+ if toggle.count() != 1:
+ return
+ toggle.click()
+ skip = page.locator('[data-testid="llama-update-skip-button"]')
+ text = skip.text_content() if skip.count() == 1 else None
+ check(
+ f"{label}: the skip action reads plural",
+ text == "Skip these versions",
+ f"text={text!r}",
+ )
+ toggle.click()
+
+
def exercise_llama_changelog(page, label: str) -> None:
toggle = page.locator('[data-testid="llama-update-changelog-toggle"]')
check(
@@ -1118,26 +1242,31 @@ def main() -> int:
llama_payload[0] = WHISPER_STATUS
boot(page, "/")
facts = measure(page, f"{width}x{height} new chat whisper")
- rows = page.locator('[data-testid="llama-update-version-line"]').count()
check(
f"{width}x{height}: whisper.cpp reuses the one runtime card",
page.locator('[data-testid="llama-update-banner"]').count() <= 1
- and "whisper.cpp" in facts["llamaText"]
- and rows == 1,
- f"rows={rows} text={facts['llamaText']!r}",
+ and "whisper.cpp" in facts["llamaText"],
+ f"text={facts['llamaText']!r}",
)
+ if (width, height) == (VIEWPORTS[2:5] if SPOT else VIEWPORTS)[0]:
+ exercise_skip_undo(page, f"{width}x{height} whisper")
+ exercise_skip_on_auth_route(page, f"{width}x{height} whisper")
- # pending runtimes add rows without adding cards.
llama_payload[0] = BUNDLE_STATUS
boot(page, "/")
facts = measure(page, f"{width}x{height} new chat bundle")
- rows = page.locator('[data-testid="llama-update-version-line"]').count()
+ summary = page.locator('[data-testid="llama-update-summary"]').text_content() or ""
check(
- f"{width}x{height}: three pending runtimes share the one card, a row each",
- page.locator('[data-testid="llama-update-banner"]').count() == 1 and rows == 3,
- f"rows={rows} text={facts['llamaText']!r}",
+ f"{width}x{height}: three pending runtimes share the one card",
+ page.locator('[data-testid="llama-update-banner"]').count() == 1
+ and "llama.cpp, whisper.cpp and audio.cpp" in summary,
+ f"summary={summary!r}",
)
exercise_llama_changelog(page, f"{width}x{height} bundle")
+ if (width, height) == (VIEWPORTS[2:5] if SPOT else VIEWPORTS)[0]:
+ llama_payload[0] = MIGRATION_BUNDLE_STATUS
+ boot(page, "/")
+ check_bundled_skip_label(page, f"{width}x{height} migration bundle")
llama_payload[0] = LLAMA_STATUS
context.close()