Skip to content

fix: resolve regressions across media and signaling#66

Merged
aniebietafia merged 2 commits into
mainfrom
fixes/production_bugs
May 10, 2026
Merged

fix: resolve regressions across media and signaling#66
aniebietafia merged 2 commits into
mainfrom
fixes/production_bugs

Conversation

@aniebietafia
Copy link
Copy Markdown
Contributor

@aniebietafia aniebietafia commented May 10, 2026

  • focusing on media pipeline reliability
  • WebRTC renegotiation, and
  • robust state transitions between the lobby and meeting room.

Summary by CodeRabbit

New Features

  • Participants now receive notifications when new users join a meeting, including the joining user's display name and guest role status.
  • Display names are now properly loaded when users are admitted from the lobby.

Tests

  • Updated test cases for user admission from lobby scenarios.

Review Change Stack

- focusing on media pipeline reliability
- WebRTC renegotiation, and
- robust state transitions between the lobby and meeting room.

Signed-off-by: aniebietafia <aniebietafia87@gmail.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 10, 2026

Warning

Rate limit exceeded

@aniebietafia has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 55 minutes and 23 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2b615cb0-6fed-45eb-8017-7fd3ecafed5b

📥 Commits

Reviewing files that changed from the base of the PR and between 997432c and c0a312b.

📒 Files selected for processing (1)
  • app/modules/meeting/service.py
📝 Walkthrough

Walkthrough

When a host admits a user from the lobby, the service now retrieves the lobby entry to extract the user's display_name, persists it alongside a default guest role in participant state, and broadcasts a user_joined event to all existing room participants to notify them of the admission.

Changes

User Admission and Join Broadcast

Layer / File(s) Summary
Participant State with Display Name and Role
app/modules/meeting/state.py
MeetingStateService.admit_from_lobby reads display_name from lobby entry and sets default role to "guest" when constructing admitted participant state.
Service-Level Admission and Broadcast
app/modules/meeting/service.py
MeetingService.admit_user fetches target user's display_name from lobby before admission, then broadcasts a user_joined event to all existing participants (excluding the admitted user) with user_id, display_name, and guest role.
Test Mocks for Lobby State
tests/meeting/test_meeting_service.py
Test setup now explicitly mocks state.get_lobby to return a lobby entry with display_name and language for the success case, and an empty dict for the not-in-lobby error case.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant MeetingService
  participant MeetingStateService
  participant ConnectionManager
  participant ExistingParticipants

  Client->>MeetingService: admit_user(host_id, target_user_id)
  MeetingService->>MeetingStateService: get_lobby()
  MeetingStateService-->>MeetingService: lobby_state with display_name
  MeetingService->>MeetingStateService: admit_from_lobby(target_user_id)
  MeetingStateService->>MeetingStateService: read display_name, set role=guest
  MeetingService->>ConnectionManager: broadcast user_joined
  ConnectionManager->>ExistingParticipants: user_joined(user_id, display_name, role)
  MeetingService-->>Client: admission_success
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • Brints/spoken-api#65: Modifies MeetingService.admit_user and related admission notification behavior alongside participant state handling.

Suggested labels

backend, tests, size/S

Poem

🐰 A user steps forth from the lobby gate,
Display name gleaming, role set to wait,
Join broadcast rings to all in the room,
Welcome and presence dispel the gloom!
Guest arrives with a celebratory zoom! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title claims to address 'media and signaling' regressions, but the changeset only modifies meeting service and state management code to add display_name handling and user_joined event broadcasting during lobby admission. Revise the title to accurately reflect the actual changes, such as 'fix: broadcast user_joined event and include display_name on lobby admission' or similar.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fixes/production_bugs

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

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/meeting/test_meeting_service.py (1)

561-575: ⚡ Quick win

Assert the new signaling side effects in the happy-path admit test.

This test now seeds lobby metadata, but it still doesn’t verify the new send_to_user/broadcast_to_room contract that this PR introduces.

✅ Suggested assertion additions
-    async def test_host_admits_user_from_lobby(self) -> None:
+    async def test_host_admits_user_from_lobby(self, mock_cm: MagicMock) -> None:
         svc, repo, state = _build_service()
         host = _make_user()
         room = _make_room(host_id=host.id)
@@
         await svc.admit_user(host=host, room_code="ABCDEF123456", target_user_id="u99")
 
+        state.get_lobby.assert_awaited_once_with("ABCDEF123456")
         state.admit_from_lobby.assert_awaited_once_with("ABCDEF123456", "u99")
+        mock_cm.send_to_user.assert_awaited_once_with(
+            "ABCDEF123456", "u99", {"type": "admitted", "room_code": "ABCDEF123456"}
+        )
+        mock_cm.broadcast_to_room.assert_awaited_once_with(
+            "ABCDEF123456",
+            {
+                "type": "user_joined",
+                "user_id": "u99",
+                "display_name": "Guest Bob",
+                "role": "guest",
+            },
+            sender_id="u99",
+        )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/meeting/test_meeting_service.py` around lines 561 - 575, The
test_host_admits_user_from_lobby happy-path test seeds lobby metadata but
doesn't assert the new signaling side effects; after calling svc.admit_user, add
assertions that svc.signaling.send_to_user was awaited with the admitted user's
id (target_user_id/"u99") and the expected payload, and that
svc.signaling.broadcast_to_room was awaited with the room code ("ABCDEF123456")
and the expected room-level broadcast payload; reference the test function
test_host_admits_user_from_lobby, the service method svc.admit_user, and the
mock methods svc.signaling.send_to_user and svc.signaling.broadcast_to_room when
adding these assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/modules/meeting/service.py`:
- Line 502: Two comments exceed the 88-character line limit and are causing Ruff
E501 failures; locate the comment string "# Fetch display_name BEFORE
admit_from_lobby removes the entry from the lobby hash." and the other long line
around the same area (near line 526) in app/modules/meeting/service.py and
reflow them to be under 88 characters by splitting into two shorter comment
lines or shortening wording (e.g., "# Fetch display_name BEFORE
admit_from_lobby" on one line and "# removes the entry from the lobby hash." on
the next), ensuring no code semantics change and keeping the original meaning.

---

Nitpick comments:
In `@tests/meeting/test_meeting_service.py`:
- Around line 561-575: The test_host_admits_user_from_lobby happy-path test
seeds lobby metadata but doesn't assert the new signaling side effects; after
calling svc.admit_user, add assertions that svc.signaling.send_to_user was
awaited with the admitted user's id (target_user_id/"u99") and the expected
payload, and that svc.signaling.broadcast_to_room was awaited with the room code
("ABCDEF123456") and the expected room-level broadcast payload; reference the
test function test_host_admits_user_from_lobby, the service method
svc.admit_user, and the mock methods svc.signaling.send_to_user and
svc.signaling.broadcast_to_room when adding these assertions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 183a921f-d969-46a7-8f05-6388972ef94c

📥 Commits

Reviewing files that changed from the base of the PR and between d1128ca and 997432c.

📒 Files selected for processing (3)
  • app/modules/meeting/service.py
  • app/modules/meeting/state.py
  • tests/meeting/test_meeting_service.py

Comment thread app/modules/meeting/service.py Outdated
Signed-off-by: aniebietafia <aniebietafia87@gmail.com>
@aniebietafia aniebietafia merged commit a0e4c54 into main May 10, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant