Repository navigation
fix(studio): derive the chat tracking assertion from the measured font size - #7821
danielhanchen wants to merge 3 commits into
Conversation
…t size
Chat UI Tests has been failing on main:
chat letter spacing theme-cycle-1/assistant: expected 0.3565px,
got ['0.334219px']
The authored tracking is in em, not px: thread.tsx sets tracking-[0.01em] and
dark:tracking-[0.02em] on the message roots, and index.css sets 0.023em for the
dark Linux instance. The computed px therefore depends on the message font size,
and #7359 moved the UI size onto --ui-font-scale, so --text-ui-15p5 now resolves
to 0.96875rem * 0.9375 = 14.53125px where it used to be 15.5px.
That staled all three px literals at once, not just the one CI reports:
light 0.01em 0.155px -> 0.145313px
dark 0.02em 0.31px -> 0.290625px
dark + render-linux 0.023em 0.3565px -> 0.334219px
The CSS is doing what it is meant to: the scale exists to bring 16px-base tokens
to the 15px product default, as index.css says where it declares the token. The
test is what went stale.
So the expectation is now computed from the element's own font size times the
authored em, compared with a small tolerance because the browser reports the
computed value rounded. A wrong tracking still fails; the assertion is only
immune to the size the em resolves against.
Deriving from a measurement would otherwise hide a font-size regression
completely, so the size itself is bounded to 12-18px: wide enough that a
deliberate scale change does not trip it, tight enough to catch chat text
rendering at a heading or caption size.
Opening comment pass. A line wrap had left "dark:tracking-" and "-[0.02em]" on consecutive lines, reading as a doubled hyphen; the citation is now the file rather than a spelled-out class that wraps badly.
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Superseded by #7826, which landed the same fix: read the font size off the element and assert the authored em instead of a px literal, with the same diagnosis (aa4e6af set --ui-font-scale to 0.9375, so every computed value became 15/16 of the pinned one). Closing rather than resolving the conflict, since resolving it would only re-land a duplicate. Two small things in this branch are not in #7826, and I will put them up separately rather than lose them:
For the record, this branch was verified green before being closed: staging CI on the exact head returned 6/6 including Chat UI Tests passing in 7m2s, against the same job failing on main. |
Chat UI Testsis red onmain:Root cause
The authored tracking is in em, not px.
thread.tsxsetstracking-[0.01em]anddark:tracking-[0.02em]on the message roots, andindex.csssetsletter-spacing: 0.023emfor the dark Linux instance. The computed px therefore depends on the message font size.#7359 moved the UI font size onto
--ui-font-scale, so--text-ui-15p5now resolves to0.96875rem * 0.9375 = 14.53125pxwhere it previously computed to15.5px. That staled all three px literals at once, not only the one CI happens to report:0.01em0.155px0.145313px0.02em0.31px0.290625px0.023em0.3565px0.334219pxThe CSS is doing what it is meant to. The scale exists to bring 16px-base tokens to the 15px product default, exactly as
index.csssays where it declares the token:The test is what went stale, so the fix belongs there.
The fix
The expectation is computed from the element's own font size times the authored em, compared with a small tolerance because the browser reports the computed value rounded (
0.023emof14.53125pxcomes back as"0.334219px").A wrong tracking still fails. The assertion is only made immune to the size the em resolves against, which is the thing that legitimately changes.
Deriving from a measurement would otherwise hide a font-size regression completely, so the size itself is bounded to 12-18px: wide enough that a deliberate scale change does not trip it, tight enough to catch chat text rendering at a heading or caption size.
Verification
Exercised the new logic against the reported values, including that a genuinely wrong tracking still fails:
CI on this PR is the real check, since the assertion only runs under Playwright.