Skip to content

test(studio): bound the chat font size and accept a normal tracking - #7828

Merged
danielhanchen merged 5 commits into
mainfrom
fix/chat-typography-size-bound
Aug 4, 2026
Merged

danielhanchen merged 5 commits into
mainfrom
fix/chat-typography-size-bound

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

Three small follow-ups to #7826, which is otherwise the right fix. The first two were split out of #7821, which I closed as superseded; the third is a separate stale constant in the same family that the first two came from.

The font size is no longer checked

Asserting the em means the size it resolves against is read rather than verified. The px literal it replaced caught that implicitly: 0.3565px only matched at a 15.5px body, so a size regression showed up as a tracking failure. After the change, chat text rendering at a caption or heading size passes silently, because the expectation moves with it.

The check now asserts the token rather than a range: chat text is text-ui-15p5, so the size has to be 15.5px * --ui-font-scale, read from the same root the product computes it on. That holds at every font-size preference and fails on any other token.

  • a scale change passes, which is the thing that broke the literal
  • every preference from 12 to 20 passes
  • a swap to text-ui-13 or text-ui-18 does not

float("normal") raises

"normal" is how a browser reports a zero tracking, and float("normal".removesuffix("px")) raises ValueError. That path would surface as a test error rather than as this check failing with its own message. Only reachable if a tracking ever becomes 0, so this is defensive rather than a live bug.

The font-scale test uses a default the store does not have

playwright_ui_font_scale.py drives the size input to DEFAULT = 16 and then asserts data-ui-font-size has been dropped. The store only removes that attribute when the preference equals UI_FONT_SIZE_RANGE.default, which is 15, so the attribute is still there and the test fails:

[font-scale] FAIL: data-ui-font-size present at default: 16

16 is the root font size, not the UI font size default. The static --ui-font-scale: 0.9375 in index.css is the same 15 / 16. This is the same shape of staleness as #7826 fixed, left behind by #7359. The ratio math in the test is relative to DEFAULT, so it stays correct at 15.

Verification

Exercised against the values that actually occur:

current dark Linux         -> pass
current dark               -> pass
current light              -> pass
pre-#7359 15.5px body      -> pass
preference 12 (0.75)       -> pass
preference 20 (1.25)       -> pass
zero tracking as normal    -> pass
wrong tracking             -> tracking [0.290625] != 0.334219
text-ui-13 swap            -> expected text-ui-15p5, 15.5px * 0.9375 = 14.5312px, got 12.1875px
text-ui-18 swap            -> expected text-ui-15p5, 15.5px * 0.9375 = 14.5312px, got 16.875px

Only the last three fail, each with the message that names the cause.

Two follow-ups to #7826, which is otherwise the right fix.

Asserting the em means the font size itself is no longer checked. The px literal
it replaced caught that implicitly, since 0.3565px only matched at 15.5px, so the
check quietly lost the ability to notice chat text rendering at the wrong size.
Bounding the size to 12-18px restores a coarse version of that: a deliberate
scale change or a user font-size preference passes, chat text at a caption or
heading size does not.

float("normal") also raises, and "normal" is how a browser reports a zero
tracking, so that path would surface as a test error rather than as this check
failing with its own message.

Exercised against the values that occur: the three current theme branches, the
pre-#7359 15.5px body, a raised user preference, a zero tracking spelled
"normal", a wrong tracking, and chat text at caption and heading sizes. Only the
last three fail, each with the message that names the cause.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Both review points, and they are the same finding from two sides: a range is
wrong at the edges and useless in the middle.

UI_FONT_SIZE_RANGE is 12 to 20 and the store sets --ui-font-scale to
preference / 16, so text-ui-15p5 spans 11.625px to 19.375px. The 12-18px bound
rejected both endpoints, failing a UI that is rendering its configured size
correctly. At the default scale it also admitted text-ui-13 at 12.1875px and
text-ui-18 at 16.875px, so the token swap it was meant to catch passed, and the
tracking assertion passed with it because the expectation derives from the same
measured size.

So read --ui-font-scale off the root and assert the size is text-ui-15p5 at that
scale. That holds at every supported preference and pins the token, which is what
the check was for.

Exercised at preferences 12, 15 and 20, at the pre-#7359 base, with a zero
tracking spelled "normal", against swaps to text-ui-13 and text-ui-18, and
against a wrong tracking. The three intended failures fail, each naming its
cause.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 2f856c4af0

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

Post-convergence comment pass. The embedded JavaScript comment is left alone: it
sits inside a Python string literal, so editing it is a code change and the
comment-only gate correctly rejects it.
The font-scale test drove the size input to 16 and then asserted that
data-ui-font-size had been dropped, but the store only removes the
attribute at UI_FONT_SIZE_RANGE.default, which is 15. The static
--ui-font-scale of 0.9375 in index.css is the same 15/16.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 4318d3ea07

ℹ️ 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 e6e5b13 into main Aug 4, 2026
16 of 21 checks passed
@danielhanchen
danielhanchen deleted the fix/chat-typography-size-bound branch August 4, 2026 10:08
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