Skip to content

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

Open
hariharan077 wants to merge 2 commits into
aws-amplify:devfrom
hariharan077:fix-14609-extract-category
Open

hariharan077 wants to merge 2 commits into
aws-amplify:devfrom
hariharan077:fix-14609-extract-category

Conversation

@hariharan077

Copy link
Copy Markdown
Contributor

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

@hariharan077

Copy link
Copy Markdown
Contributor Author

Following up on this fix for #14609. The current branch has no merge conflicts, and there are no outstanding inline review comments. The change keeps category detection prefix-based, with regression coverage for names such as storageauthbackup.

Could a maintainer review the change and check whether CI needs to be enabled for this contribution? No commit status checks or pull-request workflow runs are currently reported for 365f252. GitHub is waiting for the required AWS CodeBuild and build-and-test statuses, along with code-owner review.

@hariharan077

Copy link
Copy Markdown
Contributor Author

Updated this branch to current dev (426372b) in de4474e. The PR still changes only the classifier and its regression test. On current dev, storageauthbackup is classified as Auth. With the PR applied, it is classified as Storage.

The CLI and its workspace dependencies build successfully. The full CLI package suite passed locally with 133 suites, 887 tests, and 138 snapshots. The focused regression, lint, and formatting checks also passed.

Could a code owner review the updated branch and start the required CI checks if they are still waiting to run?

This branch has not been deployed

No deployments
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