Skip to content

Conversation

@Kesari3008
Copy link
Contributor

@Kesari3008 Kesari3008 commented Nov 30, 2025

COMPLETES #CAI-6513

This pull request addresses

by making the following changes

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

< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >

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 review from a team as code owners November 30, 2025 18:56
@aws-amplify-us-east-2
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-4593.d3m3l2kee0btzx.amplifyapp.com

@Kesari3008 Kesari3008 added the validated If the pull request is validated for automation. label Dec 8, 2025
Copy link
Contributor

@rarajes2 rarajes2 left a comment

Choose a reason for hiding this comment

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

  1. will review the UTs in the 2nd round since the diff is large.
  2. Let's fix the failing pipeline, add a vidcast and, fill the description with all the details

const {services} = this.webex.internal;

// Wait for the postauth catalog to populate.
console.log('pkesari_canRegister invoking waitForCatalog for postauth');
Copy link
Contributor

Choose a reason for hiding this comment

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

remove the console log

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

Comment on lines +259 to +269
try {
const key = formattedQuery && Object.keys(formattedQuery || {})[0];
if (key) {
selectionMeta = {
selectionType: key,
selectionValue: formattedQuery[key],
};
}
} catch {
this.logger.warn('services: error building selection meta');
}
Copy link
Contributor

Choose a reason for hiding this comment

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

see if we need try-catch for this

let selectionMeta: {selectionType: string; selectionValue: string} | undefined;
if (serviceGroup === 'preauth' || serviceGroup === 'signin') {
try {
const key = formattedQuery && Object.keys(formattedQuery || {})[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we expecting only one key at a time ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes at a time we would use either orgId or email or location to fetch the catalog

/**
* @private
* Cache the catalog in the bounded storage.
* @param {ServiceGroup} serviceGroup - preauth, signin, postauth
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we allowing this to cache all service groups ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes We are caching all service groups

async _cacheCatalog(
serviceGroup: ServiceGroup,
hostMap: ServiceHostmap,
meta?: {selectionType: string; selectionValue: string}
Copy link
Contributor

Choose a reason for hiding this comment

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

We can create type for meta, this is repeated

const hostMap: ServiceHostmap =
cachedGroup && cachedGroup.hostMap ? cachedGroup.hostMap : cachedGroup;
const meta: {selectionType: string; selectionValue: string} | undefined =
cachedGroup && cachedGroup.meta ? cachedGroup.meta : undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

cachedGroup && cachedGroup.meta ? cachedGroup.meta : undefined; --> cachedGroup?.meta

Comment on lines +1157 to +1159
if (typeof window !== 'undefined' && (window as any).localStorage) {
(window as any).localStorage.removeItem(CATALOG_CACHE_KEY_V2);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, having a util will simplify the logic

this.logger.warn('services: error clearing catalog cache');
}

return Promise.resolve();
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we resolve/reject based on try-catch ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How does rejecting it helps ? We are not going to use these methods to change any flow. All it needs to do is cache it and use the cache but any kind of faikure should not block the flows

process.env.WEBEX_CONVERSATION_DEFAULT_CLUSTER || `${DEFAULT_CLUSTER}:${CLUSTER_SERVICE}`;
const CATALOG_CACHE_KEY_V1 = 'services.v1.u2cHostMap';
const CATALOG_TTL_MS = 24 * 60 * 60 * 1000; // 24 hours

Copy link
Contributor

Choose a reason for hiding this comment

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

Please address similar comments from services-v2.ts file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

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.

2 participants