Repository navigation
Assert chat tracking in em, not in pixels at a 16px base - #7826
Merged
Merged
Conversation
The chat typography check pinned letter-spacing as px, computed against a 16px CSS base. aa4e6af set the product default to 15px (--ui-font-scale: 0.9375), so every computed value became 15/16 of the pinned one and Chat UI Tests has failed on main since, on both macOS and Linux: macOS expected 0.31px, got 0.290625px Linux expected 0.3565px, got 0.334219px The tracking is authored in em, so read the size off the element and assert the em. That holds at either base and under a user font-size preference, and still catches a tracking value that is actually wrong.
This was referenced Aug 4, 2026
danielhanchen
added a commit
that referenced
this pull request
Aug 4, 2026
…7828) * test(studio): bound the chat font size and accept a normal tracking 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. * Assert the chat size token rather than a range 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. * Tighten the size-assertion comment 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. * test(studio): match the UI font size default the store actually uses 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. * Tighten typography test comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Chat UI Testshas been red onmainsinceaa4e6af, on both macOS and Linux runners:Both are exactly 15/16 of what the test wanted, and the reason is in the product source:
The chat message roots carry
text-ui-15p5(0.96875rem) andtracking-[0.01em] dark:tracking-[0.02em], with0.023emfor the lighter dark-mode instance on Linux. Tracking authored inemresolves against the element's own size, so when the default base moved from 16px to 15px every computed value scaled with it:0.02emof15.5pxis0.31px, and0.02emof14.53125pxis0.290625px. The product is correct; the test was pinning the product of a tracking value and a base it did not measure.So this reads the size off the element and asserts the em:
Checked against every real observation, including the ones from before the default changed:
It also passes under a user font-size preference (20px, scale 1.25) rather than only at the default, which the pinned values never could. The tolerance is 0.005px, sub-pixel on purpose: substituting a genuinely wrong tracking (0.01em or 0.023em where 0.02em is required) still fails, so the check keeps its teeth.
Test-only change, no product code touched.