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

feat(webinar): spark-623318 return correct info when not reach JBH #4126

Open
wants to merge 4 commits into
base: next
Choose a base branch
from

Conversation

JudyZhuHz
Copy link
Contributor

…ng since not reach JBH

COMPLETES #< INSERT LINK TO ISSUE >

https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-623318

This pull request addresses

< DESCRIBE THE CONTEXT OF THE ISSUE >
Return failure reason as JOIN_ERROR_REASN_FOR_END_USER when meet 403003(not reach JBH time) error

by making the following changes

< DESCRIBE YOUR CHANGES >
Add new failed reason for 403 error.
Testing in local env, it's works

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >

I certified that

  • I have read and followed contributing guidelines

  • I discussed changes with code owners prior to submitting this pull request

  • I have not skipped any automated checks

  • All existing and new tests passed

  • I have updated the documentation accordingly


Make sure to have followed the contributing guidelines before submitting.

@JudyZhuHz JudyZhuHz requested review from a team as code owners March 3, 2025 02:38
Copy link

coderabbitai bot commented Mar 3, 2025

📝 Walkthrough

Walkthrough

This pull request introduces enhancements to error handling in the Webex Meetings plugin. Two new constants are added in the constants.ts file: an array constant for join errors (JOIN_ERROR_REASN_FOR_END_USER) containing the error code 403003, and a new entry (NOT_REACH_JBH) within the meeting failure reasons object. The Meeting class now includes an additional conditional check in its fetchMeetingInfoInternal method to recognize errors matching the new join error criteria. When such an error occurs, the method assigns the appropriate failure reason and code, updates the meeting information if available, and throws a custom JoinMeetingError. The related unit tests have been updated to verify that the new error path is correctly triggered and that the meeting information and properties are updated as expected.

Possibly related PRs

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.

yarn install v1.22.22
[1/4] Resolving packages...
warning eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options.
warning eslint > @humanwhocodes/config-array@0.13.0: Use @eslint/config-array instead
warning eslint > @humanwhocodes/config-array > @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
warning eslint > file-entry-cache > flat-cache > rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > glob > inflight@1.0.6: 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 > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning glob@7.2.3: Glob versions prior to v9 are no longer supported
warning intern > glob@7.1.7: Glob versions prior to v9 are no longer supported
warning intern > glob > inflight@1.0.6: 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 > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > jest-config > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > jest-runtime > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > @jest/reporters > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > @jest/transform > babel-plugin-istanbul > test-exclude > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning mocha > glob@7.2.0: Glob versions prior to v9 are no longer supported
warning mocha > glob > inflight@1.0.6: 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 sinon@9.2.4: 16.1.1
warning sinon > @sinonjs/samsam > lodash.get@4.4.2: This package is deprecated. Use the optional chaining (?.) operator instead.
warning wd > archiver > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning wd > q@1.5.1: 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 > request@2.88.0: request has been deprecated, see request/request#3142
warning wd > archiver > archiver-utils > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning wd > request > uuid@3.4.0: 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 > har-validator@5.1.5: this library is no longer supported
warning @babel/cli > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning @babel/plugin-proposal-async-generator-functions@7.20.7: 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/plugin-proposal-class-properties@7.18.6: 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/plugin-proposal-export-namespace-from@7.18.9: 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/plugin-proposal-nullish-coalescing-operator@7.18.6: 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/plugin-proposal-object-rest-spread@7.20.7: 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/plugin-proposal-optional-chaining@7.21.0: 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/polyfill@7.12.1: 🚨 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 > core-js@2.6.12: 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 > core-js@2.6.12: 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 > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning workspace-aggregator-0a297f98-70ec-4df0-81ef-dbe2a5b998d5 > eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options.
warning workspace-aggregator-0a297f98-70ec-4df0-81ef-dbe2a5b998d5 > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning workspace-aggregator-0a297f98-70ec-4df0-81ef-dbe2a5b998d5 > sinon@9.2.4: 16.1.1
warning workspace-aggregator-0a297f98-70ec-4df0-81ef-dbe2a5b998d5 > @babel/plugin-proposal-async-generator-functions@7.20.7: 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-0a297f98-70ec-4df0-81ef-dbe2a5b998d5 > @babel/plugin-proposal-class-properties@7.18.6: 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-0a297f98-70ec-4df0-81ef-dbe2a5b998d5 > @babel/plugin-proposal-export-namespace-from@7.18.9: 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-0a297f98-70ec-4df0-81ef-dbe2a5b998d5 > @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: 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-0a297f98-70ec-4df0-81ef-dbe2a5b998d5 > @babel/plugin-proposal-object-rest-spread@7.20.7: 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-0a297f98-70ec-4df0-81ef-dbe2a5b998d5 > @babel/plugin-proposal-optional-chaining@7.21.0: 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-0a297f98-70ec-4df0-81ef-dbe2a5b998d5 > @babel/polyfill@7.12.1: 🚨 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.
[2/4] Fetching packages...
error eslint-plugin-jsdoc@40.3.0: The engine "node" is incompatible with this module. Expected version "^14 || ^16 || ^17 || ^18 || ^19". Got "22.9.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

✨ Finishing Touches
  • 📝 Generate Docstrings

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

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.

@JudyZhuHz JudyZhuHz added the validated If the pull request is validated for automation. label Mar 3, 2025
Copy link

@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: 3

🧹 Nitpick comments (6)
packages/@webex/plugin-meetings/src/constants.ts (3)

206-206: Typo in constant name "REASN" instead of "REASON".

The constant name contains a typo: JOIN_ERROR_REASN_FOR_END_USER should be JOIN_ERROR_REASON_FOR_END_USER.

-export const JOIN_ERROR_REASN_FOR_END_USER = [403003];
+export const JOIN_ERROR_REASON_FOR_END_USER = [403003];

206-206: Consider adding JSDoc comments for better code documentation.

This constant would benefit from JSDoc comments explaining its purpose, similar to other constants in this file.

+/**
+ * @description Error code for when a user tries to join a meeting before Join Before Host (JBH) time
+ * @type {array}
+ * @constant
+ */
 export const JOIN_ERROR_REASN_FOR_END_USER = [403003];

1337-1337: Fix grammar in the comment.

There's a minor grammatical error in the comment.

-  NOT_REACH_JBH: 'NOT_REACH_JBH', // Meeting is not allow to access since not reach JBH time
+  NOT_REACH_JBH: 'NOT_REACH_JBH', // Meeting is not allowed to access since not reached JBH time
packages/@webex/plugin-meetings/src/meeting/index.ts (3)

126-126: Ensure constant naming follows UPPERCASE_UNDERSCORE convention

The constant JOIN_ERROR_REASN_FOR_END_USER has a typo - it's missing the "O" in "REASON". Consider renaming to JOIN_ERROR_REASON_FOR_END_USER for clarity and consistency.

-  JOIN_ERROR_REASN_FOR_END_USER,
+  JOIN_ERROR_REASON_FOR_END_USER,

1795-1804: Consider adding error message details to the JoinMeetingError

Currently, the JoinMeetingError is thrown without any specific details about the error. Consider passing the error message or code to provide more context to the caller.

- throw new JoinMeetingError();
+ throw new JoinMeetingError(`User has not reached JBH time (Error code: ${err.wbxAppApiCode})`);
🧰 Tools
🪛 GitHub Actions: JudyZhuHz is running Pull Request CI

[error] 1796-1796: error TS2339: Property 'JOIN_ERROR_REASN_FOR_END_USER' does not exist on type '{ NONE: string; WRONG_PASSWORD: string; WRONG_CAPTCHA: string; POLICY: string; WEBINAR_REGISTRATION: string; NEED_JOIN_WITH_WEBCAST: string; WEBINAR_NEED_REGISTRATIONID: string; NOT_REACH_JBH: string; OTHER: string; }'.


127-127: Consider adding unit tests for the new error handling logic

This pull request adds new error handling functionality, but it's not clear if there are corresponding test updates. Consider adding tests to verify that when a 403003 error is encountered, the appropriate JoinMeetingError is thrown with the correct meeting info and failure reason.

Would you like me to help you create a unit test for this new functionality?

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6802b46 and 7e88c9a.

📒 Files selected for processing (3)
  • packages/@webex/plugin-meetings/src/constants.ts (2 hunks)
  • packages/@webex/plugin-meetings/src/meeting/index.ts (3 hunks)
  • packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js (2 hunks)
🧰 Additional context used
🪛 GitHub Actions: JudyZhuHz is running Pull Request CI
packages/@webex/plugin-meetings/src/meeting/index.ts

[error] 1796-1796: error TS2339: Property 'JOIN_ERROR_REASN_FOR_END_USER' does not exist on type '{ NONE: string; WRONG_PASSWORD: string; WRONG_CAPTCHA: string; POLICY: string; WEBINAR_REGISTRATION: string; NEED_JOIN_WITH_WEBCAST: string; WEBINAR_NEED_REGISTRATIONID: string; NOT_REACH_JBH: string; OTHER: string; }'.

🔇 Additional comments (4)
packages/@webex/plugin-meetings/src/meeting/index.ts (2)

166-166: LGTM - Good practice importing the JoinMeetingError class

The import for the new error class is properly placed with the other error imports.


1795-1804:

✅ Verification successful

Verify implementation handles all target error cases correctly

This code assumes that JOIN_ERROR_REASN_FOR_END_USER is an array containing error code 403003, but we should verify this implementation against the requirements in SPARK-623318 to ensure all targeted error cases are properly covered.


🏁 Script executed:

#!/bin/bash
# Check constants.ts to verify JOIN_ERROR_REASN_FOR_END_USER is properly defined
echo "Checking constants.ts file to verify JOIN_ERROR_REASN_FOR_END_USER definition:"
rg "JOIN_ERROR_REASN_FOR_END_USER" "packages/@webex/plugin-meetings/src/constants.ts"

# Check if JoinMeetingError is properly implemented
echo "Checking JoinMeetingError implementation:"
cat "packages/@webex/plugin-meetings/src/common/errors/join-meeting.ts"

Length of output: 1268


Review Verification: Join Meeting Error Handling Correct

I verified that:

  • JOIN_ERROR_REASN_FOR_END_USER is defined in packages/@webex/plugin-meetings/src/constants.ts as [403003], matching the intended design.
  • The error handling in packages/@webex/plugin-meetings/src/meeting/index.ts correctly checks err.wbxAppApiCode against this array, sets the failure reason and code, and conditionally assigns meetingInfo before throwing a properly implemented JoinMeetingError.
  • The JoinMeetingError in packages/@webex/plugin-meetings/src/common/errors/join-meeting.ts is implemented as expected according to the error dictionary.

No further changes are necessary, and the implementation fully covers the targeted error case as outlined in SPARK-623318.

🧰 Tools
🪛 GitHub Actions: JudyZhuHz is running Pull Request CI

[error] 1796-1796: error TS2339: Property 'JOIN_ERROR_REASN_FOR_END_USER' does not exist on type '{ NONE: string; WRONG_PASSWORD: string; WRONG_CAPTCHA: string; POLICY: string; WEBINAR_REGISTRATION: string; NEED_JOIN_WITH_WEBCAST: string; WEBINAR_NEED_REGISTRATIONID: string; NOT_REACH_JBH: string; OTHER: string; }'.

packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js (2)

117-117: LGTM: Imported the new JoinMeetingError class correctly.

The import statement correctly adds the necessary error class that will be used in the new test case.


6343-6373: Successfully implemented test case for the JBH error scenario.

This test case properly validates the new behavior when a user tries to join a meeting before the host has joined. The code:

  1. Sets up a meeting with appropriate destination properties
  2. Configures the meetingInfoProvider to throw a MeetingInfoV2PasswordError with code 403003 (JBH error)
  3. Verifies that fetchMeetingInfo rejects with the newly imported JoinMeetingError
  4. Ensures the meeting state is correctly updated, particularly setting meetingInfoFailureReason to JOIN_ERROR_REASN_FOR_END_USER

The test is well-structured and aligns perfectly with the PR objective to return appropriate error information when a user cannot join because the host hasn't joined yet.

@@ -1790,6 +1792,17 @@ export default class Meeting extends StatelessWebexPlugin {
`Meeting:index#fetchMeetingInfo --> Info Unable to fetch meeting info for ${this.destination} - password required (code=${err?.body?.code}).`
);

if (JOIN_ERROR_REASN_FOR_END_USER.includes(err.wbxAppApiCode)) {
this.meetingInfoFailureReason = MEETING_INFO_FAILURE_REASON.JOIN_ERROR_REASN_FOR_END_USER;
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Ensure consistency with existing MEETING_INFO_FAILURE_REASON constants

Make sure MEETING_INFO_FAILURE_REASON.JOIN_ERROR_REASN_FOR_END_USER is properly defined in the constants file with a similar naming pattern to other failure reasons.


🏁 Script executed:

#!/bin/bash
# Check the structure of MEETING_INFO_FAILURE_REASON in constants.ts
echo "Checking MEETING_INFO_FAILURE_REASON structure in constants.ts:"
rg "MEETING_INFO_FAILURE_REASON" "packages/@webex/plugin-meetings/src/constants.ts" -A 15

Length of output: 1141


Review Comment: Missing and Inconsistently Named Constant

It appears that the constant MEETING_INFO_FAILURE_REASON.JOIN_ERROR_REASN_FOR_END_USER referenced in packages/@webex/plugin-meetings/src/meeting/index.ts is not defined in the constants file (packages/@webex/plugin-meetings/src/constants.ts). Please ensure that you do one of the following:

  • Define the missing constant: Add JOIN_ERROR_REASN_FOR_END_USER to the MEETING_INFO_FAILURE_REASON object in the constants file using a naming pattern consistent with other keys.
  • Review naming consistency: Confirm if the constant name is intended as written or if it should be corrected to something like JOIN_ERROR_REASON_FOR_END_USER to align with established naming conventions.

Please address this to ensure consistent and error-free usage across the codebase.

🧰 Tools
🪛 GitHub Actions: JudyZhuHz is running Pull Request CI

[error] 1796-1796: error TS2339: Property 'JOIN_ERROR_REASN_FOR_END_USER' does not exist on type '{ NONE: string; WRONG_PASSWORD: string; WRONG_CAPTCHA: string; POLICY: string; WEBINAR_REGISTRATION: string; NEED_JOIN_WITH_WEBCAST: string; WEBINAR_NEED_REGISTRATIONID: string; NOT_REACH_JBH: string; OTHER: string; }'.

Comment on lines 1795 to 1804
if (JOIN_ERROR_REASN_FOR_END_USER.includes(err.wbxAppApiCode)) {
this.meetingInfoFailureReason = MEETING_INFO_FAILURE_REASON.JOIN_ERROR_REASN_FOR_END_USER;
this.meetingInfoFailureCode = err.wbxAppApiCode;

if (err.meetingInfo) {
this.meetingInfo = err.meetingInfo;
}

throw new JoinMeetingError();
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix TypeScript error by ensuring constant is properly defined in constants.ts

The pipeline failure indicates that JOIN_ERROR_REASN_FOR_END_USER is not properly defined on the type for MEETING_INFO_FAILURE_REASON. You need to ensure this property is added to the constants file and properly typed.

Also, consider adding a descriptive comment explaining what error code 403003 represents (e.g., "not reached JBH time") to make the code more maintainable.

if (JOIN_ERROR_REASN_FOR_END_USER.includes(err.wbxAppApiCode)) {
+  // Handle the case where user hasn't reached Join Before Host (JBH) time (error code 403003)
  this.meetingInfoFailureReason = MEETING_INFO_FAILURE_REASON.JOIN_ERROR_REASN_FOR_END_USER;
  this.meetingInfoFailureCode = err.wbxAppApiCode;

  if (err.meetingInfo) {
    this.meetingInfo = err.meetingInfo;
  }

  throw new JoinMeetingError();
}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (JOIN_ERROR_REASN_FOR_END_USER.includes(err.wbxAppApiCode)) {
this.meetingInfoFailureReason = MEETING_INFO_FAILURE_REASON.JOIN_ERROR_REASN_FOR_END_USER;
this.meetingInfoFailureCode = err.wbxAppApiCode;
if (err.meetingInfo) {
this.meetingInfo = err.meetingInfo;
}
throw new JoinMeetingError();
}
if (JOIN_ERROR_REASN_FOR_END_USER.includes(err.wbxAppApiCode)) {
// Handle the case where user hasn't reached Join Before Host (JBH) time (error code 403003)
this.meetingInfoFailureReason = MEETING_INFO_FAILURE_REASON.JOIN_ERROR_REASN_FOR_END_USER;
this.meetingInfoFailureCode = err.wbxAppApiCode;
if (err.meetingInfo) {
this.meetingInfo = err.meetingInfo;
}
throw new JoinMeetingError();
}
🧰 Tools
🪛 GitHub Actions: JudyZhuHz is running Pull Request CI

[error] 1796-1796: error TS2339: Property 'JOIN_ERROR_REASN_FOR_END_USER' does not exist on type '{ NONE: string; WRONG_PASSWORD: string; WRONG_CAPTCHA: string; POLICY: string; WEBINAR_REGISTRATION: string; NEED_JOIN_WITH_WEBCAST: string; WEBINAR_NEED_REGISTRATIONID: string; NOT_REACH_JBH: string; OTHER: string; }'.

@JudyZhuHz JudyZhuHz force-pushed the SPARK-623318-not-reach-jbh branch from 7e88c9a to fcbe4ae Compare March 3, 2025 03:39
Copy link

@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: 2

♻️ Duplicate comments (1)
packages/@webex/plugin-meetings/src/meeting/index.ts (1)

126-126: ⚠️ Potential issue

Variable name contains a typo

The variable name JOIN_ERROR_REASN_FOR_END_USER contains a typo - "REASN" instead of "REASON". This typo is consistent with the TypeScript error reported in pipeline failures.

- JOIN_ERROR_REASN_FOR_END_USER,
+ JOIN_ERROR_REASON_FOR_END_USER,
🧹 Nitpick comments (1)
packages/@webex/plugin-meetings/src/meeting/index.ts (1)

1795-1796: Consider using a more efficient data structure for error code checking

The current implementation checks if an error code is included in an array with JOIN_ERROR_REASN_FOR_END_USER.includes(err.wbxAppApiCode). If this array contains many error codes, this could be inefficient. Consider using a Set for O(1) lookups if performance becomes a concern in the future.

- if (JOIN_ERROR_REASN_FOR_END_USER.includes(err.wbxAppApiCode)) {
+ // Use Set.has() for more efficient lookup if the array contains many codes
+ if (JOIN_ERROR_REASON_FOR_END_USER_SET.has(err.wbxAppApiCode)) {

For this change to work, you would need to define a Set in constants.ts:

export const JOIN_ERROR_REASON_FOR_END_USER = [403003];
export const JOIN_ERROR_REASON_FOR_END_USER_SET = new Set(JOIN_ERROR_REASON_FOR_END_USER);
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7e88c9a and fcbe4ae.

📒 Files selected for processing (2)
  • packages/@webex/plugin-meetings/src/meeting/index.ts (3 hunks)
  • packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js (2 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js

[error] 119-119: Don't focus the test.

The 'only' method is often used for debugging or during implementation. It should be removed before deploying to production.
Consider removing 'only' to ensure all tests are executed.
Unsafe fix: Remove focus from test.

(lint/suspicious/noFocusedTests)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Build Packages
  • GitHub Check: AWS Amplify Console Web Preview
🔇 Additional comments (6)
packages/@webex/plugin-meetings/src/meeting/index.ts (3)

166-166: LGTM: Appropriate error import for the new error handling case

Good addition importing the JoinMeetingError class that will be used for the new error case.


1795-1804:

✅ Verification successful

Verify the proper constant name in constants.ts file

The TypeScript error in the pipeline failures indicates that JOIN_ERROR_REASN_FOR_END_USER is not properly defined on the type for MEETING_INFO_FAILURE_REASON. Make sure the constant is correctly defined in the constants file and consistently used throughout the codebase.


🏁 Script executed:

#!/bin/bash
# Find the definition of the constant in the constants.ts file
echo "Checking for JOIN_ERROR_REASN_FOR_END_USER in constants.ts:"
rg "JOIN_ERROR_REASN_FOR_END_USER" packages/@webex/plugin-meetings/src/constants.ts

echo -e "\nChecking for any similar constant names that might be the correct one:"
rg -i "JOIN_ERROR.*END_USER" packages/@webex/plugin-meetings/src/constants.ts

echo -e "\nChecking if NOT_REACH_JBH is defined in MEETING_INFO_FAILURE_REASON:"
rg "NOT_REACH_JBH" packages/@webex/plugin-meetings/src/constants.ts -A 2 -B 2

Length of output: 1118


Action: Confirm constant definitions and review type expectations

  • Verified that JOIN_ERROR_REASN_FOR_END_USER is correctly defined in packages/@webex/plugin-meetings/src/constants.ts as [403003].
  • Confirmed that the MEETING_INFO_FAILURE_REASON object includes the NOT_REACH_JBH key as expected.

It appears there is no naming discrepancy with the constants. If the TypeScript error persists in the pipeline, please double-check that the type definitions for MEETING_INFO_FAILURE_REASON are properly aligned with its usage in the code.


1795-1804:

✅ Verification successful

Verify error code handling in other places

Check if the 403003 error code is handled consistently elsewhere in the codebase. This helps ensure the error handling approach is uniform throughout the application.


🏁 Script executed:

#!/bin/bash
# Look for other handling of 403003 error code in the codebase
echo "Checking for other occurrences of 403003 error code handling:"
rg "403003" packages/@webex/plugin-meetings/

echo -e "\nChecking for other places that use JoinMeetingError:"
rg "JoinMeetingError" packages/@webex/plugin-meetings/

Length of output: 1885


Error Code 403003 Handling Consistency Verified

  • Confirmed that the 403003 error code is defined in packages/@webex/plugin-meetings/src/constants.ts (via JOIN_ERROR_REASN_FOR_END_USER).
  • Verified that in packages/@webex/plugin-meetings/src/meeting/index.ts, when err.wbxAppApiCode equals 403003, the code updates the meeting failure reason/code appropriately before throwing a JoinMeetingError.
  • Found unit tests in packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js that validate the meeting failure code is set to 403003 and the appropriate error is thrown.

Overall, the handling of the 403003 error code is consistent across the codebase.

packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js (3)

117-117: LGTM! JoinMeetingError import matches the error handling enhancement.

This import supports the new error handling path for JBH (Join Before Host) error case.


6343-6373: Correct implementation of the error handling for JBH errors.

This test case properly verifies that when a 403003 error code is encountered, the system:

  1. Throws a JoinMeetingError instead of other error types
  2. Sets the appropriate meeting info failure code and reason
  3. Updates the meeting information properties

This aligns with the PR objective to enhance error handling for Webex Meetings plugin.


6366-6373:

✅ Verification successful

Verify the correct failure reason constant is used.

Ensure that MEETING_INFO_FAILURE_REASON.NOT_REACH_JBH has been properly defined in the constants.ts file as mentioned in the PR summary. This test correctly verifies that the right failure reason is assigned.


🏁 Script executed:

#!/bin/bash
# Check if the NOT_REACH_JBH constant is defined in the constants file
grep -r "NOT_REACH_JBH" --include="*.ts" packages/@webex/plugin-meetings/src/

Length of output: 357


Constant definition verified

The constant MEETING_INFO_FAILURE_REASON.NOT_REACH_JBH is correctly defined in packages/@webex/plugin-meetings/src/constants.ts and is used correctly in the meeting implementation. The test in packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js properly verifies that the meeting failure reason is as expected.

Copy link

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

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

Copy link

@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: 0

♻️ Duplicate comments (1)
packages/@webex/plugin-meetings/src/meeting/index.ts (1)

126-126: ⚠️ Potential issue

Fix the typo in the constant name

The constant name contains a typo - "REASN" is missing an "O" and should be "REASON".

-  JOIN_ERROR_REASN_FOR_END_USER,
+  JOIN_ERROR_REASON_FOR_END_USER,

This issue was identified in previous review comments and is causing a TypeScript error in the build pipeline.

🧹 Nitpick comments (1)
packages/@webex/plugin-meetings/src/meeting/index.ts (1)

1797-1797: Consider using a more specific failure reason constant name

The constant NOT_REACH_JBH is used for the failure reason, which is reasonable but could be more descriptive.

Consider using a more explicit name like JOIN_BEFORE_HOST_TIME or HOST_NOT_JOINED_YET to make the error reason more immediately clear to developers.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fcbe4ae and fd13cd4.

📒 Files selected for processing (2)
  • packages/@webex/plugin-meetings/src/meeting/index.ts (3 hunks)
  • packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build Packages
🔇 Additional comments (5)
packages/@webex/plugin-meetings/src/meeting/index.ts (3)

1795-1805: Good implementation with appropriate error handling for JBH case

The code properly handles the case where a user attempts to join a meeting before the Join Before Host (JBH) time. The implementation follows the established pattern for error handling in this method, setting the appropriate failure reason, storing the error code, preserving meeting info, and throwing the custom error.

However, there's a critical issue with the constant name reference:

-        if (JOIN_ERROR_REASN_FOR_END_USER.includes(err.wbxAppApiCode)) {
+        if (JOIN_ERROR_REASON_FOR_END_USER.includes(err.wbxAppApiCode)) {

This needs to be fixed to match the corrected constant name that I suggested above.


166-166: Good addition of the JoinMeetingError import

The import for the JoinMeetingError class has been correctly added, which is used to throw the appropriate error when a user tries to join before the JBH time.


1796-1804:

✅ Verification successful

Verify error code handling is comprehensive

The implementation relies on checking a single error code (403003) through the JOIN_ERROR_REASON_FOR_END_USER array.

Please verify there aren't other error codes that could represent the same "not reach JBH" condition:


🏁 Script executed:

#!/bin/bash
# Search for other potential JBH-related error codes in the codebase
echo "Searching for JBH or 'Join Before Host' related error codes:"
rg -i "join before host|jbh" --type ts --glob "!**/node_modules/**" --glob "!**/dist/**"

echo "Checking if there are other 403xxx error codes defined:"
rg "403\d{3}" --type ts --glob "!**/node_modules/**" --glob "!**/dist/**"

Length of output: 7948


Revisit Error Code Handling for JBH

  • The code exclusively checks error code 403003 via the JOIN_ERROR_REASN_FOR_END_USER array.
  • Our search for "join before host" and additional 403xxx codes revealed no other errors representing the "not reached JBH" condition.
  • Based on this verification, the current error handling is comprehensive.
packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js (2)

117-117: Added missing import for error handling.

The addition of this import is related to the new error handling for "Join Before Host" (JBH) server connection failures.


6343-6373: Added test for handling JBH server connection failures.

This test verifies the proper handling of error code 403003 when the meetingInfoProvider fails to reach the Join Before Host (JBH) server. The test ensures that:

  1. The method rejects with a JoinMeetingError
  2. The meetingInfo is properly set
  3. The meetingInfoFailureCode is set to 403003
  4. The meetingInfoFailureReason is correctly set to MEETING_INFO_FAILURE_REASON.NOT_REACH_JBH
  5. The requiredCaptcha is properly set to null

This is a well-structured test that validates the new error handling path.

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