Repository navigation
test(gateway): wait for stream diagnostics before ending each fixture - #143133
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 9, 2026, 9:49 AM ET / 13:49 UTC. ClawSweeper reviewWhat this changesThe desktop-stream test fixture waits for upgraded sockets to close before flushing and resetting diagnostic capture, preventing records from leaking into subsequent tests. Merge readiness✅ Ready for maintainer review This remains a useful, focused fixture repair: current main retains the cleanup race, and no introduced correctness defect was found. The related compression PR depends on reliable validation, rather than superseding this work. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway stream broker connects authenticated node desktop and portal streams over WebSockets. Its test fixture owns loopback connections and diagnostic capture, so teardown must finish before the next test begins. flowchart TD
A[Loopback test client] --> B[HTTP upgrade fixture]
B --> C[Desktop and portal stream broker]
B --> D[Track socket closure]
C --> E[Stream close diagnostics]
D --> F[Await fixture cleanup]
E --> G[Flush diagnostic capture]
F --> G
G --> H[Reset for next test]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +7. Total +7 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep fixture teardown responsible for completing socket lifecycles before diagnostic capture resets, preserving the existing runtime and assertions. Do we have a high-confidence way to reproduce the issue? Yes: current-main teardown can finish before upgraded sockets emit close diagnostics, and the supplied ordered loopback comparison reports that exact failure. This read-only review did not execute the reproduction. Is this the best way to solve the issue? Yes: joining the fixture-owned sockets repairs the lifecycle boundary without delays, broader mocks, relaxed assertions, or production changes. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2c191557f381. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Related: #142242, #134931
What Problem This Solves
Fixes a desktop stream test fixture that can attribute a previous connection's close diagnostic to the next test. This blocked CI for the separately reviewed workspace-manifest compression fix in #142242: the actual cancelled client closed with 1008, but the next test captured an earlier connection's 1006 diagnostic.
Why This Change Was Made
HTTP server shutdown does not wait for upgraded sockets, and client termination returns before the server observes closure. The fixture now records each upgraded socket's close promise before broker handoff and joins those promises during cleanup, before diagnostic capture is flushed and reset.
User Impact
No production behavior changes. Existing stream cancellation, idle connection, backpressure and diagnostic assertions remain unchanged; this makes their execution order reliable.
Evidence
A real loopback probe in the original test order, without scheduler mocks or inserted delays, reproduced previous-connection diagnostic leakage in 25/25 runs with the old cleanup and 0/25 with this fix. Current-connection close codes remained 1008. The complete existing test file passes all 19 cases. Full changed checks and independent P2 review pass with no findings, including review of the installed WebSocket receiver completion order.
This is a one-file fixture repair required to validate #142242, split from that production PR. The PR does not increase timeouts, relax assertions, suppress diagnostics or change runtime code.