fix(web): a check whose control the click replaces passes and replays
Merged
OK
2mo ago+275+275+012345678901234567890123456789-17-17-01234567890123456789
What and why
Fixes ENG-814. A user reported check failing with LOCATOR_NOT_FOUND on a radio the app replaces with its selected view after the pick. The page did show the selection, but the action was left out of the recording, so the next run replayed only the earlier actions and handed off with end-mismatch.
- Cause: Playwright's
check()clicks, then reads the element again to confirm it. If the click removed the element, that read throwsElement is not attached to the DOM.classifyActionErrorturned this intoNODE_STALE(retryable, "nothing dispatched"), even though the click had already landed. The agent then tried to find the radio again, found nothing, and threwLOCATOR_NOT_FOUND. A locatorcheck()re-resolved inside Playwright until it timed out. checkandunchecknow run on a single element (packages/web/src/actions.ts,setChecked):- read the state; if it's already right, do nothing
- refuse to uncheck a radio, before any click
- click
- read the state again. A control that's gone by now (detached, or its document navigated away) took the click, so the action is done. A state that didn't change fails with
NOT_ACTIONABLE.
- A control that's gone before the click is still a retryable
NODE_STALE. - Unchecking a checked radio and a click that changes nothing were
ENGINE_FAILURE; both are nowNOT_ACTIONABLE. - Limitation, by choice: whatever replaced the control is not read. If the app renders an unchecked copy in its place (e.g. a server rejected the change),
check()still passes, the same as a tap. The next observation or assertion shows the real state. Documented indocs/migrate/playwright.mdxand the changeset, and pinned by a test. - Web benchmark Control Inventory has a new Delivery exercise: picking a radio replaces it with "Express delivery selected". It has a deterministic test and an agent test. The core gestures fixture page has the same radio, with a scripted-model flow that records the step and then replays it.
flowchart LR
A[read checked] -->|already set| Z[done]
A --> B[click]
B --> C{read again}
C -->|wanted state| Z
C -->|element gone| Z
C -->|unchanged| X[NOT_ACTIONABLE]
Verified
Ran it locally: yes
packages/web/tests/integration/check-actions.test.ts: real Chromium, both target kinds (locator, and an element pinned by an observation)- web benchmark:
e2e run tests/control-inventory.e2e.tsagainst a main build in a separate worktree and against this branch packages/e2e/tests/integration/agent-act-verbs.test.ts: scripted model,checkon the replaced radio, then a replay from cache
| main | this branch | |
|---|---|---|
check-actions.test.ts | 8 of 15 fail | 17 pass |
benchmark: getByRole('radio', 'Express').check() | ACTION_FAILED: check timed out after its input was dispatched after 30s | passes in 182ms |
agent check on the replaced radio | check:failed, and the replay needs 2 model calls | check:passed, and the replay makes 0 model calls |
main:
× control inventory > check picks a radio the pick replaces with its summary 30.15s
→ check timed out after its input was dispatched: locator.check: Timeout 2…
branch:
✓ control inventory > check picks a radio the pick replaces with its summary 182ms
The 6 existing Control Inventory agent recordings still replay with --strict-cache on the changed page.
The new agent step check picks a radio the pick replaces with its summary ran against the live model in this PR's web agent job and passed. Its recording is not committed yet: this machine has no model access. Until it is recorded with test:agent and committed, the web agent job calls the model for that one step.