feat: add custom depth validation and improve project group mapping#6141
Conversation
Signed-off-by: 이승연 <sylee1274@mz.co.kr>
Signed-off-by: 이승연 <sylee1274@mz.co.kr>
Signed-off-by: 이승연 <sylee1274@mz.co.kr>
|
@seungyeoneeee is attempting to deploy a commit to the cloudforet Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the Custom Depth feature for service account auto-sync by adding provider-specific maximum depth limits. The changes update validation logic and error messages to enforce these limits.
- Added
CUSTOM_DEPTH_MAX_DEPTHconstant with provider-specific max depth values (AWS: 2000, Google Cloud: 11, Azure: 8) - Updated validation logic to enforce both minimum (>0) and maximum depth constraints
- Updated internationalization strings across English, Japanese, and Korean to reflect the new max depth validation
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/web/src/services/asset-inventory/types/service-account-page-type.ts | Added CUSTOM_DEPTH_MAX_DEPTH constant defining max depth per provider |
| apps/web/src/services/asset-inventory/components/ServiceAccountAutoSyncMappingMethod.vue | Updated validation logic and UI to enforce max depth limits using the new constant |
| packages/language-pack/en.json | Updated English strings for custom depth description and validation messages to include max depth |
| packages/language-pack/ja.json | Updated Japanese strings for custom depth description and validation messages to include max depth |
| packages/language-pack/ko.json | Updated Korean strings for custom depth description and validation messages to include max depth |
| apps/web/src/schema/identity/trusted-account/model.ts | Removed deprecated skip_project_group field from sync_options |
| apps/web/src/schema/identity/trusted-account/api-verbs/update.ts | Updated sync_options structure to use new mapping type fields instead of deprecated skip_project_group |
| apps/web/src/schema/identity/trusted-account/api-verbs/create.ts | Fixed typo in field name (workspace_mappint_type → workspace_mapping_type) and updated sync_options structure |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <span class="font-bold text-gray-600">{{ CUSTOM_DEPTH }}</span> | ||
| <span>{{ $t('IDENTITY.SERVICE_ACCOUNT.AUTO_SYNC.CUSTOM_DEPTH_DESCRIPTION') }}</span> | ||
| <span>{{ $t('IDENTITY.SERVICE_ACCOUNT.AUTO_SYNC.CUSTOM_DEPTH_DESCRIPTION', | ||
| { csp_max_depth: CUSTOM_DEPTH_MAX_DEPTH[serviceAccountPageState.selectedProvider] }) }}</span> |
There was a problem hiding this comment.
Potential runtime error: CUSTOM_DEPTH_MAX_DEPTH[serviceAccountPageState.selectedProvider] may be undefined if the provider is not 'aws', 'google_cloud', or 'azure'. This would result in displaying 'undefined' in the UI. Consider providing a fallback value or validating that the provider exists in CUSTOM_DEPTH_MAX_DEPTH before accessing it.
| <p-field-group :invalid="state.customDepth !== null && state.customDepth < 1" | ||
| :invalid-text="$t('IDENTITY.SERVICE_ACCOUNT.AUTO_SYNC.CUSTOM_DEPTH_INVALID')" | ||
| <p-field-group :invalid="state.customDepth !== null && (state.customDepth < 1 | ||
| || state.customDepth > CUSTOM_DEPTH_MAX_DEPTH[serviceAccountPageState.selectedProvider])" |
There was a problem hiding this comment.
Potential runtime error: CUSTOM_DEPTH_MAX_DEPTH[serviceAccountPageState.selectedProvider] may be undefined if the provider is not in the mapping. This would cause the comparison to always be false and validation to fail silently. Use optional chaining or provide a default value: CUSTOM_DEPTH_MAX_DEPTH[serviceAccountPageState.selectedProvider] ?? Infinity.
| <p-field-group :invalid="state.customDepth !== null && (state.customDepth < 1 | ||
| || state.customDepth > CUSTOM_DEPTH_MAX_DEPTH[serviceAccountPageState.selectedProvider])" | ||
| :invalid-text="$t('IDENTITY.SERVICE_ACCOUNT.AUTO_SYNC.CUSTOM_DEPTH_INVALID', { | ||
| csp_max_depth: CUSTOM_DEPTH_MAX_DEPTH[serviceAccountPageState.selectedProvider] |
There was a problem hiding this comment.
Potential runtime error: CUSTOM_DEPTH_MAX_DEPTH[serviceAccountPageState.selectedProvider] may be undefined if the provider is not in the mapping. This would result in displaying 'undefined' in the validation error message. Consider adding a fallback value or validation.
| type="number" | ||
| min="1" | ||
| :invalid="state.customDepth !== null && state.customDepth < 1" | ||
| :max="CUSTOM_DEPTH_MAX_DEPTH[serviceAccountPageState.selectedProvider]" |
There was a problem hiding this comment.
Potential runtime error: CUSTOM_DEPTH_MAX_DEPTH[serviceAccountPageState.selectedProvider] may be undefined for providers not in the mapping, which could result in no max constraint on the input. Consider using a fallback value.
| min="1" | ||
| :invalid="state.customDepth !== null && state.customDepth < 1" | ||
| :max="CUSTOM_DEPTH_MAX_DEPTH[serviceAccountPageState.selectedProvider]" | ||
| :invalid="state.customDepth !== null && (state.customDepth < 1 || state.customDepth > CUSTOM_DEPTH_MAX_DEPTH[serviceAccountPageState.selectedProvider])" |
There was a problem hiding this comment.
Potential runtime error: CUSTOM_DEPTH_MAX_DEPTH[serviceAccountPageState.selectedProvider] may be undefined if the provider is not in the mapping. This would cause the comparison to always be false and validation to fail silently. Use optional chaining or provide a default value.
Signed-off-by: 이승연 <sylee1274@mz.co.kr>
06188d6
into
cloudforet-io:trusted-account-auto-sync
Skip Review (optional)
style,chore,ci,test,docs)Description (optional)
Things to Talk About (optional)