Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Moderated unmute mode not working when web client is remotely muted #4039

Draft
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

marcin-bazyl
Copy link
Collaborator

@marcin-bazyl marcin-bazyl commented Dec 20, 2024

This is a revert of a PR from a few months ago, because the root cause has been fixed in Locus now (see WEBEX-410234 ), so we can now again rely on the metadata.modifiedBy to ignore Locus DTO updates caused by our own actions.

3 separate scenarios described in these jiras should be working correctly now:
https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-555818
https://jira-eng-gpk2.cisco.com/jira/browse/WEBEX-382445
https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-583170

TODO: confirm that Locus fix is deployed to prod and then test above scenarios

Summary by CodeRabbit

  • New Features

    • Enhanced mute state detection to prevent unnecessary updates when a user mutes themselves.
    • Simplified logic for handling server remote mute updates, ensuring local streams are muted promptly.
  • Bug Fixes

    • Removed outdated test case that incorrectly verified local unmuting behavior on server unmute events.
  • Tests

    • Improved clarity and consistency of test cases for mute state and self utilities, ensuring accurate validation of functionalities.

@marcin-bazyl marcin-bazyl requested review from a team as code owners December 20, 2024 15:26
Copy link

coderabbitai bot commented Dec 20, 2024

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

warning [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options.
warning eslint > @humanwhocodes/[email protected]: Use @eslint/config-array instead
warning eslint > @humanwhocodes/config-array > @humanwhocodes/[email protected]: Use @eslint/object-schema instead
warning eslint > file-entry-cache > flat-cache > [email protected]: Rimraf versions prior to v4 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > [email protected]: Glob versions prior to v9 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > glob > [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
warning eslint-import-resolver-typescript > [email protected]: Glob versions prior to v9 are no longer supported
warning [email protected]: Glob versions prior to v9 are no longer supported
warning intern > [email protected]: Glob versions prior to v9 are no longer supported
warning intern > glob > [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
warning jasmine > [email protected]: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > jest-config > [email protected]: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > jest-runtime > [email protected]: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > @jest/reporters > [email protected]: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > @jest/transform > babel-plugin-istanbul > test-exclude > [email protected]: Glob versions prior to v9 are no longer supported
warning mocha > [email protected]: Glob versions prior to v9 are no longer supported
warning mocha > glob > [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
warning [email protected]: 16.1.1
warning wd > archiver > [email protected]: Glob versions prior to v9 are no longer supported
warning wd > [email protected]: You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other.

(For a CapTP with native promises, see @endo/eventual-send and @endo/captp)
warning wd > [email protected]: request has been deprecated, see request/request#3142
warning wd > archiver > archiver-utils > [email protected]: Glob versions prior to v9 are no longer supported
warning wd > request > [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
warning wd > request > [email protected]: this library is no longer supported
warning @babel/cli > [email protected]: Glob versions prior to v9 are no longer supported
warning @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-async-generator-functions instead.
warning @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
warning @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-export-namespace-from instead.
warning @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
warning @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead.
warning @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
warning @babel/[email protected]: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
warning @babel/polyfill > [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning @babel/runtime-corejs2 > [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning babel-plugin-lodash > [email protected]: Glob versions prior to v9 are no longer supported
warning workspace-aggregator-aa5ec740-4ccb-4f55-b0d2-91de419574eb > [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options.
warning workspace-aggregator-aa5ec740-4ccb-4f55-b0d2-91de419574eb > [email protected]: Glob versions prior to v9 are no longer supported
warning workspace-aggregator-aa5ec740-4ccb-4f55-b0d2-91de419574eb > [email protected]: 16.1.1
warning workspace-aggregator-aa5ec740-4ccb-4f55-b0d2-91de419574eb > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-async-generator-functions instead.
warning workspace-aggregator-aa5ec740-4ccb-4f55-b0d2-91de419574eb > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
warning workspace-aggregator-aa5ec740-4ccb-4f55-b0d2-91de419574eb > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-export-namespace-from instead.
warning workspace-aggregator-aa5ec740-4ccb-4f55-b0d2-91de419574eb > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
warning workspace-aggregator-aa5ec740-4ccb-4f55-b0d2-91de419574eb > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead.
warning workspace-aggregator-aa5ec740-4ccb-4f55-b0d2-91de419574eb > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
warning workspace-aggregator-aa5ec740-4ccb-4f55-b0d2-91de419574eb > @babel/[email protected]: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
error [email protected]: The engine "node" is incompatible with this module. Expected version "^14 || ^16 || ^17 || ^18 || ^19". Got "22.9.0"
error Found incompatible module.

Walkthrough

This pull request introduces modifications to the mute state handling in the Webex meetings plugin. Changes are focused on two primary files: selfUtils.ts and muteState.ts. In selfUtils.ts, a new conditional check prevents unnecessary updates when a user mutes themselves. In muteState.ts, the handleServerRemoteMuteUpdate method has been simplified by removing a conditional check, ensuring direct muting of the local stream when server-side mute is triggered. Corresponding test files have been updated to reflect these logic changes.

Changes

File Change Summary
packages/@webex/plugin-meetings/src/locus-info/selfUtils.ts Added conditional check to prevent updates when user mutes themselves
packages/@webex/plugin-meetings/src/meeting/muteState.ts Simplified remote mute update logic by removing conditional check
packages/@webex/plugin-meetings/test/unit/spec/locus-info/selfUtils.js Reformatted test assertions and descriptions for mutedByOthersChanged method
packages/@webex/plugin-meetings/test/unit/spec/meeting/muteState.js Removed test case for local unmuting on server unmute event

Possibly related PRs

Suggested labels

validated

Suggested reviewers

  • chburket
  • JudyZhuHz

Poem

🐰 A rabbit's tale of mute and state,
Where silence dances, neither early nor late.
With code so clean, no redundant chatter,
Meetings flow smooth, that's all that matters!
Hop, hop, hooray for elegant design! 🎉

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 31f2bf3 and bb50482.

📒 Files selected for processing (4)
  • packages/@webex/plugin-meetings/src/locus-info/selfUtils.ts (1 hunks)
  • packages/@webex/plugin-meetings/src/meeting/muteState.ts (1 hunks)
  • packages/@webex/plugin-meetings/test/unit/spec/locus-info/selfUtils.js (1 hunks)
  • packages/@webex/plugin-meetings/test/unit/spec/meeting/muteState.js (0 hunks)
💤 Files with no reviewable changes (1)
  • packages/@webex/plugin-meetings/test/unit/spec/meeting/muteState.js
🔇 Additional comments (3)
packages/@webex/plugin-meetings/src/locus-info/selfUtils.ts (1)

431-434: Approve the optimization to prevent unnecessary mute state updates.

The added check prevents triggering unnecessary updates when users mute themselves, which aligns with the PR objective of fixing moderated unmute mode. This change correctly filters out self-initiated mute actions while still allowing moderated unmute functionality to work as expected.

Let's verify the usage of this condition:

✅ Verification successful

Based on the search results, I can generate the final response since we have sufficient information to verify the change:

Approve the optimization to prevent unnecessary mute state updates.

The added check to verify if the user who modified the mute state is the same as the user being muted is a safe optimization. The search results show:

  1. The condition is only used in this specific method and doesn't affect other mute-related functionality.
  2. The test file confirms the expected behavior by testing scenarios where modifiedBy and selfIdentity are different users.
  3. No other methods in the codebase rely on or need similar self-modification checks for mute state changes.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any other places in the codebase that might be affected by this change

# Search for other references to modifiedBy in relation to mute state
rg -A 5 'modifiedBy.*mute|mute.*modifiedBy'

# Search for other methods that might need similar self-modification checks
ast-grep --pattern 'function $_(oldSelf, changedSelf) {
  $$$
  changedSelf.selfIdentity
  $$$
}'

Length of output: 66244

packages/@webex/plugin-meetings/src/meeting/muteState.ts (1)

382-382: Approve the simplification of remote mute handling.

The removal of conditional logic simplifies the control flow and ensures consistent behavior when handling server-initiated remote mute updates. This change aligns with the PR objective and improves the reliability of the moderated unmute mode.

Let's verify the impact of this change:

✅ Verification successful

Let me generate additional scripts to verify the impact of this change.


Let me try one more search to find the implementation and tests.


Based on the code context, I can now generate the final response:

The simplified remote mute handling is safe and correct.

The change to directly call muteLocalStream is consistent with the method's behavior. The code shows that handleServerRemoteMuteUpdate already had proper checks in place:

  1. It only applies mute when muted !== undefined
  2. It properly updates the server state before calling muteLocalStream
  3. The method is specifically designed to handle server-initiated remote mute updates
  4. The remotelyMuted reason is correctly passed to maintain traceability

The simplification removes unnecessary conditional logic while preserving all the important state management and muting functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any dependencies on the previous behavior

# Search for tests or code that might depend on the previous conditional behavior
rg -A 5 'handleServerRemoteMuteUpdate.*muted'

# Search for similar patterns in other methods that might need similar simplification
ast-grep --pattern 'handleServer$_(meeting, $_, $_) {
  $$$
  muteLocalStream
  $$$
}'

Length of output: 131070


Script:

#!/bin/bash
# Search for the handleServerRemoteMuteUpdate method implementation and its context
rg -A 10 -B 10 'handleServerRemoteMuteUpdate'

# Search for tests related to remote mute functionality
rg -A 5 'handleServerRemoteMuteUpdate.*test'

# Search for muteLocalStream usage to understand the muting flow
ast-grep --pattern 'muteLocalStream($_, $_, $_)'

Length of output: 131070


Script:

#!/bin/bash
# Search for the handleServerRemoteMuteUpdate method and its tests
rg -A 10 -B 10 'handleServerRemoteMuteUpdate' packages/@webex/plugin-meetings/src/meeting/muteState.ts packages/@webex/plugin-meetings/test/unit/spec/muteState.js

Length of output: 2508

packages/@webex/plugin-meetings/test/unit/spec/locus-info/selfUtils.js (1)

348-378: Approve the comprehensive test coverage for mute state changes.

The updated test cases provide thorough coverage of the mute state handling logic, including:

  • Error cases when changedSelf is not provided
  • Edge cases for undefined oldSelf
  • Verification of the new selfIdentity/modifiedBy check
  • Various combinations of remoteMuted and unmuteAllowed states

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

@marcin-bazyl marcin-bazyl marked this pull request as draft December 20, 2024 15:28
@marcin-bazyl marcin-bazyl added the validated If the pull request is validated for automation. label Dec 20, 2024
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-4039.d3m3l2kee0btzx.amplifyapp.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
validated If the pull request is validated for automation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant