Skip to content

feat(pre-flight): add room mode state on the meeting - #26099

Draft
AtilaU19 wants to merge 8 commits into
bigbluebutton:v4.1.x-developfrom
AtilaU19:task-2846
Draft

AtilaU19 wants to merge 8 commits into
bigbluebutton:v4.1.x-developfrom
AtilaU19:task-2846

Conversation

@AtilaU19

@AtilaU19 AtilaU19 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

A room-level mode id carried by the meeting. An empty value means "not configured". Every client can read it, including users still on the pre-flight screen, and a moderator can write it with meetingSetRoomMode. No UI yet.

How

  • bbb-common-message: SetRoomModeCmdMsg and RoomModeChangedEvtMsg.
  • akka-bbb-apps: MeetingStatus2x mirror and a new handler. It only accepts moderators and rejects breakout rooms, like MuteMeetingCmdMsgHdlr. It re-validates the id, ignores unchanged values, writes the new meeting."roomMode" column and broadcasts RoomModeChangedEvtMsg. AnalyticsActor logs RoomModeChangedEvtMsg.
  • bbb-graphql-server: meeting."roomMode" (varchar(32), default ''), exposed in v_meeting to bbb_client and bbb_client_not_in_meeting, plus the meetingSetRoomMode action.
  • bbb-graphql-actions: meetingSetRoomMode handler: moderator only, refused in breakout rooms (akka keeps its own check); id must match ^[a-z][a-z0-9-]{0,31}$. Empty is only the column's default and cannot be set back, so no moderator can reopen the pre-flight panel for later arrivals.
  • bigbluebutton-html5: roomMode in the meeting type, MEETING_SUBSCRIPTION and the meeting comparator, and in the user_current meeting block and userComparator (which keeps undefined and '' apart).
  • tests: pre-flight/roomMode.spec.ts (@ci), using the existing Apollo probe. queryDocument gets an optional operation name, and runMutation returns a rejected call as errors.

Design notes

  • Pre-join read: the pre-flight reads the mode through user_current { meeting { roomMode } }, which the middleware already lets through before joining and which pushes every change, so no new allowlist entry is needed. MEETING_SUBSCRIPTION stays the source once joined (in-room settings, plugins). /api/rest/meetingStaticData can't serve it: nginx caches it for 24h per meeting.
  • Authorization: the middleware sends mutations straight to bbb-graphql-actions; the Hasura role in actions.yaml is not consulted there. A moderator who hasn't joined yet gets true back and Akka drops the command, the same as every moderator action: silently with the default ejectOnViolation=false; with it on, RegisteredUsers.eject flags the registered user and their join then fails with "User had ejected". The applier must call only after the server confirms the join (user_current.joined).
  • Intentionally left out: create-API parameter and the bbb-web copy of the value, recording event, and a client mutation document.

Known limits

MeetingDbModel is at 22 fields, the ceiling of the Scala 2 tupled mapping. The mode lives in a nested roomConfig projection (MeetingRoomConfigDbModel), like bridges and systemColumns, so Phase 2 room settings go into that group without adding fields. The SQL column stays meeting."roomMode".

Two moderators who reach an unconfigured room together race: both read '', both may set a mode, and the last write wins. This is known and deferred: the fix proposed in review (a claim with an expected value and who set it) will come with the code that applies a mode.

How to test

  1. Apply bbb-graphql-server/bbb_schema.sql and the Hasura metadata, then restart akka-bbb-apps, bbb-graphql-actions and bbb-graphql-middleware.
  2. In bigbluebutton-tests/playwright: npx playwright test pre-flight/roomMode.spec.ts --project=chromium --workers=1.

The 7 cases cover: a moderator sets the mode and another client reads it; a client still on the pre-flight reads it (and user_current.joined is false); a viewer is refused (Permission Denied (not moderator)); a moderator still on the pre-flight gets true but nothing changes until they join; a moderator in a breakout room is refused; invalid ids (Class, 33 characters) are refused; the value survives a moderator reload. Without the Apollo probe (allowOverrideClientSettingsOnCreateCall), the cases skip.

Evidence: 7/7, and 21/21 with --repeat-each=3. RED on the unmodified base (field 'roomMode' not found in type: 'meeting'; meetingSetRoomMode: Internal Server Error). html5 and suite eslint/tsc are clean; Akka clean compile is clean.

@AtilaU19
AtilaU19 requested a review from prlanzarin October 19, 2026 17:27
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@germanocaumo germanocaumo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the six layers line up, the moderator check is in both graphql-actions and akka, and the id pattern matches in TS and Scala. I deployed the branch on a dev server and ran pre-flight/roomMode.spec.ts: 4/4, 12/12 with --repeat-each=3, and the whole pre-flight/ folder passes. I also tried the edge cases by hand through the Apollo client; results are in the inline comments.

Before the configuration panel and the code that applies the mode build on this, I'd like to settle two things, plus one question:

  1. Two moderators can both configure the room. The write is unconditional, and the mutation answers true before akka runs. With two joined moderators in a room at '', sending class and meeting back to back returns true twice and leaves meeting, with nothing telling the first one. Two moderators who open the pre-flight together will both read '', both get the panel and both apply a preset.
    Could the command take an optional expected value (say expectedRoomMode), checked in the handler, so the first claim wins? The client would claim with '' first and apply its preset once its own claim shows up. That needs who set it next to the mode, since two moderators picking the same mode would otherwise both see "their" value. If last-writer-wins is fine, let's say so in the description.
    Related: '' is accepted, so any moderator can reopen the gate for everyone who arrives after them. Is clearing needed?

  2. The pre-join read can reuse userCurrentSubscription. The pre-flight already subscribes to user_current { meeting { … } } through useCurrentUser, and both userCurrentSubscription and Patched_userCurrentSubscription are allowlisted. On the dev server, a viewer still on the pre-flight gets roomMode through it, plus a push on every change.
    Adding roomMode to that meeting block (and to the comparator in userComparator.ts) gives one read path that works before and after joining, with no new allowlist entry. As it stands, getRoomMode has no client document, and the client's patched hooks would send Patched_getRoomMode. The middleware drops that before join without an error: I got no answer, for both a query and a subscription.
    The roomMode added to MEETING_SUBSCRIPTION can't be read before join, so it doesn't cover the pre-flight. It's still the right source once joined (the in-room settings, and plugins, whose meeting data comes from useMeeting), so I'd keep it there and add the user_current read for the pre-flight only.

  3. Question: where should the next room-level settings go? MeetingDbModel is now at 22 fields, the Scala 2 tuple limit. That's fine today, and the file already shows the way out (bridges, systemColumns). But if the follow-up settings get a table of their own, roomMode could start it, and room configuration would live in one place.

One correction to the description: "Akka drops the command silently" for a moderator who hasn't joined holds only while ejectOnViolation is off, which is the default. With it on, RegisteredUsers.eject flags the registered user even though they never joined (UsersApp.ejectUserFromMeeting), and their join then fails with "User had ejected". So the code that applies the mode should start from the server's joined state, not from the join call returning.

Comment thread bbb-graphql-middleware/config/Config.go Resolved
@antobinary antobinary added this to the Release 4.1 milestone Oct 20, 2026
AtilaU19 added a commit to AtilaU19/bigbluebutton that referenced this pull request Oct 20, 2026
Address the inline comments of the bigbluebutton#26099 review:

- bbb-graphql-actions: refuse a breakout room up front; akka refuses it
  too, but only after the call has answered true
- akka-bbb-apps: log RoomModeChangedEvtMsg in AnalyticsActor
- playwright: runMutation returns a rejected call as errors, so callers
  get one shape
- playwright: skip, naming the requirement, when the Apollo probe is not
  exposed (allowOverrideClientSettingsOnCreateCall)
- playwright: assert user_current.joined is false on the pre-join read
- playwright: cover the refusals only akka makes (a moderator still on the
  pre-flight, a breakout room) and invalid ids
- playwright: drop the viewer removal from the reload case, which could
  not fail on the room mode
AtilaU19 added a commit to AtilaU19/bigbluebutton that referenced this pull request Oct 20, 2026
Address the inline comments of the bigbluebutton#26099 review:

- bbb-graphql-actions: refuse a breakout room up front; akka refuses it
  too, but only after the call has answered true
- akka-bbb-apps: log RoomModeChangedEvtMsg in AnalyticsActor
- playwright: runMutation returns a rejected call as errors, so callers
  get one shape
- playwright: skip, naming the requirement, when the Apollo probe is not
  exposed (allowOverrideClientSettingsOnCreateCall)
- playwright: assert user_current.joined is false on the pre-join read
- playwright: cover the refusals only akka makes (a moderator still on the
  pre-flight, a breakout room) and invalid ids
- playwright: drop the viewer removal from the reload case, which could
  not fail on the room mode
@AtilaU19
AtilaU19 requested a review from germanocaumo October 20, 2026 18:25
@AtilaU19

Copy link
Copy Markdown
Contributor Author

@germanocaumo, on the question in your first review, whether clearing the mode ('') is needed: it isn't. No client path sends it, and the in-session change (#2850) switches between modes, never back to none. As you pointed out, accepting it let any moderator reopen the panel for everyone arriving after them, so 6331d67632 refuses it in both bbb-graphql-actions and akka. Empty stays the column's default only. The invalid-mode case now also sends ''; roomMode.spec.ts passes 8/8 locally.

I also updated the description: the pattern no longer allows empty, and the authorization note now includes your ejectOnViolation correction.

@github-actions

Copy link
Copy Markdown

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

Carry a room-level mode id on the meeting (empty means not configured),
readable by every client, including those still on the pre-flight, and
writable by a moderator through meetingSetRoomMode.

- bbb-common-message: SetRoomModeCmdMsg and RoomModeChangedEvtMsg
- akka-bbb-apps: MeetingStatus2x mirror, handler (moderator only, not
  in breakout rooms), MeetingDAO column and update, event broadcast
- bbb-graphql-server: meeting."roomMode" column, exposed to bbb_client
  and bbb_client_not_in_meeting, and the meetingSetRoomMode action
- bbb-graphql-actions: meetingSetRoomMode handler (moderator only, id
  validated as ^([a-z][a-z0-9-]{0,31})?$)
- bbb-graphql-middleware: allow the getRoomMode operation for users who
  have not joined yet
- bigbluebutton-html5: read roomMode in the meeting subscription
- tests: pre-flight/roomMode.spec.ts
Address the inline comments of the bigbluebutton#26099 review:

- bbb-graphql-actions: refuse a breakout room up front; akka refuses it
  too, but only after the call has answered true
- akka-bbb-apps: log RoomModeChangedEvtMsg in AnalyticsActor
- playwright: runMutation returns a rejected call as errors, so callers
  get one shape
- playwright: skip, naming the requirement, when the Apollo probe is not
  exposed (allowOverrideClientSettingsOnCreateCall)
- playwright: assert user_current.joined is false on the pre-join read
- playwright: cover the refusals only akka makes (a moderator still on the
  pre-flight, a breakout room) and invalid ids
- playwright: drop the viewer removal from the reload case, which could
  not fail on the room mode
feat(pre-flight): add room mode state on the meeting

Carry a room-level mode id on the meeting (empty means not configured),
readable by every client, including those still on the pre-flight, and
writable by a moderator through meetingSetRoomMode.

- bbb-common-message: SetRoomModeCmdMsg and RoomModeChangedEvtMsg
- akka-bbb-apps: MeetingStatus2x mirror, handler (moderator only, not
  in breakout rooms), MeetingDAO column and update, event broadcast
- bbb-graphql-server: meeting."roomMode" column, exposed to bbb_client
  and bbb_client_not_in_meeting, and the meetingSetRoomMode action
- bbb-graphql-actions: meetingSetRoomMode handler (moderator only, id
  validated as ^([a-z][a-z0-9-]{0,31})?$)
- bigbluebutton-html5: read roomMode in the meeting subscription and in
  userCurrentSubscription (user_current.meeting), which users who have
  not joined yet already receive
- tests: pre-flight/roomMode.spec.ts
Refuse an empty room mode, in bbb-graphql-actions and in akka. Empty is
only the column's default: accepting it let any moderator reopen the
pre-flight panel for everyone arriving after them, and no client path
needs to clear the mode. The invalid-mode case now also sends ''.
Follow the probe's switch upstream from the raw create module (APOLLO_CLIENT_SETTINGS_MODULE) to APOLLO_CLIENT_SETTINGS_OVERRIDE through createClientSettingsOverride.
Sort the breakout create import as simple-import-sort expects (playwright-code-validation).
@github-actions

Copy link
Copy Markdown

🚨 Automated tests failed

This branch has not been deployed

No deployments
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.

3 participants