Skip to content

docs(calling): Spark 787601 templates#4784

Open
Kesari3008 wants to merge 12 commits intowebex:nextfrom
Kesari3008:SPARK-787601-Templates
Open

docs(calling): Spark 787601 templates#4784
Kesari3008 wants to merge 12 commits intowebex:nextfrom
Kesari3008:SPARK-787601-Templates

Conversation

@Kesari3008
Copy link
Copy Markdown
Contributor

COMPLETES #https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-787601

This pull request addresses

Adding templates to identify if new module has to be added or, feature enhancement is in existing module, adding new method or bug fixing in existing code.

by making the following changes

Added templates at root of calling package to to triaging to identify the scope of the implementation and get the required details from the user.

Change Type

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

The following scenarios were tested

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was not used (or, no additional notation is required)
  • Code was generated entirely by GAI
  • GAI was used to create a draft that was subsequently customized or modified
  • Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Github Copilot
    • Other - Please Specify
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

I certified that

  • I have read and followed contributing guidelines
  • I discussed changes with code owners prior to submitting this pull request
  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the documentation accordingly

Make sure to have followed the contributing guidelines before submitting.

@Kesari3008 Kesari3008 requested a review from a team as a code owner March 16, 2026 15:32
@Kesari3008 Kesari3008 added the validated If the pull request is validated for automation. label Mar 16, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 976c12c5b9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


| Module | Scope / Keywords | Location | ai-docs |
|---|---|---|---|
| **CallingClient** | line, register, call, dial, answer, hold, transfer, mute, media | `src/CallingClient/` | [`src/CallingClient/ai-docs/`](src/CallingClient/ai-docs/AGENTS.md) |
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fix CallingClient ai-docs route in module table

The routing table points CallingClient tasks to src/CallingClient/ai-docs/AGENTS.md, but this commit creates the module docs under src/CallingClient/calling/ai-docs/. Following the documented workflow sends agents to a non-existent path, so CallingClient requests will miss their module-specific AGENTS/architecture context.

Useful? React with 👍 / 👎.

1. **Classify the task** - Determine if it's a new module, new method, bug fix, feature enhancement, or architecture question.
2. **Load context** - Use the [Module Routing Table](#module-routing-table) to find and read the target module's `ai-docs/AGENTS.md` and `ARCHITECTURE.md`.
3. **Load rules** - Read [`ai-docs/RULES.md`](ai-docs/RULES.md) for coding standards.
4. **Load patterns** - Read relevant patterns from [`ai-docs/patterns/`](ai-docs/patterns/).
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove missing patterns prerequisite from workflow

The quick-start checklist requires loading ai-docs/patterns/, but this commit does not add a packages/calling/ai-docs/patterns/ directory or the referenced pattern docs. As written, agents that follow the workflow hit a missing prerequisite and cannot complete the documented process end-to-end.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

@akulakum akulakum left a comment

Choose a reason for hiding this comment

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

Review — AI-docs Templates for Calling Package

Overall this is a solid set of templates with excellent domain knowledge of the calling SDK internals (Logger, MetricManager, Eventing, error hierarchy, state machines, multi-backend patterns). The "STOP — Ask These Questions First" gates and the common bug patterns table are particularly well done.

Please address the inline comments below before merge. Most are quick fixes around path consistency, script names, and template content accuracy.

@@ -0,0 +1,113 @@
# New Module Workflow - Master Orchestrator
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Medium] There's no top-level entry point (ai-docs/README.md or ai-docs/templates/README.md) that explains:

  • What these templates are for
  • How to choose between new-module, new-method, and existing-module
  • Prerequisites and dependencies on other docs (AGENTS.md, RULES.md, patterns/)

Without a navigation doc, someone landing in ai-docs/templates/ for the first time won't know where to start. Consider adding a lightweight README as the entry point.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We have another PR where Root AGENTS.md and README.md are being reviewed. And there we will have information on how these templates are chosen


Use the [Module Routing Table](../../../AGENTS.md#module-routing-table) to identify the affected module, then:

1. Read the module's `ai-docs/AGENTS.md` (if exists) — understand the public API and expected behavior
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Medium] This references ../../../AGENTS.md#module-routing-table, which resolves to packages/calling/AGENTS.md. Since that file is being introduced in a separate PR, this link will be broken until that PR merges.

Consider either:

  1. Adding a note: "Requires the Module Routing Table from AGENTS.md (see PR #XXXX)"
  2. Or gating this PR to merge after the AGENTS.md PR

Also, the path convention is inconsistent across templates — 05-validation.md references src/Agents.md instead. Please standardize.

**Every enhancement MUST update tests:**

1. **Update existing tests** if method signature or behavior changed:
```typescript
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Medium] These pattern file references don't exist yet:

  • ../../patterns/typescript-patterns.md
  • ../../patterns/event-driven-patterns.md

Same issue as the AGENTS.md dependency — if these are coming in a separate PR, add a note indicating that. Otherwise agents following this template will fail at Step 1 of the implementation workflow.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adding a note for something that will be merged right away doesn't make sense so it's ok to keep them this way and based on whichever PR first merges, paths can be updated

npx jest src/ModuleName/ModuleName.test.ts --verbose
```

### Verify All Pass
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Medium] Script name mismatch. The @webex/calling package's package.json defines:

  • test:unit (not test)
  • test:style (not lint)

These commands should be:

# Run ESLint:
yarn test:style

# Or from repo root:
yarn workspace @webex/calling test:style

And the test section below should use yarn test:unit. This mismatch appears in multiple templates — please do a pass across all files to align with actual package scripts.


---

## Add Metric Events
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Medium] Using submitVoicemailMetric as the example for a generic module template is misleading. A new module named e.g. "Recordings" or "Presence" should not be calling a voicemail-specific metric method.

Suggestion: Replace with neutral guidance like:

"Use the appropriate domain-specific metric submit method (e.g., submitCallMetric, submitRegistrationMetric). If no existing method matches, add a new one to IMetricManager in src/Metrics/types.ts."

Or rename the example to clearly show it as a placeholder pattern.

const successHandler = jest.fn();
call.on(CALL_EVENT_KEYS.PARKED, successHandler);

// Act — trigger the method
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Low] midCallEvent as any contradicts the validation checklist in 04-validation.md which states: "No any types (use proper typing or unknown + type assertion)".

For consistency with the project's own standards, this should be:

call['handleMidCallEvent'](midCallEvent as unknown as CallEvent);

Or define a proper mock type.

expect(client).toBeTruthy();
});
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Low] The angle-bracket type assertion <unknown> on this line appears to be getting swallowed by markdown rendering, making the code snippet look broken when viewed on GitHub.

Use as unknown syntax instead to avoid markdown/HTML conflicts:

const mockPayload = MOCK_SUCCESS_RESPONSE_BODY as unknown as WebexRequestPayload;

This also aligns with the TypeScript as assertion style used elsewhere in the templates.

```

---

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Low] The validation checklist and build/verify commands (yarn test:unit, yarn test:style, yarn build) are repeated nearly verbatim across bug-fix.md, feature-enhancement.md, new-method/04-validation.md, and new-module/05-validation.md.

Consider extracting these into a shared ai-docs/templates/common/validation-checklist.md and referencing it from each template. This reduces maintenance burden — when script names change (as noted in another comment), you'd only need to update one file.

@@ -0,0 +1,565 @@
# Code Generation
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Low] At 565 lines, this is the longest file in the PR. While thoroughness is appreciated, the full class templates (base template, no-events customization, multi-backend customization, singleton, backend connector) make this quite dense.

Consider:

  1. Keeping the main flow concise with the base template
  2. Moving customization variants (multi-backend, singleton, no-events) to an appendix section or separate file
  3. Referencing actual source files (e.g., "See src/Voicemail/Voicemail.ts for the multi-backend pattern") rather than reproducing full class bodies

This would make the template easier to follow while still providing the detail when needed.


For significant modules, create an `ai-docs/` folder within the module directory:

```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Medium] This references src/Agents.md but other templates reference packages/calling/AGENTS.md (via relative paths like ../../../AGENTS.md). These are different paths.

Please standardize to one consistent reference. Since the AGENTS.md is expected at the package root (packages/calling/AGENTS.md), this should probably be a relative path from this file's location.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eec3797d8f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +25 to +29
- [ ] You have read `ai-docs/RULES.md` for coding standards
- [ ] You have read `ai-docs/patterns/typescript-patterns.md` for type and interface conventions
- [ ] You have read `ai-docs/patterns/event-driven-patterns.md` if the module emits events
- [ ] You have read `ai-docs/patterns/error-handling-patterns.md` for error class usage, error mapping, and error event emission conventions
- [ ] You have read `ai-docs/patterns/testing-patterns.md` for Jest conventions
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove mandatory prereqs that point to missing docs

This template makes ai-docs/RULES.md and several ai-docs/patterns/*.md files hard prerequisites, but those files do not exist anywhere under packages/calling/ai-docs in this commit, so the workflow blocks before implementation starts. The same missing pattern docs are also referenced by other newly added templates, so contributors and agents cannot complete the documented process end-to-end.

Useful? React with 👍 / 👎.


### Step 1: Load Module Context

Use the [Module Routing Table](../../../AGENTS.md#module-routing-table) to identify the affected module, then:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fix module-routing link to missing AGENTS index

The investigation flow sends readers to ../../../AGENTS.md#module-routing-table, which resolves to packages/calling/AGENTS.md, but that file is not present in this commit. Because this is the first step for module identification, bug triage cannot follow the documented path and agents lose the routing context the template depends on.

Useful? React with 👍 / 👎.

@Kesari3008 Kesari3008 enabled auto-merge (squash) April 1, 2026 07:15
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 636c972578

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

2. Read the target module's `ai-docs/ARCHITECTURE.md` (if exists) — understand current flows
3. Read the specific file(s) being modified — understand current implementation
4. Read the test file(s) — understand existing test coverage
5. Load patterns: [`../../patterns/typescript-patterns.md`](../../patterns/typescript-patterns.md), [`../../patterns/event-driven-patterns.md`](../../patterns/event-driven-patterns.md), [`../../patterns/error-handling-patterns.md`](../../patterns/error-handling-patterns.md)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Point event pattern link to an existing patterns doc

This workflow step requires loading ../../patterns/event-driven-patterns.md, but that file is not present in packages/calling/ai-docs/patterns (the available doc is event-patterns.md). Because this is in the mandatory context-loading step, agents following the template will hit a dead link and skip or miss event-pattern guidance before implementation.

Useful? React with 👍 / 👎.

| Coding Standards | [`../../RULES.md`](../../RULES.md) |
| TypeScript Patterns | [`../../patterns/typescript-patterns.md`](../../patterns/typescript-patterns.md) |
| Testing Patterns | [`../../patterns/testing-patterns.md`](../../patterns/testing-patterns.md) |
| Event Patterns | [`../../patterns/event-driven-patterns.md`](../../patterns/event-driven-patterns.md) |
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fix broken event patterns reference in new-method guide

The reference table links Event Patterns to ../../patterns/event-driven-patterns.md, but that file does not exist in this package, so the documented prerequisite cannot be completed as written. This leaves method-generation tasks without the intended event-pattern source and makes the workflow inconsistent with the actual docs tree.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

@mkesavan13 mkesavan13 left a comment

Choose a reason for hiding this comment

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

  • This review is for existing-module and new-method
  • While this is being fixed, will review new-module

Apart from this, here are few Non-blocking, nitpick, do-later type, "junk code" to remove from the Codebase:

  • SUPPLEMENTARY_SERVICES.DIVERT and SUPPLEMENTARY_SERVICES.PARK
  • DivertContext & ParkContext
  • WEBSOCKET_SCOPE and WEBSOCKET_KEYS
  • CallProgressMessage


### 6. Metrics

10. **"Do existing metrics need to change, or do new metrics need to be added?"**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need to ask for more info around this if it is a yes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added

Comment on lines +15 to +17
- **Creating an entirely new module** (new class/folder) -- Use [`../new-module/00-master.md`](../new-module/00-master.md)
- **Enhancing or modifying an existing method** -- Use [`../existing-module/feature-enhancement.md`](../existing-module/feature-enhancement.md)
- **Fixing a bug** -- Use [`../existing-module/bug-fix.md`](../existing-module/bug-fix.md)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
- **Creating an entirely new module** (new class/folder) -- Use [`../new-module/00-master.md`](../new-module/00-master.md)
- **Enhancing or modifying an existing method** -- Use [`../existing-module/feature-enhancement.md`](../existing-module/feature-enhancement.md)
- **Fixing a bug** -- Use [`../existing-module/bug-fix.md`](../existing-module/bug-fix.md)
- **Creating an entirely new module** (new class/folder) -- Use [`../new-module/00-master.md`](../new-module/00-master.md) instead.
- **Enhancing or modifying an existing method** -- Use [`../existing-module/feature-enhancement.md`](../existing-module/feature-enhancement.md) instead.
- **Fixing a bug** -- Use [`../existing-module/bug-fix.md`](../existing-module/bug-fix.md) instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Why is this change required ? What difference does it make ?


Write the method following the calling SDK's established patterns:
- Logger with `{ file, method }` context
- MetricManager via `getMetricManager()` for success/failure metrics
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it only success/failure we measure or do we also have progress metrics? Like when the calls state changes from Alerting to Connected

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated

- Logger with `{ file, method }` context
- MetricManager via `getMetricManager()` for success/failure metrics
- Error hierarchy (`ExtendedError` -> `CallError` / `LineError` / `CallingClientError`)
- `Eventing<T>` base class for event emission
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is this particular Eventing about in a method implementation? May be some more expansion on the description would help?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines +64 to +68
* @param param1 - <Description of param1.>
* @param param2 - <Description of param2.>
* @returns <Description of return value.>
*/
public async methodName(param1: ParamType, param2?: OptionalType): Promise<ReturnType> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we mention ... param{n} here?

Suggested change
* @param param1 - <Description of param1.>
* @param param2 - <Description of param2.>
* @returns <Description of return value.>
*/
public async methodName(param1: ParamType, param2?: OptionalType): Promise<ReturnType> {
* @param param1 - <Description of param1.>
* @param param2 - <Description of param2.>
* .
* .
* .
* @param param{n} - <Description of param{n}.>
* @returns <Description of return value.>
*/
public async methodName(param1: ParamType1, param2?: ParamType2, ..., param{n}?: OptionalType): Promise<ReturnType> {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed

Comment on lines +361 to +394
### Run all tests for the calling package

```bash
cd packages/calling
yarn test:unit
```

### Run a specific test file

```bash
cd packages/calling
yarn jest src/CallingClient/calling/call.test.ts
```

### Run tests matching a pattern

```bash
cd packages/calling
yarn jest --testPathPattern="call.test" --verbose
```

### Run a specific describe block

```bash
cd packages/calling
yarn jest src/CallingClient/calling/call.test.ts -t "parkCall tests"
```

### Run lint check

```bash
cd packages/calling
yarn test:style
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Have we tried to run these commands locally to know if they're correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes I have checked and they work

Comment on lines +84 to +94
### Error Logging Level Guide

Use the correct log level for each situation:

| Level | Usage | Example |
|---|---|---|
| `log.error` | Caught exceptions, API failures, unrecoverable errors | `log.error('Failed to park call: ...', logContext)` |
| `log.warn` | Recoverable issues, timeouts, degraded behavior | `log.warn('Park response timed out', logContext)` |
| `log.info` | Method entry/exit, significant state changes | `log.info('${METHOD_START_MESSAGE} with: ...', logContext)` |
| `log.log` | Diagnostic details (response codes, intermediate states) | `log.log('Response code: ${response.statusCode}', logContext)` |
| `log.trace` | Verbose debugging (payloads, full objects) | `log.trace('Full response: ${JSON.stringify(body)}', logContext)` |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe this was captured in patterns itself. Do we need to repeat it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good to add here because these are like final steps that during actual code generation would be followed

// Success metric
this.metricManager.submitCallMetric(
METRIC_EVENT.CALL,
'parkCall', // action string
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This can be a string constant or a variable but never a hardcoded string. If that's true, we need to correct the doc.

Curious if this was also caught in the patterns already but we are repeating here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is updated

Comment on lines +163 to +189
**Incorrect** -- Incomplete error handling:

```typescript
// WRONG: Swallowing the error
catch (e) {
console.error(e);
}

// WRONG: Throwing raw error instead of typed CallError
catch (e) {
throw e;
}

// WRONG: Missing metric submission
catch (e) {
const callError = createCallError(...);
this.emit(CALL_EVENT_KEYS.PARK_ERROR, callError);
// Forgot: this.submitCallErrorMetric(callError);
}

// WRONG: Missing event emission
catch (e) {
const callError = createCallError(...);
this.submitCallErrorMetric(callError);
// Forgot: this.emit(CALL_EVENT_KEYS.PARK_ERROR, callError);
}
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need this here as we have mentioned the steps anyway in the correct section?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is good to give an idea what is considered incorrect even though we mention the correct section, it is too vast for LLM to understand what could be wrong

this.sendCallStateMachineEvt({type: 'E_CALL_ESTABLISHED', data: errData});
},
ERROR_LAYER.CALL_CONTROL,
/* istanbul ignore next */ (interval: number) => undefined,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we see an istanbul ignore next here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because in actual code example, its like that

Service: janus
Request: query params only (date: string, limit: number)
Response: { statusCode: number; data: { recordings: Recording[] }; message: string }
Errors: 400, 401, 404, 500
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Example doesn't talk about meanings.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated

>
> | Event Key | Direction | Payload Type | Description |
> |-----------|-----------|-------------|-------------|
> | `moduleName:event_name` | Outbound (to consumer) | `EventPayloadType` | When this fires |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
> | `moduleName:event_name` | Outbound (to consumer) | `EventPayloadType` | When this fires |
> | `moduleName:event_name` | Outbound (to consumer) | `EventPayloadType` | When is this fired? |

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated

Service: {mobius|janus|hydra|...}
Request: {type shape}
Response: {type shape}
Errors: {status codes}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Errors: {status codes}
Errors: {status code1} - {reason1}, {status code2} - {reason2}, ..., {status codeN} - {reasonN},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed

Comment on lines +7 to +46
## File Structure by Placement Type

### Top-Level Module (`src/ModuleName/`)

```
src/ModuleName/
ModuleName.ts # Main service class + factory function
types.ts # IModuleName interface, response types, LoggerInterface
constants.ts # MODULE_NAME_FILE, METHODS, module-specific constants
ModuleName.test.ts # Co-located unit tests
moduleNameFixtures.ts # Test fixture data
```

### Sub-Module of CallingClient (`src/CallingClient/moduleName/`)

```
src/CallingClient/moduleName/
index.ts # Main class
types.ts # Interface and types
constants.ts # Constants
moduleName.test.ts # Co-located tests
moduleNameFixtures.ts # Test fixtures
```

### Multi-Backend Module (`src/ModuleName/`)

```
src/ModuleName/
ModuleName.ts # Facade class (delegates to connectors)
types.ts # IModuleName, IWxCallBackendConnector, etc.
constants.ts # Shared constants
WxCallBackendConnector.ts # WXC backend implementation
BroadworksBackendConnector.ts # Broadworks backend implementation
UcmBackendConnector.ts # UCM backend implementation
ModuleName.test.ts # Facade tests
WxCallBackendConnector.test.ts # WXC connector tests
BroadworksBackendConnector.test.ts # Broadworks connector tests
UcmBackendConnector.test.ts # UCM connector tests
moduleNameFixture.ts # Shared test fixtures
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems to be repeating content from the pre-questions template itself


Only create new types that do not already exist in these shared locations.

### Types Template
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't patterns take care of this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Some of the instructions are repeated here (in addition to pattern docs) because this is the file-generation step where duplication mistakes usually occur

2. **Check `src/Events/types.ts`** -- Do not re-declare event enums that already exist
3. **Check `src/Metrics/types.ts`** -- If adding metric actions, extend the existing enums there

### Constants Template
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Once again, shouldn't patterns cover this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Some of the instructions are repeated here (in addition to pattern docs) because this is the file-generation step where duplication mistakes usually occur


### A1. Export from `src/api.ts`

Add the module's exports to `src/api.ts` following the existing grouped pattern:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We have a pre-question regarding this. Should we talk about that?


export enum MOBIUS_EVENT_KEYS {
// ... existing keys ...
MODULE_NAME_EVENT = 'event:janus.module_name_event',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we have a Mobius example as well here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added

Comment on lines +267 to +280

```bash
# Run all tests:
yarn test:unit

# Run only the new module's tests:
npx jest src/ModuleName/

# Run with coverage:
npx jest src/ModuleName/ --coverage

# Run a single test file:
npx jest src/ModuleName/ModuleName.test.ts --verbose
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Have we tried to run these to know if these are correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes I have run it

@Kesari3008
Copy link
Copy Markdown
Contributor Author

  • This review is for existing-module and new-method
  • While this is being fixed, will review new-module

Apart from this, here are few Non-blocking, nitpick, do-later type, "junk code" to remove from the Codebase:

  • SUPPLEMENTARY_SERVICES.DIVERT and SUPPLEMENTARY_SERVICES.PARK
  • DivertContext & ParkContext
  • WEBSOCKET_SCOPE and WEBSOCKET_KEYS
  • CallProgressMessage

These are not junk codes, they were added for features which were deprioritized I believe

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ab903ca4a1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Add the new module to the Module Index table in root `AGENTS.md` (`packages/calling/AGENTS.md`):

```markdown
| **ModuleName** | `ModuleName` | `createModuleNameClient()` | `IModuleName` | {one-sentence description} |
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use the real AGENTS routing-table schema in docs

The row template here uses a 5-column “Module Index” format, but packages/calling/AGENTS.md’s module routing table is a 3-column table (Module, Scope Keywords, Source of Truth). If contributors follow this snippet, they will insert malformed rows that break the routing table structure and omit the scope/source metadata agents rely on for module selection.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4ada1a48aa

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +13 to +15
### A1. Export from `src/api.ts`

Add the module's exports to `src/api.ts` following the existing grouped pattern:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Update module integration to export via package entrypoint

Path A marks integration complete after exporting only from src/api.ts, but @webex/calling is published from dist/module/index.js (generated from src/index.ts). If contributors follow this workflow, a new top-level module can pass the checklist yet remain unavailable to consumers importing from @webex/calling, which breaks the stated goal of making the module accessible to consumers.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

validated If the pull request is validated for automation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants