-
Notifications
You must be signed in to change notification settings - Fork 377
Hardcoded mobius prod afra wxt-prod2 URL #4424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe changes enforce the use of a hardcoded Mobius URL in two locations within the codebase. In the Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🧰 Additional context used🧠 Learnings (3)📓 Common learnings
📚 Learning: in `packages/calling/src/callingclient/constants.ts`, when validating phone numbers using `valid_pho...
Applied to files:
📚 Learning: in the `updateanswercallscrossclient` method in the `usersub` class (`packages/@webex/internal-plugi...
Applied to files:
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/calling/src/CallingClient/calling/call.ts
(1 hunks)packages/calling/src/CallingClient/registration/register.ts
(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: robstax
PR: webex/webex-js-sdk#3948
File: packages/@webex/webex-core/test/unit/spec/webex-core.js:178-254
Timestamp: 2024-11-01T00:30:53.442Z
Learning: In the webex-js-sdk project, when reviewing changes in `packages/@webex/webex-core/test/unit/spec/webex-core.js`, if the user declines to add negative test cases for invalid interceptor configurations, accept their decision and do not insist.
📚 Learning: in `packages/calling/src/callingclient/constants.ts`, when validating phone numbers using `valid_pho...
Learnt from: sreenara
PR: webex/webex-js-sdk#3904
File: packages/calling/src/CallingClient/constants.ts:59-59
Timestamp: 2024-10-24T10:00:26.858Z
Learning: In `packages/calling/src/CallingClient/constants.ts`, when validating phone numbers using `VALID_PHONE_REGEX`, prefer to keep the permissive regex `/[\d\s()*#+.-]+/`, as the call processing agent will handle any invalid phone numbers. Do not enforce stricter phone number validation in the client code.
Applied to files:
packages/calling/src/CallingClient/calling/call.ts
packages/calling/src/CallingClient/registration/register.ts
📚 Learning: in the `updateanswercallscrossclient` method in the `usersub` class (`packages/@webex/internal-plugi...
Learnt from: mmulcair1981
PR: webex/webex-js-sdk#3936
File: packages/@webex/internal-plugin-usersub/src/usersub.ts:65-66
Timestamp: 2024-10-24T08:50:23.626Z
Learning: In the `updateAnswerCallsCrossClient` method in the `Usersub` class (`packages/@webex/internal-plugin-usersub/src/usersub.ts`), the `deviceId` can be empty, and the request should not be rejected in this case.
Applied to files:
packages/calling/src/CallingClient/calling/call.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: AWS Amplify Console Web Preview
🔇 Additional comments (1)
packages/calling/src/CallingClient/registration/register.ts (1)
135-143
: Replace hardcoded Mobius URLs with configurable valuesHardcoding the Prod Mobius endpoint in two places breaks the method contract, ties the code to one environment, and hamstrings testing. Let’s centralize this URL and respect the incoming parameter:
• packages/calling/src/CallingClient/registration/register.ts
- Remove the line
url = "https://mobius.afrawxt-prd-2.prod.infra.webex.com/api/v1/calling/web/";
- Derive the active URL from either an environment variable or the passed-in
url
• packages/calling/src/CallingClient/calling/call.ts
- Remove the hardcoded assignment
this.mobiusUrl = "https://mobius.afrawxt-prd-2.prod.infra.webex.com/api/v1/calling/web/";
- Use the URL from configuration or the caller
Suggested pattern:
public setActiveMobiusUrl(inputUrl: string) { - // Hardcoded production URL — remove this - inputUrl = "https://mobius.afrawxt-prd-2.prod.infra.webex.com/api/v1/calling/web/"; + // Prefer an environment override, else fall back to the provided URL + const mobiusUrl = process.env.MOBIUS_URL ?? inputUrl; log.info(`${METHOD_START_MESSAGE} with ${mobiusUrl}`, { method: METHODS.UPDATE_ACTIVE_MOBIUS, file: REGISTRATION_FILE, }); - this.activeMobiusUrl = inputUrl; - this.callManager.updateActiveMobius(inputUrl); + this.activeMobiusUrl = mobiusUrl; + this.callManager.updateActiveMobius(mobiusUrl); }Repeat the same adjustment in
call.ts
. This ensures:
- Callers control the URL
- Environments can override without code changes
- Tests can inject mocks easily
[fіx_required]
This pull request is automatically being deployed by Amplify Hosting (learn more). |
COMPLETES #< INSERT LINK TO ISSUE >
This pull request addresses
< DESCRIBE THE CONTEXT OF THE ISSUE >
by making the following changes
< DESCRIBE YOUR CHANGES >
Change Type
The following scenarios were tested
< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >
The GAI Coding Policy And Copyright Annotation Best Practices
I certified that
Make sure to have followed the contributing guidelines before submitting.