[PR #8523] [MERGED] Multiplayer: rejoin as your own hero after removal, ask before Leave, explain a refused Approve #8652

Closed
opened 2026-11-07 16:46:15 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8523
Author: @kolacheee
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @kolacheee

Base: staging ← Head: fix/room-rejoin-and-leave


📝 Commits (5)

  • f979c90 fix(multiplayer): rejoin as your own hero after removal, ask before Leave, explain a refused Approve
  • 1bbfc70 fix(multiplayer): wake the waiting guest on a refused Approve, drop a re-id'd member's sprite
  • 2873e67 Merge branch 'staging' into fix/room-rejoin-and-leave
  • 9a8a582 fix(game): let exact-name party members claim their combat unit first
  • b6e06c6 Merge branch 'staging' into fix/room-rejoin-and-leave

📊 Changes

11 files changed (+189 additions, -27 deletions)

View changed files

📝 e2e/multiplayer-controls.e2e.ts (+11 -0)
📝 packages/client/src/components/game/GameSurface.tsx (+29 -12)
📝 packages/client/src/features/multiplayer/MultiplayerChat.tsx (+11 -0)
📝 packages/client/src/features/multiplayer/MultiplayerHostControls.tsx (+17 -2)
📝 packages/client/src/lib/game-character-name-match.ts (+14 -0)
📝 packages/client/src/localization/locales/en.json (+2 -0)
📝 packages/server/src/services/multiplayer/game-persona.ts (+20 -2)
📝 packages/server/src/services/multiplayer/service.ts (+16 -2)
📝 scripts/regressions/multiplayer-game-persona.regression.ts (+59 -1)
📝 scripts/regressions/multiplayer-seat-key-security.regression.ts (+5 -2)
📝 scripts/regressions/multiplayer-session-lifecycle.regression.ts (+5 -6)

📄 Description

Linked issue

Follows #6790 (secure multiplayer). These are fixes from a two-player Game room playtest; no separate issue was opened.

Why this change

  • If the host removed a player from a shared Game, that player could never come back as their hero. Approving their rejoin failed with identity-conflict, because the hero's card was still bound to the old seat.
  • When Approve was refused for a name in use, the host got a silent 400. The guest waited on "Waiting for the host to approve" forever.
  • Leave dropped a guest out of the room on a single click.
  • A rejoined guest's hero, not on the party list until the next round, was matched by name to the host's persona:active entry. The fight then started with two members sharing one id and was refused: "Invalid combat sides or duplicate units".

What changed

  • A player the host removed can rejoin as their own hero. Approve rebinds the card, sheet and bag of a hero whose player is no longer seated to the new seat. A seated player's hero and the game's own NPC names are still refused.
  • A refused Approve now ends the request with identity-conflict, so the guest sees "This character name is already in use…". The refusal wakes the guest's waiting poll at once, instead of leaving it to the 20 s timer. The host gets an alert saying how to free the name: remove that seat under Players, or ask them to join under another character name.
    • Handing a seat to someone without its rejoin key is still refused, as before.
  • Guest Leave asks "Leave this shared chat?" first. Cancel keeps the seat.
  • In a generated combat party, members named exactly as a unit claim it first, and later members only match units nobody holds yet. A member left without a unit gets its own generated id and no sprite, so the fight opens and each member wears its own art, whatever the party order.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Every multiplayer-* regression passes on this branch. multiplayer-game-persona gained the rejoin case and source checks. multiplayer-seat-key-security and multiplayer-session-lifecycle now expect a refused request to end with its reason, instead of waiting for the host to decline it. chat-window-icons and floating-window also pass, and so do client tsc, eslint on the changed files, and the locale check. Server tsc reports only mmd-parser / @takahirox/three-mmd type errors, because those packages aren't installed in this checkout; none are in the changed files. pnpm check wasn't run in full here.

Manual verification notes

These were checked by a two-machine room playtest, host and guest, on the same changes in our working branch:

  • Remove a guest, then have them rejoin as the same hero and approve: the card is rebound and their bag survives (7 items).
  • Rejoin under a new display name with the same persona: rebound.
  • A seated persona is refused.
  • After a guest pressed Leave, a different display name asking for the same hero: the host sees the alert, and the guest sees "This character name is already in use…". After the host removes that seat, Approve rebinds it.
  • Leave → Cancel keeps the seat. Leave → Leave leaves.
  • After a rejoin, a fight opens.
  • e2e/multiplayer-controls.e2e.ts passed 44/44 on desktop-chromium and mobile-chromium (WebKit isn't installed there). Its "Leave in an old joined chat" test now answers the confirm.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

Two new English UI strings (multiplayer.guest.leaveConfirm, multiplayer.host.approveConflict).

UI evidence (if applicable)

Leave's confirm and the host's alert use the app's existing dialogs.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8523 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `fix/room-rejoin-and-leave` --- ### 📝 Commits (5) - [`f979c90`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f979c90c970180c24af76854b8e8e8b0a2d61b92) fix(multiplayer): rejoin as your own hero after removal, ask before Leave, explain a refused Approve - [`1bbfc70`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1bbfc70130290ac9659c8d74d925878504ceed7a) fix(multiplayer): wake the waiting guest on a refused Approve, drop a re-id'd member's sprite - [`2873e67`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2873e676eec4396a354151911cb0aff50d4a6ea9) Merge branch 'staging' into fix/room-rejoin-and-leave - [`9a8a582`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9a8a5823867ec5b9181296e13d2d84fbcd2bc532) fix(game): let exact-name party members claim their combat unit first - [`b6e06c6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b6e06c6193d6757391d78ec7ea31abff57aed4f3) Merge branch 'staging' into fix/room-rejoin-and-leave ### 📊 Changes **11 files changed** (+189 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `e2e/multiplayer-controls.e2e.ts` (+11 -0) 📝 `packages/client/src/components/game/GameSurface.tsx` (+29 -12) 📝 `packages/client/src/features/multiplayer/MultiplayerChat.tsx` (+11 -0) 📝 `packages/client/src/features/multiplayer/MultiplayerHostControls.tsx` (+17 -2) 📝 `packages/client/src/lib/game-character-name-match.ts` (+14 -0) 📝 `packages/client/src/localization/locales/en.json` (+2 -0) 📝 `packages/server/src/services/multiplayer/game-persona.ts` (+20 -2) 📝 `packages/server/src/services/multiplayer/service.ts` (+16 -2) 📝 `scripts/regressions/multiplayer-game-persona.regression.ts` (+59 -1) 📝 `scripts/regressions/multiplayer-seat-key-security.regression.ts` (+5 -2) 📝 `scripts/regressions/multiplayer-session-lifecycle.regression.ts` (+5 -6) </details> ### 📄 Description ## Linked issue Follows #6790 (secure multiplayer). These are fixes from a two-player Game room playtest; no separate issue was opened. ## Why this change - If the host removed a player from a shared Game, that player could never come back as their hero. Approving their rejoin failed with `identity-conflict`, because the hero's card was still bound to the old seat. - When Approve was refused for a name in use, the host got a silent 400. The guest waited on "Waiting for the host to approve" forever. - Leave dropped a guest out of the room on a single click. - A rejoined guest's hero, not on the party list until the next round, was matched by name to the host's `persona:active` entry. The fight then started with two members sharing one id and was refused: "Invalid combat sides or duplicate units". ## What changed - A player the host removed can rejoin as their own hero. Approve rebinds the card, sheet and bag of a hero whose player is no longer seated to the new seat. A seated player's hero and the game's own NPC names are still refused. - A refused Approve now ends the request with `identity-conflict`, so the guest sees "This character name is already in use…". The refusal wakes the guest's waiting poll at once, instead of leaving it to the 20 s timer. The host gets an alert saying how to free the name: remove that seat under Players, or ask them to join under another character name. - Handing a seat to someone without its rejoin key is still refused, as before. - Guest Leave asks "Leave this shared chat?" first. Cancel keeps the seat. - In a generated combat party, members named exactly as a unit claim it first, and later members only match units nobody holds yet. A member left without a unit gets its own generated id and no sprite, so the fight opens and each member wears its own art, whatever the party order. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` Every `multiplayer-*` regression passes on this branch. `multiplayer-game-persona` gained the rejoin case and source checks. `multiplayer-seat-key-security` and `multiplayer-session-lifecycle` now expect a refused request to end with its reason, instead of waiting for the host to decline it. `chat-window-icons` and `floating-window` also pass, and so do client tsc, eslint on the changed files, and the locale check. Server tsc reports only `mmd-parser` / `@takahirox/three-mmd` type errors, because those packages aren't installed in this checkout; none are in the changed files. `pnpm check` wasn't run in full here. ### Manual verification notes These were checked by a two-machine room playtest, host and guest, on the same changes in our working branch: - Remove a guest, then have them rejoin as the same hero and approve: the card is rebound and their bag survives (7 items). - Rejoin under a new display name with the same persona: rebound. - A seated persona is refused. - After a guest pressed Leave, a different display name asking for the same hero: the host sees the alert, and the guest sees "This character name is already in use…". After the host removes that seat, Approve rebinds it. - Leave → Cancel keeps the seat. Leave → Leave leaves. - After a rejoin, a fight opens. - `e2e/multiplayer-controls.e2e.ts` passed 44/44 on desktop-chromium and mobile-chromium (WebKit isn't installed there). Its "Leave in an old joined chat" test now answers the confirm. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) Two new English UI strings (`multiplayer.guest.leaveConfirm`, `multiplayer.host.approveConflict`). ## UI evidence (if applicable) Leave's confirm and the host's alert use the app's existing dialogs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:46:15 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8652
No description provided.