Skip to content

fix(bbb-web): fix plugins not loading nor running into breakout-rooms - #21525

Merged
antobinary merged 2 commits into
bigbluebutton:v3.0.x-releasefrom
GuiLeme:fix-breakouts-plugin
Oct 25, 2024
Merged

antobinary merged 2 commits into
bigbluebutton:v3.0.x-releasefrom
GuiLeme:fix-breakouts-plugin

Conversation

@GuiLeme

@GuiLeme GuiLeme commented Oct 24, 2024

Copy link
Copy Markdown
Contributor

What does this PR do?

It fixes plugins not running into breakout-rooms, so now, the same plugins that run on the main-room are going to also run into the breakouts.

Closes Issue(s)

Closes bigbluebutton/bigbluebutton-html-plugin-sdk#127

Motivation

There are some required plugins that will run into breakouts, so this must have been sorted out.

How to test

Really simple:

  • Load a plugin into your BBB session (via create parameter or .properties bbb-web configuration)
  • See if it runs in the main room;
  • Create a breakout-room;
  • See if it runs into the breakout you just created.

More

Demo of the newly fixed behaviour:

demo-plugin-running-on-breakouts.mp4

For this Demo, and for the tests, I used SampleActionButtonDropdownPlugin already in the manifest structure. But it's possible to test it with the pick-random-user-plugin as well (this last one has the manifest structure already)

@coderabbitai

coderabbitai Bot commented Oct 24, 2024 •

Copy link
Copy Markdown
Contributor

Walkthrough

The pull request introduces several modifications across multiple files related to the handling of breakout rooms and associated plugin properties within the BigBlueButton application. Key changes include the addition of a pluginProp parameter to the CreateBreakoutRoomsCmdMsgHdlr trait, which allows for the passing of plugin properties during breakout room creation. The BreakoutRoomDetail class has been updated to include a new field for pluginProp, enhancing its capability to manage plugin-related data. The MeetingService class sees the introduction of two overloaded createMeeting methods, allowing for more flexible handling of plugins depending on whether the meeting is a breakout room or not. Additionally, the ParamsProcessorUtil class now conditionally processes plugin manifests based on the isBreakout flag. Overall, these changes aim to improve the functionality and handling of plugins in breakout rooms, ensuring that they operate similarly to their parent meetings.

Assessment against linked issues

Objective Addressed Explanation
Plugins in breakouts do not work (#127) ✅
Expected behavior for plugins in breakouts ✅

Possibly related PRs

Suggested reviewers

  • gustavotrott
  • antobinary

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@GuiLeme
GuiLeme requested a review from gustavotrott October 24, 2024 16:44

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (4)
bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/CreateBreakoutRoom.java (1)

28-28: Add JavaDoc for the pluginProp field

Consider adding documentation to explain the purpose and expected content of the pluginProp field, similar to other fields in the class.

+    /**
+     * Properties for plugins that should be enabled in the breakout room.
+     * Inherited from the parent meeting's plugin configuration.
+     */
     public final Map<String, Object> pluginProp;
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/CreateBreakoutRoomsCmdMsgHdlr.scala (2)

102-102: Consider adding logging for plugin propagation.

To aid in debugging and monitoring, consider adding debug logs when plugin properties are propagated to breakout rooms.

+        log.debug(s"Propagating plugins to breakout room ${breakout.id}")
         pluginProp = liveMeeting.props.pluginProp,

102-102: Consider adding documentation about plugin behavior.

To improve maintainability, consider adding code comments explaining:

  • Which plugins are propagated to breakout rooms
  • How plugins behave in breakout rooms vs main room
  • Any limitations or special considerations
+        // Propagate all plugins from parent meeting to breakout room
+        // This ensures consistent plugin functionality across main and breakout rooms
         pluginProp = liveMeeting.props.pluginProp,
bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/OldMeetingMsgHdlrActor.scala (1)

129-131: Consider adding error handling for plugin properties.

The current implementation directly passes the plugin properties without validation. Consider adding error handling to gracefully handle cases where plugin properties are malformed or incompatible with breakout rooms.

Example improvement:

-      msg.body.room.pluginProp,
+      Option(msg.body.room.pluginProp).getOrElse(Map.empty[String, Object]),
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 67dac35 and dd34630.

📒 Files selected for processing (6)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/CreateBreakoutRoomsCmdMsgHdlr.scala (1 hunks)
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/BreakoutMsgs.scala (2 hunks)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java (2 hunks)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java (1 hunks)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/CreateBreakoutRoom.java (4 hunks)
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/OldMeetingMsgHdlrActor.scala (1 hunks)
🔇 Additional comments (9)
bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/CreateBreakoutRoom.java (2)

3-4: LGTM: Import addition is appropriate

The added Map import is necessary for the new plugin properties functionality.


Line range hint 28-71: Verify integration with plugin manifest processing

The changes look good for enabling plugin support in breakout rooms. Let's verify the integration points to ensure proper handling of plugin properties.

✅ Verification successful

Based on the results, I can now generate a final response as we have sufficient information about the integration points.

Plugin properties are properly integrated in the breakout room creation flow

The verification shows a complete chain of plugin property handling:

  • pluginProp is correctly passed from parent meeting to breakout rooms in CreateBreakoutRoomsCmdMsgHdlr.scala
  • The property is properly propagated through the message system (BreakoutMsgs.scala, Meeting2x.scala)
  • MeetingService.java handles the creation with plugin properties
  • RunningMeeting.scala processes the plugin properties using PluginModel.createPluginModelFromJson
  • Plugin data persistence is handled in MeetingDAO.scala
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration between CreateBreakoutRoom and plugin manifest processing

# Test 1: Check for plugin manifest processing logic
echo "Checking for plugin manifest processing..."
rg -l "manifest\.json.*plugin" 

# Test 2: Check for other uses of pluginProp
echo "Checking for pluginProp usage..."
rg "pluginProp"

# Test 3: Check for breakout room creation handling
echo "Checking breakout room creation handling..."
ast-grep --pattern 'createBreakoutRoom($$$)'

Length of output: 3520

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/CreateBreakoutRoomsCmdMsgHdlr.scala (2)

102-102: LGTM! The plugin property propagation looks correct.

The addition of pluginProp from the parent meeting to the breakout room details effectively addresses the core issue of plugins not working in breakout rooms.


102-102: Verify plugin property handling.

Let's verify that plugin properties are properly handled throughout the breakout room lifecycle.

bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/BreakoutMsgs.scala (2)

3-4: LGTM!

The import statement is correctly placed and necessary for the new pluginProp field type.


61-61: Verify serialization handling and document the new field.

The new pluginProp field enables plugin support in breakout rooms, which aligns with the PR objectives. However, please address the following:

  1. Document the purpose and expected content structure of the pluginProp field
  2. Ensure proper serialization/deserialization handling for the new field

Run this script to verify serialization handling:

✅ Verification successful

Let me gather more information about the serialization handling by checking the actual implementation details.


Let me check one more aspect to understand how Scala case classes are serialized in this project.


Let me check the actual serialization implementation in the project.


Based on the gathered information, I can now provide the final response:

The pluginProp field is properly handled by the existing serialization framework

The codebase uses Jackson for JSON serialization/deserialization with proper Scala support through DefaultScalaModule. The util.Map[String, AnyRef] type is natively supported by Jackson, and the project's JsonUtil class is configured to handle null values and unknown properties appropriately. Since BreakoutRoomDetail is a case class, it automatically gets proper serialization support.

Key findings:

  • The project uses Jackson with Scala support (DefaultScalaModule)
  • Case classes are automatically handled by the serialization framework
  • util.Map[String, AnyRef] is a standard type that Jackson handles correctly
  • The serialization configuration in JsonUtil is properly set up with DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES

However, documentation of the field's purpose and structure is still needed in the code comments.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for JSON serialization/deserialization code that needs to be updated

# Look for JSON serialization/deserialization code
rg -l "(?i)(json|jackson|gson|serializ|deserializ).*BreakoutRoomDetail"

# Look for any migration scripts or database schema updates
rg -l "(?i)(migration|schema|upgrade|database).*BreakoutRoom"

Length of output: 295


Script:

#!/bin/bash
# Check the implementation of BreakoutRoomDetail and related classes
ast-grep --pattern 'case class BreakoutRoomDetail'

# Look for any JSON conversion/handling related to BreakoutRoom messages
rg -A 5 -B 5 "BreakoutRoomDetail.*(?i)(json|convert|serial|deserial)"

# Check if there are any existing plugin property handling in the codebase
rg -A 3 "pluginProp.*Map\[String, AnyRef\]"

Length of output: 3902


Script:

#!/bin/bash
# Check for message serialization patterns in the project
rg -A 5 "trait BbbCoreMsg" 

# Look for any existing serialization utilities or message converters
rg -l "(?i)(json|convert|serialize).*Message" --type scala

# Check for any documentation about message handling
fd README -e md | xargs rg -l "(?i)(message|serialization)"

Length of output: 3338


Script:

#!/bin/bash
# Check the JsonUtil and Deserializer implementations
cat bbb-common-message/src/main/scala/org/bigbluebutton/common2/util/JsonUtil.scala
cat bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/Deserializer.scala

# Look for existing test cases
cat bbb-common-message/src/test/scala/org/bigbluebutton/common2/messages/DeserializerTests.scala

Length of output: 8118

bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/OldMeetingMsgHdlrActor.scala (1)

130-130: LGTM! Verify plugin property propagation.

The addition of pluginProp to the CreateBreakoutRoom message aligns with the PR objective of enabling plugin functionality in breakout rooms.

Let's verify the plugin property propagation chain:

✅ Verification successful

Let me try a different search strategy to verify the plugin property propagation.


Based on the search results, I can now verify the plugin property propagation chain. Let me generate the final response.

Plugin property propagation is correctly implemented

The code shows a complete chain of plugin property propagation from parent meeting to breakout rooms:

  1. pluginProp is properly passed through CreateBreakoutRoom message in Java and Scala classes
  2. The property is handled in multiple layers:
    • OldMeetingMsgHdlrActor.scala passes it in the message
    • MeetingService.java propagates it during breakout room creation
    • CreateBreakoutRoomsCmdMsgHdlr.scala copies it from parent meeting via liveMeeting.props.pluginProp
    • RunningMeeting.scala initializes plugins using PluginModel.createPluginModelFromJson(props.pluginProp)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the complete chain of plugin property propagation
# from parent meeting to breakout rooms.

# Check CreateBreakoutRoom message handling
rg -A 5 "CreateBreakoutRoom.*pluginProp"

# Check BreakoutRoomDetail construction
rg -A 5 "BreakoutRoomDetail.*pluginProp"

# Check if there are any plugin manifest processors
rg -A 5 "processPluginManifests.*isBreakout"

Length of output: 132


Script:

#!/bin/bash
# Let's search for plugin-related code patterns more broadly

# Search for plugin property handling in breakout context
rg -l "plugin.*breakout" --type scala

# Search for CreateBreakoutRoom class/case class definition
ast-grep --pattern 'case class CreateBreakoutRoom'

# Search for BreakoutRoom related structures that might handle plugins
rg -A 10 "case class .*Breakout.*Room"

# Search for plugin manifest or property handling
rg -A 5 "pluginProp"

Length of output: 37026

bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java (2)

467-469: Good use of method overloading for createMeeting method

The introduction of an overloaded createMeeting method that accepts plugins enhances flexibility and maintains backward compatibility by defaulting the plugins parameter to null.

Also applies to: 470-473


825-825: Verify message.pluginProp initialization before passing to createMeeting

Ensure that message.pluginProp is properly initialized before passing it to createMeeting(breakout, message.pluginProp), to prevent potential NullPointerExceptions or unexpected behavior if pluginProp is null.

@antobinary antobinary added this to the Release 3.0 milestone Oct 24, 2024

@gustavotrott gustavotrott 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.

It's working properly, good work!

I left only a small suggestion to make the code simpler.

@GuiLeme
GuiLeme requested a review from gustavotrott October 24, 2024 19:20
@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java (2)

467-467: LGTM! Consider adding rate limiting for URL fetching.

The implementation is robust with proper error handling, checksum validation, and metadata processing. However, since it makes HTTP requests to fetch plugin manifests, consider adding rate limiting to prevent potential DoS vectors.

Consider:

  1. Adding a connection timeout
  2. Implementing retry with backoff
  3. Adding rate limiting per meeting/session

Line range hint 467-492: Initialize plugins map to prevent NPE in breakout rooms.

When creating a breakout room meeting and plugins is null, pluginsMap becomes null which could cause a NullPointerException when passed to m.setPlugins().

Apply this fix:

 Map<String, Object> pluginsMap;
 if (m.isBreakout()) {
-    pluginsMap = plugins;
+    pluginsMap = (plugins != null) ? plugins : new HashMap<>();
 } else {
     pluginsMap = requestPluginManifests(m);
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between dd34630 and 5dc295d.

📒 Files selected for processing (1)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java (2 hunks)
🔇 Additional comments (2)
bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java (2)

823-823: LGTM! Properly passes plugin properties to breakout rooms.

The change correctly implements the PR objective by passing plugin properties to breakout rooms during creation, enabling plugins to function in breakout rooms as intended.


Line range hint 467-823: Verify plugin-related method consistency.

Let's verify that all plugin-related method calls and configurations are consistent across the codebase.

✅ Verification successful

Based on the gathered information, I can now provide the final response:

Plugin handling is correctly implemented and consistent across the codebase

The verification shows that:

  • The Meeting class properly maintains plugin state with private Map<String, Object> plugins and private ArrayList<PluginManifest> pluginManifests
  • Plugin handling for breakout rooms is correctly implemented, with breakout rooms using parent meeting's plugins (pluginsMap = plugins) while regular meetings fetch manifests (pluginsMap = requestPluginManifests(m))
  • The plugin manifest system is properly encapsulated in the PluginManifest class
  • All plugin-related method calls are consistent with no conflicting implementations
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for plugin-related method calls and configurations

# Test 1: Check for plugin method calls
echo "Checking plugin method calls..."
rg -A 2 "setPlugins|getPlugins|requestPluginManifests"

# Test 2: Check for plugin configurations in manifest files
echo "Checking plugin configurations..."
fd -e json -e xml "manifest" --exec grep -l "plugin"

# Test 3: Check for breakout room plugin handling
echo "Checking breakout room plugin handling..."
rg -A 5 "isBreakout.*plugin|createBreakoutRoom.*plugin"

Length of output: 18149


Script:

#!/bin/bash
# Let's verify the plugin handling in the Meeting class and related components

# Check for plugin-related method implementations
echo "=== Checking plugin method implementations ==="
ast-grep --pattern 'class Meeting {
  $$$
  setPlugins($$$) {
    $$$
  }
  $$$
}'

# Check for breakout room plugin handling in MeetingService
echo "=== Checking breakout room plugin handling in MeetingService ==="
rg -B 5 -A 2 "createMeeting.*plugins.*breakout|isBreakout.*plugins" bbb-common-web/

# Check for plugin manifest handling
echo "=== Checking plugin manifest handling ==="
rg -B 2 -A 5 "requestPluginManifests" bbb-common-web/

# Check for plugin-related configurations
echo "=== Checking plugin configurations ==="
fd "application.conf|application.properties" --exec grep -l "plugin"

Length of output: 2388


Script:

#!/bin/bash
# Let's verify the complete plugin handling flow

# Check Meeting class plugin-related fields and methods
echo "=== Checking Meeting class plugin handling ==="
rg -B 2 -A 2 "private.*plugins|getPlugins|setPlugins|pluginManifests" bbb-common-web/src/main/java/org/bigbluebutton/api/domain/Meeting.java

# Check CreateMeeting message handling
echo "=== Checking CreateMeeting message handling ==="
rg -B 5 -A 5 "class CreateMeeting|handle.*CreateMeeting" bbb-common-web/src/main/java/org/bigbluebutton/api/

# Check plugin manifest related code
echo "=== Checking plugin manifest related code ==="
rg -B 2 -A 2 "class.*PluginManifest|implements.*PluginManifest" bbb-common-web/

# Check breakout room creation with plugins
echo "=== Checking breakout room creation with plugins ==="
rg -B 3 -A 3 "createBreakoutRoom.*plugin|processCreateBreakoutRoom.*plugin" bbb-common-web/

Length of output: 9807

@gustavotrott gustavotrott 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.

LGTM! Well done!

@github-actions

Copy link
Copy Markdown

Automated tests Summary

✅ All the CI tests have passed!

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.

Plugins in breakouts do not work

3 participants