Skip to content

Studio: keep an appearance edit made while the personalization load is in flight - #15953

Merged
danielhanchen merged 1 commit into
mainfrom
personalization-keep-edits-made-during-hydration
Oct 29, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
personalization-keep-edits-made-during-hydration

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Chat UI Tests (extra) fails now and then in tests/studio/playwright_ui_font_scale.py, on PRs that do not touch the UI (#15917, #15859):

[font-scale] FAIL in step 'default restores exactly' after 0.3s:
default drifted for navFont: 13.5938 -> 18.125

18.125 is the nav font at UI size 20 (13.5938 x 20 / 15), so a size the test had left two steps earlier came back after it set the default. The test is right; this is a real product race in usePersonalizationSync:

  1. On load, the hook GETs /api/settings/personalization and, when the answer arrives, replaceAlls the appearance store with the server copy.
  2. Saves are debounced by 800 ms, so a size changed shortly before a navigation is in localStorage but not on the server. In the run above, 20 was saved, then 12 was set and the page reloaded inside the debounce.
  3. After the reload the user (here, the test) sets the size again. If the GET resolves after that, the server's stale 20 replaces the value they just picked.

A user who changes a setting in the first moments after opening Studio can see it snap back the same way.

What changed

  • use-personalization-sync.ts notes the appearance customization when the load starts. If the store holds a different object when the server answers, the user edited during the request, so local wins: the store is not overwritten, and because the baseline records the server's values, the normal debounced push uploads the edit.
  • Without an edit in flight, nothing changes: a saved server customization still replaces the local one.

Verification

  • Two tests in studio/frontend/tests/personalization-locale-hydration.test.ts, using its existing hook harness with the GET held open:
    • an edit made while the request is in flight survives and is the value that gets saved (fails on main: the size becomes the server's 20)
    • with no edit in flight, the server customization still wins
  • The whole file: 14 pass. Against the unfixed hook, only the in-flight test fails.
  • npm run typecheck passes and eslint is clean on both files. Biome reports the same 2 errors as on main, all in lines this change does not touch.

The fix changes when a setting is kept, not anything drawn, so there is nothing to screenshot. The Playwright font-scale check in Chat UI Tests (extra) is the end-to-end cover.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 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-29T11:18:16.744588Z ff7ba46 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: ff7ba4605a

ℹ️ 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 1af0f78 into main Oct 29, 2026
1 of 40 checks passed
@danielhanchen
danielhanchen deleted the personalization-keep-edits-made-during-hydration branch October 29, 2026 11:53
danielhanchen added a commit that referenced this pull request Oct 29, 2026
…inned row (#15959)

## Summary

`Mac Unsloth UI + API + Update + Inference CI` fails now and then in
`tests/studio/playwright_mac_tab_capabilities.py` on PRs that do not
touch the sidebar (#15930 at 08:33, #15953 at 11:20 on 2026-10-29; the
other runs that day passed):

```
[mac-tabs] FAIL: Library: nav row library is pinned inline by default but did not render
```

The run's `tab_library.png` shows why: the page was still on the app's
boot `Loading...` screen, with no sidebar at all. Each tab is a full
`page.goto(..., wait_until="domcontentloaded")` followed by a fixed 1.5
s wait, and on a slow macOS runner the app had not mounted by then. The
Library row was never missing from a rendered sidebar; nothing had
rendered yet. So this is the test's timing, not the product.

## What changed

- `drive_tabs` waits up to 30 s for the sidebar shell (any `nav-row-*`;
every pinned row renders in the same pass) before it judges the tab's
row. A shell that never mounts is logged and the pinned-row check still
fails.
- The pinned-row failure now says whether the shell had mounted and
lists every row's state, so a future failure tells "app not booted"
apart from "row missing".

## Verification

- `tests/studio/test_mac_tab_capability_warm_window.py`: 53 passed,
including two new cases on its `FakePage`:
- the sidebar only mounts once the script waits (the boot screen): no
failure, every pinned row seen
- the sidebar mounts without the Library row: still fails, and says
`shell mounted: True`
- With the wait removed from `drive_tabs`, both new cases fail; the
existing "rows never render", "projects stand-in" and "hidden section"
cases keep passing either way.
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