Skip to content

feat(partyplug): adopt HexStacker's room-teardown kit + wire close-room#5

Merged
tim4724 merged 1 commit into
mainfrom
emdash/update-partyplug-75weg
Jul 8, 2026
Merged

feat(partyplug): adopt HexStacker's room-teardown kit + wire close-room#5
tim4724 merged 1 commit into
mainfrom
emdash/update-partyplug-75weg

Conversation

@tim4724

@tim4724 tim4724 commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

Syncs the PartyPlug kit with the HexStacker-Party reference and wires the new close-room lifecycle into the game. set_state (retained roster snapshot) was already adopted here, so this PR covers the remaining delta: room teardown, terminal-close handling, the controller-URL template, and self-detected create failures.

Kit sync (partyplug/PartyConnection.js + .d.ts, README, tests)

  • closeRoom() — host/slot-0 tears the room down on the relay: every member socket closes with 4001 and GET /room/:code turns 404, so stale join/claim QRs die with the room
  • 4001 handling — surfaces as terminal onClose(0, 0, {roomClosed: true}); no auto-reconnect against a deleted room
  • create(maxClients, url) — optional controller-URL template ({room}/{instance}) the relay resolves for code-only clients; https-only, omitted on plain-http origins (dev/E2E)
  • failAttempt() — drives the normal backoff/give-up path for failures the caller detects itself (open socket, unanswered/rejected create)

Only PartyConnection differed from the reference — RoomFlow, PartyFastlane, and the AirConsole adapter were already identical.

Game wiring

  • Display pagehide: net.closeRoom() right after the existing DISPLAY_CLOSED broadcast — the room now dies server-side even when the app-level goodbye is dropped (crash, bfcache freeze); the broadcast stays as the instant path
  • Display create: registers the controller-URL template; a relay-rejected create now retries via failAttempt() backoff instead of dead-ending on a console warning
  • Controller: {roomClosed} surfaces as 'room_closed' and bails straight to the device chooser (?bail=game_ended), same exit as DISPLAY_CLOSED

Testing

  • npm test: 212/212 pass (includes the new closeRoom / 4001 / create-url kit tests)
  • npm run test:e2e: 17/17 pass over the real relay — "closing the big screen bails joined phones out at once" now exercises the new path
  • Probed the deployed relay (ws.couch-games.com) directly: accepts the url template, closes host + guest sockets with 4001 on close_room, and 404s the room afterward

🤖 Generated with Claude Code

https://claude.ai/code/session_01WrjJk5evnn2g63cD2eaqhC

Sync PartyConnection with the HexStacker-Party reference:
- closeRoom(): host/slot-0 tears the room down on the relay (members get
  a 4001 close, GET /room/:code turns 404 so stale join/claim QRs die)
- 4001 handling: terminal onClose {roomClosed} — no futile reconnects
  against a deleted room
- create(maxClients, url): register a controller-URL template ({room}/
  {instance}) the relay resolves for code-only clients (https-only)
- failAttempt(): drive the normal backoff path for self-detected failures
  (open socket, unanswered create)

Game wiring:
- display pagehide: closeRoom() after the DISPLAY_CLOSED goodbye, so the
  room dies server-side even when the app-level broadcast is dropped
- display create: pass the controller-URL template; a rejected create now
  retries via failAttempt() instead of dead-ending on a warn
- controller: {roomClosed} surfaces as 'room_closed' and bails straight
  to the device chooser (?bail=game_ended), same exit as DISPLAY_CLOSED

set_state (retained roster snapshot) was already in place. Verified the
deployed relay honors the new contract (4001 both sockets, /room 404).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WrjJk5evnn2g63cD2eaqhC
@claude

claude Bot commented Jul 8, 2026

Copy link
Copy Markdown

Claude finished @tim4724's task in 0s —— View job


I'll analyze this and get back to you.

@tim4724
tim4724 merged commit 73bb4d6 into main Jul 8, 2026
6 checks passed
@tim4724
tim4724 deleted the emdash/update-partyplug-75weg branch July 8, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant