Skip to content

Follow #11648's UI-scale layout and #11628's Code placement in the studio contracts - #11673

Merged
danielhanchen merged 6 commits into
mainfrom
fix/ui-scale-contract-pins
Sep 23, 2026
Merged

danielhanchen merged 6 commits into
mainfrom
fix/ui-scale-contract-pins

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

What failed

#11648 ("scale padding, icons and widths with the UI font size, and make interface scale work in the browser") merged with Repo tests (CPU, studio) red (job). The same four tests fail on main at 6eb1b2eec:

FAILED tests/studio/test_chat_thinking_compact_layout.py::test_thinking_control_has_compact_hooks_in_both_composers
FAILED tests/studio/test_desktop_reliability_frontend_contract.py::test_image_page_structural_panes_share_the_container_breakpoint
FAILED tests/studio/test_desktop_reliability_frontend_contract.py::test_audio_page_matches_the_image_rail_header_and_action_footer
FAILED tests/studio/test_settings_compact_overflow_contract.py::test_dialog_content_can_shrink_inside_the_dialog_grid
4 failed, 44 passed

Why

In each case the product change is deliberate and the test pinned the old spelling. I ran every assertion in the two desktop tests one by one, and only the rail-width line fails in each; the rest of each contract still holds.

Test Pinned Now Read
Images / Audio rail @[50rem]:w-[408px] min(calc(408px*scale), calc(100%-13rem)), identical on both pages The rail is clamped so the canvas keeps the 13rem its header column reserves (minmax(13rem,1fr)) when a larger scale grows the rail. Still 408px at the default scale where it fits.
Settings dialog ... w-full max-sm:flex-col ... w-full data-stacked:flex-col, data-stacked={stacked || undefined} from useStackedLayout() max-sm: reads the viewport, which a larger interface scale in the browser does not move, so stacking now follows the dialog's own width.
Thinking caret size-[15px] size-[calc(15px*var(--ui-space-scale,1))] Same 15px at the default scale, wrapped like the rest of the composer.

Fix

Tests only:

  • test_desktop_reliability_frontend_contract.py: both rail assertions pin one shared RAIL_WIDTH = "@[50rem]:w-[min(408px,calc(100%-13rem))]", as _ui_source reads it at the default scale. Images and Audio still have to match each other, and the clamp is now part of the contract.
  • test_settings_compact_overflow_contract.py: keeps flex h-full min-h-0 min-w-0 w-full, and requires both that the attribute is set (data-stacked={stacked || undefined}) and that the stacking class is keyed on it (min-w-0 w-full data-stacked:flex-col).
  • test_chat_thinking_compact_layout.py: accepts the caret at 15px in either spelling, raw or scale-wrapped, and names the file when it fails.

Verification

  • The three files pass: 48 passed.
  • Sabotage against the product, one change at a time, each failing exactly its own test:
    • the Images rail loses its min(...) clamp
    • the Audio rail drifts to 420px
    • the settings dialog never sets data-stacked
    • the thread.tsx caret grows to 18px

Second commit: the rest of the fallout

A full tests/studio run on main (6eb1b2eec) turned up more tests pinned to spellings that #11648, and one pinned to a derivation that #11628 ("Fix Code tool placement for ChatGPT subscriptions"), changed on purpose.

Test Pinned Now Fix
test_update_release_notes.py::test_update_popups_share_the_notes_width (x2) max-w-[448px] max-w-[calc(448px*var(--ui-space-scale,1))] on all three banners _max_widths() reads each max-w-[...] back at the default scale, then requires 448px and no 400px.
test_ui_font_scale_contract.py::test_css_default_scale_matches_the_store_default --ui-font-scale: 0.9375; --ui-font-scale: calc(var(--ui-font-size-scale, 0.9375) * var(--ui-interface-scale, 1));, with the store writing --ui-font-size-scale Still derived from UI_FONT_SIZE_RANGE.default / UI_FONT_SIZE_CSS_BASE, now asserted as the fallback of that derivation.
test_ui_font_scale_contract.py::test_icons_follow_the_ui_font_size_itself half-rate min(...) icon curve calc(1rem * var(--ui-font-scale, 1)) #11648's commit message says icons now scale linearly. The docstring and both curve pins now say so.
test_chat_response_details_ui_contract.py !isExternalRequest && supportsTools && codeToolsEnabled hostedCodeToolsForThisTurn.length > 0 || (supportsStudioToolsForThisTurn && studioLocalCodeTools.length > 0) #11628 records Code from what the request actually sends, so the test pins that derivation.

Two Playwright drivers were broken by the same change, one loudly and one silently. Since #11648, --ui-font-scale is a calc(), and an unregistered custom property reads back as its text: Chromium returns calc(0.9375 * 1).

Both now resolve the scale through a length: a hidden probe with width: calc(10000px * var(--ui-font-scale, 1)). In Chromium against the new rule, the default, a 20px size and a 1.1 interface scale resolve to 0.9375, 1.25 and 1.375. The banner check compares that number to the default again, so it can fail when the scale did not move.

Verification for this commit:

  • All of tests/studio on the branch: 14579 passed, 143 skipped. The one error is test_mlx_context_platform_matrix.py, which does not collect on this host, where import unsloth stops on vLLM's Transformers v5 requirement. It errors on main here too.
  • The 246 driver-pinning tests that read these two Playwright files pass.
  • Sabotage against the product, each failing exactly its own test:
    • the Web banner widens to 460px, or the Llama banner narrows to 400px
    • the icons go back to half rate
    • the CSS default drifts to 16px (var(--ui-font-size-scale, 1))
    • the adapter goes back to the hosted-only Code flag

#11648 merged with Repo tests (CPU, studio) red, and main has failed those four since:

- The Images and Audio rails are now min(408px, 100% - 13rem) at the default scale, so
  the canvas keeps the 13rem its header column reserves. Both pages pin that exact
  expression through a shared RAIL_WIDTH, so they still have to match each other.
- The settings dialog stacks on its own measured width (data-stacked) rather than the
  max-sm viewport breakpoint, which a larger interface scale does not move. The test
  now requires the attribute to be set and the stacking class keyed on it.
- The Thinking caret is 15px at the default scale in either spelling, since the
  composer's lengths are now wrapped in the space scale.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-23T11:47:27.351546Z d74e271 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 1eeccd1344

ℹ️ 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".

A full tests/studio run on main turned up five more contracts and two Playwright
drivers pinned to spellings those two PRs changed on purpose:

- test_update_release_notes: the update banners are 448px at the default scale, now
  written scale-wrapped; widths are read back through the scale before comparing.
- test_ui_font_scale_contract: the CSS default lives in the fallback of the derived
  --ui-font-scale, and icons scale linearly with it (#11648 said so), not at half rate.
- test_chat_response_details_ui_contract: response details record Code from the
  placement actually sent, hosted sandbox or local tools (#11628).
- playwright_chat_ui / playwright_update_banner_layout: --ui-font-scale is now a calc()
  and an unregistered custom property reads back as that text, so float() failed
  ('unreadable --ui-font-scale') and the banner's 'is it scaled' string compare
  could no longer fail. Both resolve the scale through a length instead.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen danielhanchen changed the title Follow #11648's UI-scale layout in four studio contract tests Follow #11648's UI-scale layout and #11628's Code placement in the studio contracts Sep 23, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 23, 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: 5d748133bc

ℹ️ 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".

# #11628: Code is recorded from the placement the request actually sends, a hosted sandbox or Studio's local
# python/terminal/edit_file, so an external connection without a sandbox still reports Code when it runs locally.
assert "hostedCodeToolsForThisTurn.length > 0 ||" in src
assert "studioLocalCodeTools.length > 0" in src

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 Scope the local-Code assertion to response details

When the buildResponseDetails derivation stops including local Code—for example, if its second operand is accidentally replaced with false—this assertion still succeeds because studioLocalCodeTools.length > 0 also appears later in the request-payload construction. The test therefore does not actually protect the stated external-provider/local-tool metadata behavior; require the complete hosted-or-supported-local expression within the existing builder_block instead.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 0aa0740: the assertion now matches the whole hosted-or-local expression inside builder_block, and replacing the second operand with false fails it.

@danielhanchen
danielhanchen force-pushed the fix/ui-scale-contract-pins branch from 8144aab to 0aa0740 Compare September 23, 2026 11:11
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@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: 0aa0740e20

ℹ️ 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".



# The Create rail on Images and Audio at the default UI scale, as `_ui_source` reads it.
RAIL_WIDTH = "@[50rem]:w-[min(408px,calc(100%-13rem))]"

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 Require the rail width to retain its scale wrapper

If either media page changes the rail to the bare @[50rem]:w-[min(408px,calc(100%-13rem))], both new assertions still pass because _ui_source() normalizes the current scale-wrapped value to exactly this constant. The rail would then remain 408px at non-default UI sizes instead of growing with its text, so this needs a raw-source assertion for the --ui-space-scale wrapper in addition to the default-scale geometry check.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 1378399: both tests now also require the raw calc(408px*var(--ui-space-scale,1)) spelling, and reverting either page to a bare 408px fails its test.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@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: 137839922a

ℹ️ 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".

assert "unsloth-thinking-caret size-[15px]" in source
# 15px at the default UI scale; #11648 wrapped it in the space scale like the rest of the composer.
assert re.search(
r"unsloth-thinking-caret size-\[(15px|calc\(15px\*var\(--ui-space-scale,1\)\))\]",

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 Require the Thinking caret to retain its scale wrapper

If either composer is reverted to the old size-[15px] class, this alternation still passes even though the caret then remains 15px while the surrounding controls grow or shrink with the interface scale. Since the change is intended to protect the UI-scale behavior, require the calc(15px*var(--ui-space-scale,1)) form rather than accepting the unscaled fallback.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in b8a7bb4: both composers must now carry size-[calc(15px*var(--ui-space-scale,1))], and reverting either to size-[15px] fails the test.

#11648 wrapped these lengths in `calc(Npx*var(--ui-space-scale,1))` so they follow the interface size, which is
Npx at the default scale. Read back that way, the contract stays about the width rather than its spelling.
"""
return {_SCALED_PX.sub(r"\1", width) for width in re.findall(r"max-w-\[([^\]\s\"]+)\]", source)}

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 Pin the update-banner width scale wrapper

When all 448px widths in any update-banner source are changed back to bare max-w-[448px], _max_widths() returns the same "448px" value and the new assertions still pass. The affected banner would consequently stop widening with larger interface sizes, so retain the default-scale comparison but also assert the raw --ui-space-scale wrapper in each banner source.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in b8a7bb4: the web, Tauri and llama.cpp banners must now carry max-w-[calc(448px*var(--ui-space-scale,1))] and no bare max-w-[448px]. Reverting any one of them fails its case.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@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: b8a7bb456c

ℹ️ 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".

assert (
f"--ui-font-scale: calc(var(--ui-font-size-scale, {scale:g}) * var(--ui-interface-scale, 1));"
) in INDEX_CSS
assert '"--ui-font-size-scale"' in STORE

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 Tie the font-size scale check to its non-default write

If the non-default branch changes the property passed to setVar (for example, to a misspelled name), this assertion still succeeds because the default branch independently contains setVar("--ui-font-size-scale", null), while the arithmetic assertion above also remains present. CSS would then keep using the 0.9375 fallback for every custom font size despite this contract passing; require the correct property and effectiveUiFontSize / UI_FONT_SIZE_CSS_BASE value in the same setter call.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in d74e271: the property and the effectiveUiFontSize / UI_FONT_SIZE_CSS_BASE value are now matched in one setVar call. Misspelling the property in the non-default branch fails the test.

Comment on lines +21 to +22
assert "data-stacked={stacked || undefined}" in source
assert "min-w-0 w-full data-stacked:flex-col" in source

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 Require the stacking attribute on the flex container

If data-stacked={stacked || undefined} is moved onto another element while this flex container retains data-stacked:flex-col, both substring assertions still pass, but Tailwind's data variant checks the attribute on the element carrying the class, so the dialog never stacks. Match both tokens within the same opening tag to protect the measured-width behavior.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in d74e271: the test now reads the opening tag that carries data-stacked:flex-col and requires data-stacked and group/settings in it. Moving the attribute onto the aside fails the test.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: d74e271772

ℹ️ 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 a4faad0 into main Sep 23, 2026
17 of 23 checks passed
@danielhanchen
danielhanchen deleted the fix/ui-scale-contract-pins branch September 23, 2026 11:48
Stanley00 pushed a commit to stanley-fork/unsloth that referenced this pull request Sep 23, 2026
… the update card's scaled width (unslothai#11700)

* Read the sidebar pin's width default only where matchMedia exists

unslothai#11660 made use-sidebar-pin read the lg media query when it is imported,
without asking whether window.matchMedia exists. Frontend tests that reach
the window titlebar supply a partial window with no matchMedia, so the import
threw and failed training-dataset-source-transitions.test.ts on main.

With nothing to ask, keep the desktop default, as the module already does
when there is no window at all, and skip the width listener.

* Expect the update card's scaled width at a larger UI size

unslothai#11648 made the card's max width calc(448px * var(--ui-space-scale, 1)), so
at the 20px UI size it is 597px, and the layout pass still wanted 448. The
pass only reached that check once unslothai#11673 made its scale probe readable.
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…lacement in the studio contracts (unslothai#11673)

* Follow unslothai#11648's UI-scale layout in four studio contract tests

unslothai#11648 merged with Repo tests (CPU, studio) red, and main has failed those four since:

- The Images and Audio rails are now min(408px, 100% - 13rem) at the default scale, so
  the canvas keeps the 13rem its header column reserves. Both pages pin that exact
  expression through a shared RAIL_WIDTH, so they still have to match each other.
- The settings dialog stacks on its own measured width (data-stacked) rather than the
  max-sm viewport breakpoint, which a larger interface scale does not move. The test
  now requires the attribute to be set and the stacking class keyed on it.
- The Thinking caret is 15px at the default scale in either spelling, since the
  composer's lengths are now wrapped in the space scale.

* Cover the rest of unslothai#11648's and unslothai#11628's studio fallout

A full tests/studio run on main turned up five more contracts and two Playwright
drivers pinned to spellings those two PRs changed on purpose:

- test_update_release_notes: the update banners are 448px at the default scale, now
  written scale-wrapped; widths are read back through the scale before comparing.
- test_ui_font_scale_contract: the CSS default lives in the fallback of the derived
  --ui-font-scale, and icons scale linearly with it (unslothai#11648 said so), not at half rate.
- test_chat_response_details_ui_contract: response details record Code from the
  placement actually sent, hosted sandbox or local tools (unslothai#11628).
- playwright_chat_ui / playwright_update_banner_layout: --ui-font-scale is now a calc()
  and an unregistered custom property reads back as that text, so float() failed
  ('unreadable --ui-font-scale') and the banner's 'is it scaled' string compare
  could no longer fail. Both resolve the scale through a length instead.

* Read the Code placement inside buildResponseDetails, not anywhere in the adapter

* Pin the rail's scale wrapper as written, since the default-scale read cannot see it

* Pin the scaled spelling of the Thinking caret and the update notes width

* Read the font-size setter and the stacking attribute where they take effect
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
… the update card's scaled width (unslothai#11700)

* Read the sidebar pin's width default only where matchMedia exists

unslothai#11660 made use-sidebar-pin read the lg media query when it is imported,
without asking whether window.matchMedia exists. Frontend tests that reach
the window titlebar supply a partial window with no matchMedia, so the import
threw and failed training-dataset-source-transitions.test.ts on main.

With nothing to ask, keep the desktop default, as the module already does
when there is no window at all, and skip the width listener.

* Expect the update card's scaled width at a larger UI size

unslothai#11648 made the card's max width calc(448px * var(--ui-space-scale, 1)), so
at the 20px UI size it is 597px, and the layout pass still wanted 448. The
pass only reached that check once unslothai#11673 made its scale probe readable.
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