Repository navigation
test(e2e): wait for the page's slot read before the drag in spec 22 - #38482
Conversation
Spec 22 dragged the card as soon as its row showed in the ToDo column. The socket's connect snapshot can render that row before the page's own GET /api/chat/slots returns, so the drop and that read raced. A reply serialized before the drop but applied after the drop's slots push puts the pre-drop row back, and nothing pushes again, so the card never reaches the Done column. Wait for that read to finish before the drag, as spec 8 does.
First Principles Review (Opus 5.5) — ⏭️ skippedRevision |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The PR only changes a Playwright test file and adds or changes no user-visible control, so the missing blind read leaves no evidence gap. [UX-REVIEWED] 88fa8fe Description read[DESCRIPTION-READ] 5b632f531d7e5b029ee080951b723142717387e692af595da160226664f33336 That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS This is a test-only change. Spec 22 now waits for the page's first slot-list read before the drag, the same wait spec 8 already uses, so the race described in the PR is gone. Notes
[DESIGN-REVIEWED] 88fa8fe Description read[DESCRIPTION-READ] 7afd27b7480be2226011b7ad512255121749a8e27c5d71d465c9a3c9caec803c That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approving. On head 88fa8fe, the review checked these points. The diff is 7 test-only lines in spec 22 of website/playwright/session-tags-e2e.spec.ts. The waitForResponse for GET /api/chat/slots is armed before page.goto, so it catches the shell's first slot-list read. The predicate matches on pathname, so the ?crew=all query still matches. finished() is awaited before the drag, so the reply the server sends cannot overwrite the drop. No assertion, timeout or tolerance changed. No sleep or clock was added. The offline E2E job passed on this head, and nothing on main already fixes this.
Done well: the PR fixes the race by ordering, not by loosening the test. It reuses spec 8's wait word for word and adds no new helper. It leaves the underlying stale-reply reducer behaviour to #11149.
Problem / Motivation
Goal: Spec 22 of
website/playwright/session-tags-e2e.spec.ts(drag a session card onto a status-tag column) passes on its first attempt, so theE2E (stub ACP backend, offline)job stops going red on PRs that do not touch it.Spec 22 failed its first attempt and passed on the retry, which
test/test_playwright_e2e.py'sMAX_FLAKY_SPECS=0turns into a red job: run 43687843063, job 132733806558, on #37381, whose diff touches no sidebar tag or board code. First-attempt failure:The
expect.polljust before that line had already read the slot's tags back from the server as[done], so the drop worked; only the board kept the card out of the Done column for the whole 5 s.Why it matters
Any PR can go red on this spec for reasons unrelated to its diff: #38079, which touches no board code either, hit it the same way (run 43981923348). Each hit costs a rerun or a round of triage.
Not a goal
What changed (motivation → approach → change)
Spec 22 stops failing at random: it drags only after the page has finished its own first read of the session list, so a late reply can no longer put the card back in ToDo. The race was inside the test:
GET /api/chat/slots(dispatched by the shell's mount effect) is still in flight.fetchSlots.fulfilledreplaces the rows with the pre-drop list. The ToDo row comes back, and nothing pushes again in a quiet test gateway, so the 5 s check runs out while the server already says Done. This matches the CI log above.The change: spec 22 registers
page.waitForResponsefor that GET beforepage.gotoand awaits itsfinished()before the drag, the same wait #37286 gave spec 8. The drag, both assertions and their timeouts are unchanged.Backwards compatibility
Compatible: test-only change; no product code, config or API moves.
Removes nothing: one spec gains a wait on a real response; no assertion, timeout or step is dropped.
Tests
website/playwright/session-tags-e2e.spec.tsspec 22 (drag session card onto a status-tag column reassigns tag) is the changed test: it now drags only after the page's own slot-list read has finished.Determinism proof on an Ubuntu 24.04 machine, Chromium, against the E2E gate's own harness gateway (stub ACP backend), a fresh gateway per run, every run
--retries=0 --workers=1:8cd1bac582GET /api/chat/slotsis answered by the gateway at once but reaches the page only after the drop's slots update has (or after 2.5 s if no drop comes)toBeVisibleelement(s) not foundafter the server poll read[done]--repeat-each=30--repeat-each=20session-tags-e2e.spec.ts, oncesession-tags-e2e,session-tagsandsession-tags-foldersspecs together, onceThe file runs in serial mode and Playwright has no shuffle flag, so there is no shuffled run.
Proof: not provable -- frontend test (prove.py runs Python only)
Manual verification
The table above is the reproduction and the smoke test, run on Linux (Ubuntu 24.04). The full CI-equivalent E2E run (
test/test_playwright_e2e.py) could not start on that machine: its sign-in step was refused withIP mismatchbecauselocalhostresolved to different loopback addresses for the test runner and the browser, on the base as well, so CI's E2E job is the full-suite check.Screenshots / video
Why no screenshot: the diff is one Playwright spec and nothing renders differently.
Related Issues
Closes #37561
Sibling sweep
Swept: git grep -nE "DragEvent('drop'|/drop`" -- website/playwright/
Swept: per test in
website/playwright/*.spec.ts, every test-siderequest.post|patch|put|deleteto/api/chat/made after that test's ownpage.goto/page.reload(10 sites): apart from spec 8's drop atsession-tags-e2e.spec.ts:218, each is a teardown delete or a tag cleanup with no board assertion after itSibling: website/playwright/session-tags-e2e.spec.ts:218 -- not affected -- spec 8 already waits for the page's slot read before its drop (#37286)
Sibling: website/playwright/session-tags-e2e.spec.ts:232 -- not affected -- spec 9 asserts the API answer only and loads no page
Sibling: website/playwright/session-tags-e2e.spec.ts:462 -- not affected -- spec 21 reorders columns and asserts the server's column order only
Sibling: website/playwright/session-tags-e2e.spec.ts:500 -- changed here -- spec 22
Sibling: website/playwright/session-tags-e2e.spec.ts:535 -- not affected -- spec 23 asserts the server's tags stay unchanged, which a late page read cannot alter
Sibling: website/playwright/session-tags-e2e.spec.ts:735 -- not affected -- spec 29 asserts the API answer only and loads no page
Sibling: website/playwright/session-tags-folders.spec.ts:147 -- not affected -- F5 reloads the page before it checks the board
Sibling: website/playwright/session-tags-folders.spec.ts:188 -- not affected -- F6 asserts the server's folder only
Sibling: website/playwright/session-tags-folders.spec.ts:226 -- not affected -- F7ui reloads the page before it checks the board
Sibling: website/playwright/session-tags-folders.spec.ts:252 -- not affected -- F7 drops through the API before page.goto
Sibling: website/playwright/session-tags.spec.ts:60 -- not affected -- asserts the API answer only and loads no page
Sibling: website/playwright/session-tags.spec.ts:77 -- not affected -- asserts the API answer only and loads no page
Pattern harvest
Rule candidate: review-prompt
Pattern: a Playwright spec that, after page.goto, changes slot state through a write the page never stamps (an API call made by the test, or the board drop, which has no eager patch) and then asserts the board must first wait for the page's own initial slot-list read.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.