Repository navigation
Description
Context
At verification base 6814f2ce5d3ea7f626284ab28b3c230428d06630, the hygiene review browser fixture wires each scene's real WebSocket to whichever root is in the mutable module-level ui and socket variables at callback time, not to the root and socket that scene created (scene, packages/ui-react/tests/browser/hygiene-review.layout.tsx:55-112):
- the sender reads the global
socket(lines 77-82); socket.onmessagedispatches to the globalui!.connection(lines 83-87);socket.onclosecallsconnectionLost()on the globalui(line 88).
A late callback from the previous scene's socket can therefore act on the next scene's root.
A controlled native experiment on 2026-10-16 (main ed6b0c5f09ada1b6f899bf245f3f1b176352bf77, recorded on #1974) demonstrated this. Two temporary diagnostic cases created a real first scene, disposed its root and requested its real socket close, then held the real close callback until the next scene had handled its real inbox snapshots and gone online. Released through a microtask:
- Original global lookup: the old callback reset the new root's
onlinetrue → false while the new socket stayed OPEN, and the originalsceneonline poll failed (expected true, received false). - Owner-bound control: the same held callback targeted its captured original root; the new root stayed online and the poll passed.
No synthetic socket frame or store reset was injected. Raw log SHA-256 39acbb991cd6d66dcb478d636277617427bf799429f0758028014b72caaf561c, diagnostic source SHA-256 674f73361edce56c9c47ffd5c7d08a7d3683c30f53c353fb68923b6466fc2d47. A later audit (2026-10-19 and 2026-10-21) confirmed that the message handler and sender share the same ownership flaw; the message path is a source-backed instance, not a measured late-frame failure.
This task fixes the demonstrated fixture defect. Whether it caused the historical natural initial-online failures remains #1974's investigation; this task does not claim it did.
Scope
- In
scene, capture the root and socket the scene creates, and bind the sender,onmessageandoncloseto those captured owners. - A callback arriving after its owner was disposed must not act on any other root. Choose the behavior (ignore, or act only on the captured disposed root) and state it in the PR.
- Audit every other callback the file registers against a scene-owned resource (timers,
releaseRead, fixture handles) and bind any that read the mutable globals at callback time. List the audit result in the PR. - Add a regression case using the held-old-close ordering above that fails on the current global lookup and passes with the owner binding.
Out of scope
- Product behavior in
packages/ui-react/src(the connection store,connectionLost, server message handling). - Deadlines, poll timeouts, retries or weakened assertions.
- Other browser fixture files, even if they share the pattern. File each as its own issue with its cited line.
- Explaining or closing the historical natural failures in ui-react: hygiene browser scene can time out waiting for initial inbox online #1974, ui-react: manual hygiene recheck remains applying in browser proof #1970 or ui-react: hygiene-review layout test reads the item before it renders #1685.
Acceptance criteria
- The sender, message handler and close handler in
scenereference only the root and socket created by that scene invocation, shown in the diff. - A regression case that holds a disposed scene's real close callback until the next scene is online, then releases it, fails on the pre-change fixture with the original online assertion and passes after the change. The PR records both runs.
- A matching late-message case, or a written reason it cannot be driven natively without synthetic frames, is in the PR.
- The complete unmodified
hygiene-review.layout.tsxfile passes in the pinned offline browser image with every original assertion, deadline and guard unchanged. - The PR lists every other scene-owned callback audited and whether it changed.
Verification
From packages/ui-kit, inside the pinned network-disabled Playwright 1.63.0 image:
node /repo/node_modules/vitest/vitest.mjs run --project=ui-react-layout --browser.fileParallelism=false ../ui-react/tests/browser/hygiene-review.layout.tsxRecord the failing-first run of the new regression case on the pre-change fixture, the passing run after it, and a mutation that restores the global lookup in one handler and fails the named case.
Contract impact
None. Test fixture only.
2026-10-25: verified the original owner lookups against the stated base and refreshed their moved line citations; scope and historical evidence are unchanged.
Activity
schlessera commentedon Oct 25, 2026
Claim
2754-socket-owner-044-20261025: working this pre-selected issue ontest/2754-hygiene-socket-owner-044, through a draft PR only. Verifiedscenestill contains the global sender, message and close lookups at the cited source location. Late callbacks will act only on their captured original root, including after disposal. Original assertions and deadlines remain unchanged.schlessera commentedon Oct 25, 2026
Draft handoff for claim
2754-socket-owner-044-20261025: #2914 at77dc0211cb51d090e2f8b861d66e30b3419dc2f7.The full hygiene layout file passes 102/102, strict typecheck passes, and the single final-head PR preflight passes 210 fast cases. The close, native snapshot and sender regressions fail by name before binding, pass after binding, and each fails under its matching restored-global mutation. Late callbacks retain only their original owners, including after disposal. The PR lists the complete callback audit.
The full package suite reports 2,515 pass / six tracker failures, with the same six reproduced on the clean verification base (#2900). The root suite reports 1,952 pass / two exact-note failures (#2769); the clean base passes that file in isolation and reproduces both failures with controlled fictional provider variables. The PR records those distinctions and the later main advancement without claiming combined-tree qualification.
PR and issue milestones were read back as 0.44.0. Separate source-backed fixture follow-ups are #2905, #2906 and #2909. Releasing this invocation's assignment for the coordinator; the PR remains draft, and the coordinator owns ready-candidate proof and merge.