Skip to content

Read the descender guard's class list wherever it is written - #8765

Merged
danielhanchen merged 3 commits into
mainfrom
fix/descender-guard-cn-wrapper
Aug 14, 2026
Merged

danielhanchen merged 3 commits into
mainfrom
fix/descender-guard-cn-wrapper

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Aug 14, 2026 •

Copy link
Copy Markdown
Member

Repo tests (CPU) is red on main. test_model_selector_trigger_label_uses_leading_tight fails with could not find ModelSelectorTrigger model-name span, which blocks every open PR.

The component is not the problem

#8445 gave the trigger label a caller override, so the span changed shape:

-<span className="min-w-0 flex flex-1 items-baseline truncate font-heading text-ui-16 font-medium leading-tight text-black dark:text-white">
+<span
+  className={cn(
+    "min-w-0 flex flex-1 items-baseline truncate font-heading text-ui-16 font-medium leading-tight text-black dark:text-white",
+    triggerLabelClassName,
+  )}
+>

The class list is byte for byte the same. It still pairs truncate with leading-tight and carries no leading-none, which is exactly what this guard exists to require. Nothing regressed in the UI.

The guard is

It matched on the JSX attribute syntax:

r'<span\s+className="[^"]*\bmin-w-0\b...'

so wrapping the identical string in cn() made it match nothing, and its only response to matching nothing was to say it could not find the span. A guard that falls silent the moment a label grows an override is not guarding much, since taking an override is an ordinary thing for a label to do.

It now collects the class literals wherever they are written and matches on the token set, so both the attribute form and the cn() argument form are covered.

Attribution

Bisected across the eight most recent commits to model-selector.tsx:

4b38ab1b4  1 failed, 2 passed   Fix Audio layout and responsive media headers (#8445)
8d0edc1a4  3 passed             Studio: read a model picker row at a glance (#8658)
993e3e452  3 passed             Studio: drop the duplicated HubModelPicker import (#8534)
dfae53b53  3 passed             Studio: name a connected model the provider dropped (#8470)

Proof the guard can still fail

mutation to model-selector.tsx result
leading-tight to leading-none on the label FAILED, expected leading-tight, got: ... truncate font-heading text-ui-16 font-medium leading-none ...
text-ui-16 to text-ui-15 so the label no longer matches FAILED, could not find ModelSelectorTrigger model-name span
unmutated 3 passed

The second mutation matters: without it the first would pass vacuously on a file where the label had simply been renamed away.

Not a narrowing: run against the pre-#8445 source at 8d0edc1a4, the new matcher still finds the literal.

The sibling check had the same hole

test_sidebar_account_block_uses_leading_tight keyed on <div className="..."> for the same reason, so it would go quiet the moment that div takes an override. Both checks now share one matcher and select on their own token set.

Behaviour is unchanged: the same single div matches. app-sidebar.tsx has two group-data-[collapsible=icon]:hidden divs and only the account block carries flex-1, which is what the original required set already selected on.

mutation to app-sidebar.tsx result
leading-tight to leading-none on the account block FAILED
account block carries no leading-* at all FAILED, no leading-* class on sidebar account-block parent
drop flex-col so the block no longer matches FAILED, could not find sidebar account-block parent div
unmutated 3 passed

Repo tests (CPU) is red on main: test_model_selector_trigger_label_uses_leading_tight
fails with "could not find ModelSelectorTrigger model-name span".

The component is fine. #8445 gave the trigger label a caller override, so the span
went from className="..." to className={cn("...", triggerLabelClassName)}. The class
list itself did not change: it still carries truncate with leading-tight and no
leading-none, which is exactly what the guard exists to require.

What broke is the guard. It matched on the JSX attribute syntax, so wrapping the same
string in cn() made it find nothing, and its only reaction to finding nothing was to
say so. A guard that goes quiet the moment a label grows an override is not guarding
much, since taking an override is a normal thing for a label to do.

It now reads the class literals wherever they are written and matches on the token
set, so both the attribute form and the cn() argument form are covered. The
pre-#8445 literal is still matched, so this is not a narrowing.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 0b07c8123b

ℹ️ 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 added 2 commits August 14, 2026 02:33
The account-block check next to it keyed on `<div className="...">` for the same
reason and would go quiet the same way the moment that div takes an override, so
it now shares the one matcher. Selecting on its four specific tokens is what makes
reading every literal safe. Behaviour is unchanged: the same single div matches.
wasimysaid added a commit to wasimysaid/unsloth that referenced this pull request Aug 14, 2026
@danielhanchen
danielhanchen merged commit 8fef5ed into main Aug 14, 2026
26 of 29 checks passed
@danielhanchen
danielhanchen deleted the fix/descender-guard-cn-wrapper branch August 14, 2026 11:53
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.

1 participant