Skip to content

Studio: follow the chat background from #15973 through three frontend guards - #16116

Merged
danielhanchen merged 1 commit into
mainfrom
tests-general-tab-chat-background-stub
Oct 30, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
tests-general-tab-chat-background-stub

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

#15973 (add customizable chat background images and effects) left 12 frontend unit tests red on main. Every PR's Frontend unit tests and Frontend build + bundle sanity jobs fail on them, for example #16109, #16110 and #16112. This fixes 11 of the 12. The last one is the titlebar :has() on the document root, which needs a product change and goes in its own PR.

1. General Settings token sync (9 tests)

not ok - an untouched General Settings tab adopts a token changed in another tab   (and 8 more in the file)
  error: 'no stub for import "@/features/chat-background" in .../settings/tabs/general-tab.tsx'

general-tab.tsx now imports resetChatBackground from @/features/chat-background for Reset all preferences. The test's stub map was one module behind, so this adds "@/features/chat-background": { resetChatBackground: async () => true }.

2. Every page loads the polyfill (1 test)

smoke-chat-background.html must load /crypto-boot.js

The new smoke page skipped the crypto.randomUUID polyfill that every other page loads before its module entry. It now carries the same <script src="/crypto-boot.js"></script>.

3. Toasts and composers read one shadow variable (1 test)

:is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) .unsloth-composer-surface, .wallpaper-preview-composer uses the shared shadow
  actual: 'inset 0 0 0 1px var(--border)'   expected: 'var(--composer-shadow)'

The wallpaper composer draws an outline instead of a drop shadow, which is a deliberate design. It now sets that through the variable rather than around it: --composer-shadow: inset 0 0 0 1px var(--border); box-shadow: var(--composer-shadow);. The "Composer outline" off rule sets --composer-shadow: none, and its :has() is more specific, so it still wins. Nothing reading --composer-shadow sits inside the composer surface, so the override reaches nothing else.

Verification

  • Frontend suite: on main, 12 failures across those four files. Here, general-settings-token-sync 9/9, crypto-uuid-boot 4/4, toast-composer-shadow 2/2 and chat-background 7/7 pass. The one remaining failure is titlebar-modal-layering's document-root :has(), as described above.
  • Rendering on smoke-chat-background.html, driven the way tests/studio/playwright_chat_background.js drives it (reset, upload an image, toggle Composer outline):
    • Computed box-shadow of both preview composers and the live composer is oklch(0.9208 0 0) 0px 0px 0px 1px inset with the outline on and none with it off, on main and here alike.
    • A screenshot pixel diff in the same tree, with only index.css swapped, is 80 / 26 pixels for outline on / off. Main against main is 71 / 26, so that is the run-to-run noise floor and there is no visible change.

Screenshots

Chat background settings with an uploaded image on this branch. Composer outline on: the previews and the live composer keep the 1px outline.

Composer outline on

Composer outline off: no outline and no shadow, as on main.

Composer outline off

- general-settings-token-sync stubs @/features/chat-background, which General Settings now imports
- smoke-chat-background.html loads /crypto-boot.js before its module entry, as every page must
- the wallpaper composer outline is set through --composer-shadow, so toasts and composers keep
  reading one shadow variable; computed box-shadow is unchanged with the outline on and off
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 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-10-30T12:13:26.096649Z f6343f2 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.

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 30, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 30, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: f6343f28b7

ℹ️ 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 cedf0ce into main Oct 30, 2026
2 of 46 checks passed
@danielhanchen
danielhanchen deleted the tests-general-tab-chat-background-stub branch October 30, 2026 12:46
danielhanchen added a commit that referenced this pull request Oct 30, 2026
…l:has() (#16117)

The 12th frontend failure #15973 (customizable chat background images
and effects) left on main. #16116 fixes the other 11.

```
not ok - the titlebar dims for viewport backdrops without a :has() on the document root
  expected not to match /(?:^|[\s,{}(>~+])(?:html|body|:root)...:has\(/
```

To clear the Desktop titlebar over a ready wallpaper, #15973 added four
rules of the form `html:has(:is([data-wallpaper-workspace],
[data-chat-content-root]) > .chat-wallpaper[data-ready])
[data-slot="window-titlebar"] ...`. The titlebar renders outside the
wallpaper's subtree, so a plain descendant selector cannot reach it. A
`:has()` whose subject is the document root, though, makes every DOM
mutation anywhere a candidate for re-matching. That is why
`titlebar-modal-layering` forbids it, and why the viewport-backdrop
dimming next to it goes through a store and an attribute instead.

Here the product needed the change, not the test.

## Change

- `ChatBackground` sets `data-chat-wallpaper-ready` on `<html>` while
the app's own wallpaper is ready, plus
`data-chat-wallpaper-workspace-ready` when it sits in the workspace. The
marks are reference-counted and removed when the wallpaper unmounts,
deactivates or loses its frame.
- The check reads the wallpaper's direct parent, the same `>
.chat-wallpaper` relation the old selectors used. So the settings
previews never mark the root, just as they never matched before.
- The four rules now key off `html[data-chat-wallpaper-ready]` and
`html[data-chat-wallpaper-workspace-ready]`. They are still unlayered,
so they keep beating the titlebar's Tailwind utilities. The
pinned-sidebar segment rule stays more specific than the
transparent-controls rule, so it still wins.
- `titlebar-modal-layering` matched `data-slot="window-titlebar"`
immediately followed by `data-viewport-backdrop-open=`, and #15973 had
put `data-wallpaper-sidebar-pinned` between them. The pattern now allows
other attributes inside the same opening tag.

## Verification

- `tests/titlebar-modal-layering.test.ts` and
`tests/chat-background.test.ts`: 12 passed. On main the titlebar case
fails.
- Sabotage: restoring main's `index.css` fails the root `:has()` check,
and dropping `data-viewport-backdrop-open` from the titlebar fails the
attribute check.
- Behaviour. The titlebar only renders in the Desktop app on Windows and
Linux, so I measured it rather than screenshotting it. On
`smoke-chat-background.html` I added stand-in `window-titlebar` (sidebar
pinned, two `data-wallpaper-chrome-controls`) and
`window-titlebar-decoration` elements, with base styles in `@layer
utilities` like the real classes. Computed styles, main and this branch
alike:

| State | titlebar bg / backdrop-filter | first controls (pinned
sidebar) bg | other controls bg / backdrop-filter | decoration |
`<html>` marks (branch) |
|---|---|---|---|---|---|
| no wallpaper | red / blur(4px) | red | red / blur(4px) | visible |
none |
| wallpaper ready | transparent / none | `rgb(255, 255, 255)`
(`--sidebar`) | transparent / none | hidden | ready, workspace-ready |
| after Reset all | red / blur(4px) | red | red / blur(4px) | visible |
none |

Text shadow on the controls also matches (`rgb(254, 254, 253) 0px 1px
8px` when ready).
- Full frontend suite: the only failures left are the 11 that #16116
fixes. `tsc --noEmit -p tsconfig.app.json` is clean.
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