Skip to content

fix(spec2cdk): throw on unrecognized uppercase prefix in event pattern#37283

Merged
mergify[bot] merged 3 commits intoaws:mainfrom
gasolima:fix-throw-error-unrecognized
Mar 19, 2026
Merged

fix(spec2cdk): throw on unrecognized uppercase prefix in event pattern#37283
mergify[bot] merged 3 commits intoaws:mainfrom
gasolima:fix-throw-error-unrecognized

Conversation

@gasolima
Copy link
Copy Markdown
Contributor

Issue # (if applicable)

Closes #.

Reason for this change

Previously, the function only logged a warning when encountering an event name that starts with an unknown uppercase prefix (e.g., a new service acronym). This made the issue easy to overlook and allowed inconsistent or incorrect pattern method names to be generated silently.

By throwing an error instead of logging, we enforce strict handling of event naming conventions. This ensures that any newly introduced event with a service/acronym prefix is explicitly reviewed and added to the prefixes list, preventing incorrect method name(e.g., kMSCMKDeletionPattern instead of kmsCMKDeletionPattern) generation and improving long-term maintainability.

Description of changes

  • Replaced the console.log warning with a thrown error when an unrecognized uppercase prefix is detected in the event name.
  • The function now fails fast if it encounters an event that appears to start with a service or feature acronym not included in the predefined prefixes list.
  • This guarantees that:
    • All known service prefixes are explicitly defined.
    • Newly introduced events with acronyms are caught during development/testing rather than slipping into production.
  • No changes to behavior for recognized prefixes or standard camelCase event names.

Describe any new or updated permissions being added

Description of how you validated changes

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team March 18, 2026 22:46
@github-actions github-actions bot added the p2 label Mar 18, 2026
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Mar 18, 2026
Copy link
Copy Markdown
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

(This review is outdated)

@leonmk-aws leonmk-aws changed the title fix(spec2cdk): throw on unrecognized uppercase prefix in event patter… fix(spec2cdk): throw on unrecognized uppercase prefix in event pattern Mar 19, 2026
@leonmk-aws leonmk-aws added the pr-linter/exempt-readme The PR linter will not require README changes label Mar 19, 2026
@leonmk-aws leonmk-aws self-assigned this Mar 19, 2026
@leonmk-aws leonmk-aws added pr-linter/exempt-test The PR linter will not require test changes pr-linter/exempt-integ-test The PR linter will not require integ test changes and removed pr-linter/exempt-readme The PR linter will not require README changes labels Mar 19, 2026
@aws-cdk-automation aws-cdk-automation dismissed their stale review March 19, 2026 09:07

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 19, 2026

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 19, 2026

Merge Queue Status

  • Entered queue2026-03-19 09:07 UTC · Rule: default-squash
  • 🚫 Left the queue2026-03-19 09:07 UTC · at 7c0ed5601599b7d432f005b62c51fa9a56ad7cd8

This pull request spent 4 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/pr-linter.yml without workflows permission

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

@leonmk-aws
Copy link
Copy Markdown
Contributor

@Mergifyio refresh

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 19, 2026

refresh

✅ Pull request refreshed

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 19, 2026

Merge Queue Status

  • Entered queue2026-03-19 09:20 UTC · Rule: default-squash
  • 🚫 Left the queue2026-03-19 09:21 UTC · at 7c0ed5601599b7d432f005b62c51fa9a56ad7cd8

This pull request spent 4 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/pr-linter.yml without workflows permission

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 19, 2026

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 19, 2026

Merge Queue Status

  • Entered queue2026-03-19 09:53 UTC · Rule: default-squash
  • Checks passed · in-place
  • Merged2026-03-19 10:24 UTC · at 34ee2829a8c43b2bf71501becd12805e444052b0

This pull request spent 30 minutes 53 seconds in the queue, including 30 minutes 40 seconds running CI.

Required conditions to merge

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 19, 2026

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit c68f2f5 into aws:main Mar 19, 2026
18 of 19 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

contribution/core This is a PR that came from AWS. p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exempt-test The PR linter will not require test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants