Skip to content

Data settings check: pin the legacy store outcome in the failed-delete check - #11763

Merged
danielhanchen merged 2 commits into
mainfrom
fix/data-settings-dialog-reset
Sep 24, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
fix/data-settings-dialog-reset

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Problem

python tests/studio/playwright_data_settings.py intermittently fails in Frontend CI's Windows Firefox leg, while Chromium passes in the same job. The failure is:

File "tests/studio/playwright_data_settings.py", line 216, in run
    expect(page.locator("#clear-chats-delete-files")).to_have_count(0)
AssertionError: Locator expected to have count '0'
Actual value: 1

It has shown up on main at 288b1a3, on #11740 (twice, once on a rerun) and on #11730.

The failed-delete check sets the backend to refuse the clear, and then asserts that the Clear chats confirmation closes. The app closes it only when the legacy IndexedDB clear succeeds. When both stores fail, clearStoredChats throws "both backend and legacy clear failed". The confirmation then stays open, armed for a retry, which has been the design since #7029.

Which of the two outcomes the check gets depends on LegacyStoreGate (studio/frontend/src/features/chat/utils/chat-history-storage.ts:187). Any legacy read slower than 1 s shuts the gate for the rest of the page, and after that a clear counts the legacy store as failed. Firefox on the Windows runner sometimes crosses that 1 s line earlier in the run. The check then inherits a shut gate and fails at line 216. So the product behaves as intended, and the test asserted an outcome it did not control.

Fix

  • Deterministic outcome. The fixture can now refuse legacy IndexedDB writes on request (failLegacyWrites). The failed-delete check sets this, so it drives the outcome it asserts instead of inheriting whatever the gate did earlier. It asserts that:
    • the clear settles, with both backend attempts answered;
    • the confirmation stays open, with its action and switch re-enabled;
    • no chat is lost;
    • Cancel closes it with no further delete.
  • Stable locator. The dialog is located through its switch (#clear-chats-delete-files) rather than .last. .last slides onto Settings once the confirmation closes.
  • Better failure evidence. A failure now records every [role=dialog] still in the DOM: its data-state, display, opacity and running animations. The next unrelated failure will say what kept a dialog mounted, instead of leaving only a blank screenshot.

Evidence

Firefox results, same machine and same origin/main:

script legacy writes result
main refused for the whole page (simulates a shut gate) fails at the same assertion as CI: #clear-chats-delete-files count 1
this PR refused for the whole page 219 checks passed
this PR normal 219 checks passed

Earlier loops of this PR's script also passed with no failures: 48 runs in Firefox and 16 in Chromium. A plain Firefox loop on main (96 runs) never reproduced the failure locally. It only showed 3 unrelated Page.goto timeouts under load, which is why the check had to force the shut-gate state to reproduce it.

The failed-delete check asserted that the Clear chats confirmation closes
when the backend refuses the clear. The app closes it only when the legacy
IndexedDB clear succeeds: with both stores failed, clearStoredChats throws
and the confirmation stays open, armed for a retry, by design since #7029.

Which of the two happens is decided by the legacy store gate (#9446). Any
legacy read slower than 1 s shuts it for the life of the page, after which
a clear reports the legacy store as failed. Firefox on the Windows runner
occasionally crosses that line, and the check then fails at line 216 with
the confirmation still on screen. Seen on main at 288b1a3 and on #11730
and a87d180, with Chromium passing in the same job.

The fixture now refuses legacy writes on request, so the check drives the
outcome it asserts instead of inheriting whatever the gate did earlier: the
clear settles, the confirmation is still open with its action and switch
re-enabled, no chat is lost, and Cancel closes it with no further delete.
It is pinned to the confirmation by its switch, not `.last`, which slides
onto Settings once the confirmation goes.
A Firefox run on the Windows runner failed in reset() with one hidden
dialog left 5 s after closing Settings, and the only evidence was a blank
screenshot. The report now lists every [role=dialog] still in the DOM with
its data-state, display, opacity and running animations, so the next
occurrence says whether an exit animation held the dialog or something else
kept it mounted.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 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-09-24T03:15:55.506792Z 6d8dede Manual request
🔒 Security Review ⚠️ Failed 2026-09-24T03:13:41.038552Z 6d8dede PR opened
ℹ️ 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. Swish!

Reviewed commit: 6d8dede1df

ℹ️ 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 f23d84b into main Sep 24, 2026
23 of 25 checks passed
@danielhanchen
danielhanchen deleted the fix/data-settings-dialog-reset branch September 24, 2026 03:40
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