Skip to content

Conversation

@chrisadubois
Copy link
Collaborator

This pull request addresses

fixes meeting joined time to convert the date string from locus to an ISO format

by making the following changes

  /**
   * Setter - sets isoLocalClientMeetingJoinTime
   * This will be set once on meeting join, and not updated again
   * this will always produce an ISO string
   * If the iso string is invalid, it will fallback to the current system time
   * @param {string | undefined} time
   */
  set isoLocalClientMeetingJoinTime(time: string | undefined) {
    const fallback = new Date().toISOString();
    if (!time) {
      this.#isoLocalClientMeetingJoinTime = fallback;
    } else {
      const date = new Date(time);

      // Check if the date is valid
      if (Number.isNaN(date.getTime())) {
        LoggerProxy.logger.info(
          // @ts-ignore
          `Meeting:index#isoLocalClientMeetingJoinTime --> Invalid date provided: ${time}. Falling back to system clock.`
        );
        this.#isoLocalClientMeetingJoinTime = fallback;
      } else {
        this.#isoLocalClientMeetingJoinTime = date.toISOString();
      }
    }
  }

this is the only thing that changed vs the revert

validated live with @Coread

Screenshot 2025-04-01 at 9 03 33 AM

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

manual test and verify with correlationID
update unit tests

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.

@chrisadubois chrisadubois requested review from a team as code owners April 1, 2025 16:07
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 1, 2025

📝 Walkthrough

Walkthrough

This pull request updates the meeting diagnostics and related meeting modules by introducing a new property, meetingJoinedTime, into the client event object used in diagnostic metrics. In the CallDiagnosticMetrics class, the createClientEventObjectInMeeting method has been updated to include meetingJoinedTime when available. Corresponding unit tests have been added or updated to verify that this property is correctly set and passed through various methods. Additionally, the Meeting class in the meetings module now includes a new setter to manage isoLocalClientMeetingJoinTime, ensuring that the meeting join time is properly validated, logged, and assigned—either from the response headers or using the system time as a fallback. Minor adjustments in the utility functions further integrate this new property into the meeting join workflow.

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.

🔧 ast-grep (0.31.1)
packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js
🔧 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 [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-runtime > [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/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 sinon > @sinonjs/samsam > [email protected]: This package is deprecated. Use the optional chaining (?.) operator instead.
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 > request > [email protected]: this library is no longer supported
warning wd > archiver > [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 > archiver > archiver-utils > [email protected]: Glob versions prior to v9 are 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-1263cdcb-0480-4220-a0b8-a3a252f3dbe7 > [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options.
warning workspace-aggregator-1263cdcb-0480-4220-a0b8-a3a252f3dbe7 > [email protected]: Glob versions prior to v9 are no longer supported
warning workspace-aggregator-1263cdcb-0480-4220-a0b8-a3a252f3dbe7 > [email protected]: 16.1.1
warning workspace-aggregator-1263cdcb-0480-4220-a0b8-a3a252f3dbe7 > @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-1263cdcb-0480-4220-a0b8-a3a252f3dbe7 > @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-1263cdcb-0480-4220-a0b8-a3a252f3dbe7 > @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-1263cdcb-0480-4220-a0b8-a3a252f3dbe7 > @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-1263cdcb-0480-4220-a0b8-a3a252f3dbe7 > @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-1263cdcb-0480-4220-a0b8-a3a252f3dbe7 > @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-1263cdcb-0480-4220-a0b8-a3a252f3dbe7 > @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.
[2/4] Fetching packages...
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.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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 plan to trigger planning for file edits and PR creation.
  • @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.

@chrisadubois chrisadubois added the validated If the pull request is validated for automation. label Apr 1, 2025
Copy link
Contributor

@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

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

7531-7535: Avoid potential test flakiness due to exact time comparison.
Using new Date().toISOString() inline may cause rare mismatches if the test and the setter occur a few milliseconds apart. Consider stubbing or mocking Date to always return a fixed value during tests.

 it('should fallback to system clock ISO string when given an undefined value', () => {
-  const currentSystemTime = new Date().toISOString();
+  const fixedTime = '2025-04-01T13:00:36.000Z'; // example
+  sandbox.stub(Date.prototype, 'toISOString').returns(fixedTime);

  meeting.isoLocalClientMeetingJoinTime = undefined;
-  assert.equal(meeting.isoLocalClientMeetingJoinTime, currentSystemTime);
+  assert.equal(meeting.isoLocalClientMeetingJoinTime, fixedTime);
});

7537-7541: Same time comparison issue for invalid date test.
This scenario faces the same potential risk of test flakiness as the undefined-value test. Mocking or stubbing Date helps ensure predictable results.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d1f2877 and 76dd1a7.

📒 Files selected for processing (6)
  • packages/@webex/internal-plugin-metrics/src/call-diagnostic/call-diagnostic-metrics.ts (1 hunks)
  • packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts (3 hunks)
  • packages/@webex/plugin-meetings/src/meeting/index.ts (1 hunks)
  • packages/@webex/plugin-meetings/src/meeting/util.ts (1 hunks)
  • packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js (2 hunks)
  • packages/@webex/plugin-meetings/test/unit/spec/meeting/utils.js (1 hunks)
🧰 Additional context used
🧬 Code Definitions (2)
packages/@webex/internal-plugin-metrics/src/call-diagnostic/call-diagnostic-metrics.ts (1)
docs/samples/browser-plugin-meetings/app.js (15)
  • meeting (441-441)
  • meeting (460-460)
  • meeting (490-490)
  • meeting (616-616)
  • meeting (753-753)
  • meeting (1007-1007)
  • meeting (1029-1029)
  • meeting (1051-1051)
  • meeting (1087-1087)
  • meeting (1100-1100)
  • meeting (1113-1113)
  • meeting (1149-1149)
  • meeting (1196-1196)
  • meeting (1218-1218)
  • meeting (1240-1240)
packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js (1)
packages/@webex/plugin-meetings/src/meeting/index.ts (2)
  • isoLocalClientMeetingJoinTime (1685-1687)
  • isoLocalClientMeetingJoinTime (1696-1714)
🔇 Additional comments (9)
packages/@webex/internal-plugin-metrics/src/call-diagnostic/call-diagnostic-metrics.ts (1)

739-742: LGTM: Properly adding the meeting joined time to the client event object.

This implementation correctly adds the meetingJoinedTime to the client event object when available, which enhances the metrics by tracking when users join meetings.

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

183-183: LGTM: Properly capturing meeting join time from response headers.

This implementation captures the meeting join time from the response headers, correctly providing a timestamp from the server. The comment indicates that there's a fallback to system clock when the header is not available, which is likely handled by the setter method in the Meeting class.

packages/@webex/plugin-meetings/test/unit/spec/meeting/utils.js (1)

464-505: LGTM: Good test coverage for the new functionality.

This test properly verifies that the isoLocalClientMeetingJoinTime property is correctly set from the response headers when joining a meeting. The test setup is thorough and covers the essential functionality.

packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts (3)

64-68: Good addition of the test fixture with isoLocalClientMeetingJoinTime property.

The fakeMeeting4 object properly includes the new property that this PR is implementing, which will allow testing how the system handles the new ISO format meeting joined time.


82-82: LGTM! Properly added to the fakeMeetings collection.

This ensures the new test fixture is available for lookup by ID in tests.


1089-1225: Well-structured test for the new meeting joined time functionality.

This test effectively verifies that when a meeting has an isoLocalClientMeetingJoinTime property, it is correctly:

  1. Passed as meetingJoinedTime to the prepareDiagnosticEvent method
  2. Included in the submitted event object
  3. Used consistently throughout the event processing pipeline

The test follows the established pattern of the other tests in this file and provides thorough coverage of the new functionality.

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

1689-1714: Well-implemented setter with proper validation and fallback.

The new isoLocalClientMeetingJoinTime setter properly handles conversion of meeting joined time to ISO format with appropriate validation and fallback logic. If the provided time is undefined or invalid, it correctly falls back to the current system time, logs the issue, and ensures the property is always set as a valid ISO string.

This implementation aligns well with the PR objectives of converting the meeting joined time from a locus date string to an ISO format, which will help ensure consistent timestamp formatting throughout the application.

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

213-213: Variable naming and usage appear consistent.
A new variable isoLocalClientMeetingJoinTime is introduced for test setup. This aligns with the Meeting class property and ensures clarity in the tests.


7543-7548: Comprehensive check for valid date strings.
Testing with a valid date string is important. This test thoroughly verifies that the setter correctly normalizes the provided date to ISO format.

@chrisadubois chrisadubois mentioned this pull request Apr 1, 2025
11 tasks
@chrisadubois chrisadubois enabled auto-merge (squash) April 1, 2025 17:35
@chrisadubois chrisadubois merged commit f5dd045 into webex:next Apr 1, 2025
21 of 23 checks passed
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.

3 participants