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
Repoint three guard tests at where the code moved, and derive the font-size expectations (#7833)
Daniel Han6a2d705aa17e
diff --git a/studio/frontend/tests/sidebar-spinner-column.test.ts b/studio/frontend/tests/sidebar-spinner-column.test.tsindex 57945f7d23d..86aaec8f078 100644--- a/studio/frontend/tests/sidebar-spinner-column.test.ts+++ b/studio/frontend/tests/sidebar-spinner-column.test.ts@@ -39,7 +39,9 @@ test("nav and Recents spinners land on one trailing column", async () => {);const chatRow = grab(source,- /"(sidebar-nav-btn h-\[33px\] cursor-pointer rounded-full[^"]*)"/,+ // Row height is a density choice and moves independently of the trailing+ // column, so match any h-[Npx]; cursor-pointer is what makes this the chat row.+ /"(sidebar-nav-btn h-\[\d+px\] cursor-pointer rounded-full[^"]*)"/,"Recents chat row",);const chatSpinner = grab(diff --git a/tests/studio/playwright_ui_font_scale.py b/tests/studio/playwright_ui_font_scale.pyindex 2e2d859e603..a9dd4652b06 100644--- a/tests/studio/playwright_ui_font_scale.py+++ b/tests/studio/playwright_ui_font_scale.py@@ -13,6 +13,7 @@ Runs against an already-booted, already-bootstrapped Unsloth:"""import os+import reimport sysfrom pathlib import Path@@ -27,9 +28,29 @@ PW = os.environ["STUDIO_PW"]ART = Path(os.environ.get("PW_ART_DIR", "logs/playwright_fontscale"))ART.mkdir(parents = True, exist_ok = True)-SIZES = (12, 20)-# UI_FONT_SIZE_RANGE default (appearance-custom-store.ts); only here is data-ui-font-size dropped.-DEFAULT = 15+# Read the range from the store instead of restating it: the default is the one+# size at which data-ui-font-size is dropped, and it has already moved once+# (16 -> 15), which is exactly what a pinned copy here fails on.+_STORE = (+ Path(__file__).resolve().parents[2]+ / "studio/frontend/src/features/settings/stores/appearance-custom-store.ts"+).read_text(encoding = "utf-8")+_RANGE = re.search(+ r"UI_FONT_SIZE_RANGE\s*=\s*\{\s*min:\s*(\d+),\s*max:\s*(\d+),\s*default:\s*(\d+)",+ _STORE,+)+if _RANGE is None:+ raise AssertionError("[font-scale] FAIL: no UI_FONT_SIZE_RANGE in appearance-custom-store.ts")+SIZES = (int(_RANGE.group(1)), int(_RANGE.group(2)))+DEFAULT = int(_RANGE.group(3))+# The base the authored rem typography is written against; --ui-font-scale is+# the preference divided by it.+_BASE = re.search(r"UI_FONT_SIZE_CSS_BASE\s*=\s*(\d+)", _STORE)+if _BASE is None:+ raise AssertionError(+ "[font-scale] FAIL: no UI_FONT_SIZE_CSS_BASE in appearance-custom-store.ts"+ )+CSS_BASE = int(_BASE.group(1))def step(s):@@ -227,23 +248,24 @@ def main():page.goto(f"{BASE}/hub", wait_until = "domcontentloaded")page.wait_for_timeout(2000)open_appearance(page)- set_input(page, "UI font size", 12)+ small = SIZES[0]+ set_input(page, "UI font size", small)page.keyboard.press("Escape")page.wait_for_timeout(400)tab = page.get_by_role("radio").filter(has_text = "Discover").firsttab.wait_for(state = "visible", timeout = 15000)tab_font = tab.evaluate("el => parseFloat(getComputedStyle(el).fontSize)")- # text-ui-12p5 at scale 0.75; 16px means twMerge dropped the token.- if not near(tab_font, 12.5 * 12 / 16):+ # text-ui-12p5 at the smallest scale; the unscaled 12.5px means twMerge dropped the token.+ if not near(tab_font, 12.5 * small / CSS_BASE):fail(f"hub tab font did not scale (twMerge drop?): {tab_font}")icon_w = page.evaluate("() => { const el = document.querySelector('.size-icon');"" return el ? parseFloat(getComputedStyle(el).width) : null; }")- # Standard icons render at the UI font size itself below the- # default, so setting 12 gives 12px glyphs.- if not near(icon_w, 12):- fail(f"size-icon did not match the UI font size below 16: {icon_w}")+ # Standard icons render at the UI font size itself below the CSS base,+ # so the smallest setting gives glyphs of exactly that many px.+ if not near(icon_w, small):+ fail(f"size-icon did not match the UI font size below {CSS_BASE}: {icon_w}")page.goto(BASE, wait_until = "domcontentloaded")page.wait_for_timeout(1500)open_appearance(page)diff --git a/tests/studio/test_model_picker_contracts.py b/tests/studio/test_model_picker_contracts.pyindex 7d5faca3e35..69353c5adc8 100644--- a/tests/studio/test_model_picker_contracts.py+++ b/tests/studio/test_model_picker_contracts.py@@ -410,10 +410,14 @@ def test_a_pinned_cached_row_loads_from_the_id_the_backend_pinned():block = re.search(r"onSelect\(repoId, \{.*?\n\s*\}", picker, re.S)assert block and "loadId: downloaded === true ? loadId : undefined," in block.group(0)# localPath alone: preferLocalCache would answer from disk and drop the undownloaded quants.- assert (- "listGgufVariants(repoId, hfToken, localSource ? { localPath: localSource } : undefined)"- in picker- )+ # #7767 added the expander's abort signal to this call, so the options are an object+ # literal now rather than the bare localSource ternary.+ call = re.search(r"listGgufVariants\(repoId, hfToken, \{.*?\n\s*\}\)", picker, re.S)+ assert call, "the expander must still list variants for the row's own repo"+ assert "...(localSource ? { localPath: localSource } : {})" in call.group(+ 0+ ), "the expander drops the row's own cache directory"+ assert "preferLocalCache" not in call.group(0)assert "cachePath={c.cache_path}" in picker# A reload rebuilds its target from the checkpoint id, so the resident model remembers the pin.@@ -528,11 +532,19 @@ def test_chat_autoload_scopes_variant_lookup_to_cached_repo_path():assert auto_load.count("preferLocalCache: true") >= 2assert auto_load.count("localPath: repo.cache_path") >= 2+ # #7767 moved the query building out of chat-api into its own module, so the listing+ # imports without the auth barrel. Both halves are pinned: the caller must still hand+ # its options to the builder, and the builder must still forward them.chat_api = _read("features/chat/api/chat-api.ts")variants_fn = chat_api.split("export async function listGgufVariants", 1)[1]variants_fn = variants_fn.split("export interface KvCacheEstimate", 1)[0]- assert 'params.set("prefer_local_cache", "true")' in variants_fn- assert 'params.set("local_path", localPath)' in variants_fn+ assert "ggufVariantsQuery(repoId, options, isHuggingFaceOffline())" in variants_fn++ query_src = _read("features/chat/api/gguf-variants-request.ts")+ query_fn = query_src.split("export function ggufVariantsQuery", 1)[1]+ query_fn = query_fn.split("\nexport ", 1)[0]+ assert 'params.set("prefer_local_cache", "true")' in query_fn+ assert 'params.set("local_path", localPath)' in query_fndef test_cache_location_update_invalidates_frontend_inventory():diff --git a/tests/studio/test_ui_font_scale_contract.py b/tests/studio/test_ui_font_scale_contract.pyindex 44457dd6abb..f2a0dec3bb5 100644--- a/tests/studio/test_ui_font_scale_contract.py+++ b/tests/studio/test_ui_font_scale_contract.py@@ -58,13 +58,20 @@ def test_preference_writes_a_scale_not_the_root_font_size():assert "style.fontSize" not in STORE-def test_default_ui_font_size_is_fifteen():- assert "UI_FONT_SIZE_RANGE = { min: 12, max: 20, default: 15 }" in STORE- assert "const UI_FONT_SIZE_CSS_BASE = 16;" in STORE+def test_css_default_scale_matches_the_store_default():+ """index.css carries the default as a scale, the store carries it as a px+ size, and the applier only drops data-ui-font-size at the store's value.+ Derive the scale so the two cannot drift: when they did, everything+ rendered at one size while the preference control called it another."""+ rng = re.search(r"UI_FONT_SIZE_RANGE = \{ min: (\d+), max: (\d+), default: (\d+) \}", STORE)+ assert rng is not None+ base = re.search(r"const UI_FONT_SIZE_CSS_BASE = (\d+);", STORE)+ assert base is not Noneassert "c.uiFontSize ?? UI_FONT_SIZE_RANGE.default" in STOREassert "effectiveUiFontSize !== UI_FONT_SIZE_RANGE.default" in STOREassert "effectiveUiFontSize / UI_FONT_SIZE_CSS_BASE" in STORE- assert "--ui-font-scale: 0.9375;" in INDEX_CSS+ scale = int(rng.group(3)) / int(base.group(1))+ assert f"--ui-font-scale: {scale:g};" in INDEX_CSSdef test_named_text_tokens_scale():