Skip to content

test(e2e): wait for the page's slot read before the drag in spec 22 - #38482

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/37561-tags-e2e-drag-wait
Nov 17, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/37561-tags-e2e-drag-wait

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

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 the E2E (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's MAX_FLAKY_SPECS=0 turns into a red job: run 43687843063, job 132733806558, on #37381, whose diff touches no sidebar tag or board code. First-attempt failure:

Error: expect(locator).toBeVisible() failed
Locator: locator('[data-testid="column-11906aa3919e"] [data-slot-key="chat-65-1794727501"]')
Error: element(s) not found
    at website/playwright/session-tags-e2e.spec.ts:503:101

The expect.poll just 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:

  1. Spec 22 dragged the card as soon as its row showed in the ToDo column. That row can come from the socket's connect snapshot, which carries the slot list, while the page's own GET /api/chat/slots (dispatched by the shell's mount effect) is still in flight.
  2. The drop's slots push moves the row to Done.
  3. When that GET was answered before the drop but reaches the page after the push, fetchSlots.fulfilled replaces 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.waitForResponse for that GET before page.goto and awaits its finished() 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.ts spec 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:

run base 8cd1bac582 this PR
Forced condition: the page's first GET /api/chat/slots is 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) 5/10 red, each the CI failure: Done-column toBeVisible element(s) not found after the server poll read [done] 0/10 red; the drag starts only after the held reply lands
Spec 22, --repeat-each=30 0/30 red (the race is rare unforced) 0/30 red
Spec 22 with Chromium's CPU throttled 4x, --repeat-each=20 0/20 red 0/20 red
Whole session-tags-e2e.spec.ts, once — 0/34 red
session-tags-e2e, session-tags and session-tags-folders specs together, once — 0/53 red

The 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 with IP mismatch because localhost resolved 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-side request.post|patch|put|delete to /api/chat/ made after that test's own page.goto/page.reload (10 sites): apart from spec 8's drop at session-tags-e2e.spec.ts:218, each is a teardown delete or a tag cleanup with no board assertion after it
Sibling: 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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributed under the project's Apache-2.0 license.

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.
@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision 88fa8fe17d3a873e831e63ce4557705b4b651aaa ships no reviewable capability (docs, tests or generated files only), so there is nothing to inventory. Does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 88fa8fe17d3a873e831e63ce4557705b4b651aaa — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 88fa8fe17d3a873e831e63ce4557705b4b651aaa — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 88fa8fe17d3a873e831e63ce4557705b4b651aaa — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 88fa8fe

Verdict parsed from the review's SHA-scoped output markers for commit 88fa8fe17d3a873e831e63ce4557705b4b651aaa.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 88fa8fe17d3a873e831e63ce4557705b4b651aaa false-positive: <reason, 20 to 500 characters>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 88fa8fe17d3a873e831e63ce4557705b4b651aaa and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 88fa8fe

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 88fa8fe17d3a873e831e63ce4557705b4b651aaa false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 17, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) November 17, 2026 16:10

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Nov 17, 2026
@KiroCrewCaptain
KiroCrewCaptain merged commit 2c58b2d into main Nov 17, 2026
99 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/37561-tags-e2e-drag-wait branch November 17, 2026 16:39
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 17, 2026
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: session-tags-e2e spec 22 (drag session card onto a status-tag column) passes only on retry

2 participants