Skip to content

Studio: add a loaded models indicator with per-model eject - #8082

Merged
danielhanchen merged 49 commits into
mainfrom
feat/loaded-models-indicator
Aug 8, 2026
Merged

danielhanchen merged 49 commits into
mainfrom
feat/loaded-models-indicator

Conversation

@shimmyshimmer

@shimmyshimmer shimmyshimmer commented Aug 7, 2026 •

Copy link
Copy Markdown
Member

Problem

A loaded model is only visible on the page that loaded it. Load something in Chat, then go to the Hub, Train or Images, and nothing on screen says a model is still holding memory. The only way to see what is resident, or to release it, is to navigate back to where it was loaded.

This gets worse with several runtimes in play, because a TTS model, a GGUF chat model and an image model can all be resident at once and no single view shows that.

What this adds

A compact card in the bottom-right listing everything currently in memory, with an eject button per row. Visible from every page.

It reads all four runtimes and merges them into one list:

Row Status endpoint Eject endpoint
Chat, Speech, Dictation /api/inference/status /api/inference/unload
Image /api/inference/images/status /api/inference/images/unload
Video /api/inference/video/status /api/inference/video/unload
Dictation sidecars /api/inference/audio/stt/status /api/inference/audio/stt/unload

A TTS load is split out from a chat load by audio_type. Both come from the same picker and both hold memory, but only one answers prompts, and telling them apart is most of the point. Each row shows its runtime and quantisation (GGUF Q4_K_M, flux cuda), truncated with the full id on hover.

It renders only when something is actually loaded.

Placement

It joins the existing bottom-right stack in provider.tsx with positioned={false}, the same slot the web update banner, the llama.cpp update banner and the Hub download panel already flow through. That stack exists so these never overlap, so nothing is obstructed. Toasts are top-right and untouched.

Collapses to a small pill with a count, and that choice persists across reloads. Expanded is the default, since a card you have to open first answers nothing.

Settings

Settings, General, Notifications, "Loaded models indicator". On by default. Only an explicit off is stored, mirroring use-llama-update-pref.ts.

Notes on the implementation

  • Reads are independent and fail soft. A chat-only host has no video runtime, and that must not blank the rows the other sources returned.
  • Polls every 5s, paused while the tab is hidden or the pref is off, and refreshed on focus so a load or unload done in another tab lands.
  • Ejecting the active chat model reuses unloadResident from the API monitor: read, unload, re-read. An API auto-switch can replace the model between those steps, and /unload naming a replaced model is a documented 200 no-op, so a single pass would report success over a model still holding VRAM.
  • The chat picker selection is cleared only when the eject actually released the model it names, since chat can hold an external provider selection while a local model is resident.
  • images/api, video/api and api-monitor/unload-resident are imported directly rather than through their feature indexes, matching api-monitor-page.tsx. Those indexes re-export their pages, which __root.tsx deliberately keeps out of the eager bundle behind lazy(), and this mounts from the root.

Tests

10 cases in tests/loaded-models-sources.test.ts covering the status to row mapping: nothing loaded, an unreachable runtime, GGUF variants, TTS against whisper, a cached non-active model, per-engine dictation rows, absent detail fields, merge order and dedupe, and local path labels.

Rebased onto current main and re-run there:

npm run typecheck   clean
npm test            740 passed
npm run i18n:check  all locale overlays pass parity
npm run build       clean

New English strings only. The parity check allows other locales to fall back.

A loaded model is only visible on the page that loaded it. Leave Chat for the
Hub or Train and nothing on screen says a model is still holding memory, so the
only way to check or release it is to navigate back.

Adds a compact card in the bottom-right listing everything resident, with an
eject button per row. Chat, images, video and dictation each own a runtime and
their own /status, so all four are read and merged. A TTS load is split out from
a chat load by audio_type: same picker, but it does not answer prompts.

It joins the existing bottom-right stack in provider.tsx alongside the update
banners and the download panel, so nothing overlaps. Collapses to a pill, and
that choice persists. On by default, with a toggle in Settings, General,
Notifications.

Reads fail soft per runtime, so a chat-only host missing /video keeps its other
rows. Ejecting the active chat model reuses the API monitor's read, unload,
re-read sequence, since an API auto-switch can replace the model mid-eject.
@shimmyshimmer
shimmyshimmer force-pushed the feat/loaded-models-indicator branch from afe425c to 5e59588 Compare August 7, 2026 04:28
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Eject the row's own model, not whatever is active. An API auto-switch can land
between the poll and the click, and re-reading unconditionally would free a
model nobody asked to free while reporting the clicked one as ejected. The
sequence moves to eject-chat-model.ts, taking its I/O as deps like
api-monitor/unload-resident.ts, so the scoping is under test.

Fall back to the top-level STT fields. Servers predating the per-engine split
report the resident Transformers model only there, so those installs showed no
dictation row and had no eject for it.

Bound each status read. authFetch has no timeout, so a runtime that accepts the
connection and never answers left the Promise.all pending forever, and with it
the in-flight guard that gates every later refresh.

Re-sync Images and Video after an eject. Both hold their own status and re-read
it on tab activation, not on a timer, so ejecting from the indicator left their
controls offering to generate on a freed runtime.

Add both preference keys to "Reset all local preferences", which otherwise left
the indicator hidden or collapsed after a reset.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

Went through all five. Every one held up, so all five are fixed in 6e3257a.

P1, eject the row's model instead of the latest active model. Correct, and the worst of the five. The row is up to one poll old, so an auto-switch landing before the click meant unloadResident re-read, found the new model and freed that, while the toast reported the clicked one as ejected. On the Transformers backend the clicked model could stay cached as well.

The read is now scoped to the row: if the resident model does not match the entry, that pass is skipped and the row is unloaded by name instead, leaving the newly active model alone. The mid-eject switch the original code was written for still works, since the re-read simply stops matching.

Moved the sequence into eject-chat-model.ts, taking its I/O as deps the way api-monitor/unload-resident.ts does, so it is reachable from the node suite. tests/loaded-models-eject-chat.test.ts drives it with the real modelIdsMatch, covering the switch before the click, the switch mid-eject, a target surviving its own unload, a cached row, and load path against advertised repo id. Confirmed the two switch cases fail with the scoping removed.

P2, legacy STT fields. Correct. SttStatus documents the engine blocks as absent on servers predating the split, and those installs report the resident Transformers model only in the top-level loaded_model and device. describeSttStatus now falls back to those for the transformers engine. Two cases added: a legacy payload produces the row, and an engine block still wins so a current server never doubles it.

P2, bound each status read. Correct. authFetch applies no timeout, so a request that accepts the connection and never settles leaves Promise.all pending forever and inFlightRef stuck, skipping every later refresh for the rest of the mount. One correction: the rows do not disappear, the last read just stops updating.

Each read now carries disposableTimeoutSignal from the existing hub shim, threaded through a new optional signal on the three status readers so the request is actually aborted rather than abandoned. 10s, comfortably past a cold status probe so only a real hang trips it. Abort throws a DOMException, and fetchWithTauriNetworkRetry only retries TypeError, so it propagates rather than being retried.

P2, synchronize media pages. Correct. Both pages only re-read status on active transitions and on their own actions, so ejecting from the indicator while either is on screen left the selector and generate controls claiming the model was loaded. Added lib/model-eject-events.ts; the eject announces the runtime and each page re-runs its refreshStatus. Verified the routing delivers only to the named runtime and that unsubscribe leaves no listeners attached.

P2, reset list. Correct, and by the file's own convention: unsloth_show_llama_update_banner and unsloth_monitor_overlay are already there. Both keys now come from one exported LOADED_MODELS_PREFERENCE_KEYS and are in PREFS_KEYS, so they cannot drift.

npm run typecheck   clean
npm test            748 passed
npm run i18n:check  all locale overlays pass parity
npm run build       clean

chatgpt-codex-connector[bot]

This comment was marked as resolved.

/images/unload, /video/unload and the STT unload carry no model id and release
whatever their runtime holds, so acting on a row up to one poll old could free a
model nobody clicked while reporting the clicked one as ejected. The image and
video races need a load landing in that window; dictation loads on demand and
releases when idle, so its engine can change with no user action at all.

Each now re-reads its runtime and only unloads when the resident model still
matches the row. This narrows the window to the round trip rather than closing
it, which would take a backend that accepts the model id.

Ejecting reports an outcome instead of a bare string, so a stale row says the
model is already gone and names what took its place, rather than claiming a
success it did not perform. An unreadable dictation status is now an error
rather than a false success.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

Both new ones are right, and they are the same bug I fixed for chat, sitting on the three unloads that carry no model id. Fixed in a0c1af9.

Confirmed against the backend: /images/unload and /video/unload take no request body at all, and /audio/stt/unload takes only engine. Each releases whatever its runtime holds, so acting on a row up to one poll old could free a model nobody clicked.

P1, the STT row. Agreed on the severity, and for a reason worth stating: the other two need a load to land inside the poll window, but dictation loads on demand and releases itself when idle, so an engine's resident model changes with no user action at all. The row can go stale on its own.

P2, the image row. Same race, and the video path had it too, as noted.

Each of the three now re-reads its runtime and only unloads when the resident model still matches the row. That narrows the window to the round trip rather than closing it, which would take a backend that accepts the model id, but the row being a whole poll old was the part worth not trusting. Chat needs no pre-check, since /unload matches on the model id.

Ejecting now returns an outcome rather than a bare string, so the three cases are distinguishable:

  • ejected, the row's model is gone
  • replaced, the runtime holds something else, nothing was unloaded, and the toast names what took its place
  • stillResident, the unload ran and the model survived

That also removes the false success this raised: a stale row no longer claims an eject it did not perform.

One thing I found while fixing it, not in the review: readSttStatus answers null on a non-ok response, which under the new pre-check would have read as "nothing resident" and reported success without unloading anything. It now throws instead.

The decision itself is verifyResident in loaded-models-sources.ts, covered by four cases in the node suite driving the real modelIdsMatch: match, replaced, an idle runtime, and the tolerance for a trailing separator or casing difference, since a spurious replaced would refuse a legitimate eject. Also simulated both races the review describes through the same code path as ejectRuntimeRow and confirmed the runtime-wide unload does not fire.

One correction on the image comment. The wrong model does get freed, which is the real problem, but the clicked model is not still resident: the diffusion runtime holds a single pipeline, so A was already gone when B loaded. The fix is the same either way.

npm run typecheck   clean
npm test            752 passed
npm run i18n:check  all locale overlays pass parity
npm run build       clean

chatgpt-codex-connector[bot]

This comment was marked as resolved.

The llama.cpp and whisper.cpp STT sidecars report their engine name as the
device (stt_mtmd_sidecar.device is "llama.cpp", stt_ggml_sidecar.device is
"whisper.cpp"), so a row read "Dictation - llama.cpp - llama.cpp". Only the
Transformers sidecar reports a real device.

joinDetail now drops repeated parts, so the engine is named once and a genuine
device still shows beside it.
…monitor

The card and the Live monitor both anchor to the bottom-right, so opening the
monitor buried the card underneath it. The monitor is draggable and resizable,
so a fixed offset would only hold until it moved.

The monitor now publishes its box. The corner stack lifts above it, but only
while it is in the stack's column and low enough to be in the way, so a monitor
dragged elsewhere leaves the corner alone. This clears the update banners and
the download panel too, which had the same overlap.

The card also gets a drag handle: anchored to its corner until moved, then kept
where it was left, clamped back into view if the window shrinks. Its position
persists and joins the reset list.
The loaded models card and the Train wizard's Model step both take
AiBrain01Icon, and the indicator toggle moves above the llama.cpp one so the
Notifications section leads with it.
The drag handle only existed in the expanded header, so the pill could not be
moved. The pill is now its own handle: a press becomes a drag past a few
pixels, below that it stays the click that expands the card, and reading the
flag clears it so a keyboard activation is not swallowed.

Re-clamping now also runs on a ResizeObserver, so expanding a pill dragged to
the bottom edge pulls the taller card back into view instead of growing off
screen.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Keep the Chat picker selection when an eject leaves the model resident, so a
reload during the run no longer empties the picker while the model still runs.

Republish the Live monitor's frame from a layout effect. ResizeObserver does
not fire for a position-only change, so dragging the monitor left the overlay
stack dodging its old corner.

Cap the overlay stack's height to the space above its own bottom inset. Lifting
it over the monitor without shortening it pushed the top of a long download
list off screen.

Measure the stack column from the update banners (448px), not the download
panel (400px), so a monitor beside a banner is still dodged.

Name the precision an image or video pipeline loaded at, so a quantised build
is distinguishable from bf16 in the row.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: fb3ba5c3b5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen danielhanchen self-assigned this Aug 8, 2026
The card is anchored bottom-right, where a native CSS resize grip has nowhere
to grow, so it resizes from a grip at the leading corner instead: the anchored
corner is held still and the box opens up and to the left. The grip shares the
title icon's slot rather than adding another control to a small header, and
double-clicking it returns the card to its default size and corner.

The size persists next to the position, is clamped to a floor and to the room
available, and is cleared by Reset all local preferences.
Clicking a row now goes to where that model is used: chat models to Chat,
image and video pipelines to their tabs, dictation to the Voice settings tab
that drives the sidecars. The target follows the runtime holding the weights,
not the kind, so a Whisper checkpoint in the chat slot goes to Chat rather
than to dictation.

Navigation carries no search params, so it only changes page: it does not
start a new thread or reload anything. Dictation moves to the Audio page once
that lands.
Back to the fixed-size card. Reverts 96749d1.

Also read /api/inference/status directly instead of through the chat barrel,
matching the dictation read alongside it. The server logs show the indicator's
chat read never reaching the backend: across every session the status count
sits at roughly half the images/video/dictation count, matching the chat
page's own 10s poll rather than the indicator's 5s one, which is why a loaded
text model showed no row while an image model did.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

…at report work they did not do

Two of these break the feature outright, the rest report success for an eject
that never happened.

The card can become permanently unreachable. use-drag-position captured
panelRef.current once, in an effect keyed [position, reclamp]. The indicator
returns null until the first poll produces a row, so that effect always ran
while the ref was still null: no ResizeObserver was ever constructed, and the
resize listener closed over null. Neither dependency changes when the node
finally mounts, so it never re-ran, and nothing in production ever called
clampToViewport except an active drag. Dragging the card on a 2560x1440 screen
and reopening at 1440x900 left it at x=2502, off screen, taking its own drag
handle and collapse button with it; resizing did not help. The only way back
was devtools or Reset all local preferences. The node now arrives through
state so the effect re-subscribes, and the stored position is clamped as it is
read so it cannot paint off screen even for one frame.

Locale parity fails. CI's first gate is i18n:check:strict and the two new keys
were added to en.ts only, so all 11 overlays were short. Added everywhere.

The chat eject reported ejects it never performed. When nothing matching was
resident it POSTed /unload anyway and returned stillResident: null without
re-reading. The backend answers 200 "unloaded" for a model it never held, so
the user got a success toast for a no-op and their picker selection was
cleared off the back of it. Reachable by an ordinary sequence: loading B
evicts A, and the card shows A for up to one poll. It now reports the same
replaced / already-gone outcomes the runtime rows use, and only names a model
directly for a cached row, which is the one case a status read cannot see.

The dictation eject could release another engine's model. /audio/stt/unload
silently serves gguf from the transformers engine when whisper-server is
absent, and the unload response body is a fixed {loaded_model: null}, so a 200
was not evidence this engine let go. It now re-reads and reports what the
engine actually holds.

No timeout on the eject path. READ_TIMEOUT_MS guarded only readLoadedModels; a
runtime that accepted the connection and never answered left the row disabled
with a spinner until reload. Same bound, raised rather than swallowed.

An audio-input VLM was filed under Speech. The split was audio_type !==
"whisper", but the backend's own is_audio_input_type names two input types,
whisper and audio_vlm. A model that listens was labelled as one that speaks,
which is the confusion this card exists to remove.

A stale poll could restore an ejected row, and the trailing refresh could not
repair it because the in-flight guard was still held by that same read. A
generation counter retires reads issued before an eject, and a pending flag
keeps the trailing refresh.

The drag now captures the pointer, as the Live monitor's does. Without it a
release over another window is never delivered and the card follows the cursor.

Backend: the card polls four runtimes every 5s for as long as the app is open,
and only /api/inference/status was in _QUIET_POLL_PATHS. Its three siblings
are now too, or every desktop tauri.log carries three lines every five seconds.

Tests

tests/loaded-models-platform-matrix.test.ts walks the payloads
[Windows, Linux, WSL, macOS] x [NVIDIA, AMD ROCm, Intel XPU, CPU-only, Apple]
actually produce. None of it is visible from a CUDA box: ROCm reports itself
as cuda, Apple reports mps, XPU reports xpu for images but cpu for dictation
because the STT device probe never checks torch.xpu, and the sd.cpp engine
omits model_kind and puts "gguf" in dtype.

tests/loaded-models-backcompat.test.ts covers the desktop app running against
an older wheel, which is a supported configuration: it ships its own frontend
bundle and adopts a separately installed backend. /video/status and the STT
mtmd block are both days old, so a 404 route, a missing engine block, the
pre-split top-level fields and absent optional fields all have to degrade
rather than blank the rows a working runtime returned. Also pins that fields
a future backend adds are ignored.

tests/loaded-models-drag-restore.test.ts guards the restore geometry and, by
reading the source, the wiring it depends on. Four of its cases fail against
the code before this commit.

tests/studio/playwright_loaded_models_indicator.py runs 28 checks in Chromium,
Firefox and WebKit, covering Chrome, Edge and the WebView2, WKWebView and
WebKitGTK the desktop app embeds. It stubs the four status endpoints with
page.route, so it needs no model, no GPU and no llama.cpp build, and can
therefore replay the AMD, Apple and CPU-only payloads on any runner. The
position restore is here rather than in the node suite because it needs a real
layout and a real ResizeObserver. Wired into the Linux, macOS and Windows UI
workflows alongside the existing permission runs. Against the code before this
commit it reports 25/28, failing exactly on the off-screen card and the
mislabelled audio-input model.
@danielhanchen
danielhanchen self-requested a review as a code owner August 8, 2026 04:19
…op racing them

Staging CI on macos-14 caught this: every check up to the eject passed, then
the run died on a 60s locator timeout.

rows() read count() and then indexed nth(i). The eject checks poll it while
the row is disappearing, which is the whole point of them, so the row could go
between the two calls and nth(1) would block for the full locator timeout
rather than reporting a shorter list. evaluate_all takes the snapshot in a
single evaluation, so there is no window.

card_text had the same count()-then-read shape; it is now bounded and returns
empty rather than blocking when the card is mid-change.

Test-only. Confirmed 28/28 in Chromium, Firefox and WebKit after the change.
danielhanchen pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Aug 8, 2026
… fix

The Windows job failed with 'unsloth: command not found': install.ps1 updates
the User PATH through the registry, which a running Git Bash session never
sees. Same GITHUB_PATH step the upstream Windows UI workflow carries.

Also merges unslothai#8082's fix for the rows() locator race that
macos-14 caught.
pre-commit-ci Bot and others added 2 commits August 8, 2026 04:51
Run the media pages' full unload cleanup on an indicator eject, not just a
status refresh. Images and Video kept lastLoad and canReapply, so Reapply
still offered to reload the model that was just ejected, and the stale
quantisation stayed on screen. Both now share that cleanup with their own
Unload rather than duplicating half of it.

Cap the overlay stack under a monitor parked high in its column. Avoidance was
skipped entirely whenever the monitor's bottom sat above the midpoint, on the
grounds that the corner was free, but the stack grows upwards from the bottom
and a full download list plus the card reaches well past halfway. It is capped
to the gap below such a monitor instead, since lifting over it would be wrong.

stackBottomInset and stackMaxHeight now come from one stackGeometry call, so
the two cannot disagree about where the monitor is.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 8, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 8, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

danielhanchen and others added 2 commits August 8, 2026 13:35
Main had gained its own tests in test_inference_status_loaded_gguf.py, for the
chat template projection, while this branch added three for what a GGUF load
leaves in the registry. The two sets are about different things and the file's
first four cases are identical on both sides, so the resolution keeps the union.
Nine backend cases pass, and the frontend suite is clean at 1261.
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

Main's on-device GGUF pick fix reworked handleUnload on both media pages,
inlining the teardown and adding pickGuard.cancel() so a resolving pick or a
staged download cannot load back what was just ejected. This branch had factored
that same teardown into dropResidentState for the indicator's eject listener to
share.

Resolved by keeping the factoring and folding the new cancel into it, so both
callers get main's protection: the page's own Unload, and an eject driven from
the card, which has the same hazard and previously had no guard at all.

1289 frontend tests pass, typecheck and build clean, and eslint reports the same
20 and 14 pre-existing errors on the two pages as origin/main does, so the merge
adds none.
… was covering

The loaded models card is the first overlay in the bottom-right stack that is
persistent rather than transient, and the chat composer docks to the bottom of
that same column once a thread has turns. The card landed on top of the Send
button and swallowed the click: Playwright resolved the button, found it
visible, enabled and stable, then retried for 60s while
"unsloth/gemma-3-270m-it-GGUF ... subtree intercepts pointer events". Caught by
the chat UI suite on both ubuntu-latest and macos-14.

The stack already knows how to keep clear of something: the Live monitor
publishes its box and stackGeometry lifts the stack above it. That store held
one box, from one publisher, so the composer had nowhere to say where it is.
It now keeps a box per publisher and dodges their union, which is also the
right answer while the monitor is mid-exit and two panels are briefly
published at once.

The composer publishes through a small usePublishedFrame hook, re-measuring on
resize and through a ResizeObserver because it grows with its input and moves
from centred to docked without a resize event. A hidden composer measures 0x0
and is withdrawn rather than published, which would otherwise pull the union
to the top-left and pin the stack there.

Verified against a live backend at 1280x900, 1280x720 and 1440x900 with the
composer docked: the element under the Send button's centre is the composer,
and reverting the publish alone puts the overlay stack back there at all
three. 1289 node tests pass, typecheck, i18n parity and build clean.
danielhanchen added a commit to Datta0/unsloth-staging-3 that referenced this pull request Aug 8, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ffcd701d0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// own finally does.
setBusy((prev) => (prev === "loading" ? null : prev));
setQuant(null);
void refreshStatus();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Ignore status reads started before an eject

On a slow or external Studio server, a tab-activation refreshStatus() can read the loaded pipeline before the eject, but finish after this post-eject refresh and overwrite its empty status. The active Images page then continues offering generation against the freed runtime because it has no periodic status poll; the identical unsequenced refresh exists in Video. Add a request generation or abort older status reads so only the newest refresh can call setStatus.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, and both pages had it. They re-read status on tab activation and on their own actions but never on a timer, so an activation read that saw the pipeline loaded can answer after the post-eject read that saw it gone, and nothing comes along to correct it: the controls go on offering to generate against a freed runtime.

Fixed in 950fc4e. Every read takes a ticket before it awaits and only the newest may write. One correction to the scope: the refresh was not the only writer worth gating. The load-progress read and the unload response set status directly too and could overwrite a newer answer just as easily, so all three go through the same gate on both pages. Four cases pin it, all failing with the pages reverted.

Comment on lines +44 to +47
left: Math.min(merged.left, frame.left),
top: Math.min(merged.top, frame.top),
right: Math.max(merged.right, frame.right),
bottom: Math.max(merged.bottom, frame.bottom),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep independent obstacle frames separate

When the Live monitor is dragged to the left while the chat composer is published near the bottom-right, this union fabricates one large rectangle spanning the empty space between them. For example, a top-left monitor contributes the union's top while the composer contributes its right edge and bottom, so stackBottomInset treats the fabricated rectangle as a full-height obstacle in the stack column and can lift the update/download/model stack to its 120px-room cap even though the monitor is nowhere near that column. Preserve the individual frames and calculate the vertical constraint only from publishers that actually intersect the stack column.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reasoning about the merged rectangle is right, but the consequence does not reach the stack at this head. 69ed15d already stopped the geometry reading a union: stackGeometry folds the published boxes one at a time, taking the largest lift any single one asks for and the shortest height any allows, and useStackGeometry passes it the frames map rather than the merged box. Nothing read the merged field at all. So a monitor dragged left cannot lift the stack to its 120px cap, which is the case pinned by 'two obstacles are folded one at a time, not as their bounding box' in monitor-stack-inset.test.ts, using exactly that geometry.

Marking this down for that reason rather than because the shape was harmless: it was, in fact, the bug, one round earlier. The field you are pointing at was a leftover summary nothing consumed, and since it is what made this look live I have deleted it in 950fc4e and said in the type why the boxes are kept apart.

…ng box

Follow-up to the composer fix. Publishing a second box made the store hold two,
and reading their union as one obstacle was wrong: a tall monitor and the wide
docked composer share almost no area, so the rectangle around the pair covers
most of the viewport. stackBottomInset then lifted the stack to its clamp near
the top of the screen and put it back over the monitor it was dodging. The chat
UI suite caught it on Windows and macOS as the card swallowing the monitor's
Close button, at the step that drags the monitor up the column first, which is
exactly when the union is most unlike its parts.

stackGeometry now folds per box: each asks for the lift it needs, the stack
takes the largest, and the height is the shortest any of them allows. The
single-box maths is untouched, so its existing cases still pin it. The store
keeps the union as a summary only, and says so.

Three cases added: the fold against a monitor parked high, which is the case
that diverges, plus an empty list and a single box matching the old calls.
1295 node tests pass, typecheck and build clean, and the docked-composer probe
still finds the composer under the Send button at three viewports.
danielhanchen added a commit to Datta0/unsloth-staging-3 that referenced this pull request Aug 8, 2026
The Images and Video pages hold their own status and re-read it on tab
activation and on their own actions, never on a timer. Two reads are therefore
in flight across an eject: the activation read that saw the pipeline loaded,
and the post-eject read that saw it gone. Responses have no order, so the older
one could land last and put the loaded status back, leaving the page offering
to generate against a runtime that was already free, with no poll coming to
correct it. Both pages had it, identically.

Every read now takes a ticket before it awaits, and only the newest may write.
All three writers on each page go through the same gate, not just the refresh:
the load-progress read and the unload response could overwrite a newer answer
just as easily.

Also drops the merged rectangle the frame store still exposed. Nothing read it
after the fold landed, but it was the shape the review picked up on, and it
merged obstacles that do not touch: the rectangle around a left-hand monitor
and a bottom-right composer spans the empty space between them. The store keeps
the boxes apart and says why; stackGeometry already folds them one at a time.

Four cases pin the sequencing, all four failing with the pages reverted. 1299
node tests pass, typecheck, i18n parity and build clean.
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 950fc4e238

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit b3705f4 into main Aug 8, 2026
7 of 57 checks passed
@danielhanchen
danielhanchen deleted the feat/loaded-models-indicator branch August 8, 2026 15:27
danielhanchen added a commit that referenced this pull request Aug 9, 2026
)

* Repin six UI contracts on what they guard, not how it was spelled

Repo tests (CPU) is red on main with six failures. All six are source-shape
contracts whose subject was rewritten by #8082 and #8149; in every case the
behaviour they exist to protect is intact, and in two cases it is better than
what the assertion described.

Three in test_update_release_notes.py asserted the literal Tailwind class
max-h-[calc(100dvh_-_2rem)]. #8082 replaced that fixed cap with stackGeometry,
which subtracts the same 2rem when nothing is in the way and subtracts more when
the Live monitor is, so the stack dodges it instead of sitting under it. The
arithmetic is checked numerically in monitor-stack-inset.test.ts, which pins
stackGeometry(null, W, H).maxHeight to H - 32 among thirteen other cases. What
these tests can still add is that every stack element reads it, so they now
count stack containers and require a cap on each. Counting matters: there are two
such elements, browser and desktop, and capping one and not the other is the
mistake worth catching. A fourth test names the node test, so deleting the
numeric check does not quietly leave the cap unguarded.

Three in test_model_picker_contracts.py:

- The routed pick test pinned diffusionRoutePick's second argument, which was
  respelled from routeSearch.quant to routedFilename. The catalog spec is the
  third argument and is the thing the test is named for, so the second is no
  longer matched.
- The GGUF guard test required a toast.error in a branch that used to reject a
  repo-id pick. #8149 made that branch resolve the repo's own .gguf instead,
  which is the better answer. The invariant that survives is that the branch does
  something: a bare return there drops the pick with no request and no message.
- The deferred-load test required the flush effect to end with }, [active]); and
  to call handleLoadRef directly. The load body moved into runStagedLoad, shared
  with the visible path, so the dependency array grew. It now accepts either
  spelling and, when the helper is used, follows through into it.

Mutation-tested, all eight caught: cap dropped from the browser stack; from the
desktop stack alone; desktop stack stops measuring itself; node test stops
pinning H - 32; repo-id GGUF pick returns bare; routed pick drops its catalog
spec; deferred flush clears the flag and stops; runStagedLoad loads nothing. The
first two survived an earlier draft that used a plain substring check, which is
why the counting form is there.

tests/studio: 3 failed, 2795 passed. The three are
test_studio_gguf_export_script_pin.py, which fails identically on main and is
outside this job's scope.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Bound the deferred-flush match to its own effect

Keying the closing boundary on `[active` let a validly reordered dependency
array run the match past the effect and on to the next hook, where loadOrStage's
own handleLoadRef call satisfied the loader assertion for a flush that loads
nothing. Stop at the first boundary and check the deps separately.

* Check the catalog spec by position, not by presence

The capture is every argument after `wanted`, so a substring check did not prove
the spec reached the third parameter. `diffusionRoutePick(wanted, routedFilename
?? loadSpecFor(wanted, IMAGE_CATALOG)?.filename)` type-checks, passes the catalog
filename as the quant and drops the spec, which sends curated single-file
artifacts down the GGUF branch, and it satisfied the old assertion. Split the
argument list on its own commas and pin the third.

* Tighten the repinned contract comments

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: danielhanchen <[email protected]>
shimmyshimmer added a commit that referenced this pull request Aug 25, 2026
)

* Studio: put the notification rail back in its bottom-right corner

The rail was anchored with `fixed bottom-4 right-4` until #8082, which added
the loaded models indicator and, with it, a frame store the rail read: the
Live monitor, the API monitor panel and the chat composer publish their boxes,
and `useStackGeometry` wrote `bottom` and `maxHeight` as inline styles that
dodged them.

Every input to that placement moves on its own. The composer grows with its
input and goes from centred to docked with no resize event, a download row
arrives, release notes expand, a banner is dismissed. Each change re-ran the
measurement, and when the room fell short the rail lifted over the obstacle at
`viewportHeight - frame.top + STACK_GAP`. On the welcome chat that is the cards
in the middle of the window; against a maximised monitor the lift clamped at
MIN_STACK_ROOM and parked them at the top. It reads as random because the
trigger is measurement timing.

The store also had to probe its own output, dropping `max-height` to read
`scrollHeight` and restoring it with transitions suppressed, because the
placement was feeding on the box it had just sized. It went from 184 lines to
701 over nine follow-up PRs, all of them editing the same arithmetic.

So this restores the anchor rather than adding another special case. The rail
is `fixed bottom-4 right-4` with the CSS cap again, on the named layer rather
than the old hard-coded z-index. The frame store keeps its map of boxes, which
api-monitor/panel-placement still needs to open the API panel clear of the
monitor and the composer, and loses the dodge arithmetic, the measurement loop
and the `coverable` licence. The composer still publishes for that panel's
sake. The indicator itself is untouched.

Known trade-off, and the pre-#8082 behaviour: in a short window a card can sit
over the composer's Send button rather than the rail dodging it. The indicator
is off by default, draggable and dismissible.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Studio: scroll the rail at its cap instead of spilling cards off screen

Review catch, and it reproduces. The cap alone does not contain anything: the
cards that cannot shrink lay out past the rail's bottom edge, which is pinned
16px off the floor, so the overflow goes under the bottom of the window with
no way to bring it back.

At 320x480 with --ui-font-scale 1.25, three cards up: the llama.cpp banner is
in flow with its bottom at 497 against a 480px viewport, and the card after it
is squeezed to 0px at 505. scrollHeight 501 against clientHeight 448, and
overflow-y visible. The Update button is below the fold for good.

Earlier sizes missed it because the download panel is the one min-h-0 card in
the rail and absorbed the squeeze on its own. Raising the type size puts the
two banner floors over the cap and the slack runs out.

So the rail scrolls again, in CSS only. No measurement, no placement: the
offset and the cap stay where they were. The gutter comes back with it, since
overflow-y forces overflow-x and the card shadows clip without it, and stays
horizontal so the bottom card keeps sitting on bottom-4.

The rail stays click-through. Verified that the fold is still reachable:
elementFromPoint over a card returns a node inside it, so the card is the hit
target despite the rail being pointer-events-none, and the rail is that node's
nearest scrollable ancestor, which is the chain a wheel scrolls. Focus works
too: the Update button measured at bottom 481 in a 480px viewport, and
focusing it scrolled the rail to 17 and brought it to 464.

* Studio: measure the rail's corner off a card, and drop the stale pointer contract

Two fixes to the Playwright suite, both mine to begin with.

The corner check measured `fromRight` off the rail's border box. The rail
carries the shadow gutter, `-mx-3 px-3`, so its border box sits 4px from the
viewport edge while the cards it pads sit at 16. It reported 4 and would have
failed at every inspected viewport. Measured at 320x480 and at 921x534, one of
the two the pass runs: rail 4, every in-flow card 16. It now takes the right
edge from the cards, filtered to the ones in flow, since a dragged loaded
models card is `fixed` somewhere else. The bottom still comes off the rail:
no vertical margin or padding, and its border box does not move when the cards
scroll. Checked at both scroll extremes.

The other is a contract this branch already invalidated. The suite asserted the
rail takes pointer input exactly when it scrolls, which was #9150 and needed the
JS that also placed it. The rail is click-through in every state now, so that
check failed whenever the rail scrolled. Verified at 320x480 with the rail
actually scrolling, scrollHeight 501 against clientHeight 448: pointer-events
none, and a click on the gutter lands on the thread viewport behind it. Both
assertions are now unconditional.

* CI: drop the install and the artifact dir the deleted rail harness owned

The vite install in the banner shard exists for playwright_overlay_rail.py and
nothing else, so with the harness gone it is dead. Nothing left in
studio-ui-smoke.yml touches npm, npx, node_modules or studio/frontend, so on a
frontend-dist cache hit it would run a clean `npm ci` for no consumer.

logs/playwright-overlay-rail goes with it: it was only ever written by the two
steps this branch removed.

Job-level setup-node stays. It predates the harness (#9060) and the installer
needs node to build the frontend on a cache miss.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
danielhanchen added a commit that referenced this pull request Sep 18, 2026
…pattern (#11268)

* Find the overlay rails by testid, not by the corner spelled into the pattern

#11260 moved the rails flush to the bottom-right corner (right-4 -> right-0,
max-h-[calc(100dvh_-_8px)] -> max-h-[100dvh]) and paid the inset as inline px
padding. Four tests across two files matched the rail with a regex that spelled
the old corner into the pattern, so they found nothing and reported the rails as
missing rather than as moved:

  test_overlay_layering.py::test_the_notification_stack_uses_the_named_layer
  test_update_release_notes.py::test_the_overlay_stack_fits_the_viewport
  test_update_release_notes.py::test_the_desktop_stack_is_capped_like_the_browser_one
  test_update_release_notes.py::test_the_download_panel_can_shrink_inside_the_capped_stack

The product change is deliberate and documented; the matchers are what move.
Both files now find the rails by data-testid="overlay-rail", which is the same
reasoning test_update_release_notes.py already grew _class_on_testid for: an
anchor built out of the classes under test cannot survive one of them changing.

Where the rail sits is now a claim in its own test rather than a side effect of
the matcher, and the gutter rule #11260 introduced gets one too: the cap is the
whole viewport and the gutters are paid as inline px, so the cards keep the band
they had. That test also holds the two floors the comment gives (22px left and
14px top, from the deepest card shadow) and refuses a rem-valued padding utility,
which is the #8082 failure the constants exist to avoid.

Sabotage-proved: rail off the corner, cap removed, left gutter cut to 4px, and a
px-3 utility restored each fail the right test with a message naming the cause.
A pure restyle no longer breaks them, which is what went wrong here.

* Require the rail's corner ungated, and bind each padding to its own constant

Two review items, both right, both the failure this file exists to catch.

_applies passes on a gated rule, so md:fixed md:bottom-0 md:right-0 satisfied the
corner guarantee while the rail was unpinned below that breakpoint. The file's own
matcher tests say a positive guarantee takes _only_under; the rail assertions were
the place that did not.

Counting "padding*: STACK_" per file said nothing about which constant reached
which property. paddingLeft fed from STACK_CARD_INSET_RIGHT still counted two,
left the 22px floor vouching for a 28px constant nothing applied, and rendered a
16px gutter that clips the shadow the floor exists for. Now read per rail as a
property-to-constant map and compared whole.

Both sabotages fail the right test: gating the three utilities fails the corner
test, and swapping paddingLeft's constant fails the gutter test.

* Read the cap and the padding utilities through their variants

Two more of the same shape, both right.

The cap was a substring test, so md:max-h-[100dvh] counted as capped while every
viewport below that breakpoint could spill cards off screen again. It takes
_only_under now, like the corner assertions.

The rem-padding refusal matched a bare token only, so !px-3 walked past it -- and
an important Tailwind padding beats the non-important inline px padding outright,
which is precisely the rem-scaled offset the constants exist to avoid. It reads
through _split_variants now, so the variants and the importance marker come off
first, and arbitrary rem values are refused alongside the numeric scale.

Sabotages: md:max-h-[100dvh] fails the three capping tests, !px-3 and md:!px-3
each fail the gutter test. All three passed before.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Share one JSX scanner, and refuse padding by property rather than by value

Three review items, all right, and two of them the same lesson twice.

test_overlay_layering.py found the rail with rfind("<")/find(">"). An attribute
holding a comparison starts that scan mid-expression and drops every class before
it, so a hard-coded z-index earlier in the className is invisible and the layering
test passes over the regression it exists to catch. The bracket- and literal-aware
scanner it needed already existed in test_update_release_notes.py, so it moves to
tests/_shared/jsx_tags.py and both files import it. tests/conftest.py already puts
that directory on sys.path for exactly this reason, in its own words: so the levels
"share one module rather than each growing a private copy".

The padding refusal enumerated spellings and kept missing them: first !px-3, then
px-2.5 (fractional, and this repo uses it) and !pr-[0px] / md:!p-[4px] (arbitrary,
non-rem, and !important beats the inline declaration outright). Enumerating values
has an endless tail, so it matches the PROPERTY now: the rail's padding comes from
the inline px style, and ANY padding utility on it is either rem-scaled or an
override. Seven spellings sabotage-proved, including all five named in review, plus
a plain pt-4.

The truncated-tag case is proved too: a comparison attribute before the test id
with z-[99] added to the className now fails the layering test.

* Cover the logical padding utilities too

ps- and pe- were outside the character class, and this repo uses both (ps-9,
ps-1.5, ps-[5px], pe-[calc(...)]), so !ps-3 on a rail would have overridden the
inline start gutter with a rem-scaled value and passed.

The side letter stays optional and a "-" still has to follow it, so
pointer-events-none, peer-* and place-items-center are unaffected; that is
asserted as a control alongside the four sabotages (ps-3, !ps-3,
pe-[calc(1rem)], md:!pe-2), each of which fails the gutter test.

* Keep the rail's pointer-events contract, which the new matcher had dropped

The class-anchored matcher this PR replaces carried "pointer-events-none" inside
its pattern, so the rule was enforced as a side effect of finding the element.
Anchoring on the testid found the rail without it, and nothing else asserted it.

That is a behaviour contract, not styling. The rail spans its whole cap with a
28px transparent shadow gutter and a scroll region, and the cards inside opt back
in with pointer-events-auto (the download panel by name), so a rail that loses the
container rule swallows clicks meant for the UI behind it.

Asserted ungated, next to the corner rules. Dropping the class fails the test, and
so does gating it behind a breakpoint.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Read prohibitions off the whole class expression, not the always-rendered part

_class_value answers what the className renders in EVERY state, which is what the
positive corner and cap guarantees need. The padding prohibition was reading the
same set, and for a "must never" that is the wrong question: cn("...", compact &&
"!pl-0") overrides the inline gutter whenever compact is true, and an
always-rendered reader never sees the token at all.

_rail_class_tokens reads the literals out of the whole expression instead, and the
two readers stay side by side with the asymmetry written down: "must always have X"
and "must never have Y" cannot be answered from the same set.

Sabotage: wrapping both rails as cn("...", isUpdating && "!pl-0") now fails the
gutter test and passed before.

* Cover Tailwind's arbitrary padding properties as well as its utility family

Tailwind has two ways to set padding and the guard only knew one. The
arbitrary-property form is emitted with !important and, once _split_variants has
taken the marker off, begins with "[", so a pattern anchored on "p" never sees
![padding:0px] or [padding-left:0px]! at all.

Both spellings now sit in one named pattern. The side letter stays optional with a
"-" required after it, so pointer-events-none, peer-* and place-items-* are still
out, and [margin-left:4px] and [position:fixed] are too; that control is asserted
alongside the four sabotages (![padding:0px], [padding-left:0px]!,
md:![padding-inline:1rem], [padding-block:2px]).

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…pattern (unslothai#11268)

* Find the overlay rails by testid, not by the corner spelled into the pattern

unslothai#11260 moved the rails flush to the bottom-right corner (right-4 -> right-0,
max-h-[calc(100dvh_-_8px)] -> max-h-[100dvh]) and paid the inset as inline px
padding. Four tests across two files matched the rail with a regex that spelled
the old corner into the pattern, so they found nothing and reported the rails as
missing rather than as moved:

  test_overlay_layering.py::test_the_notification_stack_uses_the_named_layer
  test_update_release_notes.py::test_the_overlay_stack_fits_the_viewport
  test_update_release_notes.py::test_the_desktop_stack_is_capped_like_the_browser_one
  test_update_release_notes.py::test_the_download_panel_can_shrink_inside_the_capped_stack

The product change is deliberate and documented; the matchers are what move.
Both files now find the rails by data-testid="overlay-rail", which is the same
reasoning test_update_release_notes.py already grew _class_on_testid for: an
anchor built out of the classes under test cannot survive one of them changing.

Where the rail sits is now a claim in its own test rather than a side effect of
the matcher, and the gutter rule unslothai#11260 introduced gets one too: the cap is the
whole viewport and the gutters are paid as inline px, so the cards keep the band
they had. That test also holds the two floors the comment gives (22px left and
14px top, from the deepest card shadow) and refuses a rem-valued padding utility,
which is the unslothai#8082 failure the constants exist to avoid.

Sabotage-proved: rail off the corner, cap removed, left gutter cut to 4px, and a
px-3 utility restored each fail the right test with a message naming the cause.
A pure restyle no longer breaks them, which is what went wrong here.

* Require the rail's corner ungated, and bind each padding to its own constant

Two review items, both right, both the failure this file exists to catch.

_applies passes on a gated rule, so md:fixed md:bottom-0 md:right-0 satisfied the
corner guarantee while the rail was unpinned below that breakpoint. The file's own
matcher tests say a positive guarantee takes _only_under; the rail assertions were
the place that did not.

Counting "padding*: STACK_" per file said nothing about which constant reached
which property. paddingLeft fed from STACK_CARD_INSET_RIGHT still counted two,
left the 22px floor vouching for a 28px constant nothing applied, and rendered a
16px gutter that clips the shadow the floor exists for. Now read per rail as a
property-to-constant map and compared whole.

Both sabotages fail the right test: gating the three utilities fails the corner
test, and swapping paddingLeft's constant fails the gutter test.

* Read the cap and the padding utilities through their variants

Two more of the same shape, both right.

The cap was a substring test, so md:max-h-[100dvh] counted as capped while every
viewport below that breakpoint could spill cards off screen again. It takes
_only_under now, like the corner assertions.

The rem-padding refusal matched a bare token only, so !px-3 walked past it -- and
an important Tailwind padding beats the non-important inline px padding outright,
which is precisely the rem-scaled offset the constants exist to avoid. It reads
through _split_variants now, so the variants and the importance marker come off
first, and arbitrary rem values are refused alongside the numeric scale.

Sabotages: md:max-h-[100dvh] fails the three capping tests, !px-3 and md:!px-3
each fail the gutter test. All three passed before.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Share one JSX scanner, and refuse padding by property rather than by value

Three review items, all right, and two of them the same lesson twice.

test_overlay_layering.py found the rail with rfind("<")/find(">"). An attribute
holding a comparison starts that scan mid-expression and drops every class before
it, so a hard-coded z-index earlier in the className is invisible and the layering
test passes over the regression it exists to catch. The bracket- and literal-aware
scanner it needed already existed in test_update_release_notes.py, so it moves to
tests/_shared/jsx_tags.py and both files import it. tests/conftest.py already puts
that directory on sys.path for exactly this reason, in its own words: so the levels
"share one module rather than each growing a private copy".

The padding refusal enumerated spellings and kept missing them: first !px-3, then
px-2.5 (fractional, and this repo uses it) and !pr-[0px] / md:!p-[4px] (arbitrary,
non-rem, and !important beats the inline declaration outright). Enumerating values
has an endless tail, so it matches the PROPERTY now: the rail's padding comes from
the inline px style, and ANY padding utility on it is either rem-scaled or an
override. Seven spellings sabotage-proved, including all five named in review, plus
a plain pt-4.

The truncated-tag case is proved too: a comparison attribute before the test id
with z-[99] added to the className now fails the layering test.

* Cover the logical padding utilities too

ps- and pe- were outside the character class, and this repo uses both (ps-9,
ps-1.5, ps-[5px], pe-[calc(...)]), so !ps-3 on a rail would have overridden the
inline start gutter with a rem-scaled value and passed.

The side letter stays optional and a "-" still has to follow it, so
pointer-events-none, peer-* and place-items-center are unaffected; that is
asserted as a control alongside the four sabotages (ps-3, !ps-3,
pe-[calc(1rem)], md:!pe-2), each of which fails the gutter test.

* Keep the rail's pointer-events contract, which the new matcher had dropped

The class-anchored matcher this PR replaces carried "pointer-events-none" inside
its pattern, so the rule was enforced as a side effect of finding the element.
Anchoring on the testid found the rail without it, and nothing else asserted it.

That is a behaviour contract, not styling. The rail spans its whole cap with a
28px transparent shadow gutter and a scroll region, and the cards inside opt back
in with pointer-events-auto (the download panel by name), so a rail that loses the
container rule swallows clicks meant for the UI behind it.

Asserted ungated, next to the corner rules. Dropping the class fails the test, and
so does gating it behind a breakpoint.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Read prohibitions off the whole class expression, not the always-rendered part

_class_value answers what the className renders in EVERY state, which is what the
positive corner and cap guarantees need. The padding prohibition was reading the
same set, and for a "must never" that is the wrong question: cn("...", compact &&
"!pl-0") overrides the inline gutter whenever compact is true, and an
always-rendered reader never sees the token at all.

_rail_class_tokens reads the literals out of the whole expression instead, and the
two readers stay side by side with the asymmetry written down: "must always have X"
and "must never have Y" cannot be answered from the same set.

Sabotage: wrapping both rails as cn("...", isUpdating && "!pl-0") now fails the
gutter test and passed before.

* Cover Tailwind's arbitrary padding properties as well as its utility family

Tailwind has two ways to set padding and the guard only knew one. The
arbitrary-property form is emitted with !important and, once _split_variants has
taken the marker off, begins with "[", so a pattern anchored on "p" never sees
![padding:0px] or [padding-left:0px]! at all.

Both spellings now sit in one named pattern. The side letter stays optional with a
"-" required after it, so pointer-events-none, peer-* and place-items-* are still
out, and [margin-left:4px] and [position:fixed] are too; that control is asserted
alongside the four sabotages (![padding:0px], [padding-left:0px]!,
md:![padding-inline:1rem], [padding-block:2px]).

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants