@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.
- package/.sdd/manifest.json +1312 -0
- package/.sdd/templates/.source.json +30 -0
- package/.sdd/templates/component-repo/module-docs/module-spec-quality.md +111 -0
- package/.sdd/templates/component-repo/module-docs/module-spec.template.md +321 -0
- package/.sdd/templates/component-repo/reference-docs/adr/_adr-example.md +59 -0
- package/.sdd/templates/component-repo/reference-docs/patterns/_pattern-example.md +49 -0
- package/.sdd/templates/component-repo/reference-docs/rules/_rule-example.md +42 -0
- package/.sdd/templates/component-repo/standing-docs/AGENTS.template.md +120 -0
- package/.sdd/templates/component-repo/standing-docs/ARCHITECTURE.template.md +206 -0
- package/.sdd/templates/component-repo/standing-docs/CONTRACTS.template.md +90 -0
- package/.sdd/templates/component-repo/standing-docs/DATA_MODEL.template.md +68 -0
- package/.sdd/templates/component-repo/standing-docs/GETTING_STARTED.template.md +111 -0
- package/.sdd/templates/component-repo/standing-docs/GLOSSARY.template.md +57 -0
- package/.sdd/templates/component-repo/standing-docs/REVIEW_CHECKLIST.template.md +69 -0
- package/.sdd/templates/component-repo/standing-docs/RULES.template.md +96 -0
- package/.sdd/templates/component-repo/standing-docs/SECURITY.template.md +84 -0
- package/.sdd/templates/component-repo/standing-docs/SERVICE_STATE.template.md +82 -0
- package/.sdd/templates/component-repo/standing-docs/SPEC_INDEX.template.md +94 -0
- package/.sdd/templates/component-repo/standing-docs/TEST_INDEX.template.md +64 -0
- package/.sdd/templates/component-repo/template-map.json +112 -0
- package/AGENTS.md +130 -4
- package/ai-docs/ARCHITECTURE.md +208 -0
- package/ai-docs/CONTRACTS.md +267 -0
- package/ai-docs/DATA_MODEL.md +64 -0
- package/ai-docs/GETTING_STARTED.md +73 -0
- package/ai-docs/GLOSSARY.md +56 -0
- package/ai-docs/REVIEW_CHECKLIST.md +45 -0
- package/ai-docs/RULES.md +79 -0
- package/ai-docs/SECURITY.md +74 -0
- package/ai-docs/SERVICE_STATE.md +59 -0
- package/ai-docs/SPEC_INDEX.md +85 -0
- package/ai-docs/TEST_INDEX.md +45 -0
- package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +61 -0
- package/ai-docs/patterns/defensive-error-propagation.md +55 -0
- package/ai-docs/patterns/event-scope-emission.md +46 -0
- package/ai-docs/patterns/source-to-test-path-mirroring.md +45 -0
- package/ai-docs/patterns/stateless-plugin-request-classes.md +53 -0
- package/ai-docs/patterns/typed-constants-and-enum-values.md +47 -0
- package/assets/README.md +28 -0
- package/assets/e2ee-0.0.1.js +2 -0
- package/assets/e2ee-0.0.1.wasm +0 -0
- package/dist/aiEnableRequest/index.js +1 -1
- package/dist/annotation/index.js +55 -19
- package/dist/annotation/index.js.map +1 -1
- package/dist/assets/e2ee-0.0.1.js +2 -0
- package/dist/assets/e2ee-0.0.1.wasm +0 -0
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +39 -5
- package/dist/breakouts/index.js.map +1 -1
- package/dist/common/errors/webex-errors.js +7 -2
- package/dist/common/errors/webex-errors.js.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.js +6 -5
- package/dist/constants.js.map +1 -1
- package/dist/hashTree/hashTreeParser.js +101 -48
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interceptors/dataChannelAuthToken.js +41 -59
- package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
- package/dist/interceptors/locusRetry.js +1 -1
- package/dist/interceptors/locusRetry.js.map +1 -1
- package/dist/interpretation/index.js +46 -12
- package/dist/interpretation/index.js.map +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/index.js +236 -80
- package/dist/locus-info/index.js.map +1 -1
- package/dist/locus-info/types.js +2 -1
- package/dist/locus-info/types.js.map +1 -1
- package/dist/media/MediaConnectionAwaiter.js +225 -175
- package/dist/media/MediaConnectionAwaiter.js.map +1 -1
- package/dist/meeting/index.js +355 -299
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/util.js +8 -2
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting/voicea-meeting.js +2 -1
- package/dist/meeting/voicea-meeting.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +10 -3
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meetings/index.js +72 -31
- package/dist/meetings/index.js.map +1 -1
- package/dist/multistream/remoteMediaManager.js +32 -4
- package/dist/multistream/remoteMediaManager.js.map +1 -1
- package/dist/multistream/sendSlotManager.js +11 -1
- package/dist/multistream/sendSlotManager.js.map +1 -1
- package/dist/types/annotation/index.d.ts +19 -0
- package/dist/types/common/errors/webex-errors.d.ts +6 -2
- package/dist/types/config.d.ts +1 -0
- package/dist/types/constants.d.ts +2 -1
- package/dist/types/hashTree/hashTreeParser.d.ts +12 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/locus-info/index.d.ts +45 -1
- package/dist/types/locus-info/types.d.ts +1 -0
- package/dist/types/media/MediaConnectionAwaiter.d.ts +61 -53
- package/dist/types/meeting/index.d.ts +49 -12
- package/dist/types/meeting/util.d.ts +3 -1
- package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
- package/dist/types/meetings/index.d.ts +2 -1
- package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
- package/dist/types/multistream/sendSlotManager.d.ts +5 -1
- package/dist/webinar/index.js +298 -255
- package/dist/webinar/index.js.map +1 -1
- package/package.json +25 -23
- package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
- package/src/annotation/ai-docs/annotation-spec.md +236 -0
- package/src/annotation/index.ts +61 -29
- package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
- package/src/breakouts/index.ts +35 -2
- package/src/common/errors/webex-errors.ts +8 -2
- package/src/config.ts +5 -1
- package/src/constants.ts +2 -1
- package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
- package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
- package/src/hashTree/hashTreeParser.ts +67 -3
- package/src/index.ts +1 -0
- package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
- package/src/interceptors/dataChannelAuthToken.ts +48 -77
- package/src/interceptors/locusRetry.ts +1 -1
- package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
- package/src/interpretation/index.ts +38 -1
- package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
- package/src/locus-info/index.ts +156 -35
- package/src/locus-info/types.ts +1 -0
- package/src/media/MediaConnectionAwaiter.ts +223 -207
- package/src/media/ai-docs/media-spec.md +267 -0
- package/src/meeting/ai-docs/meeting-spec.md +404 -0
- package/src/meeting/index.ts +332 -296
- package/src/meeting/util.ts +7 -4
- package/src/meeting/voicea-meeting.ts +1 -1
- package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
- package/src/meeting-info/meeting-info-v2.ts +7 -2
- package/src/meetings/ai-docs/meetings-spec.md +296 -0
- package/src/meetings/index.ts +59 -23
- package/src/member/ai-docs/member-spec.md +196 -0
- package/src/members/ai-docs/members-spec.md +256 -0
- package/src/metrics/ai-docs/metrics-spec.md +185 -0
- package/src/multistream/ai-docs/multistream-spec.md +295 -0
- package/src/multistream/remoteMediaManager.ts +23 -1
- package/src/multistream/sendSlotManager.ts +15 -1
- package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
- package/src/reachability/ai-docs/reachability-spec.md +261 -0
- package/src/reactions/ai-docs/reactions-spec.md +198 -0
- package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
- package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
- package/src/roap/ai-docs/roap-spec.md +241 -0
- package/src/webinar/ai-docs/webinar-spec.md +243 -0
- package/src/webinar/index.ts +168 -188
- package/test/unit/spec/annotation/index.ts +214 -182
- package/test/unit/spec/breakouts/index.ts +145 -13
- package/test/unit/spec/hashTree/hashTreeParser.ts +212 -1
- package/test/unit/spec/interceptors/dataChannelAuthToken.ts +81 -99
- package/test/unit/spec/interceptors/locusRetry.ts +29 -1
- package/test/unit/spec/interpretation/index.ts +93 -0
- package/test/unit/spec/locus-info/index.js +397 -0
- package/test/unit/spec/media/MediaConnectionAwaiter.ts +426 -19
- package/test/unit/spec/media/properties.ts +3 -3
- package/test/unit/spec/meeting/index.js +1219 -723
- package/test/unit/spec/meeting/utils.js +52 -18
- package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
- package/test/unit/spec/meeting-info/meetinginfov2.js +69 -1
- package/test/unit/spec/meetings/index.js +145 -43
- package/test/unit/spec/multistream/remoteMediaManager.ts +46 -0
- package/test/unit/spec/multistream/sendSlotManager.ts +30 -2
- package/test/unit/spec/webinar/index.ts +886 -718
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
<!-- sdd-generated-metadata
|
|
2
|
+
doc_kind: module-spec
|
|
3
|
+
generated_from: module-spec@0.2.2
|
|
4
|
+
generator_plugin: repo-annotation@1.0.5+codex.20260818094939
|
|
5
|
+
generated_by: codex
|
|
6
|
+
approved_by: repository user
|
|
7
|
+
updated_at: 2026-08-22T15:21:29Z
|
|
8
|
+
validation_status: pass-with-warnings
|
|
9
|
+
-->
|
|
10
|
+
# CONTROLS OPTIONS MANAGER — SPEC
|
|
11
|
+
|
|
12
|
+
> Start here → root [`AGENTS.md`](../../../AGENTS.md) · router [`SPEC_INDEX.md`](../../../ai-docs/SPEC_INDEX.md) · system [`ARCHITECTURE.md`](../../../ai-docs/ARCHITECTURE.md). This is the canonical source-local spec for `src/controls-options-manager/`.
|
|
13
|
+
|
|
14
|
+
## Metadata
|
|
15
|
+
|
|
16
|
+
| Field | Value |
|
|
17
|
+
|---|---|
|
|
18
|
+
| Module id | `controls-options-manager` |
|
|
19
|
+
| Source path(s) | `src/controls-options-manager/` |
|
|
20
|
+
| Parent spec | — |
|
|
21
|
+
| Doc kind | Module spec |
|
|
22
|
+
| Coverage score | 93% assessed 2026-08-22; 13/14 mandatory fields present; all critical and Important fields present; one noncritical polish gap remains; pending independent validation of the participant-role repair |
|
|
23
|
+
| Generated from | `module-spec` @ SDLC template library `0.2.2` |
|
|
24
|
+
| generated_by / approved_by / updated_at | codex / repository user / 2026-08-22T15:21:29Z |
|
|
25
|
+
| Validation status | pass-with-warnings |
|
|
26
|
+
|
|
27
|
+
## Evidence Rules
|
|
28
|
+
|
|
29
|
+
Requirements cite current source and mirrored tests. Current code wins over retained prose when they conflict; commit and PR history are excluded. Missing evidence stays a gap.
|
|
30
|
+
|
|
31
|
+
## Source Material Register
|
|
32
|
+
|
|
33
|
+
| Source material | Scope | Decision | Detail location or disposition |
|
|
34
|
+
|---|---|---|---|
|
|
35
|
+
| No routed legacy module spec | overview / API / behavior / tests | none; generated from current manager/types/enums/constants/utilities and tests |
|
|
36
|
+
| Current source and mirrored tests | implementation / tests | verified | requirements, flows, failures, and test strategy below |
|
|
37
|
+
|
|
38
|
+
## Overview
|
|
39
|
+
|
|
40
|
+
`src/controls-options-manager/` contains 5 direct source/reference file(s) and has 2 mirrored unit-test file(s). This spec separates its public operations, runtime data movement, component ownership, state applicability, and verification boundary.
|
|
41
|
+
|
|
42
|
+
## Purpose / Responsibility
|
|
43
|
+
|
|
44
|
+
Validates requested meeting-control mutations against display hints, builds the declared control bodies, and sends them through the owning Meeting request object.
|
|
45
|
+
|
|
46
|
+
## Stack
|
|
47
|
+
|
|
48
|
+
TypeScript/JavaScript in the Node 22.14 Yarn workspace; Webex core/plugin abstractions and Mocha/Sinon/`@webex/test-helper-chai` tests.
|
|
49
|
+
|
|
50
|
+
## Folder / Package Structure
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
src/controls-options-manager/
|
|
54
|
+
├── constants.ts — module constants and wire values
|
|
55
|
+
├── enums.ts — declared action/control enum values
|
|
56
|
+
├── index.ts — module facade/controller or primary exports
|
|
57
|
+
├── types.ts — module type declarations
|
|
58
|
+
├── util.ts — normalization/helper functions
|
|
59
|
+
└── ai-docs/controls-options-manager-spec.md — canonical module specification
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Key Files (source of truth)
|
|
63
|
+
|
|
64
|
+
| File | Holds |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `src/controls-options-manager/constants.ts` | module constants and wire values |
|
|
67
|
+
| `src/controls-options-manager/enums.ts` | declared action/control enum values |
|
|
68
|
+
| `src/controls-options-manager/index.ts` | module facade/controller or primary exports |
|
|
69
|
+
| `src/controls-options-manager/types.ts` | module type declarations |
|
|
70
|
+
| `src/controls-options-manager/util.ts` | normalization/helper functions |
|
|
71
|
+
| `test/unit/spec/controls-options-manager/index.js` and 1 sibling test file(s) | mirrored characterization/unit coverage |
|
|
72
|
+
|
|
73
|
+
## Public Surface
|
|
74
|
+
|
|
75
|
+
| Contract ID | Type | Surface | Purpose | Compatibility / deprecation | Schema / detail link | Root index |
|
|
76
|
+
|---|---|---|---|---|---|---|
|
|
77
|
+
| `controls-options-manager.1` | SDK / configuration | `set()`, `setLocusUrl()`, `setDisplayHints()`, `getLocusUrl()`, and `getDisplayHints()` | Hold current/main Locus URLs and display hints used to authorize later control mutations. | Preserve current setter/getter semantics; no normalized query projection is exposed. | `src/controls-options-manager/index.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
|
|
78
|
+
| `controls-options-manager.2` | SDK / remote | `update(ControlConfig[])` | Validate each scoped mutation with `Utils.canUpdate()` and send the generated requests sequentially. | Unknown scopes and denied capabilities both throw synchronously while the batch is mapped; preserve request ordering and the returned request promise. | `src/controls-options-manager/index.ts`, `src/controls-options-manager/util.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
|
|
79
|
+
| `controls-options-manager.3` | SDK / remote | `setMuteOnEntry()`, `setDisallowUnmute()`, and `setMuteAll()` | Build the audio-control bodies permitted by current display hints and route them to main/breakout Locus context. | Preserve body keys, capability checks, and breakout authorization selection. | `src/controls-options-manager/index.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
|
|
80
|
+
| `controls-options-manager.4` | exported predicates | `Utils.canSetMuteOnEntry()`, `canUnsetMuteOnEntry()`, `canSetDisallowUnmute()`, `canUnsetDisallowUnmute()`, `canSetMuted()`, `canUnsetMuted()`, `hasHints()`, `hasPolicies()`, `canUpdateAudio()`, `canUpdateRaiseHand()`, `canUpdateReactions()`, `canUpdateShareControl()`, `canUpdateViewTheParticipantsList()`, `canUpdateVideo()`, `canUpdateAnnotation()`, `canUpdateRemoteDesktopControl()`, and `canUpdatePollingQA()` | Centralize capability interpretation for every supported control family. | These are static utilities, not manager instance query APIs. | `src/controls-options-manager/util.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
|
|
81
|
+
| `controls-options-manager.5` | exported routing utilities | `Utils.canUpdate()`, `isAudioControl()`, `isBreakoutLocusUrl()`, and `getControlsRequestParams()` | Select the permitted control family, request URL, and request body for each mutation. | Preserve scope matching and main-versus-breakout routing rules. | `src/controls-options-manager/util.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
|
|
82
|
+
| `controls-options-manager.6` | exported class/constants/types | `ControlsOptionsManager`, `ENABLED`, `CAN_SET`, `CAN_UNSET`, `AUDIO_CONTROL_BODY_KEYS`, `Control`, `Setting`, `ControlProperties`, `AudioProperties`, `RaiseHandProperties`, `ReactionsProperties`, `ShareControlProperties`, `VideoProperties`, `ViewTheParticipantListProperties`, `AnnotationProperties`, `RemoteDesktopControlProperties`, `PollingQAProperties`, `Properties`, and `ControlConfig` | Share the exact configuration vocabulary accepted by `update()`. | Raw control/setting/body-key values and discriminated property shapes are compatibility-sensitive. | `src/controls-options-manager/index.ts`, `src/controls-options-manager/constants.ts`, `src/controls-options-manager/enums.ts`, `src/controls-options-manager/types.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
|
|
83
|
+
|
|
84
|
+
### Emitted events
|
|
85
|
+
|
|
86
|
+
Current source emits or forwards these observable literals for this operation boundary. Preserve literal values, scope, payload shape, and emission timing; a constant name alone is not a substitute for the consumer-visible value.
|
|
87
|
+
|
|
88
|
+
| Event literal | Constant / expression | Emission evidence |
|
|
89
|
+
|---|---|---|
|
|
90
|
+
| `meeting:actionsUpdate` | `EVENT_TRIGGERS.MEETING_ACTIONS_UPDATE` | `src/meeting/index.ts` |
|
|
91
|
+
| `meeting:controls:ai-summary-notification:updated` | `EVENT_TRIGGERS.MEETING_CONTROLS_AI_SUMMARY_NOTIFICATION_UPDATED` | `src/meeting/index.ts` |
|
|
92
|
+
| `meeting:controls:annotation:updated` | `EVENT_TRIGGERS.MEETING_CONTROLS_ANNOTATION_UPDATED` | `src/meeting/index.ts` |
|
|
93
|
+
| `meeting:controls:auto-end-meeting-warning:updated` | `EVENT_TRIGGERS.MEETING_CONTROLS_AUTO_END_MEETING_WARNING_UPDATED` | `src/meeting/index.ts` |
|
|
94
|
+
| `meeting:controls:disallow-unmute:updated` | `EVENT_TRIGGERS.MEETING_CONTROLS_DISALLOW_UNMUTE_UPDATED` | `src/meeting/index.ts` |
|
|
95
|
+
| `meeting:controls:meeting-full:updated` | `EVENT_TRIGGERS.MEETING_CONTROLS_MEETING_FULL_UPDATED` | `src/meeting/index.ts` |
|
|
96
|
+
| `meeting:controls:mute-on-entry:updated` | `EVENT_TRIGGERS.MEETING_CONTROLS_MUTE_ON_ENTRY_UPDATED` | `src/meeting/index.ts` |
|
|
97
|
+
| `meeting:controls:polling-qa:updated` | `EVENT_TRIGGERS.MEETING_CONTROLS_POLLING_QA_UPDATED` | `src/meeting/index.ts` |
|
|
98
|
+
| `meeting:controls:practice-session-status:updated` | `EVENT_TRIGGERS.MEETING_CONTROLS_PRACTICE_SESSION_STATUS_UPDATED` | `src/meeting/index.ts` |
|
|
99
|
+
| `meeting:controls:raise-hand:updated` | `EVENT_TRIGGERS.MEETING_CONTROLS_RAISE_HAND_UPDATED` | `src/meeting/index.ts` |
|
|
100
|
+
| `meeting:controls:reactions:updated` | `EVENT_TRIGGERS.MEETING_CONTROLS_REACTIONS_UPDATED` | `src/meeting/index.ts` |
|
|
101
|
+
| `meeting:controls:remote-desktop-control:updated` | `EVENT_TRIGGERS.MEETING_CONTROLS_REMOTE_DESKTOP_CONTROL_UPDATED` | `src/meeting/index.ts` |
|
|
102
|
+
| `meeting:controls:share-control:updated` | `EVENT_TRIGGERS.MEETING_CONTROLS_SHARE_CONTROL_UPDATED` | `src/meeting/index.ts` |
|
|
103
|
+
| `meeting:controls:stage-view:updated` | `EVENT_TRIGGERS.MEETING_CONTROLS_STAGE_VIEW_UPDATED` | `src/meeting/index.ts` |
|
|
104
|
+
| `meeting:controls:video:updated` | `EVENT_TRIGGERS.MEETING_CONTROLS_VIDEO_UPDATED` | `src/meeting/index.ts` |
|
|
105
|
+
| `meeting:controls:view-the-participants-list:updated` | `EVENT_TRIGGERS.MEETING_CONTROLS_VIEW_THE_PARTICIPANTS_LIST_UPDATED` | `src/meeting/index.ts` |
|
|
106
|
+
| `meeting:controls:webcast:updated` | `EVENT_TRIGGERS.MEETING_CONTROLS_WEBCAST_UPDATED` | `src/meeting/index.ts` |
|
|
107
|
+
| `meeting:layout:update` | `EVENT_TRIGGERS.MEETING_CONTROLS_LAYOUT_UPDATE` | `src/meeting/index.ts` |
|
|
108
|
+
|
|
109
|
+
Compatibility notes:
|
|
110
|
+
- Prefer additive fields/options and preserve current return and rejection semantics. Internal helpers are not public merely because they are exported within the source directory.
|
|
111
|
+
|
|
112
|
+
## Requires (dependencies)
|
|
113
|
+
|
|
114
|
+
Locus controls, control/setting enums, constants, utility normalization, parent meeting request access, and role/capability state.
|
|
115
|
+
|
|
116
|
+
## Requirements
|
|
117
|
+
|
|
118
|
+
| ID | WHAT | WHY | Source Evidence | Test / Example Evidence | Assumptions / Gaps | Confidence |
|
|
119
|
+
|---|---|---|---|---|---|---|
|
|
120
|
+
| `CONTROLS-OPTIONS-MANAGER-R-001` | `update` validates each `ControlConfig` scope and display-hint capability, builds one request body per control, and sends them sequentially. | Invalid or unauthorized shared-control mutations must fail before they reach Locus, and accepted mutations must preserve caller order. | `src/controls-options-manager/index.ts`, `src/controls-options-manager/util.ts` | `test/unit/spec/controls-options-manager/index.js` | none | PRESENT |
|
|
121
|
+
| `CONTROLS-OPTIONS-MANAGER-R-002` | `ControlsOptionsManager` exposes URL/hint accessors and mutation methods; `canSet*`, `canUnset*`, and `canUpdate*` predicates are static methods on `util.ts`, not instance query APIs or normalized properties. | Consumers must not depend on an availability/current-value surface the manager does not implement. | `src/controls-options-manager/index.ts`, `src/controls-options-manager/util.ts` | `test/unit/spec/controls-options-manager/index.js`, `test/unit/spec/controls-options-manager/util.js` | none | PRESENT |
|
|
122
|
+
| `CONTROLS-OPTIONS-MANAGER-R-003` | Missing `locusUrl` returns a rejected promise, an unknown scope or failed `canUpdate` check throws synchronously in `update`, and legacy audio setters reject unauthorized values; the module allocates no listener or timer. | Callers must distinguish validation throws from returned request rejections and must not expect cleanup behavior the module does not own. | `src/controls-options-manager/` | `test/unit/spec/controls-options-manager/index.js` | none | PRESENT |
|
|
123
|
+
|
|
124
|
+
## Design Overview
|
|
125
|
+
|
|
126
|
+
`index.ts` stores request context, validates mutations using static predicates from `util.ts`, builds control request bodies, and sends them through `request` or `locusDeltaRequest`. It exposes no normalized-control property or enabled-state query surface and owns no listeners or timers.
|
|
127
|
+
|
|
128
|
+
## Data Flow
|
|
129
|
+
|
|
130
|
+
```mermaid
|
|
131
|
+
flowchart LR
|
|
132
|
+
Caller[Meeting / consumer] --> Manager[index.ts mutation methods]
|
|
133
|
+
Hints[display hints + current controls callback] --> Manager
|
|
134
|
+
Types[constants.ts / enums.ts / types.ts] --> Util[util.ts capability and request helpers]
|
|
135
|
+
Manager --> Util
|
|
136
|
+
Util --> Body[control-setting request params]
|
|
137
|
+
Body --> Parent[Meeting request owner]
|
|
138
|
+
Parent --> Locus[Locus controls endpoint]
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Sequence Diagram(s)
|
|
142
|
+
|
|
143
|
+
Sequence coverage:
|
|
144
|
+
|
|
145
|
+
| Operation group | Diagram | Failure coverage |
|
|
146
|
+
|---|---|---|
|
|
147
|
+
| UC-1…UC-4 — control mutation operation groups | Control mutation primary sequence | unknown scope, denied display hint, missing Locus URL, and request rejection |
|
|
148
|
+
| UC-1…UC-4 — control mutation alternate/failure paths | Control mutation alternate/failure sequence | unknown control/setting, absent capability, or malformed Locus control data |
|
|
149
|
+
|
|
150
|
+
### Control mutation primary sequence
|
|
151
|
+
|
|
152
|
+
```mermaid
|
|
153
|
+
sequenceDiagram
|
|
154
|
+
participant P as Meeting parent
|
|
155
|
+
participant M as ControlsOptionsManager
|
|
156
|
+
participant U as util.ts
|
|
157
|
+
P->>M: update(...ControlConfig)
|
|
158
|
+
M->>U: canUpdate(control, displayHints)
|
|
159
|
+
U-->>M: allowed or denied
|
|
160
|
+
M->>U: getControlsRequestParams(body, locus URLs)
|
|
161
|
+
U-->>M: PATCH request params
|
|
162
|
+
M->>P: request/locusDeltaRequest(params)
|
|
163
|
+
P-->>M: request outcome
|
|
164
|
+
M-->>P: sequential update promise outcome
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Control mutation alternate/failure sequence
|
|
168
|
+
|
|
169
|
+
```mermaid
|
|
170
|
+
sequenceDiagram
|
|
171
|
+
participant C as Caller / current input owner
|
|
172
|
+
participant M as ControlsOptionsManager
|
|
173
|
+
C->>M: request control mutation
|
|
174
|
+
alt locusUrl missing
|
|
175
|
+
M--xC: rejected promise
|
|
176
|
+
else scope unknown or capability denied by update
|
|
177
|
+
M--xC: synchronous Error / PermissionError
|
|
178
|
+
else accepted
|
|
179
|
+
M-->>C: owning request promise outcome
|
|
180
|
+
end
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Class / Component Relationships
|
|
184
|
+
|
|
185
|
+
```mermaid
|
|
186
|
+
classDiagram
|
|
187
|
+
class Locus
|
|
188
|
+
class Util
|
|
189
|
+
class Manager
|
|
190
|
+
class Types
|
|
191
|
+
class Body
|
|
192
|
+
class Parent
|
|
193
|
+
Manager --> Util
|
|
194
|
+
Types --> Util
|
|
195
|
+
Manager --> Body
|
|
196
|
+
Body --> Parent
|
|
197
|
+
Parent --> Locus
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
The arrows identify ownership and delegation inside `src/controls-options-manager/`; files that only declare types or constants are not presented as transports.
|
|
201
|
+
|
|
202
|
+
## Use Cases
|
|
203
|
+
|
|
204
|
+
- **UC-1:** Refresh current/main Locus URLs and display hints, then read those raw values without expecting a normalized control projection. Evidence: `src/controls-options-manager/index.ts`.
|
|
205
|
+
- **UC-2:** Validate and sequentially send a batch of scoped `ControlConfig` mutations using `Utils.canUpdate()` and `getControlsRequestParams()`. Evidence: `src/controls-options-manager/index.ts`, `src/controls-options-manager/util.ts`.
|
|
206
|
+
- **UC-3:** Build mute-on-entry and disallow-unmute bodies only when the matching set/unset display hints permit the requested value. Evidence: `src/controls-options-manager/index.ts`, `src/controls-options-manager/util.ts`.
|
|
207
|
+
- **UC-4:** Route mute-all to the appropriate main or breakout Locus authorization context and preserve permission/request failures. Evidence: `src/controls-options-manager/index.ts`, `src/controls-options-manager/util.ts`.
|
|
208
|
+
|
|
209
|
+
## State Model
|
|
210
|
+
|
|
211
|
+
The manager stores current/main Locus URLs, display hints, and callbacks for current controls/webinar status. It does not maintain a normalized control projection.
|
|
212
|
+
|
|
213
|
+
## Business Rules & Invariants
|
|
214
|
+
|
|
215
|
+
- A setting can be changed only when its control advertises the matching capability; request body keys use the declared control/setting map. Enforced under `src/controls-options-manager/`.
|
|
216
|
+
|
|
217
|
+
## Error Handling & Failure Modes
|
|
218
|
+
|
|
219
|
+
| Condition | Signal | Caller recovery |
|
|
220
|
+
|---|---|---|
|
|
221
|
+
| `locusUrl` is absent | Rejected `ParameterError` promise. | Set the current Locus URL before retrying. |
|
|
222
|
+
| Scope is unknown or `Util.canUpdate` denies it | Synchronous `Error` or `PermissionError` from `update`. | Correct the scope/properties or wait for matching display hints. |
|
|
223
|
+
| Request dependency rejects | Returned update/audio-control promise rejects. | Preserve the dependency error; retry only under caller policy. |
|
|
224
|
+
|
|
225
|
+
## Pitfalls
|
|
226
|
+
|
|
227
|
+
- The static `Util.canSet*`/`canUnset*`/`canUpdate*` predicates are implementation helpers, not instance query methods on `ControlsOptionsManager`.
|
|
228
|
+
- Verify both typed constants/enums and raw wire values before changing a logical condition in this legacy package.
|
|
229
|
+
|
|
230
|
+
## Test-Case Strategy (module)
|
|
231
|
+
|
|
232
|
+
Use the current mirrored suites: `test/unit/spec/controls-options-manager/index.js`, `test/unit/spec/controls-options-manager/util.js`. Characterize the controls-options-manager-specific use cases above and each listed failure condition; add cleanup or transition cases only for resources and state this module actually owns.
|
|
233
|
+
|
|
234
|
+
| Behavior / Requirement | Existing test evidence | Gap |
|
|
235
|
+
|---|---|---|
|
|
236
|
+
| `CONTROLS-OPTIONS-MANAGER-R-001` | `test/unit/spec/controls-options-manager/index.js` | cover every `Control`/`Setting` capability predicate and route |
|
|
237
|
+
| `CONTROLS-OPTIONS-MANAGER-R-002` | `test/unit/spec/controls-options-manager/index.js` | cover mixed-control batches and prove request order plus main/breakout URL selection |
|
|
238
|
+
| `CONTROLS-OPTIONS-MANAGER-R-003` | `test/unit/spec/controls-options-manager/index.js` | distinguish synchronous unknown-scope and permission errors from missing-URL and dependency promise rejections |
|
|
239
|
+
|
|
240
|
+
## Traceability
|
|
241
|
+
|
|
242
|
+
- Repo architecture: [`ARCHITECTURE.md`](../../../ai-docs/ARCHITECTURE.md) · Registry: [`SPEC_INDEX.md`](../../../ai-docs/SPEC_INDEX.md)
|
|
243
|
+
- Coverage state and contracts baseline: `../../../.sdd/manifest.json`
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
<!-- sdd-generated-metadata
|
|
2
|
+
doc_kind: module-spec
|
|
3
|
+
generated_from: module-spec@0.2.2
|
|
4
|
+
generator_plugin: repo-annotation@1.0.5+codex.20260818094939
|
|
5
|
+
generated_by: codex
|
|
6
|
+
approved_by: repository user
|
|
7
|
+
updated_at: 2026-09-08T00:00:00Z
|
|
8
|
+
validation_status: pass-with-warnings
|
|
9
|
+
-->
|
|
10
|
+
# HASH TREE — SPEC
|
|
11
|
+
|
|
12
|
+
> Start here → root [`AGENTS.md`](../../../AGENTS.md) · router [`SPEC_INDEX.md`](../../../ai-docs/SPEC_INDEX.md) · system [`ARCHITECTURE.md`](../../../ai-docs/ARCHITECTURE.md). This is the canonical source-local spec for `src/hashTree/`.
|
|
13
|
+
|
|
14
|
+
## Metadata
|
|
15
|
+
|
|
16
|
+
| Field | Value |
|
|
17
|
+
|---|---|
|
|
18
|
+
| Module id | `hashTree` |
|
|
19
|
+
| Source path(s) | `src/hashTree/` |
|
|
20
|
+
| Parent spec | — |
|
|
21
|
+
| Doc kind | Module spec |
|
|
22
|
+
| Coverage score | 93% assessed 2026-08-22; 13/14 mandatory fields present; all critical and Important fields present; one noncritical polish gap remains; pending independent validation of the participant-role repair |
|
|
23
|
+
| Generated from | `module-spec` @ SDLC template library `0.2.2` |
|
|
24
|
+
| generated_by / approved_by / updated_at | codex / repository user / 2026-09-08T00:00:00Z |
|
|
25
|
+
| Revalidated against | `b7b93b443e` (manual diff review of `f9a29f61..b7b93b443e`; not a generator/validator tool run) |
|
|
26
|
+
| Validation status | pass-with-warnings |
|
|
27
|
+
|
|
28
|
+
## Evidence Rules
|
|
29
|
+
|
|
30
|
+
Requirements cite current implementation and mirrored unit-test paths. Current code wins over retained prose when they conflict; commit and PR history are excluded by repository-owner decision. Missing test evidence is stated as a gap rather than inferred.
|
|
31
|
+
|
|
32
|
+
## Source Material Register
|
|
33
|
+
|
|
34
|
+
| Source material | Scope | Decision | Detail location or disposition |
|
|
35
|
+
|---|---|---|---|
|
|
36
|
+
| No routed legacy module spec | overview / API / behavior / tests | none; generated from current hash-tree code and tests |
|
|
37
|
+
| Current source and mirrored tests | implementation / tests | verified | requirements, flows, failures, and test strategy below |
|
|
38
|
+
|
|
39
|
+
## Overview
|
|
40
|
+
|
|
41
|
+
`src/hashTree/` contains 5 direct source/reference file(s) and has 3 mirrored unit-test file(s). This spec separates its public operations, runtime data movement, component ownership, state applicability, and verification boundary.
|
|
42
|
+
|
|
43
|
+
## Purpose / Responsibility
|
|
44
|
+
|
|
45
|
+
Tracks incremental Locus dataset versions, detects gaps, fetches missing datasets, and emits typed update callbacks.
|
|
46
|
+
|
|
47
|
+
## Stack
|
|
48
|
+
|
|
49
|
+
TypeScript/JavaScript in the Node 22.14 Yarn workspace; Webex core/plugin abstractions and Mocha/Sinon/`@webex/test-helper-chai` tests. Build target: `yarn workspace @webex/plugin-meetings build:src`.
|
|
50
|
+
|
|
51
|
+
## Folder / Package Structure
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
src/hashTree/
|
|
55
|
+
├── constants.ts — module constants and wire values
|
|
56
|
+
├── hashTree.ts — hashTree implementation responsibility
|
|
57
|
+
├── hashTreeParser.ts — hashTreeParser implementation responsibility
|
|
58
|
+
├── types.ts — module type declarations
|
|
59
|
+
├── utils.ts — normalization/helper functions
|
|
60
|
+
└── ai-docs/hash-tree-spec.md — canonical module specification
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Key Files (source of truth)
|
|
64
|
+
|
|
65
|
+
| File | Holds |
|
|
66
|
+
|---|---|
|
|
67
|
+
| `src/hashTree/constants.ts` | module constants and wire values |
|
|
68
|
+
| `src/hashTree/hashTree.ts` | hashTree implementation responsibility |
|
|
69
|
+
| `src/hashTree/hashTreeParser.ts` | hashTreeParser implementation responsibility |
|
|
70
|
+
| `src/hashTree/types.ts` | module type declarations |
|
|
71
|
+
| `src/hashTree/utils.ts` | normalization/helper functions |
|
|
72
|
+
| `test/unit/spec/hashTree/hashTree.ts` and 2 sibling test file(s) | mirrored characterization/unit coverage |
|
|
73
|
+
|
|
74
|
+
## Public Surface
|
|
75
|
+
|
|
76
|
+
| Contract ID | Type | Surface | Purpose | Compatibility / deprecation | Schema / detail link | Root index |
|
|
77
|
+
|---|---|---|---|---|---|---|
|
|
78
|
+
| `hashTree.1` | in-memory structure | `HashTree.putItem()`, `putItems()`, `removeItem()`, `removeItems()`, and `updateItems()` | Apply version-aware leaf mutations to the pure hash-tree data structure. | Older/equal item versions do not replace newer data; preserve leaf-bucket semantics. | `src/hashTree/hashTree.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
|
|
79
|
+
| `hashTree.2` | in-memory structure | `computeLeafHash()`, `computeTreeHashes()`, `getHashes()`, `getRootHash()`, `getLeafCount()`, `getTotalItemCount()`, `getLeafData()`, and `getItemVersion()` | Compute and inspect dataset hashes and stored item/version information. | Hash ordering and result shapes are synchronization contracts. | `src/hashTree/hashTree.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
|
|
80
|
+
| `hashTree.3` | in-memory structure | `HashTree.resize()` and `diffHashes()` | Resize the leaf layout and locate differing hash ranges during synchronization. | Preserve deterministic redistribution and diff-index semantics. | `src/hashTree/hashTree.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
|
|
81
|
+
| `hashTree.4` | parser initialization | `HashTreeParser.initializeFromMessage()` and `initializeFromGetLociResponse()` | Seed dataset state from Mercury hash-tree metadata or a get-loci response before applying deltas. | Preserve dataset initialization priority and callback timing. | `src/hashTree/hashTreeParser.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
|
|
82
|
+
| `hashTree.5` | parser updates | `handleMetadataUpdate()`, `handleLocusUpdate()`, and `handleMessage()` | Apply message items, emit the resulting callback, and schedule any root-hash reconciliation required for the dataset. | Preserve the implemented ordering: `parseMessage()` mutates item state, `handleMessage()` invokes the callback, and the delayed sync algorithm checks the resulting root hash separately. | `src/hashTree/hashTreeParser.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
|
|
83
|
+
| `hashTree.6` | parser synchronization | `syncAllDatasets()`, `resumeFromMessage()`, and `resumeFromApiResponse()` | Fetch/replace missing datasets and resume queued processing from the synchronized view. | Preserve ended/not-found sentinel handling and stopped-parser guards. | `src/hashTree/hashTreeParser.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
|
|
84
|
+
| `hashTree.7` | parser lifecycle | `stop()` and `cleanUp()` | Stop future mutation and release queued/parser-owned state. | Work completed after stop must not mutate the stopped parser. | `src/hashTree/hashTreeParser.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
|
|
85
|
+
| `hashTree.8` | exported contracts/helpers | `EMPTY_HASH`, `DataSetNames`, `DATA_SET_INIT_PRIORITY`, `LLM_DATASET_NAMES`, `LeafDataItem`, `SyncAllBackoffType`, `DataSet`, `RootHashMessage`, `HashTreeMessage`, `VisibleDataSetInfo`, `LocusInfoUpdateType`, `LocusInfoUpdate`, `LocusInfoUpdateCallback`, `SyncLatencyTracker`, `HashTreeParserCallbacks`, `MeetingEndedError`, `LocusNotFoundError`, `ObjectType`, `ObjectTypeToLocusKeyMap`, `HtMeta`, `HashTreeObject`, `isSelf()`, `isMetadata()`, `deleteNestedObjectsWithHtMeta()`, `sortByInitPriority()`, and `sleep()` | Share the exact dataset protocol vocabulary, sentinel errors, and normalization helpers used by Locus integration. | Preserve dataset names, error identity, ordering, and raw message fields. | `src/hashTree/hashTree.ts`, `src/hashTree/hashTreeParser.ts`, `src/hashTree/types.ts`, `src/hashTree/constants.ts`, `src/hashTree/utils.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
|
|
86
|
+
|
|
87
|
+
Compatibility notes:
|
|
88
|
+
- Prefer additive options and payload fields. Preserve method/event names, rejection semantics, and cleanup timing; route public changes through `src/index.ts` or the documented owning object.
|
|
89
|
+
|
|
90
|
+
## Requires (dependencies)
|
|
91
|
+
|
|
92
|
+
Hash-tree wire messages, dataset request function, Locus identifiers, checksum utilities, and consumer callbacks.
|
|
93
|
+
|
|
94
|
+
## Requirements
|
|
95
|
+
|
|
96
|
+
| ID | WHAT | WHY | Source Evidence | Test / Example Evidence | Assumptions / Gaps | Confidence |
|
|
97
|
+
|---|---|---|---|---|---|---|
|
|
98
|
+
| `HASH-TREE-R-001` | `HashTreeParser` parses hash-tree messages, tracks dataset versions, detects gaps, fetches datasets, and emits typed update callbacks; `HashTree` stores leaf items and computes leaf/tree hashes. | Parser synchronization behavior and the hash data structure have different ownership and must not be attributed to the same file. | `src/hashTree/hashTreeParser.ts`, `src/hashTree/hashTree.ts` | `test/unit/spec/hashTree/hashTreeParser.ts`, `test/unit/spec/hashTree/hashTree.ts` | none | PRESENT |
|
|
99
|
+
| `HASH-TREE-R-002` | `HashTreeParser.parseMessage()` updates dataset metadata and applies message items; `handleMessage()` then invokes the object-update callback. `runSyncAlgorithm()` performs the root-hash comparison later after the configured idle/backoff delay and queues synchronization on mismatch. | Callers need the real callback-versus-reconciliation ordering and must not assume the callback waits for the deferred root-hash check. | `src/hashTree/hashTreeParser.ts`, `src/hashTree/hashTree.ts`, `src/hashTree/utils.ts` | `test/unit/spec/hashTree/hashTreeParser.ts`, `test/unit/spec/hashTree/hashTree.ts`, `test/unit/spec/hashTree/utils.ts` | none | PRESENT |
|
|
100
|
+
| `HASH-TREE-R-003` | `performSync()` converts meeting-ended/not-found responses into their sentinel callback paths, catches and logs other synchronization failures, and prevents stopped-parser work from being applied. | Sentinel dataset outcomes, logged sync failure, and stopped work must remain distinct so no failed fetch is misreported as a caller-visible rejection or current state. | `src/hashTree/hashTreeParser.ts` | `test/unit/spec/hashTree/hashTreeParser.ts` | non-sentinel failure recovery after logging needs explicit queue coverage | PRESENT |
|
|
101
|
+
| `HASH-TREE-R-004` | `resetHeartbeatWatchdogs()` clears and re-arms a per-dataset timer at `heartbeatIntervalMs + getWeightedBackoffTime(backoff)`, preferring the dataset-level `heartbeatIntervalMs` over `topLevelHeartbeatIntervalMs`. It skips any dataset without a `hashTree`, without a resolved interval, or that `isVisibleDataSet()` rejects, and skips a dataset in `LLM_DATASET_NAMES` when the injected `callbacks.isLlmExpected()` returns false. On expiry it emits `HASH_TREE_HEARTBEAT_WATCHDOG_EXPIRED`, saves the backoff latency, enqueues a sync for that dataset, and re-arms itself. `handleMessage()` re-arms the watchdogs *after* `callLocusInfoUpdateCallback()` on the state-elements path, and immediately after `handleRootHashHeartBeatMessage()` on the heartbeat-only path. | A watchdog armed for a dataset whose transport is not connected would fire on every interval and enqueue perpetual syncs, so visibility and LLM-expectation gating are part of the contract, not an optimization. Re-arming after the update callback keeps the timer anchored to the point the message was actually applied. | `src/hashTree/hashTreeParser.ts`, `src/hashTree/constants.ts` | `test/unit/spec/hashTree/hashTreeParser.ts` | the `isLlmExpected` callback is declared required on `HashTreeParserCallbacks` but is also guarded for absence at the call site; treat the guard as current behavior | PRESENT |
|
|
102
|
+
|
|
103
|
+
## Design Overview
|
|
104
|
+
|
|
105
|
+
`HashTreeParser` consumes state-element messages, compares dataset versions with `utils.ts`, stores per-dataset hash metadata in `hashTree.ts`, fetches visible or missing datasets through its injected `webexRequest`, and reports normalized changes through callbacks.
|
|
106
|
+
|
|
107
|
+
## Data Flow
|
|
108
|
+
|
|
109
|
+
```mermaid
|
|
110
|
+
flowchart LR
|
|
111
|
+
Mercury[stateElementsMessage] --> Parser[hashTreeParser.ts]
|
|
112
|
+
Parser --> Compare[utils.ts / constants.ts]
|
|
113
|
+
Compare --> Tree[hashTree.ts datasets]
|
|
114
|
+
Parser --> Request[injected webexRequest]
|
|
115
|
+
Request --> Dataset[visible / missing dataset URLs]
|
|
116
|
+
Dataset --> Parser
|
|
117
|
+
Parser --> Callback[typed update / ended / not-found callbacks]
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Sequence Diagram(s)
|
|
121
|
+
|
|
122
|
+
Sequence coverage:
|
|
123
|
+
|
|
124
|
+
| Operation group | Diagram | Failure coverage |
|
|
125
|
+
|---|---|---|
|
|
126
|
+
| UC-1…UC-5 — hash-tree mutation and synchronization operation groups | Hash-tree mutation and synchronization primary sequence | stale/gapped metadata, ended/not-found datasets, logged sync failure, and stopped-parser suppression |
|
|
127
|
+
| UC-1…UC-5 — hash-tree mutation and synchronization alternate/failure paths | Hash-tree mutation and synchronization alternate/failure sequence | out-of-order sequence, hash mismatch, dataset 404, or a stopped parser receiving queued work |
|
|
128
|
+
|
|
129
|
+
### Hash-tree mutation and synchronization primary sequence
|
|
130
|
+
|
|
131
|
+
```mermaid
|
|
132
|
+
sequenceDiagram
|
|
133
|
+
participant M as Mercury
|
|
134
|
+
participant P as HashTreeParser
|
|
135
|
+
participant H as HashTree dataset state
|
|
136
|
+
participant W as webexRequest
|
|
137
|
+
participant O as Injected owner callback
|
|
138
|
+
M-->>P: state-elements message
|
|
139
|
+
P->>H: update dataset metadata and apply message leaves
|
|
140
|
+
P-->>O: invoke injected owner callback with applied objects
|
|
141
|
+
P->>P: after idle/backoff, compare computed and received root hashes
|
|
142
|
+
opt deferred root mismatch
|
|
143
|
+
P->>W: fetch missing/visible dataset
|
|
144
|
+
W-->>P: dataset or 404
|
|
145
|
+
P->>H: replace synchronized dataset
|
|
146
|
+
end
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Hash-tree mutation and synchronization alternate/failure sequence
|
|
150
|
+
|
|
151
|
+
```mermaid
|
|
152
|
+
sequenceDiagram
|
|
153
|
+
participant Q as Queued state-elements message
|
|
154
|
+
participant P as HashTreeParser
|
|
155
|
+
participant W as Injected webexRequest
|
|
156
|
+
participant C as Owning callback
|
|
157
|
+
Q->>P: next sequence and hash-tree elements
|
|
158
|
+
P->>P: apply message items and schedule root-hash check
|
|
159
|
+
P-->>C: object update callback
|
|
160
|
+
alt later root check or visible-dataset change requires synchronization
|
|
161
|
+
P->>W: fetch dataset URL
|
|
162
|
+
W-->>P: dataset, sentinel error, or non-sentinel rejection
|
|
163
|
+
alt dataset succeeds
|
|
164
|
+
P-->>C: synchronized object update callback
|
|
165
|
+
else ended or not-found sentinel
|
|
166
|
+
P-->>C: ended or not-found callback
|
|
167
|
+
else non-sentinel rejection
|
|
168
|
+
P->>P: log failure; invoke no owner callback
|
|
169
|
+
end
|
|
170
|
+
else parser has been stopped
|
|
171
|
+
P->>P: discard queued work without applying it
|
|
172
|
+
end
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Class / Component Relationships
|
|
176
|
+
|
|
177
|
+
```mermaid
|
|
178
|
+
classDiagram
|
|
179
|
+
class Mercury
|
|
180
|
+
class OwnerCallback
|
|
181
|
+
class Parser
|
|
182
|
+
class Compare
|
|
183
|
+
class Tree
|
|
184
|
+
class Request
|
|
185
|
+
class Dataset
|
|
186
|
+
Mercury --> Parser
|
|
187
|
+
Parser --> Compare
|
|
188
|
+
Compare --> Tree
|
|
189
|
+
Parser --> Request
|
|
190
|
+
Request --> Dataset
|
|
191
|
+
Dataset --> Parser
|
|
192
|
+
OwnerCallback --> Parser : injected at construction
|
|
193
|
+
Parser --> OwnerCallback : invokes updates
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
The arrows identify ownership and delegation inside `src/hashTree/`; files that only declare types or constants are not presented as transports.
|
|
197
|
+
|
|
198
|
+
## Use Cases
|
|
199
|
+
|
|
200
|
+
- **UC-1:** Insert, update, remove, resize, and diff versioned items in the pure `HashTree` without invoking remote synchronization. Evidence: `src/hashTree/hashTree.ts`.
|
|
201
|
+
- **UC-2:** Initialize parser datasets from a Mercury message or get-loci response in declared dataset priority. Evidence: `src/hashTree/hashTreeParser.ts`, `src/hashTree/constants.ts`.
|
|
202
|
+
- **UC-3:** Apply message items in `parseMessage()` and invoke the normalized Locus callback from `handleMessage()` before the delayed root-hash reconciliation runs. Evidence: `src/hashTree/hashTreeParser.ts`.
|
|
203
|
+
- **UC-4:** Queue and synchronize missing datasets when a gap/hash mismatch is detected, mapping ended/not-found sentinels to their callback paths. Evidence: `src/hashTree/hashTreeParser.ts`.
|
|
204
|
+
- **UC-5:** Stop and clean up a parser so queued or later-completing work cannot mutate its state. Evidence: `src/hashTree/hashTreeParser.ts`.
|
|
205
|
+
|
|
206
|
+
## State Model
|
|
207
|
+
|
|
208
|
+
Per-dataset sequence/hash metadata, pending synchronization work, and last applied objects are held in memory.
|
|
209
|
+
|
|
210
|
+
## Business Rules & Invariants
|
|
211
|
+
|
|
212
|
+
- `HashTreeParser` applies only newer item versions and emits the applied-object callback for the received message. Root-hash mismatch detection is a later idle/backoff task that can enqueue synchronization; it is not a precondition for the first callback. Enforced by `src/hashTree/hashTreeParser.ts` and `src/hashTree/hashTree.ts`.
|
|
213
|
+
|
|
214
|
+
## Concurrency & Reactive Flow
|
|
215
|
+
|
|
216
|
+
- State-elements work applies through `parseMessage()` and callbacks synchronously within `handleMessage()`, while root-hash reconciliation is deferred by dataset timers. `stop()` prevents queued or subsequently completed dataset work from mutating the stopped parser.
|
|
217
|
+
- Heartbeat watchdog timers are per dataset and are re-armed after the owning message has been applied, so watchdog delay is measured from application rather than from receipt. `stopAllTimers()` clears them alongside the sync timers.
|
|
218
|
+
|
|
219
|
+
## State Machine
|
|
220
|
+
|
|
221
|
+
```mermaid
|
|
222
|
+
stateDiagram-v2
|
|
223
|
+
[*] --> active: construct
|
|
224
|
+
active --> active: apply or synchronize dataset update
|
|
225
|
+
active --> stopped: stop()
|
|
226
|
+
stopped --> [*]
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
The parser stores only `active` or `stopped` in `src/hashTree/hashTreeParser.ts`.
|
|
230
|
+
|
|
231
|
+
## Protocol / Wire Format
|
|
232
|
+
|
|
233
|
+
- External payloads are parsed/serialized by files under `src/hashTree/` and existing Webex/media dependencies. Preserve current field names, enum/raw values, sequence identifiers, and compatibility behavior; do not treat the normalized client model as the wire schema.
|
|
234
|
+
|
|
235
|
+
## Error Handling & Failure Modes
|
|
236
|
+
|
|
237
|
+
| Condition | Signal | Caller recovery |
|
|
238
|
+
|---|---|---|
|
|
239
|
+
| Sequence or hash comparison requires a missing/visible dataset | `hashTreeParser.ts` fetches the dataset through the injected request function before replacing the synchronized dataset. | Let the synchronization request settle; do not apply the incomplete delta directly. |
|
|
240
|
+
| Dataset fetch returns 404 or the dataset has ended | The parser invokes its established not-found/ended callback path. | The owner decides whether to stop or establish a new dataset. |
|
|
241
|
+
| Dataset fetch fails outside the ended/not-found sentinels, or queued work reaches a stopped parser | `performSync()` catches/logs the fetch failure; stopped-parser work is not applied. | Observe parser diagnostics and establish a new synchronization trigger if the owner still needs current state. |
|
|
242
|
+
| No heartbeat arrives for a visible dataset within its interval plus backoff | The watchdog fires, emits `HASH_TREE_HEARTBEAT_WATCHDOG_EXPIRED`, enqueues a sync for that dataset, and re-arms. For an LLM dataset while `isLlmExpected()` is false, no watchdog is armed at all and the skip is logged instead. | Do not treat a missing watchdog metric as proof of a healthy transport; check whether the dataset is visible and whether LLM is expected. |
|
|
243
|
+
|
|
244
|
+
## Pitfalls
|
|
245
|
+
|
|
246
|
+
- Sequence comparison includes rollover/ordering edge cases. Numeric or lexical comparison in place of the shared comparator corrupts reconciliation.
|
|
247
|
+
- Public behavior may be reachable through a parent `Meeting`/`Meetings` object even when the source helper is not exported directly.
|
|
248
|
+
|
|
249
|
+
## Key Design Trade-off
|
|
250
|
+
|
|
251
|
+
- Incremental datasets reduce full-state traffic but require version, checksum, and resynchronization bookkeeping.
|
|
252
|
+
|
|
253
|
+
## Test-Case Strategy (module)
|
|
254
|
+
|
|
255
|
+
Use the current mirrored suites: `test/unit/spec/hashTree/hashTree.ts`, `test/unit/spec/hashTree/hashTreeParser.ts`, `test/unit/spec/hashTree/utils.ts`. Characterize the hashTree-specific use cases above and each listed failure condition; add cleanup or transition cases only for resources and state this module actually owns.
|
|
256
|
+
|
|
257
|
+
| Behavior / Requirement | Existing test evidence | Gap |
|
|
258
|
+
|---|---|---|
|
|
259
|
+
| `HASH-TREE-R-001` | `test/unit/spec/hashTree/hashTreeParser.ts` | cover versioned put/remove/resize/diff separately from parser synchronization |
|
|
260
|
+
| `HASH-TREE-R-002` | `test/unit/spec/hashTree/hashTreeParser.ts` | non-sentinel synchronization failures are logged internally; verify queue behavior after that failure |
|
|
261
|
+
| `HASH-TREE-R-003` | `test/unit/spec/hashTree/hashTreeParser.ts` | separate sentinel callback handling, logged non-sentinel sync failure, and stopped-parser suppression cases |
|
|
262
|
+
| `HASH-TREE-R-004` | `test/unit/spec/hashTree/hashTreeParser.ts` | assert the dataset-level interval preference, the invisible-dataset and LLM-not-expected skips, expiry re-arming, and re-arm ordering relative to the update callback |
|
|
263
|
+
|
|
264
|
+
## Traceability
|
|
265
|
+
|
|
266
|
+
- Repo architecture: [`ARCHITECTURE.md`](../../../ai-docs/ARCHITECTURE.md) · Registry: [`SPEC_INDEX.md`](../../../ai-docs/SPEC_INDEX.md)
|
|
267
|
+
- Coverage state and contracts baseline: `../../../.sdd/manifest.json`
|
|
@@ -110,6 +110,7 @@ export type HashTreeParserCallbacks = {
|
|
|
110
110
|
locusInfoUpdateCallback: LocusInfoUpdateCallback;
|
|
111
111
|
syncLatencyTracker?: SyncLatencyTracker;
|
|
112
112
|
generateTrackingId?: GenerateTrackingId;
|
|
113
|
+
isLlmExpected: () => boolean;
|
|
113
114
|
};
|
|
114
115
|
|
|
115
116
|
const SYNC_METRICS_DATA_SETS = [
|
|
@@ -176,6 +177,9 @@ class HashTreeParser {
|
|
|
176
177
|
private syncQueueProcessingPromise: Promise<void> = Promise.resolve();
|
|
177
178
|
// top-level heartbeat interval from the most recent message, used as fallback when dataset-level value is missing
|
|
178
179
|
private topLevelHeartbeatIntervalMs?: number;
|
|
180
|
+
// LLM data sets that were received while LLM was not expected, so their heartbeat watchdog was
|
|
181
|
+
// skipped; reevaluateLlmWatchdogs() arms these once LLM becomes expected and then clears this set
|
|
182
|
+
private pendingLlmWatchdogDataSetNames: Set<string> = new Set();
|
|
179
183
|
/**
|
|
180
184
|
* Constructor for HashTreeParser
|
|
181
185
|
* @param {Object} options
|
|
@@ -1222,11 +1226,11 @@ class HashTreeParser {
|
|
|
1222
1226
|
// emitted only from the LLM message path, so no completion happens here.
|
|
1223
1227
|
const updatedObjects = this.parseMessage(message, debugText);
|
|
1224
1228
|
|
|
1225
|
-
this.resetHeartbeatWatchdogs(message.dataSets);
|
|
1226
1229
|
this.callLocusInfoUpdateCallback({
|
|
1227
1230
|
updateType: LocusInfoUpdateType.OBJECTS_UPDATED,
|
|
1228
1231
|
updatedObjects,
|
|
1229
1232
|
});
|
|
1233
|
+
this.resetHeartbeatWatchdogs(message.dataSets);
|
|
1230
1234
|
}
|
|
1231
1235
|
}
|
|
1232
1236
|
|
|
@@ -1876,7 +1880,22 @@ class HashTreeParser {
|
|
|
1876
1880
|
// dataset-level heartbeatIntervalMs takes priority; fall back to top-level common value
|
|
1877
1881
|
const heartbeatIntervalMs = dataSet?.heartbeatIntervalMs ?? this.topLevelHeartbeatIntervalMs;
|
|
1878
1882
|
|
|
1879
|
-
if (!dataSet?.hashTree || !heartbeatIntervalMs) {
|
|
1883
|
+
if (!dataSet?.hashTree || !this.isVisibleDataSet(dataSet.name) || !heartbeatIntervalMs) {
|
|
1884
|
+
// eslint-disable-next-line no-continue
|
|
1885
|
+
continue;
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
if (
|
|
1889
|
+
LLM_DATASET_NAMES.includes(dataSet.name) &&
|
|
1890
|
+
this.callbacks.isLlmExpected &&
|
|
1891
|
+
!this.callbacks.isLlmExpected()
|
|
1892
|
+
) {
|
|
1893
|
+
LoggerProxy.logger.info(
|
|
1894
|
+
`HashTreeParser#resetHeartbeatWatchdogs --> ${this.debugId} skipping heartbeat watchdog timer for data set "${dataSet.name}" because LLM is disconnected`
|
|
1895
|
+
);
|
|
1896
|
+
|
|
1897
|
+
// remember it so reevaluateLlmWatchdogs() can arm the watchdog once LLM becomes expected
|
|
1898
|
+
this.pendingLlmWatchdogDataSetNames.add(dataSet.name);
|
|
1880
1899
|
// eslint-disable-next-line no-continue
|
|
1881
1900
|
continue;
|
|
1882
1901
|
}
|
|
@@ -1888,7 +1907,7 @@ class HashTreeParser {
|
|
|
1888
1907
|
dataSet.heartbeatWatchdogTimer = undefined;
|
|
1889
1908
|
|
|
1890
1909
|
LoggerProxy.logger.warn(
|
|
1891
|
-
`HashTreeParser#resetHeartbeatWatchdogs --> ${this.debugId} Heartbeat watchdog fired for data set "${dataSet.name}" - no heartbeat received within expected interval, initiating sync`
|
|
1910
|
+
`HashTreeParser#resetHeartbeatWatchdogs --> ${this.debugId} Heartbeat watchdog fired for data set "${dataSet.name}" - no heartbeat received within expected interval(heartbeatIntervalMs=${heartbeatIntervalMs}, backoffTime=${backoffTime}), initiating sync`
|
|
1892
1911
|
);
|
|
1893
1912
|
|
|
1894
1913
|
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.HASH_TREE_HEARTBEAT_WATCHDOG_EXPIRED, {
|
|
@@ -1904,6 +1923,50 @@ class HashTreeParser {
|
|
|
1904
1923
|
}
|
|
1905
1924
|
}
|
|
1906
1925
|
|
|
1926
|
+
/**
|
|
1927
|
+
* Re-evaluates heartbeat watchdog timers for LLM data sets. While LLM is not expected,
|
|
1928
|
+
* resetHeartbeatWatchdogs skips setting watchdog timers for LLM data sets and records them in
|
|
1929
|
+
* pendingLlmWatchdogDataSetNames. This must be called when LLM transitions to expected (e.g. self
|
|
1930
|
+
* reports JOINED) to arm the watchdogs for those pending data sets (avoids a timing issue where
|
|
1931
|
+
* the "main"/"atd-active"/"atd-unmuted" data set arrives before the self update). The pending set
|
|
1932
|
+
* is consumed and cleared here.
|
|
1933
|
+
* @returns {void}
|
|
1934
|
+
*/
|
|
1935
|
+
reevaluateLlmWatchdogs(): void {
|
|
1936
|
+
if (this.state === 'stopped') {
|
|
1937
|
+
return;
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
if (this.pendingLlmWatchdogDataSetNames.size === 0) {
|
|
1941
|
+
return;
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
// consume the pending set - these LLM data sets were received while LLM was not expected
|
|
1945
|
+
const pendingDataSetNames = [...this.pendingLlmWatchdogDataSetNames];
|
|
1946
|
+
this.pendingLlmWatchdogDataSetNames.clear();
|
|
1947
|
+
|
|
1948
|
+
const dataSetsNeedingWatchdog = pendingDataSetNames
|
|
1949
|
+
.map((name) => this.dataSets[name])
|
|
1950
|
+
.filter((dataSet): dataSet is InternalDataSet => {
|
|
1951
|
+
if (!dataSet?.hashTree || dataSet.heartbeatWatchdogTimer) {
|
|
1952
|
+
return false;
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
return this.isVisibleDataSet(dataSet.name);
|
|
1956
|
+
});
|
|
1957
|
+
|
|
1958
|
+
if (dataSetsNeedingWatchdog.length > 0) {
|
|
1959
|
+
LoggerProxy.logger.info(
|
|
1960
|
+
`HashTreeParser#reevaluateLlmWatchdogs --> ${
|
|
1961
|
+
this.debugId
|
|
1962
|
+
} LLM became expected, setting heartbeat watchdog timers for data sets: ${dataSetsNeedingWatchdog
|
|
1963
|
+
.map((ds) => ds.name)
|
|
1964
|
+
.join(', ')}`
|
|
1965
|
+
);
|
|
1966
|
+
this.resetHeartbeatWatchdogs(dataSetsNeedingWatchdog);
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1907
1970
|
/**
|
|
1908
1971
|
* Stops all timers for the data sets to prevent any further sync attempts.
|
|
1909
1972
|
* @returns {void}
|
|
@@ -1936,6 +1999,7 @@ class HashTreeParser {
|
|
|
1936
1999
|
this.topLevelHeartbeatIntervalMs = undefined;
|
|
1937
2000
|
this.syncAllBackoffType = SyncAllBackoffType.NONE;
|
|
1938
2001
|
this.dataSetsSyncedDuringBackoff = new Set();
|
|
2002
|
+
this.pendingLlmWatchdogDataSetNames = new Set();
|
|
1939
2003
|
Object.values(this.dataSets).forEach((dataSet) => {
|
|
1940
2004
|
dataSet.syncAbortController?.abort();
|
|
1941
2005
|
dataSet.syncAbortController = undefined;
|