Skip to content

chore: stop committing binary assets and guard against new ones - #1904

Merged
inureyes merged 2 commits into
mainfrom
chore/drop-committed-screenshot-baselines
Sep 19, 2026
Merged

inureyes merged 2 commits into
mainfrom
chore/drop-committed-screenshot-baselines

Conversation

@inureyes

Copy link
Copy Markdown
Member

Why

webui/tests/screenshots/ accumulated 24 PNG baselines and ~1.9 MB with no review step noticing: each commit looked reasonable on its own and nothing looked at the aggregate. Binary blobs never delta-compress, every later revision is stored whole, and deleting one later does not shrink the history.

What changes

The baselines are removed and the directory ignored. They were renderer-, font- and platform-specific, so any font, Chromium or UI change meant recapturing on a hosted runner and reviewing each image by hand.

The 12 cases they belonged to were never screenshot-only. toHaveScreenshot was the last line of each, above axe checks with all violations rejected, overflow, toolbar hiding above 960 px, 44 px compact hit targets, data-table column visibility, heading hierarchy across repeated tab remounts and progress row alignment. Only the pixel comparison and its two pre-capture settle steps are gone. CI keeps the pinned DejaVu and WenQuanYi packages, now as a layout-stability dependency: the geometry assertions measure text, and the CJK drawer variant needs a Korean face to lay out at all.

scripts/ci/check_binary_assets.py makes the next one impossible to add quietly. Every tracked binary must match a Rule with a per-file ceiling and a reason, so an undeclared path fails until someone writes that reason. Inverted the way check_crate_versions.py inverts the crate list; a skip-list would have stayed silent on exactly the directory that prompted this. A 256 KB aggregate ceiling covers growth inside an existing rule.

traces/ is ignored too: one xctrace bundle is ~159 MB of host-specific binary that nothing reads back, and it was one git add -A from being committed.

Trade-off

Pixel-level detection of darwin/linux drift in color, shadow and font rasterization is given up; geometry and accessibility regressions are still caught. History does not shrink either, since the ~7.3 MB of PNG blobs stay in .git unless it is rewritten, which is not proposed here. The effect is that it stops growing.

Validation

Darwin, pinned toolchain (Node 26.5.1, pnpm 11.18.0): typecheck and lint clean, 316 unit tests and 28 browser tests (29 with MLXCEL_WEBUI_FONT_DIAGNOSTICS=1) passing with no baselines present at all. The guard's self-test plants an undeclared PNG, an oversize declared file and an over-budget set and asserts the checker fails on each rather than only that it runs; re-adding a screenshot with git add -f in the real tree is caught.

Two counts in docs/webui/design-system.md had gone stale independently and are corrected: the unit suite is 316 tests across 36 files, not 62 across 8, and the browser suite is 28, not 19.

The 24 PNG baselines under webui/tests/screenshots/ were renderer-, font- and platform-specific, so any font, Chromium or UI change meant recapturing them on a hosted runner and reviewing every image by hand. They reached ~1.9 MB across two platform directories with no review step noticing, because each commit looked reasonable on its own.

The 12 cases they belonged to are not screenshot-only: toHaveScreenshot was the last line of each, above axe checks with all violations rejected, document and key-panel overflow, toolbar hiding above 960 px, 44 px compact hit targets, data-table column visibility, heading hierarchy across repeated tab remounts and progress/sample row alignment. Only the pixel comparison and its two pre-capture settle steps go; every other assertion and all 12 cases stay.

CI keeps the pinned DejaVu and WenQuanYi packages, now as a layout-stability dependency rather than a rendering one: the geometry assertions measure text, and the CJK drawer variant needs a Korean face to lay out at all.

This gives up pixel-level detection of darwin/linux drift in color, shadow and font rasterization. Geometry and accessibility regressions are still caught.

Validated on darwin with the pinned toolchain: typecheck and lint clean, 316 unit tests and 28 browser tests (29 with MLXCEL_WEBUI_FONT_DIAGNOSTICS=1) passing with no baselines present. Two counts in design-system.md had gone stale independently and are corrected here.
Binary blobs enter a repository silently. Nothing about git add warns that a file will never delta-compress, that every later revision is stored whole, or that removing it later does not shrink the history. The cost surfaces as clone time long after the commit that caused it, which is how webui/tests/screenshots/ reached 24 PNGs and ~1.9 MB unnoticed.

check_binary_assets.py inverts the rule the way check_crate_versions.py inverts the crate list: every tracked file git treats as binary must match a Rule carrying a per-file ceiling and a reason, and an undeclared path fails until someone writes that reason. A skip-list would have stayed silent on exactly the directory that prompted this. A 256 KB aggregate ceiling makes growth inside an existing rule a review event too. Text is deliberately out of scope: it delta-compresses and stays diffable, and a ceiling on it would only fire on the generated WebUI bundle and the .mlir fixtures.

Also ignores traces/, where the Metal profiling scripts write xctrace bundles. One capture is ~159 MB of host-specific binary that nothing reads back, and it was one git add -A away from being committed.

The self-test plants an undeclared PNG, an oversize declared file and an over-budget set, and asserts the checker fails on each rather than only that it runs. Wired to make verify-binary-assets and a binary-assets CI job that needs no toolchain.
@inureyes inureyes added type:chore Maintenance tasks (build, CI, etc.) type:test Test related changes status:review Under review labels Sep 17, 2026
@inureyes
inureyes merged commit 2a1c404 into main Sep 19, 2026
50 of 52 checks passed
@inureyes
inureyes deleted the chore/drop-committed-screenshot-baselines branch September 19, 2026 04:02
@inureyes inureyes added status:done Completed and removed status:review Under review labels Sep 19, 2026
inureyes added a commit that referenced this pull request Sep 19, 2026
…1927)

Part of #1910. Closes #1914.

The toolbar showed the browser's selected model, so a fresh tab said "No model selected" while a model was Ready on the server. The shell now shows what the server holds. The #1915 to #1918 redesigns build on it.

## What changes

- **Toolbar:** a loaded count, up to three chips with a lifecycle badge, and a "+n" chip that opens the palette.
  - It reads "Loaded models unknown" until an authenticated catalog arrives.
  - A chip opens the model's inspector on Models and never loads it.
  - Below 960 px the chips scroll in one row.
- **Footer:** `{mode} · {status} · v{version}`. The instance id and event sequence move into a collapsed disclosure.
- **One `PageHeader` per route:** Models, Chat and Activity move their actions and their stale or action errors into the shared header. The eyebrow keys, `gallery.issue` and the now-unused `model.selected.none` are deleted.
- **Shortcuts:** `globalShortcuts` feeds the help dialog (six entries).
  - Cmd/Ctrl+N opens Chat with a new conversation. The composer also handles Cmd/Ctrl+N and Cmd/Ctrl+Enter.
  - Neither fires during IME composition, and neither repeats while a key is held.
  - On macOS the composer's new-conversation key is Cmd+N only, so Ctrl+N still moves the caret.
- **Palette:** it lists the loaded models on an empty query and matches catalog models by name or id (at most 20). `gallery` is no longer listed.

## Decisions

- **Focus fallback:** it stays on the `PageHeader` h1, as #1902 shipped, not on the `PageLayout` wrapper as the issue planned.
  - A named heading is a better landing target.
  - The adapter now always marks the h1, so every route has exactly one fallback.
  - `modal-focus.test.tsx` is unchanged. A new `main.test.tsx` case checks that focus lands on that h1 when a dialog closes after its trigger is gone.
- **Layout floor:** the layout now holds at 195 CSS px (a 390 px window at 200 percent zoom). Before, `body { min-width: 320px }` overflowed every route there by 125 px.
  - Removed that rule and switched single-column tracks to `minmax(0, 1fr)`.
  - Added a `max-width: 319px` toolbar block.
  - Long headings now wrap, which matters with CI's wider DejaVu fonts.
  - Layouts at 320 px and wider are unchanged.
  - `tests/shell.spec.ts` pins 0 px page overflow at 195 and 320 px, in en and ko, on every route.
- **Screenshot baselines:** #1904 removed the committed baselines, so the issue's recapture and SHA-256 table steps do not apply.

## Validation

- **Static checks:** typecheck, lint, `check:theme-selectors`, bundle verify, binary-asset and contract checks pass.
- **Unit:** 538 Vitest and 35 node:test pass.
- **Playwright Chromium** (per spec, on macOS and in an Ubuntu 24.04 container with CI's fonts): shell 14, browser 29, ui-common-shell 12, ui-common-components 14, models 8, chat 2, activity 3, settings 3, theme 23, engines 3, performance 4.
- **`browser:all` in the container:** passes. One WebKit case was flaky under parallel load and passed 12 of 12 when repeated alone.

## Live acceptance (bundled binary)

I ran Playwright Chromium against a server built from `b9465f91` (test-fast, metal and accelerate, embedded bundle), with `qwen3-0.6b-4bit` Ready and 224 catalog entries. Each check used a fresh browser context.

| # | Check | Result |
|---|---|---|
| 1 | The toolbar names the loaded model before any selection | **Pass.** Before login it reads "Loaded models unknown". After login it reads "1 loaded" with a `qwen3-0.6b-4bit` chip and a Ready badge, and no model is selected. The footer reads `router_pool · ready · v0.7.0` with its details collapsed. |
| 2 | The chip opens the inspector | **Pass.** From Settings, the chip goes to `#models` and the inspector shows the model. No non-GET request was sent. |
| 3 | Cmd+N from Settings | **Pass.** Meta+N goes to `#chat` with an empty "New conversation". The palette's New conversation also works. Stock browser windows keep Cmd+N for themselves, so the palette entry covers that case. |
| 4 | IME and Cmd+Enter | **Pass** (emulated). Headless Chromium cannot drive a real IME, so I used composition events. Nothing sent during `compositionstart`, with `isComposing: true`, or with keyCode 229. After composition, Cmd+Enter sent one short turn. On a macOS user agent, Ctrl+N in the composer kept the draft and moved the caret. On the Windows user agent, it started a conversation. |
| 5 | `?` lists the shortcuts | **Pass.** It lists six entries. |
| 6 | No horizontal scroll | **Pass.** At 390 px, `scrollWidth` equals `innerWidth` on Models, Chat, Activity and Settings, and the drawer closes with Escape back to the menu button. At 195 CSS px (emulating 200 percent zoom), overflow is 0 on all four routes and the drawer's close button stays inside the panel. |

Note on check 4: my 16-token request cap did not match the `?autoload=false` chat URL. The single turn used the UI defaults, and the server's runtime counters report 1 completed request with 4 completion tokens.
@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:chore Maintenance tasks (build, CI, etc.) type:test Test related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant