Skip to content

fix(tests): click in Settings only once its sheet has risen - #2032

Merged
devswha merged 1 commit into
mainfrom
fix/settings-palette-close-flake
Oct 26, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/settings-palette-close-flake

Conversation

@devswha

@devswha devswha commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Change

Fixes #2000, together with #2023 (merged).

#2023 fixed the two app races behind #2000's timeout. The third way the check failed is in the test, not the app: on a phone, Settings is a sheet that rises from the bottom edge over 360 ms, and on a loaded runner the settings search check clicked Settings' X while it was still rising. The click landed where the X had been, on the header under it, so Settings never closed and the check waited 30 s for it to (close() in the settings search, about once in 30 runs under load).

Evidence, from a traced run of the check under load (390px, Korean, palette query "OpenAI API 키"): the close click's target was the dialog's header, whose only text is the title "음성 입력". In every earlier close the target was the X's icon. Sampling the X's position every frame after Settings opens from that result shows it moves only vertically, during the sheet's rise (y 860 → 83.5 over about 360 ms, with a long spring tail). Neither the dialog, its body nor the page scrolls under it. The failing click came about 140 ms after the dialog appeared.

The regression now clicks in a phone sheet only once its own animations have ended, through sheetRisen(page, selector) in scripts/settings-page.ts:

  • Settings, once opened (openSettings), and before each click on its X;
  • the command palette, before a result is clicked (it is a sheet on a phone too);
  • openSettingsPage, shared with other scripts, before it clicks a page. At desktop width there is no animation and the wait returns at once; on a phone it adds at most the rise.

The wait reads the dialog's own animations, not its children's (an endless spinner inside cannot hold it), and is bounded by Playwright's timeout.

The stress run of that first version failed once more, with a bare waitForFunction timeout in the desktop theme checks: the script reopened Settings right after closing it, before the close's step back had landed. A step landing over a second late is taken for the user's Back (settingsHistory's landing deadline, kept on purpose since #630) and closes the Settings opened meanwhile. A scratch probe at 1280px showed it: with the step held 200 ms Settings stays open, held 1.5 s it closes. Every close followed by a reopen now waits for the step to land, as closeSettings already did: Escape in the theme checks, the X in the settings search, and the reload made with Settings open (through historyHolds, so a timeout there reports the history).

Test-only: no app code changes.

Validation

  • 4×30 of bun scripts/settings-pages-demo-regression.ts at once, in four separate checkouts, pinned to two cores under dori heavy, with fix(settings): keep a reopened Settings open when a step back lands late #2023 underneath: 120 of 120 passed. Before these fixes, the same load failed 1 of 29 runs at the sheet's rise, and the first version failed 1 of 50 at a reopen before the close's step landed.
  • bun run check fast: pass.
  • Reviews: omo-native-code-reviewer approved after its findings were fixed: the X click right after openSettings in the late-step check and the palette's result clicks still raced the rise, and the reload with Settings open lacked the wait. Codex Sol found the same X click and the same reload, both fixed.

On a phone Settings is a sheet that rises from the bottom edge over 360 ms.
On a loaded runner the settings search check clicked Settings' X while the
sheet was still rising: the click landed where the X had been, on the header
under it, Settings stayed open, and the check waited 30 s for it to close
(the third way #2000 failed; a trace showed the click's target was the
header, and sampling the X showed it moves only while the sheet rises).

The regression now waits for a sheet's own animations to end before it
clicks in it: Settings once opened (openSettings, and before each click on
its X) and the palette before a result is clicked. openSettingsPage, shared
with other scripts, waits the same way before it clicks a page.

Under the same load the script also reopened Settings right after closing
it (Escape in the theme checks, the X in the settings search, a reload with
Settings open) before the
close's step back had landed. Landing over a second late, that step is
taken for a Back of the user's (settingsHistory's landing deadline, kept
on purpose) and closes the Settings opened meanwhile. Those closes now
wait for the step to land, as closeSettings already did.

Fixes #2000
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 484dd25 and bf1e021.

Files selected for processing: 3
  • changelog.d/settings-search-test-sheet-rise.md
  • scripts/settings-page.ts
  • scripts/settings-pages-demo-regression.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Tests
    • Settings page regression checks now wait for Settings and command-palette panels to finish opening before continuing.
    • Checks also wait for Settings history updates after closing or reloading, and account for delayed navigation when testing Escape, theme selection, and reload behavior.
    • These timing adjustments help the regression checks behave more consistently on slower or busy test runs.

The Settings pages demo regression now waits for Settings and command-palette sheet animations to finish before interaction. It also waits for Settings history entries to disappear after closing or reloading before reopening Settings.

Changes: Settings demo regression

Layer / File(s) Summary
Wait for sheets to finish rising
scripts/settings-page.ts, scripts/settings-pages-demo-regression.ts, changelog.d/settings-search-test-sheet-rise.md
Adds sheetRisen to wait until a selected element has no running animations. Settings and command-palette checks wait for their sheets to finish rising before interaction. The changelog describes these waits and the reported misplaced click and timeout.
Wait for Settings history entries to clear
scripts/settings-pages-demo-regression.ts
The regression waits for the Settings history entry to disappear after closing or reloading before reopening Settings. This covers Escape, theme-picker cycles, and reloads.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other · Severity of issue fixed: Low

Possibly related PRs

  • devswha/ovis#2023: This PR also tests the Settings history race caused by delayed step-back traversals.
Merge Risk: Minimal · up to bf1e0

The synchronization changes are mergeable with no identified actionable risk.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Issue #2000 asks that the flaky wait for .settings-dialog stop timing out on CI. Its stated cause: the Ctrl/Cmd+Shift+Comma press in openSettings can arrive before the app binds its key handler, a… Provide evidence that #2023 (or another base change) makes the Settings shortcut robust to an early press, for example its diff or a test that presses the shortcut before the handler binds. Alternatively, confirm that the #2000 failure is t…
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the primary change: preventing Settings clicks before the sheet rises.
Description check Passed The description includes complete Change and Validation sections. It explains the race conditions, implementation, scope, and test results.
Out of Scope Changes check Passed All changes are test-side or documentation. scripts/settings-page.ts adds sheetRisen and calls it in openSettingsPage. scripts/settings-pages-demo-regression.ts adds sheetRisen calls in `ope…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1 …
Full details: Out of Scope Changes check

Explanation

All changes are test-side or documentation. scripts/settings-page.ts adds sheetRisen and calls it in openSettingsPage. scripts/settings-pages-demo-regression.ts adds sheetRisen calls in openSettings, closeSettings, openPalette, and the settings-search close. It adds history-landing waits after Escape, after the theme-picker close, and after the reload with Settings open (through historyHolds). The changelog entry describes the same change. No app code changes appear in the diff. Each change ties to a race named in the PR description, so none is unrelated. The shared openSettingsPage wait affects other scripts. The PR states that it returns at once at desktop width. That behavior was not checked here, but the wait is bounded by the Playwright timeout and is not a functional change.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1 unsupported.)

Full details: Linked Issues check

Explanation

Issue #2000 asks that the flaky wait for .settings-dialog stop timing out on CI. Its stated cause: the Ctrl/Cmd+Shift+Comma press in openSettings can arrive before the app binds its key handler, and is not retried. This diff does not change that path. openSettings still presses once and waits for .settings-dialog. The diff adds the following test-side waits: sheetRisen for the Settings sheet rise and the palette rise, and waitForFunction for the history step to land after each close that precedes a reopen. These address the two other races named in the PR description. For the #2000 cause, the PR relies on #2023 (aea938a, in the base). The only evidence for that is the PR author's statement and the commit subject "keep a reopened Settings open when a step back lands late", which does not name the shortcut-binding race. The stress results (120 of 120, and earlier failure counts) are author-reported and were not reproduced here. The code changes match the races the PR describes. Whether the #2000 failure mode is fixed is not established.

Resolution

Provide evidence that #2023 (or another base change) makes the Settings shortcut robust to an early press, for example its diff or a test that presses the shortcut before the handler binds. Alternatively, confirm that the #2000 failure is the sheet-rise or close/reopen race that this PR fixes. Reproduced stress-run results for the reviewed head would also settle the flakiness requirement.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 26, 2026

Copy link
Copy Markdown
Owner Author

Merge pass: the gate approved bf1e021. Three stress runs on two cores passed, and so did both callers of the shared helper and the conventions tests. Six browser probes show that a spinner inside the sheet can't hold the wait, that a sheet that never finishes still times out, and that an animation-free sheet returns at once. It merges once its CI is green and its turn comes in the queue.

@devswha

devswha commented Oct 26, 2026

Copy link
Copy Markdown
Owner Author

Merge pass review report. Overall: PASSED. This is a test-only change to scripts/settings-page.ts, scripts/settings-pages-demo-regression.ts and a changelog fragment. The gate (omo-native-gate-reviewer, gpt-6-astra) approved bf1e021.

What it fixes: this is the last way #2000 failed, and #2023 already fixed the two app races. On a phone, Settings is a sheet that rises over 360 ms. On a loaded runner, the test clicked the X while the sheet was still rising, so the click landed on the header. The regression now clicks in a phone sheet only after the sheet's own animations have ended, using sheetRisen(page, selector). Reopening Settings right after a close now waits for the close's step back to land, so a step back that lands late is no longer taken for the user's Back.

Gate verification:

  • Six Chromium probes confirmed three things:
    • a spinner inside the sheet can't hold the helper;
    • a sheet that never finishes still times out, so a real app bug can't hide;
    • a sheet with no animation returns at once.
  • The close/reopen waits read the exact history state and use no fixed sleeps. The conventions tests pass (19 tests).
  • Three stress runs pinned to two cores (dori heavy, taskset -c 0,1) all exited 0.
  • Both scripts that use the shared openSettingsPage helper pass.

It shares scripts/settings-pages-demo-regression.ts with outside PR #1911 only.

@devswha
devswha merged commit 4af6867 into main Oct 26, 2026
11 checks passed
@devswha
devswha deleted the fix/settings-palette-close-flake branch October 26, 2026 18:19
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.

Flaky: settings pages demo regression never sees the Settings dialog open on CI

1 participant