Skip to content

fix(rds): add lower bound validation for ClusterInstance promotionTier#37519

Open
yasomaru wants to merge 1 commit intoaws:mainfrom
yasomaru:fix/issue-37518-promotion-tier-validation
Open

fix(rds): add lower bound validation for ClusterInstance promotionTier#37519
yasomaru wants to merge 1 commit intoaws:mainfrom
yasomaru:fix/issue-37518-promotion-tier-validation

Conversation

@yasomaru
Copy link
Copy Markdown
Contributor

@yasomaru yasomaru commented Apr 4, 2026

promotionTier only validated the upper bound (> 15) but did not reject negative values. Added check for < 0 to match the documented range of 0-15 and the existing error message.

Issue # (if applicable)

Closes #37518

Reason for this change

ClusterInstance's promotionTier validation only checked this.tier > 15 but
did not reject negative values. The error message already stated "must be between
0-15", but the lower bound was not enforced. Negative values passed synth
silently and failed at CloudFormation deploy time.

Description of changes

Added this.tier < 0 to the existing validation condition in
aurora-cluster-instance.ts:

- if (this.tier > 15) {
+ if (this.tier < 0 || this.tier > 15) {

Added unit tests for both boundary violations (promotionTier: -1 and
promotionTier: 16) using test.each, following the existing pattern in
cluster.test.ts.

Describe any new or updated permissions being added

N/A. This is a validation-only change.

Description of how you validated changes

  • Added 2 unit tests via test.each covering negative (-1) and above-range (16)
    values
    • All 231 tests in cluster.test.ts pass
    • No integration test needed as this change does not affect synthesized
      CloudFormation templates for valid inputs

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 April 4, 2026 06:23
@github-actions github-actions bot added bug This issue is a bug. p2 labels Apr 4, 2026
@github-actions github-actions bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Apr 4, 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)

@yasomaru yasomaru changed the title fix(aws-rds): add lower bound validation for ClusterInstance promotionTier fix(rds): add lower bound validation for ClusterInstance promotionTier Apr 4, 2026
@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Apr 4, 2026
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Apr 4, 2026
@badmintoncryer
Copy link
Copy Markdown
Contributor

I think it's better to add a unit test.

@aws-cdk-automation aws-cdk-automation removed the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Apr 5, 2026
@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Apr 5, 2026
@yasomaru yasomaru force-pushed the fix/issue-37518-promotion-tier-validation branch from 4342386 to 481aa21 Compare April 5, 2026 00:57
@aws-cdk-automation aws-cdk-automation dismissed their stale review April 5, 2026 00:59

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

@yasomaru
Copy link
Copy Markdown
Contributor Author

yasomaru commented Apr 5, 2026

@badmintoncryer
Thanks !
Added unit tests for both boundary cases (promotionTier: -1 and 16), plus an integ test covering the valid boundaries (0 and 15) with updated snapshots.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
This security report is NOT a review blocker. Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ✅SkippedFailed
Security Guardian Results24 ran24 passed
TestResult
No test annotations available

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
This security report is NOT a review blocker. Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ✅SkippedFailed
Security Guardian Results with resolved templates24 ran24 passed
TestResult
No test annotations available

@yasomaru yasomaru force-pushed the fix/issue-37518-promotion-tier-validation branch from 481aa21 to cc4a9de Compare April 5, 2026 07:42
@yasomaru
Copy link
Copy Markdown
Contributor Author

yasomaru commented Apr 5, 2026

Exemption Request

This is a validation-only fix that rejects invalid input earlier (at synth time
instead of deploy time). It does not change synthesized CloudFormation templates
for any valid input, so an integration test is not applicable.

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Apr 5, 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.

The pull request linter fails with the following errors:

❌ Fixes must contain a change to an integration test file and the resulting snapshot.

If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.

✅ A exemption request has been requested. Please wait for a maintainer's review.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Apr 5, 2026
Comment on lines +144 to +146
[-1, /promotionTier must be between 0-15/],
[16, /promotionTier must be between 0-15/],
])('when promotionTier is %s', (promotionTier, errorMessage) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think errorMessage variable is not needed.

Suggested change
[-1, /promotionTier must be between 0-15/],
[16, /promotionTier must be between 0-15/],
])('when promotionTier is %s', (promotionTier, errorMessage) => {
-1, 16,
])('when promotionTier is %s', (promotionTier) => {

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. p2 pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-rds): ClusterInstance promotionTier validation missing lower bound check (allows negative values)

3 participants