Skip to content

fix(rocm): select the catalog backend column from the resolved backend - #1921

Merged
inureyes merged 3 commits into
mainfrom
fix/issue-1886-rocm-catalog-backend
Sep 19, 2026
Merged

inureyes merged 3 commits into
mainfrom
fix/issue-1886-rocm-catalog-backend

Conversation

@inureyes

@inureyes inureyes commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Summary

The WebUI catalog picked its registry column with a cfg!(metal) / cfg!(cuda) / else chain, so every ROCm build reported every architecture as not runnable. It now reads the column for mlxcel_core::hardware::gpu_backend_kind(), the backend MLX resolved at runtime. GpuBackendKind::None reads as Unsupported. A build with no GPU backend resolves to None, and so does a ROCm build with no visible device.

  • BackendSupport gains a rocm column and replaces both positional [BackendStatus; 2] arrays. None remain.
  • Every family's ROCm column is ROCM_FIRST_PASS = Partial. The reasoning sits next to the const: the backend is experimental, fused kernels run as graph fallbacks until perf(rocm): allocator footprint and ROCm ports of mlxcel fused kernels #1814, and few checkpoints have run on AMD. Partial keeps families runnable in the catalog without claiming Metal parity. Per-family refinement belongs to epic: AMD GPU (ROCm) backend on Linux via mlxcelverse #1801.
  • mlxcel-core gets GpuBackendKind::ALL and a compile-time guard. The guard's match has no wildcard, and each arm reads its own variant's slot of ALL. A new variant therefore fails to compile until it has an arm, and the arm fails to compile (unconditional_panic on ALL[N]) until ALL lists the variant. A catalog test walks ALL, so a listed kind with no registry column fails.
  • mlxcel arch --json gains an additive rocm key under each family's backends object, documented in docs/supported-models.md. No HTTP response carries BackendSupport. The catalog still exposes only the runnable_on_backend boolean and its reason (docs/webui/catalog.md and catalog.ko.md now say it follows the runtime-resolved backend).

Effect per build

  • --features metal and --features cuda: unchanged. At the pinned MLX, metal::is_available() and cu::is_available() both return a compile-time true, so these builds always resolve Metal or Cuda and read the same column as before. The catalog contract fixture (tests/fixtures/webui/examples/catalog.page.json) and the five tests named in the issue are unchanged and pass on Metal.
  • --features rocm: reads the new ROCm column, so runnable families show as runnable.
  • macOS without the metal cargo feature: now reads the Metal column. mlxcel-core/build.rs builds MLX with Metal on for every macOS build, but the old chain also required feature = "metal", so those builds reported nothing runnable. That includes the release workflow's cargo build --release --target aarch64-apple-darwin --locked, which uses default features. No tagged release is affected, because v0.7.0 predates the catalog.

Verification (this host: Apple Silicon, Metal)

On the final tree:

  • cargo fmt --all -- --check: pass.
  • cargo test --profile test-fast --features metal,accelerate -p mlxcel --lib server::webui::catalog: 37 passed, 0 failed. This includes the five tests named in the issue and the four new backend_tests.
  • cargo test --profile test-fast --features metal,accelerate -p mlxcel --lib models::registry: 10 passed, 0 failed. This includes every_family_is_runnable_on_rocm and the extended registry_json_round_trips, which pins the backends JSON for qwen3, whisper and rt_detr_v2.
  • cargo clippy -p mlxcel --lib --tests --features metal,accelerate -- -D warnings: pass.

Revert checks (each change was restored afterwards):

  • Dropping the Rocm arm from backend_status_for fails each_backend_kind_reads_its_own_column and every_gpu_backend_kind_has_a_registry_column (2 passed, 2 failed).
  • Wiring Rocm to the CUDA column fails each_backend_kind_reads_its_own_column.
  • Setting ROCM_FIRST_PASS to Unsupported, which reproduces the issue's defect in the registry, fails every_family_is_runnable_on_rocm and registry_json_round_trips (8 passed, 2 failed).
  • Forcing the catalog to resolve None, which is what the old chain did on ROCm, fails 7 of the 37 catalog tests, among them the five issue tests and the live-wiring test. Forcing it to resolve Rocm passes all 37.
  • Swapping two entries of GpuBackendKind::ALL stops mlxcel-core compiling (E0080). A standalone rustc build of the guard shows the missing-variant case: a fifth variant that is given an arm but left out of ALL fails to compile, and adding it to ALL makes the build compile again.

A search for other Metal/CUDA/else cfg! chains found none. The remaining cfg!(feature = "cuda") sites gate CUDA-only behavior, so nothing was filed.

Real-binary verification (Metal)

Run by the epic #1910 orchestrator on M1 Ultra (macOS 27.0) with mlxcel-server and mlxcel built from this PR head (988aa718) under --profile test-fast --features metal,accelerate, serving the 224-entry local store with --webui --models-dir models/mlx --no-models-autoload.

  • Every catalog page (224 items) was dumped from this binary and from a binary without this change (414d45dc, which does not touch the catalog). supported, metadata.support (architecturally_supported, runnable_on_backend and both reasons) and every pre_load capability are identical for all 224 entries: 201 supported and 209 runnable on both. The only raw difference was the provider_ready capabilities of the one model that was loaded during the baseline capture.
  • mlxcel arch --json: all 181 backends objects carry "rocm": "partial" next to the unchanged metal and cuda values.

Not verified on this host

These need the gfx1151 ROCm host or a CUDA host and were not run:

  • cargo test --workspace --profile test-fast --features rocm -p mlxcel --lib server::webui::catalog
  • cargo test --workspace --profile test-fast --features rocm -p mlxcel --lib
  • cargo clippy --workspace --all-targets --features rocm -- -D warnings
  • CUDA regression guard: cargo test --workspace --profile test-fast --features cuda -p mlxcel --lib server::webui::catalog
  • Manual: on the gfx1151 host, start the server, open the WebUI model catalog, and confirm a qwen3 model is listed as runnable with its capabilities available.

In their place, this host ran the following. The pure mapping tests exercise GpuBackendKind::Rocm and GpuBackendKind::None against every column layout. The ALL walk fails for any kind without a column. every_family_is_runnable_on_rocm pins the registry side. The forced-Rocm catalog run passes all 37 catalog tests. The unchanged Metal contract fixture passes.

Closes #1886

runnable_on_backend picked the registry column with a cfg!(metal) / cfg!(cuda) / else chain. A ROCm build took the else arm, so the WebUI catalog listed every architecture as not runnable on a host that runs them, and five catalog tests failed under --features rocm. The registry had no ROCm column to read either.

BackendSupport gains a rocm column and replaces both positional [BackendStatus; 2] arrays, so a new column has to be written at every construction site. Every family starts at ROCM_FIRST_PASS (Partial), a first-pass value recorded next to the const, to be refined per family under #1801. The catalog now reads the column for mlxcel_core::hardware::gpu_backend_kind(); GpuBackendKind::None, which is also what a build with no GPU backend resolves to, reads as Unsupported.

GpuBackendKind::ALL lists every variant, with a const guard in mlxcel-core that fails to compile when a variant is added, and a catalog test walks it so a backend kind without a registry column fails. mlxcel arch --json gains a rocm key in each family's backends object; no HTTP response carries BackendSupport.

Closes #1886
@inureyes inureyes added status:review Under review type:bug Bug fixes, error corrections, or issue resolutions labels Sep 19, 2026
@inureyes

Copy link
Copy Markdown
Member Author

Implementation Review Summary

Intent

The WebUI catalog reads the registry column for the GPU backend MLX resolved at runtime, and the registry gains a ROCm column, so ROCm builds stop reporting every architecture as not runnable.

Findings Addressed

None at CRITICAL or HIGH; no commits added.

Remaining Items

  • (MEDIUM) The GpuBackendKind::ALL const guard rejects a missing arm, a misordered list and a repeat, but not a variant left out of ALL: with a fifth variant, writing only its arm (=> 4) compiles and the catalog's ALL walk never sees it (checked with standalone rustc). "keeps the list complete" overstates it. Enforcing variant, also checked: arms of a nested const fn return GpuBackendKind::ALL[n], so the new arm's ALL[4] trips the deny-by-default unconditional_panic lint until ALL grows.
  • (MEDIUM) The PR body (the future squash commit body) misstates the backend deltas. MLX's cu::is_available() is unconditionally true on a CUDA build, so CUDA always resolves Cuda and its catalog output is unchanged even without a GPU. The real delta is macOS without the metal cargo feature: MLX is still built with Metal there, so the catalog now reads the Metal column where the old chain reported nothing runnable. release.yml builds the shipped macOS binaries that way, so this PR also fixes that catalog on main.
  • (LOW) docs/supported-models.md:742 writes lablup/mlxcel#1801; the rest of the file uses bare #NNN.

Verification

  • All stated requirements implemented (ROCm-host and CUDA-host items remain unverified here, as listed)
  • No placeholder/mock code remaining
  • Integrated into project code flow
  • Project conventions followed
  • Existing modules reused where applicable
  • No unintended structural changes
  • Tests pass: catalog 37/37, registry 10/10, clippy and fmt clean. With runnable_on_backend forced to GpuBackendKind::Rocm, catalog passes 37/37 including the five named tests; forced to GpuBackendKind::None (what the old chain did on ROCm), those five fail again.

The const guard caught a missing match arm, an out-of-order list and a repeated variant, but not a variant left out of `ALL`: a fifth variant with an arm of its own compiled with `ALL` still at four entries, so the catalog's `ALL` walk never saw it and a kind with no registry column passed. Each arm now reads its own variant's slot of `ALL`, so the arm for a fifth variant indexes `ALL[4]` and fails to compile (`unconditional_panic`) until `ALL` gains that entry. The loop also checks that every arm reads its own slot. Checked with a standalone rustc build of the guard: an unlisted variant fails to compile, and listing it compiles.

The `mlxcel arch --json` doc bullet now cites #1801 as a bare reference, matching the rest of docs/supported-models.md.
@inureyes

Copy link
Copy Markdown
Member Author

Security and performance review of 44167ea. No CRITICAL, HIGH or MEDIUM findings, so nothing was auto-fixed and no commit was added.

  • Exposure: the catalog response shape is unchanged (the runnable_on_backend bool and its fixed reason string). BackendSupport is serialized only by mlxcel arch --json; no HTTP route emits it. No load path reads the catalog's supported flag, so ROCM_FIRST_PASS = Partial changes what the UI advertises, not what the server allows.
  • Request cost: runnable_on_backend runs only on a catalog cache miss, and after the first call gpu_backend_kind() is a OnceLock read. Nothing is added per request.
  • Probe trigger: router startup returns before initialize_runtime_checked(), so in router mode the first catalog cache miss can be the first probe in the process. It runs inside spawn_blocking, is memoized in Rust and C++, and takes no request input, so a client cannot repeat it. On Metal and CUDA it resolves from a compile-time constant; on ROCm it is one hipGetDeviceCount, which the first in-process model load runs anyway.
  • LOW, not fixed: with the pinned MLX, cu::is_available() returns true unconditionally, so a CUDA build resolves Cuda even with no driver. The PR body's paragraph about a driverless CUDA host describes a state that cannot occur (CUDA catalog output is unchanged in every case), and "or available" in the backend_status_for doc comment holds only for ROCm.

On this Metal host: fmt pass, catalog tests 37 passed, registry tests 10 passed, clippy pass. Wiring Rocm to the CUDA column fails each_backend_kind_reads_its_own_column (3 passed, 1 failed), then restored. ROCm and CUDA host runs were not performed.

…comment

The `backend_status_for` comment said `gpu_backend_kind()` returns `None` when no GPU backend is compiled in or available. At the pinned MLX, Metal and CUDA report availability as a compile-time constant, so only a ROCm build can resolve to `None` for want of a visible device. The comment now says that.
@inureyes

Copy link
Copy Markdown
Member Author

PR finalization check

Verified against the requirements brief for issue #1886 on this Metal host (988aa718).

  • Tests: cargo test --profile test-fast --features metal,accelerate -p mlxcel --lib server::webui::catalog (37 passed, 0 failed, includes the 4 new backend_tests) and ... --lib models::registry (10 passed, 0 failed, includes every_family_is_runnable_on_rocm and the extended registry_json_round_trips).
  • Lint/format: cargo clippy -p mlxcel --lib --tests --features metal,accelerate -- -D warnings and cargo fmt --all -- --check both pass.
  • Docs: confirmed no other English or Korean doc (README.md, docs/installation.md's ROCm status table, the other docs/webui/*.md/*.ko.md files) describes the two-backend catalog contract or the arch --json backend fields; only docs/supported-models.md and docs/webui/catalog.md/catalog.ko.md line 29 needed the update already in this PR.
  • No [BackendStatus; 2] remains anywhere, recipes/registry/*, CHANGELOG.md, and the named catalog fixture/tests are untouched, and the bare #1886/#1801/#1814 references all resolve to real lablup/mlxcel issues.

Working tree is clean and matches origin/fix/issue-1886-rocm-catalog-backend; nothing was left to commit. ROCm-host acceptance items remain unverified here, as documented in the PR body.

@inureyes inureyes added status:done Completed and removed status:review Under review labels Sep 19, 2026
@inureyes
inureyes merged commit 590a548 into main Sep 19, 2026
18 checks passed
@inureyes
inureyes deleted the fix/issue-1886-rocm-catalog-backend branch September 19, 2026 05:40
inureyes added a commit that referenced this pull request Sep 19, 2026
Brings in #1919, #1921 and #1922 (the i18n catalog consolidation from #1913). Conflicts were resolved so both changes survive: primitives.tsx keeps #1922's ConfirmDialog and drops the local Sheet and Tooltip; Activity runtime tiles keep #1922's t(locale, 'activity.*') keys inside the StatCard adapter; the operations list keeps #1922's keyed copy wrapped in SmoothHeight. The embedded bundle was rebuilt by scripts/webui/build_bundle.py rather than merged by hand.

Merged instead of rebased so the test-first commit hashes cited in the PR evidence stay valid and no published commit is rewritten.

Validated after the merge: typecheck, lint, unit (359 Vitest in 47 files, including src/i18n/drift.test.ts), all seven Playwright spec files on a private preview port, build_bundle.py --verify, check_webui_contract.py and check_binary_assets.py.
inureyes added a commit that referenced this pull request Sep 19, 2026
The bundled WebUI now uses all 17 `@lablup/[email protected]` components instead of 7. The ten new ones sit behind the `webui/src/design-system/common-*.tsx` adapter seam and are re-exported from `primitives.tsx`, so feature screens still import only the design system. The local `Tooltip`, `Sheet` and `ErrorBanner` implementations are gone from `primitives.tsx`.

Count, measured the issue's way (`grep -rn '@lablup/ui-common' webui/src/` against the 17 names in `dist/index.d.ts`): 17 of 17. Package imports appear only in `common-adapters.tsx` (Button, StatusTag, ProgressBar, EmptyState, Tabs, DataTable), `common-select.tsx` (Select), `common-overlays.tsx` (Drawer, Tooltip), `common-feedback.tsx` (ErrorState, Skeleton), `common-layout.tsx` (BaseCard, PageHeader, PageLayout, SmoothHeight) and `common-data.tsx` (Badge, StatCard), plus the existing `styles/base.css` import in `main.tsx`.

## What each adapter keeps

- **Drawer** (compact nav below 960px, replaces the native-dialog `Sheet`): stable `onClose` (the package reruns its focus effect on every identity change, so each SSE-driven shell render moved focus); completes the first-open focus hand-off the package drops while the panel is still `visibility:hidden`; `<main>` is `inert` while it is open and an Escape that starts outside the panel still closes it (skipping IME composition and already-handled events), because the package only traps focus from inside its panel; the shortcut guard also matches `[role="dialog"][aria-modal="true"]`; left sheet at the approved `min(320px, 100vw - 32px)` via scoped CSS (two commented `!important`s outrank the package's `<768px` full width); localized title and close label; `data-testid="mobile-nav-sheet"` kept by a ref bridge; widening past 960px while open closes it and focuses the desktop sidebar (the old sheet stayed open with a `display:none` restore target).
- **ErrorState**, through the kept `ErrorBanner` name and props: the 23 call sites are unchanged, and #1913/#1914 rely on the name. A ref bridge removes the package's inner `role="alert" aria-live="polite"` so the banner stays the only live region (`status` for info, `alert` otherwise) and sets `role="none"` on the package h2 so no heading lands in sections that own one. `action` stays a ReactNode because `primaryAction` cannot express the chat anchor or icon Buttons. Tones map error/warning/info to danger/warning/accent.
- **Tooltip** (gallery): props are `{content, children}`. The package describes its wrapper, and only while open, so the control is described by an always-present hidden node; the wrapper adds no tab stop; inside `NativeModalContext` it renders in place instead of portalling out of the top layer. Escape now dismisses it (WCAG 1.4.13).
- **BaseCard** (`Card`, gallery cards; also inside StatCard): keeps `.surface-card`, passes `role` (article, or region for the named focusable table card), turns `hoverable` off, and restores the focus outline that BaseCard's `:focus-within` rule removes.
- **PageLayout** (shell content column, `wide`): drops the package's extra 0.5rem inline padding below 768px.
- **PageHeader** (Settings, gallery, the three sign-in/connection states): the eyebrow line is dropped there; its keys stay for #1914, which owns Models/Chat/Activity headings. A ref bridge restores the title and description test ids, and `focusFallback` puts `tabIndex=-1` plus `data-dialog-focus-fallback` on the Settings h1, so the dialog focus fallback stays a named heading.
- **StatCard** (Activity runtime summary and details), **Skeleton** (`LoadingStatus`: one visible, localized `role="status"` over decorative shapes in the Models table loading slot, since SkeletonRow/SkeletonText mount a status per row), **SmoothHeight** (Activity operations list, active only while an operation is in flight plus a 400ms settle window restarted on every transition, so a settled list is never height-pinned or focus-clipped), **Badge** (Models row: selected, source, quantization; rows at 1440 go from 100.5px to 79.5px).

## Recorded decisions and follow-up

- `usePrefersReducedMotion`: not adopted. It reads only the OS media query and cannot see the in-app `data-reduce-motion` toggle; CSS stays the only mechanism and its global rules also stop the shared components' motion (browser test: with the OS preference unset, the drawer's transitions are 1ms). StatCard `animate` stays off for the same reason.
- `formatCompactNumber`: not adopted. It falls back to a locale-less `toLocaleString()`; `format.ts` stays the single locale-aware formatter.
- Both are recorded at the seam (`common-data.tsx`) and in `docs/webui/ui-common.md`, which also records the follow-up to contribute `Dialog` (native top layer, focus trap, Escape with focus restoration) to `lablup/ui-common`; the same note sits above `ModalDialog`. Nothing was opened upstream.

## Tests first: failing before each swap, and naive reverts

Each test commit precedes its swap commit, and the shared-DOM assertion is last, so the red runs fail there unless noted. All Playwright runs used a private preview port (4902) so no sibling worktree's server was reused.

```
Tooltip    RED  vitest: expected null not to be null  (button.closest('.tooltip__wrapper'))
                pw: > 27 | expect(page.locator('.tooltip__wrapper').filter({ has: trigger })).toHaveCount(1)  0 elements
                pw Escape case: > 36 | expect.poll(() => shownTooltips(page)).toEqual([])  (old CSS tooltip is not dismissible)
           NAIVE no describedby clone: expected '' to be 'Tooltips are descriptive only'; toHaveAccessibleDescription failed
                 no modal fallback: expected <div id="tooltip-…"> to be null
                 default tabIndex 0: expected 0 to be less than 0; after Tab toBeFocused failed
ErrorState RED  vitest (4 cases): expected null not to be null  (.error-state--<tone>)
                pw: > 64 | expect(banner.locator('.error-state')).toHaveCount(1)  0 elements
           NAIVE inner live region kept: expected [<section>, …(1)] to deeply equal [<section>]
                 h2 kept as heading: expected ['Runtime', 'Observations are stale'] to deeply equal ['Runtime']
                 no compact CSS: > 62 | expect(layout.top).toBeLessThan(32)  Received: 100
BaseCard   RED  pw: > 86 | expect(page.locator('.surface-card.base-card')).toHaveCount(1)  0 elements
           NAIVE no role: > 73 | expect(articles).toHaveCount(2); hoverable: > 77 | toHaveCSS('transform', 'none'); no outline restore: > 85 | outlineStyle not 'none'
Drawer     RED  vitest (2): expected false to be true  (panel matches aside.drawer[role=dialog][aria-modal=true])
                pw (4): > 26 | expect(panel).toHaveJSProperty('tagName', 'ASIDE')  resolved to <dialog … class="ds-dialog ds-sheet">
                pw widening case: > 122 | expect(dialog).toBeHidden()  (old sheet stays open)
                pw pointer-press case: > 93 | focus left the drawer (Shift+Tab reached the page behind it)
           NAIVE per-render onClose: expected <button …> to be <a href="#chat" …>
                 guard only dialog[open]: expected true to be false  (command dialog opened)
                 no first-open hand-off: > 45 | expect(close).toBeFocused()
                 no left-sheet CSS: > 52 | expect(box.width).toBeLessThanOrEqual(320 + 1)
                 no closeLabel: > 45 | close button named 닫기 not found
                 no widening handler: > 122 | expect(dialog).toBeHidden()
                 no inert <main>: > 93 | focus left the drawer
                 no outside Escape: >  98 | expect(dialog).toBeHidden()  unexpected value "visible"
                 handled Escape still closes: vitest expected false to be true
PageLayout RED  pw (3): > 163 | expect(page.locator('.app-content.page-layout.page-layout--wide')).toHaveCount(1)  0 elements
           NAIVE package padding kept: > 157 | expect(Math.abs(metrics.left)).toBeLessThanOrEqual(1)  (390 and 390 at 200% text)
PageHeader RED  vitest (6): expected false to be true  (.page-header .page-header__title)
                pw (3): > 196 | expect(page.getByTestId('gallery-title')).toHaveClass(/page-header__title/)  resolved to <h1 data-testid="gallery-title">
           NAIVE no test-id bridge: Error: Missing settings-title
                 no focus fallback: expected <button …> to be <h1 class="page-header__title" …>
                 no title CSS: > 186 | fontWeight toBeGreaterThanOrEqual(600)
StatCard   RED  vitest: expected [null, null] to deeply equal ['Active requests: 2 requests', …]
                pw (390, 1440): > 132 | locator('.activity-metric.stat-card') toHaveCount(4)  0 elements
           NAIVE nowrap/ellipsis: > 125 | clipped toEqual([]); uppercase: > 126; hover lift: > 129 | toHaveCSS('transform', 'none')
Skeleton   RED  vitest (en, ko): expected 0 to be greater than 0  (.skeleton inside the status)
                pw (390, 1440): > 158 | expect(status.locator('.skeleton').first()).toBeVisible()  not found
           NAIVE non-decorative shapes: expected [ …(4) ] to have a length of 1 but got 4
SmoothHeight RED vitest: expected null not to be null
                pw (390, 1440): > 193 | locator('.smooth-height.smooth-height--active') toHaveCount(1)  0 elements
           NAIVE always active: expected true to be false (settled list pinned); no settle window: expected false to be true
                 window not restarted on false-true-false: expected false to be true
Badge      RED  vitest: expected [] to deeply equal ['Selected', 'cache', '4bit']
                pw (390, 1440): > 226 | cell.locator('.badge:not(.status-tag)') toHaveText(['models_dir', '4bit'])  0 elements
           NAIVE no whitespace: expected 'alphaSelectedcache4bit' not to contain 'cache4bit'
```

## Also fixed here

`.ds-button:hover` applied to disabled buttons and swapped a disabled primary fill for the 8% selection tint behind white text. Dropping the eyebrow moved the sign-in Connect button up, so after sign-in the pointer rests on the still-disabled Models "Add" button and the existing 1440 signed-in axe check failed about one run in ten; the rule is broken on main too. The hover rules now use `:hover:where(:not(:disabled))`, which excludes disabled buttons without raising specificity, so the package's primary and danger hover fills still win on enabled buttons (a first version at higher specificity made enabled hover text 1.16:1; the test for that case failed before the correction).

Known and left: at 390px the loading or empty Models table scrolls horizontally with nothing focusable inside (`scrollable-region-focusable`, also on main); the Skeleton test tolerates exactly that node and the table belongs to #1918. The served-CSP spec exercises the gallery only, so SmoothHeight and Skeleton reach the real CSP only through their CSSOM height/width writes, which strict `style-src 'self'` permits.

## Validation

- Branch is current with main at fd33ff1 (#1919, #1921, #1922) through a merge commit rather than a rebase, so the test-first commit hashes cited above stay valid. Conflicts with #1922 were resolved so its catalog keys survive inside the StatCard and SmoothHeight swaps and its `ConfirmDialog` stays next to the removed `Sheet`/`Tooltip`; the bundle was rebuilt, not hand-merged.
- `pnpm --dir webui run typecheck` and `lint`: pass. `unit`: 18 node:test and 359 Vitest tests (47 files) pass, including #1922's `src/i18n/drift.test.ts`.
- Playwright chromium at the merged head: ui-common-shell 12, ui-common-components 14, browser 19, activity 3, chat 2, models 3, settings 3, all pass.
- `python3 scripts/webui/build_bundle.py` then `--verify`: clean, regenerated `src/webui/assets/` committed; initial JS 152.7 kB gzip against the 200 KiB budget. `check_webui_contract.py` (49 fixtures) and `check_binary_assets.py`: pass.
- CI at be87e27: all checks pass on run attempt 2. Attempt 1 failed only `src/features/chat/confirmations.test.tsx` "refocuses the Clear All trigger once clearing settles if focus is still on body" (from #1922): its `setTimeout(0)` focus claim can run before React commits the re-enabled button. It passed 15 of 15 isolated and 4 of 4 full-suite runs locally, and this PR does not touch that flow; recorded as a flaky #1922 test, not relaxed here.
- Review: implementation review fixed the hover specificity and the drawer's non-inert background; the security and performance review found nothing at CRITICAL, HIGH or MEDIUM; three LOW hardening items (settle window restart, handled-Escape guard, adapter-scoped layout whitelist) were applied test-first.

## Live acceptance against the embedded bundle

Run against `mlxcel-server --webui --models-dir models/mlx --no-models-autoload --settings --props --metrics --slots` built from be87e27 (test-fast profile, embedded bundle), signed in with a session key, no model loaded, nothing loaded, unloaded or downloaded. Headless Chromium, driven by a local uncommitted spec.

- [x] PASS, 390 px nav: the menu button opens the drawer with focus on its close button and `<main>` inert; Tab cycles home, Models, Chat, Activity, Settings, Close and wraps back to home without leaving the drawer; Shift+Tab from Close reaches Settings then Activity; Escape closes it and focus returns to the menu button; choosing Activity closes it with focus on the menu button; after a pointer press on the drawer heading, Shift+Tab goes to the document and then to the drawer's last link, never to the page behind. No horizontal overflow with the drawer closed or open.
- [x] PASS, 200 percent zoom, emulated (headless Chromium cannot drive native browser zoom): a 780x844 window at 200 percent, emulated as a 390x422 CSS px viewport at deviceScaleFactor 2. Models, Chat, Activity, Settings and `#gallery` have 0 px horizontal overflow with the nav closed and open; the drawer is 320 px and every nav link stays inside the viewport. Not a native-zoom observation.
- [ ] Not met, pre-existing and routed to #1914: a 390x844 window at 200 percent, emulated as 195x422 CSS px at deviceScaleFactor 2, overflows by exactly 125 px on every route with the nav closed or open. The cause is `body { min-width: 320px }` on main (320 - 195), not this PR; the drawer itself fits (163 px, links inside the viewport).
- [x] PASS, real-server `webui/tests/csp.spec.ts` via `MLXCEL_WEBUI_CSP_URL=http://127.0.0.1:<port>/webui/` and `playwright.csp.config.ts`: both cases (light 1440, dark 390) pass with zero CSP violations and no external requests, including the new steps that open the drawer and show the tooltip.
- [x] PASS, Settings and banners: on Settings, with focus on the document, Cmd/Ctrl+K then Escape lands focus on the Settings title (`h1.page-header__title`, `settings-title`). Both Settings info banners are `role="status"` and the gallery warning banner is `role="alert"`, with no nested live region and the package title set to `role="none"` (no extra heading).
- [x] Extra: axe (WCAG 2.2 AA tags) on signed-in Models, Activity and Settings at 390 px with the nav open reports no violations.

Part of #1910

Closes #1902
inureyes added a commit that referenced this pull request Sep 19, 2026
Part of epic #1910.

## Summary

- `identity.display_name` is now the model's inference id with no character rewriting. The catalog no longer turns `-` and `_` into spaces. Cache and preset entries keep their full name (`mlx-community/Qwen3-4B-4bit`), models-dir entries keep the directory name, and single-model entries keep the last `/` segment of the served id, as the issue decided. `qwen3-0.6b-4bit` and `qwen3_0.6b_4bit` are two distinct rows again. Every surface that prints `display_name` (library row, inspector heading, toolbar pill, Chat and Activity selectors, operation titles, settings selectors, dialogs) now shows the name passed to `-m` and the API. The Rust change is the `display_name` helper in `src/server/webui/catalog_metadata.rs` and its two call sites.
- `ModelIdentity.display_name.maxLength` in `docs/webui/api.yaml` goes from 128 to 256 to match `inference_id`, because a cache `owner/name` can be 193 characters. The field's new description gives the rule for each source. `schema_version` stays `webui.ui-api.v1`, and the generated `ui-api.d.ts` is unchanged.
- The delete dialog still accepts only `identity.id` as its token, and the fence test is byte-identical to main. The body now says to type the model ID shown below, not the model name. The field label reads "Opaque model ID shown above (starts with mdl_)" in English and "위에 표시된 모델 ID (mdl_로 시작)" in Korean. The `tests/fixtures/webui/strings.json` copies of both strings, which had drifted, now match `strings.ts`.
- Long ids wrap. The dialog body paragraph and the model names listed in the capacity-recovery dialog now carry `models-wrap`, like the id already did. Without it, a verbatim underscore name has no break point: at 390px the capacity dialog measured scrollWidth 523 against clientWidth 356.
- Fixtures and tests that used space-separated names now use hyphenated ids. That includes `identity-collision.json`, which still collides on `inference_id`, and the performance fixtures and specs. The `models.long_name` gallery string is now a long hyphenated id, the same in en and ko. `docs/webui/catalog.md` and `docs/webui/catalog.ko.md` describe the new meaning. The committed bundle is regenerated.

## Premises checked

- Search already found the real name before this change: `inventory()` and the server `q` filter both match `inference_id`, which already held `qwen3-0.6b-4bit`. What changes is that the matched row now prints that name.
- The issue expected a trailing `/` to fall back to the whole name through the existing `unwrap_or(name)`, but it never did. `"x/".rsplit('/').next()` is `Some("")`, so the old helper returned an empty string. The new helper skips the empty segment, and the test covers that case.
- The issue did not say how to treat presets; this PR keeps their names whole. A preset's inference id is its section name (`config.model_alias = name`), and an overlay-only preset takes over a cache `owner/name`, which the last-segment rule would shorten.
- Single-model mode keeps the last-segment rule, as the issue specified. The id there is either `--alias` or the checkpoint directory's `file_name()`, never a path, so the rule only changes an alias that contains `/` (for example `--alias Qwen/Qwen3-8B` displays as `Qwen3-8B`). The docs and the api.yaml description say so. Showing the alias whole would be a one-line change if that is preferred.

## Changes during review

- Implementation review: the capacity-dialog list items got the wrap class. The capacity-recovery unit test now checks the listed names and the class, and fails without them.
- Implementation review: the api.yaml description and both catalog docs now give the rule for each source. The earlier wording said "verbatim" everywhere, which is not true for single-model aliases. The Korean confirm label dropped "불투명", a word Settings already uses for the visual Opaque material.
- Security and performance review: `performance.spec.ts` searched the 1000-entry catalog for `'0999'`, which only matched the old padded label, so the `WebUI bundle` engine smoke timed out on every engine. It now searches for `perf-model-999`. The review found no injection or path exposure: names render as React text or escaped attributes, and `display_name` is always equal to `inference_id` or a substring of it. The delete fence still requires the exact id and revision.

## Revert-and-fail

With the `catalog_metadata.rs` change alone reverse-applied, the new contract test fails:

```
test server::webui::catalog::tests::catalog_contract_tests::display_name_is_the_inference_id_verbatim ... FAILED
panicked at src/server/webui/catalog_contract_tests.rs:543:5:
assertion `left == right` failed
  left: [("Meta-Llama-3.1-8B-Instruct_4bit", "Meta Llama 3.1 8B Instruct 4bit"), ("mlx-community/Qwen3-4B-4bit", "Qwen3 4B 4bit"), ("qwen3-0.6b-4bit", "qwen3 0.6b 4bit"), ("qwen3_0.6b_4bit", "qwen3 0.6b 4bit"), ("team/qwen3-preset", "qwen3 preset")]
 right: [("Meta-Llama-3.1-8B-Instruct_4bit", "Meta-Llama-3.1-8B-Instruct_4bit"), ("mlx-community/Qwen3-4B-4bit", "mlx-community/Qwen3-4B-4bit"), ("qwen3-0.6b-4bit", "qwen3-0.6b-4bit"), ("qwen3_0.6b_4bit", "qwen3_0.6b_4bit"), ("team/qwen3-preset", "team/qwen3-preset")]
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 8596 filtered out
```

With the patch re-applied, all 34 catalog tests pass. The check was run twice, once by the implementer and once independently. The frontend check was done the same way. Reverting `api.yaml`, `strings.ts` and `dialogs.tsx` makes the new 193-character schema-bound test and the delete-dialog wording test fail. Removing the capacity-list wrap class makes the capacity-recovery test fail.

## Test plan

This branch is rebased onto origin/main at fd33ff1, which includes #1921 (catalog backend column) and #1922 (i18n catalog consolidation). The committed bundle was rebuilt by `build_bundle.py` at each rebased commit rather than merged by hand. One rebase conflict needed both sides: the performance spec's Chat option now reads `perf-model-0 · Ready`, combining this PR's name with #1922's localized state label. No test or fixture added by #1922 uses a space-separated model name. Results on the rebased head:

- [x] `cargo test --profile test-fast --features metal,accelerate -p mlxcel --lib server::webui`: 78 passed, 0 failed, including `display_name_is_the_inference_id_verbatim`
- [x] `cargo clippy -p mlxcel --lib --tests --features metal,accelerate -- -D warnings` and `cargo fmt --all -- --check`: clean
- [x] `pnpm --dir webui run typecheck` and eslint: clean
- [x] `pnpm --dir webui run unit`: node 18/18, vitest 340/340 in 39 files
- [x] Playwright chromium default suite: 30/30. Engines config (`engines.spec.ts` and `performance.spec.ts`), chromium: 7/7. All runs used a private port with `--strictPort`, never the preview server shared with other worktrees
- [x] `check_webui_contract.py` (49 fixtures), `build_bundle.py --verify`, `check_binary_assets.py`, `check_cross_repo_refs.py`: pass

Before the rebase, the same gates also passed `server::router_server` (63 passed, 1 ignored) and the engines config in firefox (7/7).

## Real-binary acceptance

The orchestrator built `mlxcel-server` from 3082e1d, the pre-rebase head carrying the same change (`--profile test-fast --features metal,accelerate`), and ran it with `--webui --models-dir models/mlx --no-models-autoload` against the real checkpoint store and the default managed cache. I drove the bundled WebUI in Chromium at 1440px with a read-only Playwright script that aborts any load, unload, download, delete or refresh request. It recorded no mutating request.

- [x] Hyphenated models-dir entry: `qwen3-0.6b-4bit` prints as `qwen3-0.6b-4bit` in the library row, the inspector heading and the toolbar pill (`qwen3-0.6b-4bit · Unloaded`).
- [x] Underscored models-dir entry: `stablelm-2-1_6b-chat-4bit` prints unchanged in the same three places.
- [x] Cache entry: `mlx-community/Qwen3-0.6B-4bit` prints as the full `owner/name` in the row, the inspector heading and the pill. It also appears as `mlx-community/Qwen3-0.6B-4bit · unloaded` in the Chat "Model for next turn" picker and as `mlx-community/Qwen3-0.6B-4bit` in the Activity selector (225 options).
- [x] Search: `qwen3-0.6b-4bit` returns the `qwen3-0.6b-4bit` row, plus `mlx-community/Qwen3-0.6B-4bit`, which contains the same text in a case-insensitive match. `qwen3_0.6b_4bit` returns no rows ("No matching local models").
- [x] Delete dialog, opened on the cache entry and cancelled without typing: the body ends "To confirm, type the model ID shown below, not the model name.", the `mdl_` id is printed below it, the field label reads "Opaque model ID shown above (starts with mdl_)", and Confirm stays disabled while the field is empty. The long cache name wraps inside the dialog.

## Merge with main and CI

- `origin/main` 5616f86 (#1924, ui-common components) was merged into this branch as 7e40c01 by the epic #1910 orchestrator. Only the generated bundle conflicted; it was regenerated with `scripts/webui/build_bundle.py` (`--verify` digest 711cbf2a) and not hand-merged. On the merged tree: `typecheck`, `eslint`, `unit` (Vitest 362 in 47 files), and Chromium Playwright on a private port (`models`, `ui-common-shell`, `ui-common-components`, `browser`, `chat`, `activity`, `settings`: 56 passed) all pass. The merged Rust tree was checked earlier: `server::webui` 78 passed, `models::registry` 10 passed.
- The GB10 `WebUI installed artifact` job's Activity performance gate reported `investigate` on four consecutive attempts at the pre-merge heads while every other step passed: `two-visible` median decode degradation -0.35 (baseline CV 5.63), +0.20 (CV 5.45), +2.74 (CV 3.38), and `one-visible` +3.38 (CV 4.22). The gate flags a median above 2 percent or a baseline CV above 5 percent over five pairs. On the same runner, `main` after #1922 failed the same gate (`two-visible` -6.76, CV 7.45) and passed on rerun, and #1919 failed it once (+3.19) and passed on its next head. This change only alters the catalog label string and a few UI strings, which do not touch decode or the Activity polling path, so these are read as runner noise. Per the maintainer's decision for this epic, the PR merges with this evidence recorded rather than with the gate relaxed; stabilizing the gate is tracked in #1925.

Closes #1912
inureyes added a commit that referenced this pull request Sep 19, 2026
…1923)

Closes #1903. Part of #1910.

## What changes

- **Theme ids.** `data-theme` always holds `<family>-<scheme>`: `mlxcel-light`, `mlxcel-dark` (the approved baseline, still the default), `glass-light`, `glass-dark`. `webui/src/design-system/theme.ts` resolves it; the stored `themeFamily` and `colorScheme` (`system`/`light`/`dark`) land in `data-theme-family` and `data-color-scheme`. The old flat `theme` field is migrated, and `system` follows host changes live. Settings gets Theme (Standard, Glass) and Color scheme selects.
- **ui-common mechanism.** `main.tsx` imports one theme entry (`themes/index.css`) after `base.css`, and no ui-common theme file. The color, shadow and button `--token-*` values moved from `:root` into `[data-theme]` blocks unchanged; `common-tokens.css` keeps the theme-independent half.
- **Glass theme.** Translucent chrome with a light reflection, tinted buttons, highlighted primary and danger fills, near-opaque content surfaces, no per-button blur. It reads the existing intensity, material, transparency, backdrop support, contrast and motion switches plus the `prefers-*` queries; any transparency or contrast preference makes it opaque at any intensity. Values derive from lablup/backend.ai-go (derivation line, `NOTICE`); the tokens stay here because they bind to this product's semantic token layer.
- **No flash.** `webui/public/theme-bootstrap.js` is a classic render-blocking script in `<head>`, external because the CSP is `script-src 'self'`. `build_bundle.py` rejects a bundle where it is missing, duplicated, deferred in any way, or after the app module, and any inline script.
- **Gate.** `check:theme-selectors` (in the `webui-bundle` job and `make verify-webui-frontend`) evaluates every `data-theme`/`data-theme-family` selector against the shipped ids and rejects `data-color-scheme` selectors, `prefers-color-scheme` outside the resolver, stray theme imports and ids with no theme block; exemptions need a written reason. Against `main` it reports `tokens.css:47`, `:48`, `:50`, `:51`, `:75`.

## Found along the way

- Chrome blur never rendered in Chromium or Firefox (Lightning CSS drops a standard `backdrop-filter` that precedes its `-webkit-` twin), and the primary and danger fills were hard-coded over ui-common's rules. Both are one-line fixes in `components.css`, and both survive the merge with #1902's rewrite of that file, alongside its `:where(:not(:disabled))` hover rules.
- `features/chat/style.test.ts` passed vacuously (Vitest blanks CSS imports); it now reads from disk. `models.css` read two undefined tokens; inspector labels are now muted and the selected row highlighted.
- Review fixed rendered glass fills and a bootstrap check that let `type="module"` through; the security pass fixed the gate skipping its check through a symlink and two super-linear patterns.

## Validation

Rebased onto `fd33ff15` (#1919, #1921, #1922) with an unchanged source diff, then merged with main at `5616f86b` (#1924, #1902's component adoption); `app.tsx` keeps #1902's PageHeader Settings screen with the theme selects, and the bundle was regenerated. On `cdb80fe7`: typecheck, lint, the gate, unit (35 node:test, 470 Vitest), Chromium suite (88, including the glass button fill case and #1902's button hover cases; axe on all four ids), `build_bundle.py --verify`, contract, binary-asset and cross-repo checks. The engines smoke on Chromium, Firefox and WebKit passed before the rebase. Each new check was reverted to confirm it fails.

## Bundled-binary checks

Playwright Chromium against `mlxcel-server` built from `c26e3247` (before the rebase and the #1924 merge) with the embedded bundle and no model loaded.

1. **No flash: pass.** `theme-bootstrap.js` is served 200, `text/javascript`, `no-cache`, under the strict CSP, ahead of the app module. With the app module held, all nine cases (cold profile under light and dark hosts, each id stored under the opposite host, glass `system` under both hosts, legacy `{theme: dark}`) had the right `data-theme` and canvas with nothing mounted, and no CSP violation.
2. **Settings: pass.** Glass then Dark gives `glass-dark`, persists without the legacy field, is restored before mount on reload; `system` follows a host flip live.
3. **390x844: pass** in both families: 0 px overflow on all four routes; the sheet opens, navigates, closes on Escape and returns focus.
4. **200 percent zoom: not native** (headless Chromium cannot zoom; a half-width CSS viewport at deviceScaleFactor 2 stood in). 320 and 640 CSS px: 0 px overflow everywhere. 195 CSS px (390 px window): 125 px on every route from `body { min-width: 320px }`; main's bundle measures the same, so it predates this PR.
5. **Keyboard: pass** for `mlxcel-light` and `glass-dark`: 18 Tab stops in DOM order, each with a visible indicator; Escape restores focus from the command palette (button and Cmd+K), a Select popup and the sheet.
6. **Contrast: pass.** axe WCAG 2.2 AA on all four routes for all four ids at intensity 100: 0 violations normally, under `prefers-contrast: more` and with High contrast on; the chrome drops to `blur(0px)` with no gradient.
7. **Served-CSP spec: pass** (both variants).




## Merge with main

`origin/main` 31c0459 (#1920, verbatim display names) was merged into this branch as 83fc058 by the epic #1910 orchestrator. Only the generated bundle conflicted; it was regenerated with `scripts/webui/build_bundle.py` (`--verify` digest 986294f2) and not hand-merged. On the merged tree: `typecheck`, `lint`, `check:theme-selectors` (152 files, 4 theme ids), `unit` (Vitest 473 in 51 files) and the Chromium Playwright suite on a private port (88 passed) all pass. The live-server script above was also re-run against a server built from cdb80fe (after #1924 was merged in): 23 of 25 cases pass, and the two failures are the pre-existing 195 CSS px overflow from `body { min-width: 320px }` described above.
@inureyes inureyes added this to the 0.8 milestone Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:done Completed type:bug Bug fixes, error corrections, or issue resolutions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(rocm): the WebUI catalog reports every architecture unsupported on ROCm

1 participant