Repository navigation
test(ui): drain browser context routes during cleanup - #156473
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 23, 2026, 7:47 AM ET / 11:47 UTC. ClawSweeper reviewWhat this changesThe PR makes browser-test cleanup wait for active context routes, moves nine cleanup calls to the shared suite owner, and extends the lifecycle regression. Merge readiness✅ Ready for maintainer review The repair remains necessary: current main still omits context-route drainage. No actionable correctness or security findings were found, and the supplied browser validation supports the change. Likely related people: steipete is a medium-confidence routing candidate based on prior suite-lifecycle work. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI browser-test harness owns browser contexts and intercepted requests used by UI scenarios. Its cleanup must finish active request callbacks before closing the context and releasing test resources. flowchart TD
A[Browser test scenarios] --> B[Shared suite cleanup]
C[Page and context routes] --> B
B --> D[Release held requests]
D --> E[Wait for active callbacks]
E --> F[Close browser context]
F --> G[Release resources or report failure]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +29. Total +29 across 5 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep browser teardown under the existing suite owner, joining both route scopes before context closure while preserving errors and bounded cleanup. Do we have a high-confidence way to reproduce the issue? Yes for the cleanup-order defect: current main closes contexts without joining their active routes, and the supplied regression exercises that ordering. The original intermittent socket failure was not reproduced; this review did not execute tests. Is this the best way to solve the issue? Yes. Extending the existing cleanup owner uses Playwright's supported drainage contract and avoids retries, suppression, or competing teardown logic. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bab3136d3c60. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Browser contexts could close their request clients while context-owned route callbacks were still fetching responses, leaving unhandled errors after otherwise passing Control UI tests.
User Impact
No production behavior changes. Browser test cleanup now waits for its active callbacks while keeping failures and cleanup deadlines visible.
Why This Change Was Made
The shared suite already drained held page routes, but the plain-HTTP outbox proxy installs context routes. Drain both scopes before closing the context. Nine callers that bypassed managed cleanup now use the existing suite owner, and the existing native-fork regression also holds a context callback until cleanup has joined it. No retries, error suppression, longer deadlines, or weaker assertions were added.
Evidence
The original main job passed all 373 assertions but reported two unhandled font
route.fetchsocket errors. Before this repair, the same 78-file membership passed on frozen maine7fbe5389e0b; the historical socket failure was not reproduced. The expanded lifecycle regression independently failed on the old helper because context closure preceded callback drainage; it passes with this change and retains the original test-body error.Remote proof on Node 24.19.0 and Playwright 1.63.0 passed:
pnpm test ui/src/test-helpers/control-ui-e2e-suite.test.ts --maxWorkers=1.Behavioral proof ran in Testbox 35838998797. Its remaining lifetime was too short for the serial typecheck, so six completed graphs were reused and the other 19 plus subsequent canonical checks passed in Testbox 35849809144. Both leases are stopped; cancellation of the first workflow records deliberate cleanup, not a passing overall payload. All five changed file hashes remain identical after rebasing onto main's already-landed CI repairs.
Preparation failures were retained and corrected before proof: the first baseline lacked Playwright's pinned ffmpeg and used changed timing weights that selected a different cohort; the candidate launcher initially rejected a raw-SHA changed-check base before remote execution. The successful build also reported the existing startup-bundle size advisory, which remains with its UI performance owner.
Current-head CI run 35855945310 passed. Reported module times were 74.97 seconds for the lifecycle helper in the Bun UI unit project, 18.63 seconds for model-picker refresh, and 72.49 seconds for scroll-dock. Catalog bootstrap was not selected in that PR CI run; its cases are covered by the explicit remote caller proof above.