@webex/plugin-meetings 3.12.0-llmrefactor.17 → 3.12.0-llmrefactor.18

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.
@@ -93,10 +93,10 @@ Webex core Interceptor/request pipeline, JWT decoding/verification helpers, Meet
93
93
 
94
94
  | ID | WHAT | WHY | Source Evidence | Test / Example Evidence | Assumptions / Gaps | Confidence |
95
95
  |---|---|---|---|---|---|---|
96
- | `INTERCEPTORS-R-001` | retry eligible Locus failures using server delay/status rules. | Provides Webex-core request middleware for bounded Locus retries, Locus route-token propagation, and data-channel auth-token refresh. | `src/interceptors/index.ts` | `test/unit/spec/interceptors/dataChannelAuthToken.ts` | none | PRESENT |
96
+ | `INTERCEPTORS-R-001` | retry eligible Locus failures using status-based rules. | Provides Webex-core request middleware for bounded Locus retries, Locus route-token propagation, and data-channel auth-token refresh. | `src/interceptors/index.ts` | `test/unit/spec/interceptors/dataChannelAuthToken.ts` | none | PRESENT |
97
97
  | `INTERCEPTORS-R-002` | capture and attach route tokens keyed by Locus id. | A route or auth token attached to the wrong request can leak authority across meetings or retry indefinitely. | `src/interceptors/index.ts`, `src/interceptors/dataChannelAuthToken.ts` | `test/unit/spec/interceptors/dataChannelAuthToken.ts` | 30-second JWT boundary and refresh-key removal need explicit boundary coverage | PRESENT |
98
- | `INTERCEPTORS-R-003` | Failures outside the eligible retry branches reject with the original reason. For an eligible Locus 429/503 after this interceptor instance has already retried once, `LocusRetryStatusInterceptor.onResponseError()` clears its retry flag and rejects with the request `options` object rather than the original HTTP reason. Retry counters and token-refresh retries remain bounded per interceptor. | Bounded, request-scoped retry state prevents loops, while documenting the already-retried branch avoids a false unchanged-error guarantee. | `src/interceptors/locusRetry.ts`, `src/interceptors/dataChannelAuthToken.ts` | `test/unit/spec/interceptors/locusRetry.ts`, `test/unit/spec/interceptors/dataChannelAuthToken.ts` | none | PRESENT |
99
- | `INTERCEPTORS-R-004` | Locus retry handles one eligible 429/503 retry per interceptor instance using the `WeakMap` flag and the response `retry-after` value (default 2000 ms); Locus `/hashtree` and `/sync` 429/5xx responses are excluded. | Global request middleware must not amplify synchronization storms, retry terminal failures, or loop indefinitely. | `src/interceptors/locusRetry.ts` | `test/unit/spec/interceptors/locusRetry.ts` | none | PRESENT |
98
+ | `INTERCEPTORS-R-003` | Failures outside the eligible retry branches reject with the original reason. For an eligible Locus 429/503 after this interceptor instance has already retried once, `LocusRetryStatusInterceptor.onResponseError()` clears its retry flag and rejects with the original HTTP reason. Locus retries are bounded per interceptor; token-refresh retries are tracked through request options. | Rejecting the original reason preserves the terminal HTTP status and response details for callers. | `src/interceptors/locusRetry.ts`, `src/interceptors/dataChannelAuthToken.ts` | `test/unit/spec/interceptors/locusRetry.ts`, `test/unit/spec/interceptors/dataChannelAuthToken.ts` | none | PRESENT |
99
+ | `INTERCEPTORS-R-004` | Locus retry handles one eligible 429/503 retry per interceptor instance using the `WeakMap` flag and the existing delay selection (default 2000 ms); Locus `/hashtree` and `/sync` 429/5xx responses are excluded. | Global request middleware must not amplify synchronization storms, retry terminal failures, or loop indefinitely. | `src/interceptors/locusRetry.ts` | `test/unit/spec/interceptors/locusRetry.ts` | none | PRESENT |
100
100
  | `INTERCEPTORS-R-005` | Route tokens are extracted from supported Locus responses, keyed by Locus id, and attached only to matching requests. | Loose routing could omit a required token or leak it to an unrelated request. | `src/interceptors/locusRouteToken.ts` | `test/unit/spec/interceptors/locusRouteToken.ts` | none | PRESENT |
101
101
  | `INTERCEPTORS-R-006` | Data-channel JWTs are treated as expired when `exp` is within the 30-second (`30 * 1000`) buffer, refreshed when needed, and retried once after 2000 ms on eligible 401/403 responses. | Refreshing before expiry avoids a request racing token expiration without creating an authentication retry storm. | `src/interceptors/dataChannelAuthToken.ts`, `src/interceptors/utils.ts`, `src/interceptors/constant.ts` | `test/unit/spec/interceptors/dataChannelAuthToken.ts`, `test/unit/spec/interceptors/utils.ts` | none | PRESENT |
102
102
 
@@ -154,10 +154,10 @@ sequenceDiagram
154
154
  participant T as Token refresh
155
155
  W->>I: response failure or authenticated request
156
156
  alt eligible Locus 429/503 outside /hashtree and /sync with no prior retry
157
- I->>I: wait Retry-After or 2000 ms; retry once
157
+ I->>I: wait selected delay or 2000 ms; retry once
158
158
  I-->>W: retry result or rejection
159
159
  else eligible Locus request was already retried
160
- I--xW: reject with the options object
160
+ I--xW: reject with the original HTTP reason
161
161
  else data-channel 401/403 with enabled token
162
162
  I->>T: refresh token after 2000 ms
163
163
  T-->>I: token or failure
@@ -52,7 +52,7 @@ export default class LocusRetryStatusInterceptor extends Interceptor {
52
52
  if (hasRetriedLocusRequest) {
53
53
  rateLimitExpiryTime.set(this, false);
54
54
 
55
- return Promise.reject(options);
55
+ return Promise.reject(reason);
56
56
  }
57
57
  rateLimitExpiryTime.set(this, true);
58
58
 
@@ -157,6 +157,7 @@ import {
157
157
  Configuration as RemoteMediaManagerConfiguration,
158
158
  RemoteMediaManager,
159
159
  Event as RemoteMediaManagerEvent,
160
+ getRemoteMediaManagerConfigForLogging,
160
161
  } from '../multistream/remoteMediaManager';
161
162
  import {
162
163
  Reaction,
@@ -9030,9 +9031,16 @@ export default class Meeting extends StatelessWebexPlugin {
9030
9031
 
9031
9032
  this.hasMediaConnectionConnectedAtLeastOnce = false;
9032
9033
  const LOG_HEADER = 'Meeting:index#addMedia -->';
9034
+ const optionsForLogging = {
9035
+ ...options,
9036
+ remoteMediaManagerConfig: getRemoteMediaManagerConfigForLogging(
9037
+ options.remoteMediaManagerConfig
9038
+ ),
9039
+ };
9040
+
9033
9041
  LoggerProxy.logger.info(
9034
9042
  `${LOG_HEADER} called with: options=${JSON.stringify(
9035
- options
9043
+ optionsForLogging
9036
9044
  )}, turnServerInfo=${JSON.stringify(
9037
9045
  turnServerInfo
9038
9046
  )}, forceTurnDiscovery=${forceTurnDiscovery}, iceTransportPolicy=${iceTransportPolicy}`
@@ -53,6 +53,28 @@ export interface Configuration {
53
53
  namedMediaGroup?: NamedMediaGroup;
54
54
  }
55
55
 
56
+ export const getRemoteMediaManagerConfigForLogging = (config?: Configuration) => {
57
+ if (!config) {
58
+ return config;
59
+ }
60
+
61
+ const {initialLayoutId, layouts} = config.video;
62
+
63
+ return {
64
+ ...config,
65
+ video: {
66
+ ...config.video,
67
+ layouts: {
68
+ count: Object.keys(layouts).length,
69
+ initial: {
70
+ id: initialLayoutId,
71
+ definition: layouts[initialLayoutId],
72
+ },
73
+ },
74
+ },
75
+ };
76
+ };
77
+
56
78
  /* Predefined layouts: */
57
79
 
58
80
  // An "all equal" grid, with size up to 3 x 3 = 9:
@@ -335,7 +357,7 @@ export class RemoteMediaManager extends EventsScope {
335
357
 
336
358
  LoggerProxy.logger.log(
337
359
  `RemoteMediaManager#constructor --> RemoteMediaManager created with config: ${JSON.stringify(
338
- this.config
360
+ getRemoteMediaManagerConfigForLogging(this.config)
339
361
  )}`
340
362
  );
341
363
  }
@@ -192,6 +192,35 @@ describe('plugin-meetings', () => {
192
192
  });
193
193
  });
194
194
 
195
+ [
196
+ [429, WebexHttpError.TooManyRequests],
197
+ [503, WebexHttpError.ServiceUnavailable],
198
+ ].forEach(([statusCode, ErrorType]) => {
199
+ it(`rejects the HTTP ${statusCode} error after a locus retry is exhausted`, async () => {
200
+ const reason = new ErrorType({
201
+ statusCode,
202
+ options: {
203
+ headers: {trackingid: 'test', 'retry-after': 1000},
204
+ uri: options.uri,
205
+ },
206
+ body: {message: 'Locus request failed'},
207
+ });
208
+ const handleRetryStub = sinon
209
+ .stub(interceptor, 'handleRetryRequestLocusServiceError')
210
+ .resolves();
211
+
212
+ await interceptor.onResponseError(options, reason);
213
+
214
+ return interceptor.onResponseError(options, reason).then(
215
+ () => assert.fail('Expected promise to be rejected'),
216
+ (error) => {
217
+ expect(error).to.equal(reason);
218
+ handleRetryStub.restore();
219
+ }
220
+ );
221
+ });
222
+ });
223
+
195
224
  describe('URI parsing edge cases', () => {
196
225
  const make503Reason = (uri) =>
197
226
  new WebexHttpError.MethodNotAllowed({
@@ -330,4 +359,3 @@ describe('plugin-meetings', () => {
330
359
  });
331
360
  });
332
361
  });
333
-
@@ -3848,6 +3848,41 @@ describe('plugin-meetings', () => {
3848
3848
  assert.exists(meeting.addMedia);
3849
3849
  });
3850
3850
 
3851
+ it('logs a compact remote media manager configuration', async () => {
3852
+ const loggerInfoStub = sinon.stub(LoggerProxy.logger, 'info');
3853
+ const remoteMediaManagerConfig = {
3854
+ audio: {
3855
+ numOfActiveSpeakerStreams: 3,
3856
+ numOfScreenShareStreams: 1,
3857
+ },
3858
+ video: {
3859
+ preferLiveVideo: true,
3860
+ initialLayoutId: 'initial',
3861
+ layouts: {
3862
+ initial: {activeSpeakerVideoPaneGroups: []},
3863
+ excluded: {activeSpeakerVideoPaneGroups: []},
3864
+ },
3865
+ },
3866
+ };
3867
+
3868
+ const error = await assert.isRejected(
3869
+ meeting.addMediaInternal(() => 'JOIN_MEETING_FINAL', false, undefined, undefined, {
3870
+ remoteMediaManagerConfig,
3871
+ })
3872
+ );
3873
+
3874
+ assert.instanceOf(error, MeetingNotActiveError);
3875
+ assert.calledOnceWithExactly(
3876
+ loggerInfoStub,
3877
+ `Meeting:index#addMedia --> called with: options=${JSON.stringify({
3878
+ remoteMediaManagerConfig:
3879
+ RemoteMediaManagerModule.getRemoteMediaManagerConfigForLogging(
3880
+ remoteMediaManagerConfig
3881
+ ),
3882
+ })}, turnServerInfo=undefined, forceTurnDiscovery=false, iceTransportPolicy=undefined`
3883
+ );
3884
+ });
3885
+
3851
3886
  it('should reject promise if meeting is not active and the meeting in lobby is not enabled', async () => {
3852
3887
  const result = await assert.isRejected(meeting.addMedia({allowMediaInLobby: false}));
3853
3888
 
@@ -12,6 +12,7 @@ import * as BrowserDetectionModule from '@webex/plugin-meetings/src/common/brows
12
12
  import PasswordError from '@webex/plugin-meetings/src/common/errors/password-error';
13
13
  import CaptchaError from '@webex/plugin-meetings/src/common/errors/captcha-error';
14
14
  import {ServerRoles} from '@webex/plugin-meetings/src/member/types';
15
+ import {WebexHttpError} from '@webex/webex-core';
15
16
 
16
17
  describe('plugin-meetings', () => {
17
18
  let webex;
@@ -779,7 +780,15 @@ describe('plugin-meetings', () => {
779
780
  });
780
781
 
781
782
  it('should post client event with error when join fails', async () => {
782
- const joinError = new Error('Join failed');
783
+ const joinError = new WebexHttpError.TooManyRequests({
784
+ statusCode: 429,
785
+ body: {message: 'Locus rate limited'},
786
+ options: {
787
+ method: 'POST',
788
+ headers: {},
789
+ uri: 'https://locus.example.com/locus/api/v1/loci/call',
790
+ },
791
+ });
783
792
  meeting.meetingRequest.joinMeeting.rejects(joinError);
784
793
  meeting.meetingInfo = {meetingLookupUrl: 'test-lookup-url'};
785
794
 
@@ -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