fix(toolkit-lib): clean up the diff change set when early validation fails - #1821
Open
lemon0333 wants to merge 1 commit into
Open
fix(toolkit-lib): clean up the diff change set when early validation fails#1821lemon0333 wants to merge 1 commit into
lemon0333 wants to merge 1 commit into
Conversation
…fails When a diff change set fails early validation (for example a resource that already exists), `waitAndThrowOnProblem` threw before the change-set and empty-stack cleanup ran, orphaning the change set and leaving a new stack stuck in REVIEW_IN_PROGRESS, which then blocked subsequent change-set creation on that stack. Run the cleanup on the failure path too (best-effort, without masking the original error) so a failed diff no longer leaks the change set or the empty review stack. Fixes aws#1767
aws-cdk-automation
enabled auto-merge
August 12, 2026 05:08
lemon0333
requested a deployment
to
integ-approval
August 12, 2026 05:08 — with
GitHub Actions
Waiting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1767
When a
cdk diffchange set fails early validation (e.g. a resource that already exists),createChangeSetAndCleanupintoolkit-lib'scfn-api.tsthrew fromwaitAndThrowOnProblembefore the change-set and empty-stack cleanup could run. That orphaned the change set and left a new stack stuck inREVIEW_IN_PROGRESS, which then blocked subsequent change-set creation and forced the user to delete it manually in the console.This change runs the cleanup on the failure path too — deleting the change set and, for a brand new stack, the empty review stack — as a best-effort step that does not mask the original validation error. Successful diffs are unchanged.
Verified with a new unit test in
diff.test.ts(change set fails validation →DeleteChangeSetandDeleteStackare called); the fulldiff.test.tssuite passes (22/22).Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license