Repository navigation
fix(tests): click in Settings only once its sheet has risen - #2032
Conversation
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
|
No actionable comments were generated in the recent review.
|
| 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:
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: 
4 · 
1
-
Failed checks: 1 inconclusive Passed checks: 4 passed-
Full details: Out of Scope Changes check
-
Explanation
All changes are test-side or documentation.
scripts/settings-page.tsaddssheetRisenand calls it inopenSettingsPage.scripts/settings-pages-demo-regression.tsaddssheetRisencalls inopenSettings,closeSettings,openPalette, and the settings-searchclose. It adds history-landing waits after Escape, after the theme-picker close, and after the reload with Settings open (throughhistoryHolds). 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 sharedopenSettingsPagewait 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
#2000asks that the flaky wait for.settings-dialogstop timing out on CI. Its stated cause: the Ctrl/Cmd+Shift+Comma press inopenSettingscan arrive before the app binds its key handler, and is not retried. This diff does not change that path.openSettingsstill presses once and waits for.settings-dialog. The diff adds the following test-side waits:sheetRisenfor the Settings sheet rise and the palette rise, andwaitForFunctionfor 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#2000cause, 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#2000failure 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#2000failure 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.
Comment @coderabbitai help to get the list of available commands.
|
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. |
|
Merge pass review report. Overall: PASSED. This is a test-only change to 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 Gate verification:
It shares |
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)inscripts/settings-page.ts:openSettings), and before each click on its X;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
waitForFunctiontimeout 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, ascloseSettingsalready did: Escape in the theme checks, the X in the settings search, and the reload made with Settings open (throughhistoryHolds, so a timeout there reports the history).Test-only: no app code changes.
Validation
bun scripts/settings-pages-demo-regression.tsat once, in four separate checkouts, pinned to two cores underdori 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.openSettingsin 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.