Skip to content

fix(client): honor List in lobby for LobbyOnly / P2P broker hosts - #6595

Closed
marktech0813 wants to merge 1 commit into
phase-rs:mainfrom
marktech0813:fix/6556-respect-list-in-lobby
Closed

fix(client): honor List in lobby for LobbyOnly / P2P broker hosts#6595
marktech0813 wants to merge 1 commit into
phase-rs:mainfrom
marktech0813:fix/6556-respect-list-in-lobby

Conversation

@marktech0813

@marktech0813 marktech0813 commented Jul 24, 2026

Copy link
Copy Markdown

Summary

  • Fixes Game shown in lobby even if "List in lobby" is disabled #6556: HostSetup's List in lobby toggle was ignored on LobbyOnly servers (and the GameProvider broker path), which always registered with public: true and set hostIsPublic from useBroker.
  • Private hosts still register with the broker so friends can join by code; they are no longer broadcast via LobbyGameAdded / public_games().

Changes

  • startP2PHostingSession: pass settings.public to registerHost; keep hostIsPublic = useBroker && settings.public through both connecting and waiting states.
  • GameProvider P2P host broker registration: use store.hostIsPublic instead of hardcoding true.
  • Regression test in multiplayerStore.test.ts.

Validation

  • pnpm exec vitest run src/stores/__tests__/multiplayerStore.test.ts — 19 passed.
  • Non-engine client/transport change (CONTRIBUTING narrow exception); no crates/engine/ edits.

Test plan

  • Host against a LobbyOnly server with List in lobby off → room absent from public lobby list
  • Join the same room by entering the code
  • Host with List in lobby on → room appears as before

Model: Composer

Made with Cursor

Summary by CodeRabbit

  • Bug Fixes

    • P2P hosts now respect the “List in lobby” visibility setting when registering with the broker.
    • Private, lobby-only sessions remain hidden from the public lobby while still supporting join-by-code.
    • Host visibility status now stays consistent throughout the hosting flow.
  • Tests

    • Added coverage verifying that private broker-hosted sessions are registered as non-public.

LobbyOnly P2P hosting always registered with public:true and overwrote
hostIsPublic from useBroker, so disabling List in lobby still advertised
the room. Pass settings.public through registerHost and keep hostIsPublic
aligned (phase-rs#6556).

Co-authored-by: Cursor <cursoragent@cursor.com>
@superagent-security superagent-security Bot added the contributor:flagged Contributor flagged for review by trust analysis. label Jul 24, 2026
@superagent-security

Copy link
Copy Markdown

🚨 Contributor flagged. Click here for more info: Superagent Dashboard

@marktech0813

Copy link
Copy Markdown
Author

Closing per docs/AI-CONTRIBUTOR.md §0.1.1: this PR was authored in a Composer session, and Composer is not on the Frontier tier accepted for PRs opened on/after 2026-07-24. Reporting accurately rather than misdeclaring the model.

The fix itself is on branch fix/6556-respect-list-in-lobby if a Frontier-tier agent wants to re-verify and reopen.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 049f1eb7-ef36-470a-a107-98d4c63f5057

📥 Commits

Reviewing files that changed from the base of the PR and between 6895ca3 and f9985bc.

📒 Files selected for processing (3)
  • client/src/providers/GameProvider.tsx
  • client/src/stores/__tests__/multiplayerStore.test.ts
  • client/src/stores/multiplayerStore.ts

📝 Walkthrough

Walkthrough

P2P broker hosting now uses the host’s “List in lobby” setting for broker registration, store state, and broker-client setup. Tests cover private LobbyOnly hosting and verify registration with public: false.

Changes

P2P lobby visibility

Layer / File(s) Summary
Store visibility and broker registration
client/src/stores/multiplayerStore.ts, client/src/stores/__tests__/multiplayerStore.test.ts
P2P hosting derives hostIsPublic and broker registration visibility from settings.public; broker mocks and a private LobbyOnly test validate the behavior.
Provider broker wiring
client/src/providers/GameProvider.tsx
The broker-opening flow passes the store’s hostIsPublic value instead of always enabling public visibility.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant HostSetup
  participant multiplayerStore
  participant Broker
  participant GameProvider
  HostSetup->>multiplayerStore: Start P2P hosting with public setting
  multiplayerStore->>Broker: registerHost(public: settings.public)
  Broker-->>multiplayerStore: Return game code and player token
  multiplayerStore->>GameProvider: Update hostIsPublic
  GameProvider->>Broker: Open broker with hostIsPublic
Loading

Possibly related PRs

  • phase-rs/phase#6515: Modifies the same P2P hosting startup logic with native-engine hosting and attempt-guard handling.

Suggested reviewers: matthewevans, davidomil

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor:flagged Contributor flagged for review by trust analysis.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Game shown in lobby even if "List in lobby" is disabled

1 participant