Skip to content

fix(cli): classify migration categories by prefix#14901

Open
hariharan077 wants to merge 1 commit into
aws-amplify:devfrom
hariharan077:fix-14609-extract-category
Open

fix(cli): classify migration categories by prefix#14901
hariharan077 wants to merge 1 commit into
aws-amplify:devfrom
hariharan077:fix-14609-extract-category

Conversation

@hariharan077
Copy link
Copy Markdown

Description

Fixes #14609.

extractCategory() previously classified logical IDs by checking whether category names appeared anywhere in the ID. That made the result order-dependent, so a storage resource such as storageauthbackup was reported as Auth because auth appeared later in the resource name.

This changes category detection to use known Amplify category prefixes and keeps core infrastructure detection prefix-based as well.

Validation

  • Reproduced the bug with a failing unit test before the fix: storageauthbackup returned Auth instead of Storage.
  • corepack yarn workspace @aws-amplify/cli-internal test src/__tests__/commands/gen2-migration/_common/categories.test.ts --runInBand --no-coverage
  • corepack yarn workspace @aws-amplify/cli-internal test src/__tests__/commands/drift --runInBand --no-coverage
  • corepack yarn workspace @aws-amplify/cli-internal test src/__tests__/commands/gen2-migration/_common/categories.test.ts src/__tests__/commands/drift/services/drift-formatter.test.ts --runInBand --no-coverage
  • corepack yarn prettier --check packages/amplify-cli/src/commands/gen2-migration/_common/categories.ts packages/amplify-cli/src/__tests__/commands/gen2-migration/_common/categories.test.ts
  • corepack yarn eslint packages/amplify-cli/src/commands/gen2-migration/_common/categories.ts packages/amplify-cli/src/__tests__/commands/gen2-migration/_common/categories.test.ts
  • corepack yarn sanitize-migration-apps
  • corepack yarn build-tests-changed
  • git diff --check

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(gen2-migration) extractCategory() uses fragile substring matching that can misclassify resources

1 participant