Repository navigation
test(ui): join placement dialog work before fixture teardown - #136354
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 11:19 AM ET / 15:19 UTC. ClawSweeper reviewWhat this changesThe branch adds a shared placement-dialog fixture that joins outstanding UI work before teardown, repins Gateway test configuration after reset, and aligns one warning assertion with the production log formatter. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review The patch is a coherent, test-only repair for asynchronous dialog teardown plus two Gateway test-fixture assertions. No introduced correctness or security defect was found; this maintainer-authored PR should remain open for normal exact-head CI and maintainer handling. Priority: P3 Review scores
Verification
How this fits togetherWeb chat placement actions lazily load a target-selection dialog, then call the Gateway to move or restart a session. The affected test helpers must keep the dialog, its requests, and the test runtime configuration alive until those asynchronous actions settle. flowchart LR
Tests[Placement tests] --> Fixture[Modal test fixture]
Fixture --> Dialog[Placement dialog]
Dialog --> Action[Move or restart action]
Action --> Requests[Mocked Gateway requests]
Requests --> Cleanup[Joined fixture cleanup]
Cleanup --> Teardown[DOM and polyfill teardown]
GatewayTests[Gateway RPC tests] --> Config[Runtime fixture config]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +2, Tests +54. Total +56 across 5 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain the single shared cleanup owner for these placement tests so pending dialog operations are cancelled and joined before UI fixture teardown. Do we have a high-confidence way to reproduce the issue? Yes, from source: placement actions await a modal owner before their request, and the new fixture explicitly tracks and settles that owner before teardown. The supplied PR body also reports focused failure-path probes, though this read-only review did not execute them. Is this the best way to solve the issue? Yes: a shared fixture at the dialog-test boundary removes duplicated per-test teardown and preserves the production dialog and Gateway action paths unchanged. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 65e5b2e19c9d. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…w#136354) * test(ui): join placement dialog work before fixture teardown * test: publish RPC fixture config before yielding
After a placement test failed while waiting for its catalog, teardown removed the dialog DOM and restored the native-dialog polyfill while the real move remained pending. Web Awesome closed its native dialog on disconnect, but that did not cancel the placement owner. The retained operation could suppress a later restart in the non-isolated UI test worker.
Give the placement and restart tests one modal fixture that tracks their actual action and request promises. Cleanup settles lazy imports and catalog responses, cancels still-owned dialogs through the existing modal-cancel event, joins callers, then removes the DOM and restores the polyfill. Keep cleanup in afterEach so Vitest preserves the original assertion failure alongside a cleanup failure. Remove the duplicated in-body finally blocks and retain the existing successful Cancel-button interactions.
The original failure-path probe reproduced the pending move and suppressed restart, then recovered them by cancelling the retained owner. The candidate probe exercised delayed-catalog move, restart and offline confirmation. In all three flows, real connected-host cancellation preceded caller settlement, and caller settlement preceded DOM/polyfill release. The delayed catalog painted before cancellation. All three original assertion errors were preserved, all six caller/cleanup observations settled, RPC counts stayed move=1/restart=1/offline=0, and no rescue was used. The initial CI wait failure's trigger remains unknown; this repairs the observed teardown cascade.
All 14 original and 14 candidate placement/restart cases passed, along with seven confirmation sibling cases and the three-flow probe. Whole commands took 6.440 / 6.417 seconds; no normal-path speedup is claimed. Existing one-second waits, polling intervals, real imports, Lit/Web Awesome components, request arguments and assertions remain. Proof used the canonical UI/jsdom configuration, Node 24.19.0 and Web Awesome 3.12.0.
All wrappers joined, temporary roots were empty, all 74 source guards were restored and the private probe was removed. Formatting, typed lint and Codex P0 review passed. Production delta is zero; five test/support files add 151 and remove 95 lines. The 63-line fixture supplies the missing lifetime owner without changing product dialogs, requests, protocols or persistence. Exact-head CI remains required before landing.
CI also exposed a separate shared Gateway test-fixture race.
rpcReqcleared the runtime config snapshot and yielded before publishing the mutable fixture overrides. A real in-flight config reader could pin the fixture's on-disk main-only config, making an admitted worktree run fail with an unknown-agent error. The RPC helper now publishes the fixture config synchronously after resetting it. This changes only test support.A controlled probe kept the existing real command preparation and first
agent.waitassertion. With the original helper, the snapshot became empty during the RPC yield, the real loader pinned main-only config, and the existing assertion failed with the same unknown-agent error. With the two-line fix and identical probe, both initial and follow-up turns passed; all preparation, lease-release and wait promises joined. The disk config remained unchanged in each run. This proves the race mechanism; the exact competing reader in the original CI run was not captured.The complete Gateway selection also exposed an overstrict retained-worktree warning assertion under a long temporary path: the production warning intentionally sanitizes and caps paths at 256 characters. The test now derives its expected displayed path with the existing formatter. It retains the warning count, branch and outcome checks and the actual file-preservation and registry assertions.
Final Gateway validation passed all 323 cases across the original 19-file CI selection and the nine-case server-environment sibling. The focused dirty-checkout case also passed with a 274-character worktree path. The preceding complete run's only failure was the old full-path warning assertion; all 323 case identities and existing timeouts are retained. Formatting, typed lint and a fresh Codex P0 review passed for both CI repairs.