Session page: a late poll answer overwrites a newer one (J5 "withdraw" flake) #932

Closed
opened 2026-09-29 11:32:00 +00:00 by claude-bot · 1 comment
Collaborator

J5 failed on #926's CI (run 11404, desktop, j5-after-the-session.spec.js:402): after Withdraw, The recording still read "Approved"; the phone and keyboard failures that followed were a cascade (shared database, the desktop evening's suggestions left un-added).

Cause. useSessionData.load (SessionPage.jsx) calls setData with whatever useAsync.run returns — and run returns an overtaken answer even though it keeps it out of its own state. The review page polls the session every 15 s while the wiki run is going (it starts at approval). A poll that left before the withdrawal and landed after the page's own refresh put the approved session back until the next poll, past J5's 10 s wait. A real bug, not only a test flake: any GM action during a poll can be visually undone for up to 15 s.

Fix. useSessionData keeps its own newest-read counter; only the newest read may draw the page. Unit test reproduces it (fails without the fix).

J5 failed on #926's CI (run 11404, desktop, `j5-after-the-session.spec.js:402`): after **Withdraw**, The recording still read "Approved"; the phone and keyboard failures that followed were a cascade (shared database, the desktop evening's suggestions left un-added). **Cause.** `useSessionData.load` (SessionPage.jsx) calls `setData` with whatever `useAsync.run` returns — and `run` returns an overtaken answer even though it keeps it out of its own state. The review page polls the session every 15 s while the wiki run is going (it starts at approval). A poll that left before the withdrawal and landed after the page's own refresh put the approved session back until the next poll, past J5's 10 s wait. A real bug, not only a test flake: any GM action during a poll can be visually undone for up to 15 s. **Fix.** `useSessionData` keeps its own newest-read counter; only the newest read may draw the page. Unit test reproduces it (fails without the fix).
Author
Collaborator

Fixed in PR #933 (merged as 67b107bf): useSessionData counts its reads, and only the newest draws the page. The new useSessionData.test.jsx reproduces the race (it fails without the fix). CI was green, including the journeys.

Possible follow-up, not done here: useAsync.run still returns overtaken answers to its callers. Any other caller doing run(...).then(setX) on a polled read has the same shape. It wasn't audited here, and a repo-wide change to useAsync semantics wants its own look.

Fixed in PR #933 (merged as 67b107bf): `useSessionData` counts its reads, and only the newest draws the page. The new `useSessionData.test.jsx` reproduces the race (it fails without the fix). CI was green, including the journeys. Possible follow-up, not done here: `useAsync.run` still returns overtaken answers to its callers. Any other caller doing `run(...).then(setX)` on a polled read has the same shape. It wasn't audited here, and a repo-wide change to `useAsync` semantics wants its own look.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rbrooks/Quest-Board#932
No description provided.