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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: press every shipped shortcut chord in the smoke suite (#11253)
Michael Hane22956a9f0bd
diff --git a/studio/frontend/smoke-shortcuts-main.tsx b/studio/frontend/smoke-shortcuts-main.tsxindex 38425e90ea9..c37b7da9620 100644--- a/studio/frontend/smoke-shortcuts-main.tsx+++ b/studio/frontend/smoke-shortcuts-main.tsx@@ -33,6 +33,7 @@ declare global {registry: typeof registry;store: typeof shortcutStore;nav: typeof useChatNavigationStore;+ recordedAs: Partial<Record<registry.ShortcutId, string>>;fired: () => Fired[];reset: () => void;setActiveChat: (value: string | null) => void;@@ -66,6 +67,44 @@ const withActiveChat = (run: (item: string) => void) => {run(activeChat.current);};+/** Actions the blocks in Harness register by hand. The rest come from the registry+ * below, so every shipped chord has a listener here to reach. This stands in for the+ * app's own call sites, which the node suite pins by source text. */+const NAMED_IDS = new Set<registry.ShortcutId>([+ "archiveChat",+ "togglePinChat",+ "deleteSelectedChats",+ "clearAllUnreads",+ "approveToolRequest",+ "declineToolRequest",+ "nextChat",+ "searchChats",+ "newChat",+ "openSettings",+ "toggleSidebar",+ "copySessionId",+]);++const GENERIC_IDS = registry.SHORTCUT_DEFS.map((def) => def.id).filter(+ (id) => !NAMED_IDS.has(id),+);++/** What a named block records, where that is not the id. Anything absent, generic+ * rows included, records its own id. */+const RECORDED_AS: Partial<Record<registry.ShortcutId, string>> = {+ archiveChat: "archiveActive",+ togglePinChat: "pinActive",+ clearAllUnreads: "toast.info",+ approveToolRequest: "approve",+ declineToolRequest: "decline",+};++/** One hook per action: a loop inside Harness would break the rules of hooks. */+function GenericRow({ id }: { id: registry.ShortcutId }) {+ useShortcut(id, () => record(id));+ return null;+}+function Harness() {const [selectionCount, setSelectionCount] = useState(0);const [toolPending, setToolPending] = useState(true);@@ -137,6 +176,9 @@ function Harness() {return (<div>+ {GENERIC_IDS.map((id) => (+ <GenericRow key={id} id={id} />+ ))}<button type="button" id="smoke-button" onClick={() => record("buttonClick")}>Deny</button>@@ -170,6 +212,7 @@ window.__shortcutsSmoke = {registry,store: shortcutStore,nav: useChatNavigationStore,+ recordedAs: RECORDED_AS,fired: () => fired.slice(),reset: () => {fired.length = 0;diff --git a/studio/frontend/tests/keyboard-shortcuts.test.ts b/studio/frontend/tests/keyboard-shortcuts.test.tsindex 0a4eccbcc5b..7f31dc4927d 100644--- a/studio/frontend/tests/keyboard-shortcuts.test.ts+++ b/studio/frontend/tests/keyboard-shortcuts.test.ts@@ -1515,6 +1515,20 @@ test("every action has a useShortcut call site", async () => {}});+// The call-site test above accepts the numbered slots on the template alone, so a+// shorter RECENT_SLOT_NUMBERS would leave the trailing rows showing a chord with+// nothing behind it. Tie the loop to what the registry declares.+test("the Recents loop registers every numbered slot the registry declares", () => {+ const slots = /const RECENT_SLOT_NUMBERS = \[([\d, ]+)\] as const;/.exec(APP_SIDEBAR);+ assert.ok(slots, "RECENT_SLOT_NUMBERS is no longer a literal list");+ assert.deepEqual(+ slots[1].split(",").map((n) => `goToRecentChat${n.trim()}`),+ SHORTCUT_DEFS.map((def) => def.id).filter((id) =>+ id.startsWith("goToRecentChat"),+ ),+ );+});+// Holding a chord past the OS repeat delay resends it. A toggle would land// wherever the user let go, and an archive would run once per repeat.test("auto-repeat only reaches the actions that walk a list", async () => {diff --git a/tests/studio/playwright_keyboard_shortcuts.py b/tests/studio/playwright_keyboard_shortcuts.pyindex 181352b9361..18ebb98217f 100644--- a/tests/studio/playwright_keyboard_shortcuts.py+++ b/tests/studio/playwright_keyboard_shortcuts.py@@ -142,6 +142,49 @@ def check_defaults(page, engine: str, platform: str) -> None:check(engine, platform, "no unreachable Ctrl default off macOS", not ctrl, str(ctrl))+def check_every_default(page, engine: str, platform: str) -> None:+ """Press every chord the build ships, not just the handful named below.++ The harness registers the registry itself, so this is the dispatch layer end to+ end: a default the matcher cannot match, a chord another action owns, a modifier+ that maps differently off macOS. The app's own call sites are pinned separately,+ by "every action has a useShortcut call site" in the node suite.+ """+ rows = page.evaluate(+ """() => {+ const r = window.__shortcutsSmoke.registry;+ const mac = r.isMacPlatform();+ const out = [];+ for (const def of r.SHORTCUT_DEFS) {+ for (const slot of r.SHORTCUT_SLOTS) {+ const value = r.defaultBindingFor(def, slot, mac);+ if (value != null) out.push({ id: def.id, slot, value });+ }+ }+ return out;+ }"""+ )+ recorded_as = page.evaluate("window.__shortcutsSmoke.recordedAs")+ missed: list[str] = []+ for row in rows:+ reset(page)+ # The Tab chords in this loop move focus, and a focused control keeps+ # its own Enter, so the bare-key pair would look dead without this.+ page.evaluate("document.activeElement && document.activeElement.blur()")+ page.keyboard.press(to_press(row["value"], platform))+ expected = recorded_as.get(row["id"], row["id"])+ if expected not in actions(page):+ missed.append(f"{row['id']}.{row['slot']} {row['value']}")+ reset(page)+ check(+ engine,+ platform,+ f"every shipped chord fires its action ({len(rows)} slots)",+ not missed,+ ", ".join(missed)[:300],+ )++def check_dispatch(page, engine: str, platform: str) -> None:reset(page)page.keyboard.press(to_press("Mod+Comma", platform))@@ -594,6 +637,7 @@ def run_engine(pw, engine: str) -> None:page.wait_for_selector("#smoke-ready", timeout = 120000)try:check_defaults(page, engine, platform)+ check_every_default(page, engine, platform)check_dispatch(page, engine, platform)check_text_fields(page, engine, platform)check_bare_keys(page, engine, platform)