@webex/plugin-meetings 3.12.0-webex-services-ready.4 → 3.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/.sdd/manifest.json +1312 -0
  2. package/.sdd/templates/.source.json +30 -0
  3. package/.sdd/templates/component-repo/module-docs/module-spec-quality.md +111 -0
  4. package/.sdd/templates/component-repo/module-docs/module-spec.template.md +321 -0
  5. package/.sdd/templates/component-repo/reference-docs/adr/_adr-example.md +59 -0
  6. package/.sdd/templates/component-repo/reference-docs/patterns/_pattern-example.md +49 -0
  7. package/.sdd/templates/component-repo/reference-docs/rules/_rule-example.md +42 -0
  8. package/.sdd/templates/component-repo/standing-docs/AGENTS.template.md +120 -0
  9. package/.sdd/templates/component-repo/standing-docs/ARCHITECTURE.template.md +206 -0
  10. package/.sdd/templates/component-repo/standing-docs/CONTRACTS.template.md +90 -0
  11. package/.sdd/templates/component-repo/standing-docs/DATA_MODEL.template.md +68 -0
  12. package/.sdd/templates/component-repo/standing-docs/GETTING_STARTED.template.md +111 -0
  13. package/.sdd/templates/component-repo/standing-docs/GLOSSARY.template.md +57 -0
  14. package/.sdd/templates/component-repo/standing-docs/REVIEW_CHECKLIST.template.md +69 -0
  15. package/.sdd/templates/component-repo/standing-docs/RULES.template.md +96 -0
  16. package/.sdd/templates/component-repo/standing-docs/SECURITY.template.md +84 -0
  17. package/.sdd/templates/component-repo/standing-docs/SERVICE_STATE.template.md +82 -0
  18. package/.sdd/templates/component-repo/standing-docs/SPEC_INDEX.template.md +94 -0
  19. package/.sdd/templates/component-repo/standing-docs/TEST_INDEX.template.md +64 -0
  20. package/.sdd/templates/component-repo/template-map.json +112 -0
  21. package/AGENTS.md +130 -4
  22. package/ai-docs/ARCHITECTURE.md +208 -0
  23. package/ai-docs/CONTRACTS.md +267 -0
  24. package/ai-docs/DATA_MODEL.md +64 -0
  25. package/ai-docs/GETTING_STARTED.md +73 -0
  26. package/ai-docs/GLOSSARY.md +56 -0
  27. package/ai-docs/REVIEW_CHECKLIST.md +45 -0
  28. package/ai-docs/RULES.md +79 -0
  29. package/ai-docs/SECURITY.md +74 -0
  30. package/ai-docs/SERVICE_STATE.md +59 -0
  31. package/ai-docs/SPEC_INDEX.md +85 -0
  32. package/ai-docs/TEST_INDEX.md +45 -0
  33. package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +61 -0
  34. package/ai-docs/patterns/defensive-error-propagation.md +55 -0
  35. package/ai-docs/patterns/event-scope-emission.md +46 -0
  36. package/ai-docs/patterns/source-to-test-path-mirroring.md +45 -0
  37. package/ai-docs/patterns/stateless-plugin-request-classes.md +53 -0
  38. package/ai-docs/patterns/typed-constants-and-enum-values.md +47 -0
  39. package/assets/README.md +28 -0
  40. package/assets/e2ee-0.0.1.js +2 -0
  41. package/assets/e2ee-0.0.1.wasm +0 -0
  42. package/dist/aiEnableRequest/index.js +1 -1
  43. package/dist/annotation/index.js +55 -19
  44. package/dist/annotation/index.js.map +1 -1
  45. package/dist/assets/e2ee-0.0.1.js +2 -0
  46. package/dist/assets/e2ee-0.0.1.wasm +0 -0
  47. package/dist/breakouts/breakout.js +1 -1
  48. package/dist/breakouts/index.js +39 -5
  49. package/dist/breakouts/index.js.map +1 -1
  50. package/dist/common/errors/webex-errors.js +7 -2
  51. package/dist/common/errors/webex-errors.js.map +1 -1
  52. package/dist/config.js +1 -0
  53. package/dist/config.js.map +1 -1
  54. package/dist/constants.js +6 -5
  55. package/dist/constants.js.map +1 -1
  56. package/dist/hashTree/hashTreeParser.js +101 -48
  57. package/dist/hashTree/hashTreeParser.js.map +1 -1
  58. package/dist/index.js +1 -0
  59. package/dist/index.js.map +1 -1
  60. package/dist/interceptors/dataChannelAuthToken.js +41 -59
  61. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  62. package/dist/interceptors/locusRetry.js +1 -1
  63. package/dist/interceptors/locusRetry.js.map +1 -1
  64. package/dist/interpretation/index.js +46 -12
  65. package/dist/interpretation/index.js.map +1 -1
  66. package/dist/interpretation/siLanguage.js +1 -1
  67. package/dist/locus-info/index.js +236 -80
  68. package/dist/locus-info/index.js.map +1 -1
  69. package/dist/locus-info/types.js +2 -1
  70. package/dist/locus-info/types.js.map +1 -1
  71. package/dist/media/MediaConnectionAwaiter.js +225 -175
  72. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  73. package/dist/meeting/index.js +355 -299
  74. package/dist/meeting/index.js.map +1 -1
  75. package/dist/meeting/util.js +8 -2
  76. package/dist/meeting/util.js.map +1 -1
  77. package/dist/meeting/voicea-meeting.js +2 -1
  78. package/dist/meeting/voicea-meeting.js.map +1 -1
  79. package/dist/meeting-info/meeting-info-v2.js +10 -3
  80. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  81. package/dist/meetings/index.js +72 -31
  82. package/dist/meetings/index.js.map +1 -1
  83. package/dist/multistream/remoteMediaManager.js +32 -4
  84. package/dist/multistream/remoteMediaManager.js.map +1 -1
  85. package/dist/multistream/sendSlotManager.js +11 -1
  86. package/dist/multistream/sendSlotManager.js.map +1 -1
  87. package/dist/types/annotation/index.d.ts +19 -0
  88. package/dist/types/common/errors/webex-errors.d.ts +6 -2
  89. package/dist/types/config.d.ts +1 -0
  90. package/dist/types/constants.d.ts +2 -1
  91. package/dist/types/hashTree/hashTreeParser.d.ts +12 -0
  92. package/dist/types/index.d.ts +1 -0
  93. package/dist/types/locus-info/index.d.ts +45 -1
  94. package/dist/types/locus-info/types.d.ts +1 -0
  95. package/dist/types/media/MediaConnectionAwaiter.d.ts +61 -53
  96. package/dist/types/meeting/index.d.ts +49 -12
  97. package/dist/types/meeting/util.d.ts +3 -1
  98. package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
  99. package/dist/types/meetings/index.d.ts +2 -1
  100. package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
  101. package/dist/types/multistream/sendSlotManager.d.ts +5 -1
  102. package/dist/webinar/index.js +298 -255
  103. package/dist/webinar/index.js.map +1 -1
  104. package/package.json +25 -23
  105. package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
  106. package/src/annotation/ai-docs/annotation-spec.md +236 -0
  107. package/src/annotation/index.ts +61 -29
  108. package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
  109. package/src/breakouts/index.ts +35 -2
  110. package/src/common/errors/webex-errors.ts +8 -2
  111. package/src/config.ts +5 -1
  112. package/src/constants.ts +2 -1
  113. package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
  114. package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
  115. package/src/hashTree/hashTreeParser.ts +67 -3
  116. package/src/index.ts +1 -0
  117. package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
  118. package/src/interceptors/dataChannelAuthToken.ts +48 -77
  119. package/src/interceptors/locusRetry.ts +1 -1
  120. package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
  121. package/src/interpretation/index.ts +38 -1
  122. package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
  123. package/src/locus-info/index.ts +156 -35
  124. package/src/locus-info/types.ts +1 -0
  125. package/src/media/MediaConnectionAwaiter.ts +223 -207
  126. package/src/media/ai-docs/media-spec.md +267 -0
  127. package/src/meeting/ai-docs/meeting-spec.md +404 -0
  128. package/src/meeting/index.ts +332 -296
  129. package/src/meeting/util.ts +7 -4
  130. package/src/meeting/voicea-meeting.ts +1 -1
  131. package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
  132. package/src/meeting-info/meeting-info-v2.ts +7 -2
  133. package/src/meetings/ai-docs/meetings-spec.md +296 -0
  134. package/src/meetings/index.ts +59 -23
  135. package/src/member/ai-docs/member-spec.md +196 -0
  136. package/src/members/ai-docs/members-spec.md +256 -0
  137. package/src/metrics/ai-docs/metrics-spec.md +185 -0
  138. package/src/multistream/ai-docs/multistream-spec.md +295 -0
  139. package/src/multistream/remoteMediaManager.ts +23 -1
  140. package/src/multistream/sendSlotManager.ts +15 -1
  141. package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
  142. package/src/reachability/ai-docs/reachability-spec.md +261 -0
  143. package/src/reactions/ai-docs/reactions-spec.md +198 -0
  144. package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
  145. package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
  146. package/src/roap/ai-docs/roap-spec.md +241 -0
  147. package/src/webinar/ai-docs/webinar-spec.md +243 -0
  148. package/src/webinar/index.ts +168 -188
  149. package/test/unit/spec/annotation/index.ts +214 -182
  150. package/test/unit/spec/breakouts/index.ts +145 -13
  151. package/test/unit/spec/hashTree/hashTreeParser.ts +212 -1
  152. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +81 -99
  153. package/test/unit/spec/interceptors/locusRetry.ts +29 -1
  154. package/test/unit/spec/interpretation/index.ts +93 -0
  155. package/test/unit/spec/locus-info/index.js +397 -0
  156. package/test/unit/spec/media/MediaConnectionAwaiter.ts +426 -19
  157. package/test/unit/spec/media/properties.ts +3 -3
  158. package/test/unit/spec/meeting/index.js +1219 -723
  159. package/test/unit/spec/meeting/utils.js +52 -18
  160. package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
  161. package/test/unit/spec/meeting-info/meetinginfov2.js +69 -1
  162. package/test/unit/spec/meetings/index.js +145 -43
  163. package/test/unit/spec/multistream/remoteMediaManager.ts +46 -0
  164. package/test/unit/spec/multistream/sendSlotManager.ts +30 -2
  165. package/test/unit/spec/webinar/index.ts +886 -718
@@ -95,6 +95,7 @@ describe('plugin-meetings', () => {
95
95
  parse: sinon.stub().returns(true),
96
96
  updateMainSessionLocusCache: sinon.stub(),
97
97
  syncAllHashTreeDatasets: sinon.stub(),
98
+ sync: sinon.stub().resolves(),
98
99
  };
99
100
  webex = new MockWebex({
100
101
  children: {
@@ -142,6 +143,7 @@ describe('plugin-meetings', () => {
142
143
 
143
144
  Object.assign(webex.internal, {
144
145
  llm: {on: sinon.stub()},
146
+ voicea: {createChannel: sinon.stub().returns({})},
145
147
  device: {
146
148
  deviceType: 'FAKE_DEVICE',
147
149
  register: sinon.stub().returns(Promise.resolve()),
@@ -239,6 +241,10 @@ describe('plugin-meetings', () => {
239
241
 
240
242
  webex.meetings.destroy(meeting, test1);
241
243
 
244
+ assert.calledOnceWithExactly(MeetingUtil.cleanUp, meeting, {
245
+ preserveVoiceaChannel: false,
246
+ });
247
+
242
248
  // and it should still return the information after the meeting is destroyed
243
249
  assert.equal(
244
250
  webex.meetings.getBasicMeetingInformation(meetingIds.meetingId).id,
@@ -1479,7 +1485,7 @@ describe('plugin-meetings', () => {
1479
1485
  it('should have #syncMeetings', () => {
1480
1486
  assert.exists(webex.meetings.syncMeetings);
1481
1487
  });
1482
- it('should skip getActiveMeetings but still call syncAllHashTreeDatasets if unverified guest', async () => {
1488
+ it('should skip getActiveMeetings but still sync each meeting with canSyncClassicLocus enabled if unverified guest', async () => {
1483
1489
  webex.meetings.request.getActiveMeetings = sinon.stub().returns(
1484
1490
  Promise.resolve({
1485
1491
  loci: [
@@ -1493,10 +1499,11 @@ describe('plugin-meetings', () => {
1493
1499
  LoggerProxy.logger.info = sinon.stub();
1494
1500
 
1495
1501
  const mockLocusInfo = {
1496
- syncAllHashTreeDatasets: sinon.stub().resolves(),
1502
+ sync: sinon.stub().resolves(),
1497
1503
  };
1504
+ const meeting1 = {locusInfo: mockLocusInfo};
1498
1505
  webex.meetings.meetingCollection.getAll = sinon.stub().returns({
1499
- meeting1: {locusInfo: mockLocusInfo},
1506
+ meeting1,
1500
1507
  meeting2: {locusInfo: undefined},
1501
1508
  meeting3: {},
1502
1509
  });
@@ -1508,7 +1515,10 @@ describe('plugin-meetings', () => {
1508
1515
  LoggerProxy.logger.info,
1509
1516
  'Meetings:index#syncMeetings --> user is unverified guest, skipping calling Locus for meeting sync'
1510
1517
  );
1511
- assert.calledOnce(mockLocusInfo.syncAllHashTreeDatasets);
1518
+ assert.calledOnceWithExactly(mockLocusInfo.sync, meeting1, {
1519
+ canSyncClassicLocus: true,
1520
+ canSyncHashTree: true,
1521
+ });
1512
1522
  });
1513
1523
  describe('succesful requests', () => {
1514
1524
  beforeEach(() => {
@@ -1537,7 +1547,11 @@ describe('plugin-meetings', () => {
1537
1547
  assert.calledOnce(webex.meetings.meetingCollection.getByKey);
1538
1548
  assert.calledOnce(locusInfo.parse);
1539
1549
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
1540
- assert.calledOnce(locusInfo.syncAllHashTreeDatasets);
1550
+ assert.calledOnceWithExactly(
1551
+ locusInfo.sync,
1552
+ {locusInfo, locusUrl: url1},
1553
+ {canSyncClassicLocus: false, canSyncHashTree: true}
1554
+ );
1541
1555
  });
1542
1556
  });
1543
1557
  describe('when meeting is not returned', () => {
@@ -1674,7 +1688,7 @@ describe('plugin-meetings', () => {
1674
1688
  locusUrl: 'breakout-url',
1675
1689
  locusInfo: {
1676
1690
  info: {globalMeetingId: 'gmid-123'},
1677
- syncAllHashTreeDatasets: sinon.stub().resolves(),
1691
+ sync: sinon.stub().resolves(),
1678
1692
  },
1679
1693
  sendCallAnalyzerMetrics: sinon.stub(),
1680
1694
  },
@@ -1698,7 +1712,8 @@ describe('plugin-meetings', () => {
1698
1712
  locusUrl: 'breakout-url',
1699
1713
  locusInfo: {
1700
1714
  info: {globalMeetingId: 'gmid-other'},
1701
- syncAllHashTreeDatasets: sinon.stub().resolves(),
1715
+ sync: sinon.stub().resolves(),
1716
+ cleanUp: sinon.stub(),
1702
1717
  },
1703
1718
  sendCallAnalyzerMetrics: sinon.stub(),
1704
1719
  },
@@ -1719,46 +1734,54 @@ describe('plugin-meetings', () => {
1719
1734
  });
1720
1735
 
1721
1736
  describe('skipHashTreeSync parameter', () => {
1722
- it('should skip syncAllHashTreeDatasets when skipHashTreeSync is true', async () => {
1737
+ it('should pass canSyncHashTree:false to locusInfo.sync when skipHashTreeSync is true', async () => {
1723
1738
  const mockLocusInfo = {
1724
- syncAllHashTreeDatasets: sinon.stub().resolves(),
1739
+ sync: sinon.stub().resolves(),
1725
1740
  };
1741
+ const meeting1 = {locusInfo: mockLocusInfo};
1726
1742
 
1727
1743
  webex.meetings.request.getActiveMeetings = sinon.stub().resolves({loci: []});
1728
1744
  webex.meetings.meetingCollection.getAll = sinon.stub().returns({
1729
- meeting1: {locusInfo: mockLocusInfo},
1745
+ meeting1,
1730
1746
  });
1731
1747
 
1732
1748
  await webex.meetings.syncMeetings({keepOnlyLocusMeetings: false, skipHashTreeSync: true});
1733
1749
 
1734
1750
  assert.calledOnce(webex.meetings.request.getActiveMeetings);
1735
- assert.notCalled(mockLocusInfo.syncAllHashTreeDatasets);
1751
+ assert.calledOnceWithExactly(mockLocusInfo.sync, meeting1, {
1752
+ canSyncClassicLocus: false,
1753
+ canSyncHashTree: false,
1754
+ });
1736
1755
  });
1737
1756
 
1738
- it('should call syncAllHashTreeDatasets when skipHashTreeSync is false (default)', async () => {
1757
+ it('should pass canSyncHashTree:true to locusInfo.sync when skipHashTreeSync is false (default)', async () => {
1739
1758
  const mockLocusInfo = {
1740
- syncAllHashTreeDatasets: sinon.stub().resolves(),
1759
+ sync: sinon.stub().resolves(),
1741
1760
  };
1761
+ const meeting1 = {locusInfo: mockLocusInfo};
1742
1762
 
1743
1763
  webex.meetings.request.getActiveMeetings = sinon.stub().resolves({loci: []});
1744
1764
  webex.meetings.meetingCollection.getAll = sinon.stub().returns({
1745
- meeting1: {locusInfo: mockLocusInfo},
1765
+ meeting1,
1746
1766
  });
1747
1767
 
1748
1768
  await webex.meetings.syncMeetings({keepOnlyLocusMeetings: false, skipHashTreeSync: false});
1749
1769
 
1750
1770
  assert.calledOnce(webex.meetings.request.getActiveMeetings);
1751
- assert.calledOnce(mockLocusInfo.syncAllHashTreeDatasets);
1771
+ assert.calledOnceWithExactly(mockLocusInfo.sync, meeting1, {
1772
+ canSyncClassicLocus: false,
1773
+ canSyncHashTree: true,
1774
+ });
1752
1775
  });
1753
1776
  });
1754
1777
 
1755
- describe('syncAllHashTreeDatasets in syncMeetings', () => {
1756
- it('should call syncAllHashTreeDatasets for multiple meetings, skipping those without locusInfo', async () => {
1778
+ describe('per-meeting sync in syncMeetings', () => {
1779
+ it('should call locusInfo.sync for multiple meetings, skipping those without locusInfo', async () => {
1757
1780
  const mockLocusInfo1 = {
1758
- syncAllHashTreeDatasets: sinon.stub().resolves(),
1781
+ sync: sinon.stub().resolves(),
1759
1782
  };
1760
1783
  const mockLocusInfo2 = {
1761
- syncAllHashTreeDatasets: sinon.stub().resolves(),
1784
+ sync: sinon.stub().resolves(),
1762
1785
  };
1763
1786
 
1764
1787
  webex.meetings.request.getActiveMeetings = sinon.stub().resolves({loci: []});
@@ -1771,13 +1794,21 @@ describe('plugin-meetings', () => {
1771
1794
 
1772
1795
  await webex.meetings.syncMeetings({keepOnlyLocusMeetings: false});
1773
1796
 
1774
- assert.calledOnce(mockLocusInfo1.syncAllHashTreeDatasets);
1775
- assert.calledOnce(mockLocusInfo2.syncAllHashTreeDatasets);
1797
+ assert.calledOnceWithExactly(
1798
+ mockLocusInfo1.sync,
1799
+ {locusInfo: mockLocusInfo1},
1800
+ {canSyncClassicLocus: false, canSyncHashTree: true}
1801
+ );
1802
+ assert.calledOnceWithExactly(
1803
+ mockLocusInfo2.sync,
1804
+ {locusInfo: mockLocusInfo2},
1805
+ {canSyncClassicLocus: false, canSyncHashTree: true}
1806
+ );
1776
1807
  });
1777
1808
 
1778
- it('should not call syncAllHashTreeDatasets when getActiveMeetings throws an error', async () => {
1809
+ it('should not call locusInfo.sync when getActiveMeetings throws an error', async () => {
1779
1810
  const mockLocusInfo = {
1780
- syncAllHashTreeDatasets: sinon.stub().resolves(),
1811
+ sync: sinon.stub().resolves(),
1781
1812
  };
1782
1813
 
1783
1814
  webex.meetings.request.getActiveMeetings = sinon.stub().rejects(new Error('network error'));
@@ -1792,7 +1823,7 @@ describe('plugin-meetings', () => {
1792
1823
  assert.equal(err.message, 'network error');
1793
1824
  }
1794
1825
 
1795
- assert.notCalled(mockLocusInfo.syncAllHashTreeDatasets);
1826
+ assert.notCalled(mockLocusInfo.sync);
1796
1827
  });
1797
1828
  });
1798
1829
  });
@@ -1879,12 +1910,27 @@ describe('plugin-meetings', () => {
1879
1910
  });
1880
1911
 
1881
1912
  describe('wasm runtime performance telemetry', () => {
1913
+ const correlationId = 'wasm-corr-id';
1914
+ const benchmarkMeasurements = {
1915
+ divRatio: 1.888,
1916
+ sqrtRatio: 3.474,
1917
+ addNsPerOp: 2.006,
1918
+ addMedianMs: 32.1,
1919
+ divMedianMs: 60.6,
1920
+ sqrtMedianMs: 111.5,
1921
+ };
1882
1922
  const probeResult = {
1883
1923
  status: 'slow',
1884
1924
  capability: 'not capable',
1885
- ratio: 0.25,
1886
- wasmMs: 25,
1887
- jsMs: 100,
1925
+ reason: null,
1926
+ measurements: benchmarkMeasurements,
1927
+ };
1928
+ const expectedMetricFields = {
1929
+ status: probeResult.status,
1930
+ capability: probeResult.capability,
1931
+ reason: probeResult.reason,
1932
+ ...benchmarkMeasurements,
1933
+ correlation_id: correlationId,
1888
1934
  };
1889
1935
  let metricsSpy;
1890
1936
  let probeCheckStub;
@@ -1893,7 +1939,7 @@ describe('plugin-meetings', () => {
1893
1939
  webex.meetings.meetingInfo.fetchInfoOptions = sinon.stub().resolves({});
1894
1940
  webex.meetings.createMeeting = sinon
1895
1941
  .stub()
1896
- .returns(Promise.resolve({on: () => true, correlationId: 'wasm-corr-id'}));
1942
+ .returns(Promise.resolve({on: () => true, correlationId}));
1897
1943
  probeCheckStub = sinon.stub(WasmRuntimeProbe, 'check').resolves(probeResult);
1898
1944
  metricsSpy = sinon.stub(Metrics, 'sendBehavioralMetric');
1899
1945
  });
@@ -1908,13 +1954,11 @@ describe('plugin-meetings', () => {
1908
1954
  await testUtils.flushPromises();
1909
1955
 
1910
1956
  assert.calledOnceWithExactly(probeCheckStub);
1911
- assert.calledOnceWithExactly(metricsSpy, 'js_sdk_wasm_runtime_performance', {
1912
- status: 'slow',
1913
- ratio: 0.25,
1914
- wasmMs: 25,
1915
- jsMs: 100,
1916
- correlation_id: 'wasm-corr-id',
1917
- });
1957
+ assert.calledOnceWithExactly(
1958
+ metricsSpy,
1959
+ 'js_sdk_wasm_runtime_performance',
1960
+ expectedMetricFields
1961
+ );
1918
1962
  });
1919
1963
 
1920
1964
  it('logs the WASM runtime status after a meeting is created', async () => {
@@ -1939,12 +1983,35 @@ describe('plugin-meetings', () => {
1939
1983
  await testUtils.flushPromises();
1940
1984
 
1941
1985
  assert.calledOnceWithExactly(probeCheckStub);
1986
+ assert.calledOnceWithExactly(
1987
+ metricsSpy,
1988
+ 'js_sdk_wasm_runtime_performance',
1989
+ expectedMetricFields
1990
+ );
1991
+ });
1992
+
1993
+ it('emits the reason with null measurement fields when no measurements are available', async () => {
1994
+ probeCheckStub.resolves({
1995
+ status: 'unknown',
1996
+ capability: 'unknown',
1997
+ reason: 'worker_timeout',
1998
+ measurements: null,
1999
+ });
2000
+
2001
+ await webex.meetings.create(test1, test2);
2002
+ await testUtils.flushPromises();
2003
+
1942
2004
  assert.calledOnceWithExactly(metricsSpy, 'js_sdk_wasm_runtime_performance', {
1943
- status: 'slow',
1944
- ratio: 0.25,
1945
- wasmMs: 25,
1946
- jsMs: 100,
1947
- correlation_id: 'wasm-corr-id',
2005
+ status: 'unknown',
2006
+ capability: 'unknown',
2007
+ reason: 'worker_timeout',
2008
+ divRatio: null,
2009
+ sqrtRatio: null,
2010
+ addNsPerOp: null,
2011
+ addMedianMs: null,
2012
+ divMedianMs: null,
2013
+ sqrtMedianMs: null,
2014
+ correlation_id: correlationId,
1948
2015
  });
1949
2016
  });
1950
2017
 
@@ -1955,8 +2022,7 @@ describe('plugin-meetings', () => {
1955
2022
  const created = await webex.meetings.create(test1, test2);
1956
2023
  await testUtils.flushPromises();
1957
2024
 
1958
- // create() resolved normally with the meeting, i.e. the failed probe did not break it.
1959
- assert.equal(created.correlationId, 'wasm-corr-id');
2025
+ assert.equal(created.correlationId, correlationId);
1960
2026
  assert.notCalled(metricsSpy);
1961
2027
  assert.calledOnceWithExactly(
1962
2028
  loggerErrorStub,
@@ -2221,6 +2287,28 @@ describe('plugin-meetings', () => {
2221
2287
  assert.calledWith(webex.internal.mercury.on, OFFLINE);
2222
2288
  assert.callCount(webex.internal.mercury.on, 4);
2223
2289
  });
2290
+
2291
+ it('handles a rejected syncMeetings when the ONLINE event fires so it does not become an unhandled rejection', async () => {
2292
+ const syncError = new Error('sync failed');
2293
+ sinon.stub(webex.meetings, 'syncMeetings').rejects(syncError);
2294
+ const loggerWarnStub = sinon.stub(LoggerProxy.logger, 'warn');
2295
+
2296
+ webex.meetings.listenForEvents();
2297
+
2298
+ const onlineCallback = webex.internal.mercury.on
2299
+ .getCalls()
2300
+ .find((call) => call.args[0] === ONLINE).args[1];
2301
+
2302
+ // invoking the listener must not throw synchronously nor leave a rejection unhandled
2303
+ onlineCallback();
2304
+
2305
+ assert.calledOnceWithExactly(webex.meetings.syncMeetings, {keepOnlyLocusMeetings: false});
2306
+
2307
+ await testUtils.flushPromises();
2308
+
2309
+ assert.calledOnce(loggerWarnStub);
2310
+ assert.include(loggerWarnStub.firstCall.args[0], 'syncMeetings after ONLINE event failed');
2311
+ });
2224
2312
  });
2225
2313
  describe('#handleLocusMercury', () => {
2226
2314
  beforeEach(() => {
@@ -2680,7 +2768,11 @@ describe('plugin-meetings', () => {
2680
2768
  undefined,
2681
2769
  undefined,
2682
2770
  extraParams,
2683
- {meetingId: meeting.id, sendCAevents}
2771
+ {
2772
+ meetingId: meeting.id,
2773
+ sendCAevents,
2774
+ correlationId: meeting.correlationId,
2775
+ }
2684
2776
  );
2685
2777
  }
2686
2778
 
@@ -3377,6 +3469,16 @@ describe('plugin-meetings', () => {
3377
3469
  assert.equal(deletedMeetingInfo.roles, meetingIds.roles);
3378
3470
  assert.equal(deletedMeetingInfo.callStateForMetrics, meetingIds.callStateForMetrics);
3379
3471
  });
3472
+
3473
+ it('cleans up locusInfo (tearing down hash tree parsers) when destroying the meeting', async () => {
3474
+ const meeting = await webex.meetings.createMeeting('test', 'test');
3475
+ const locusInfoCleanUpSpy = sinon.spy(meeting.locusInfo, 'cleanUp');
3476
+
3477
+ webex.meetings.destroy(meeting, test1);
3478
+
3479
+ // hash tree parser teardown is deferred from MeetingUtil.cleanUp to Meetings#destroy
3480
+ assert.calledOnce(locusInfoCleanUpSpy);
3481
+ });
3380
3482
  });
3381
3483
 
3382
3484
  describe('with auto upload logs enabled', () => {
@@ -6,6 +6,7 @@ import {MediaType} from '@webex/internal-media-core';
6
6
  import {
7
7
  Configuration,
8
8
  Event,
9
+ getRemoteMediaManagerConfigForLogging,
9
10
  RemoteMediaManager,
10
11
  VideoLayoutChangedEventData,
11
12
  } from '@webex/plugin-meetings/src/multistream/remoteMediaManager';
@@ -120,6 +121,34 @@ const DefaultTestConfiguration: Configuration = {
120
121
  },
121
122
  };
122
123
 
124
+ describe('getRemoteMediaManagerConfigForLogging', () => {
125
+ it('returns undefined when no configuration is provided', () => {
126
+ assert.isUndefined(getRemoteMediaManagerConfigForLogging());
127
+ });
128
+
129
+ it('replaces layouts with their count and initial layout without mutating the configuration', () => {
130
+ const config = cloneDeep(DefaultTestConfiguration);
131
+ const originalConfig = cloneDeep(config);
132
+
133
+ const result = getRemoteMediaManagerConfigForLogging(config);
134
+
135
+ assert.deepEqual(result, {
136
+ ...config,
137
+ video: {
138
+ ...config.video,
139
+ layouts: {
140
+ count: Object.keys(config.video.layouts).length,
141
+ initial: {
142
+ id: config.video.initialLayoutId,
143
+ definition: config.video.layouts[config.video.initialLayoutId],
144
+ },
145
+ },
146
+ },
147
+ });
148
+ assert.deepEqual(config, originalConfig);
149
+ });
150
+ });
151
+
123
152
  describe('RemoteMediaManager', () => {
124
153
  let remoteMediaManager;
125
154
  let fakeReceiveSlotManager;
@@ -663,6 +692,23 @@ describe('RemoteMediaManager', () => {
663
692
  });
664
693
 
665
694
  describe('constructor', () => {
695
+ it('logs the compact remote media manager configuration', () => {
696
+ logger.log.resetHistory();
697
+
698
+ new RemoteMediaManager(
699
+ fakeReceiveSlotManager,
700
+ fakeMediaRequestManagers,
701
+ DefaultTestConfiguration
702
+ );
703
+
704
+ assert.calledOnceWithExactly(
705
+ logger.log,
706
+ `RemoteMediaManager#constructor --> RemoteMediaManager created with config: ${JSON.stringify(
707
+ getRemoteMediaManagerConfigForLogging(DefaultTestConfiguration)
708
+ )}`
709
+ );
710
+ });
711
+
666
712
  it('throws if the initial layout in the config is invalid', () => {
667
713
  const config = cloneDeep(DefaultTestConfiguration);
668
714
 
@@ -348,14 +348,18 @@ describe('SendSlotsManager', () => {
348
348
 
349
349
  describe('reset', () => {
350
350
  let mediaConnection;
351
+ let mockSlot: {unpublishStream: sinon.SinonStub};
351
352
 
352
353
  beforeEach(() => {
354
+ mockSlot = {
355
+ unpublishStream: sinon.stub().resolves(),
356
+ };
353
357
  mediaConnection = {
354
- createSendSlot: sinon.stub().returns({}),
358
+ createSendSlot: sinon.stub().returns(mockSlot),
355
359
  } as MultistreamRoapMediaConnection;
356
360
  });
357
361
 
358
- it('should reset the send slot manager', () => {
362
+ it('should unpublish and reset the send slot manager', () => {
359
363
  const AudioSlot = sendSlotsManager.createSlot(mediaConnection, MediaType.AudioMain);
360
364
  const VideoSlot = sendSlotsManager.createSlot(mediaConnection, MediaType.VideoMain);
361
365
  const AudioSlidesSlot = sendSlotsManager.createSlot(mediaConnection, MediaType.AudioSlides);
@@ -364,11 +368,35 @@ describe('SendSlotsManager', () => {
364
368
  expect(sendSlotsManager.getSlot(MediaType.VideoMain)).to.equal(VideoSlot);
365
369
  expect(sendSlotsManager.getSlot(MediaType.AudioSlides)).to.equal(AudioSlidesSlot);
366
370
  expect(sendSlotsManager.getSlot(MediaType.VideoSlides)).to.equal(VideoSlidesSlot);
371
+
367
372
  sendSlotsManager.reset();
373
+
368
374
  expect(() => sendSlotsManager.getSlot(MediaType.AudioMain)).to.throw();
369
375
  expect(() => sendSlotsManager.getSlot(MediaType.VideoMain)).to.throw();
370
376
  expect(() => sendSlotsManager.getSlot(MediaType.AudioSlides)).to.throw();
371
377
  expect(() => sendSlotsManager.getSlot(MediaType.VideoSlides)).to.throw();
378
+
379
+ // every slot must be unpublished (detaching its stream listeners) before being
380
+ // discarded, otherwise it stays subscribed to a stream that may be reused later
381
+ assert.callCount(mockSlot.unpublishStream, 4);
382
+ });
383
+
384
+ it('logs a warning and still clears the slots when unpublishStream rejects', async () => {
385
+ const error = new Error('cannot unpublish: peer connection is closed');
386
+ mockSlot.unpublishStream.rejects(error);
387
+
388
+ sendSlotsManager.createSlot(mediaConnection, MediaType.AudioMain);
389
+
390
+ sendSlotsManager.reset();
391
+
392
+ // allow the rejected unpublishStream promise's .catch() handler to run
393
+ await new Promise((resolve) => setImmediate(resolve));
394
+
395
+ expect(() => sendSlotsManager.getSlot(MediaType.AudioMain)).to.throw();
396
+ assert.calledWith(
397
+ LoggerProxy.logger.warn,
398
+ `SendSlotsManager->reset#Failed to unpublish stream for ${MediaType.AudioMain} while resetting: ${error.message}`
399
+ );
372
400
  });
373
401
  });
374
402