Review of PR #822: "fix: a lobby join and a join during the microphone prompt send one join when the realtime socket drops"

From mnema-talk v3.3.13, rendered on this site.

Independent review by an opus reviewer, three rounds, final head e24c44cd1. Verdict of the last round: MERGE.

Round 1: FIX

  • A voice_leave replayed after the reconnect does nothing on the server: it ends a seat only for the connection that holds it, and the new connection holds none, so the lost seat stayed for the 30 s grace.
  • A replay of the screen share and camera stops was redundant: the server removes the media connection of the lost socket with all its tracks.
  • One test measured its baseline after the events it checked.

The stop replay was removed and the test fixed.

Round 2: FIX

The client-only replacement (a resume join, then a leave) was unsafe. It could evict the member's call on another device (the resume replaces the user's media peer and kicks the sibling connection), it showed other members a join and a leave that never happened when no grace seat was left, and it could fire hours later for a join that was never sent. The replayed leave was removed entirely: a leave during an outage stays for the server's grace, as before. The server-side option (a leave from a seatless connection that names its Talk and tab) is recorded as a follow-up in the hunt ledger.

Round 3: MERGE

Races and stuck states checked on the final diff:

  • The pending-join guard is keyed by join generation, set with voice.setChannel and cleared right before the send; a finally clears only its own generation, so a throw, a back-out or a newer join cannot leave it up, and a leave releases it. A reconnect during the microphone prompt or the socket wait sends exactly one non-resume join.
  • Switching Talks during an outage: the resume is skipped and the new join ends the old lingering seat on the server.
  • The lobby request checks its generation after the socket wait, so a leave, a second lobby or a normal join sends nothing for the held request. An abandoned wait keeps one watcher until the next connect, which is bounded.
  • Nothing made up is sent after a reconnect; a test pins it.
  • Mutation check: removing the guard fails two tests. Targeted vitest 111/111, typecheck and lint clean.

Follow-up (voice-leave follow-up): the server-side leave that names its Talk and tab now exists.

Something wrong on this page? Tell us.