Repository navigation
Read the desktop New chat button contract token by token - #12426
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f91614030
ℹ️ 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".
| # square, rounded box and muted icon it always was. | ||
| new_chat_tokens = _new_chat_button_class_tokens(chat_page) | ||
| size_tokens = [t for t in new_chat_tokens if t.startswith("!size-[")] | ||
| assert len(size_tokens) == 1 and re.search(r"(?<![\d.])30px", size_tokens[0]), new_chat_tokens |
There was a problem hiding this comment.
Require the size token to equal 30px
When the class is changed to something such as !size-[calc(30px+20px)], !size-[min(30px,1px)], or even the invalid !size-[30px, this assertion still passes because it only searches for a standalone 30px substring. The button therefore need not remain a 30px square despite this test's stated contract. Since _ui_source already normalizes the supported UI-scale wrapper to !size-[30px], this can require the complete token rather than accepting any token containing that substring.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in e0c8833: the size token must now equal !size-[30px] as read at the default UI scale.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e0c8833f86
ℹ️ 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 "!size-[30px]" in new_chat_tokens, new_chat_tokens | ||
| assert "rounded-[10px]" in new_chat_tokens, new_chat_tokens | ||
| assert "text-muted-foreground" in new_chat_tokens, new_chat_tokens |
There was a problem hiding this comment.
Reject utilities that override the required button styles
If a later conflicting utility is added, such as !size-[30px] !size-[50px], rounded-[10px] rounded-none, or text-muted-foreground text-red-500, all three assertions still pass even though Button sends the classes through cn/tailwind-merge, which retains the later utility and changes the rendered button. Fresh evidence after the exact-token fix is that twMerge('!size-[30px] !size-[50px]') produces !size-[50px]; validate the effective/conflicting utility groups rather than membership alone.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing: this is a source contract test, and a second conflicting size, radius or colour utility on the same button is not a change anyone would make by accident; checking tailwind-merge groups here would be test hardening past the contract the test pins.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e0c8833f86
ℹ️ 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".
| label = chat_page.index('aria-label="New chat"') | ||
| start = chat_page.rindex("<Button", 0, label) |
There was a problem hiding this comment.
Bind the label to the parsed Button tag
If aria-label="New chat" is moved onto a child icon or an unrelated later element, label still points after this <Button, so rindex selects the button and the helper returns its classes even though the label is not in that opening tag. The separate global label assertion also passes, allowing the contract to stay green after the New chat button itself loses the required label; verify that the located label occurs before the parsed opening-tag terminator.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in cbeeba6. The helper now asserts that the located aria-label="New chat" falls inside the parsed <Button> opening tag. Moving the label onto the icon inside the button fails the test with that message; I checked it that way.
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! 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". |
Problem
Repo tests (CPU, studio)is red on main, and so on every PR based on it (for example #12393, and the post-merge run of #12406):#12355 ("compact context usage ring when the chat header is squeezed") changed the desktop New chat button in
chat-page.tsxto:That is deliberate. It scales the 30px box with the UI font size, the same way #11458 did for the other chrome, and keeps the button from shrinking when the header is squeezed. It is still the same 30px rounded square with a muted icon. The test pinned the whole class string, so any change to how that size is written fails it.
Fix
The test now reads the className of the element carrying
aria-label="New chat"and checks the tokens that make up the contract:!size-[...]token, and it is 30px (scaled or not);rounded-[10px];text-muted-foreground.The element is found by scanning its opening tag outside braces and quotes, so attribute order does not matter. The other assertions in the test are unchanged. No product change.
Verification
tests/studio/test_desktop_reliability_frontend_contract.py: 42 passed (the test fails on main).chat-page.tsxeach fail the test: 30px changed to 28px,rounded-[10px]changed torounded-md, andtext-muted-foregroundchanged totext-foreground.