Skip to content

fix: diff leaves empty stack in REVIEW_IN_PROGRESS#1534

Merged
aws-cdk-automation merged 1 commit into
mainfrom
mrgrain/fix/toolkit-lib/diff-cleanup-review-in-progress
May 20, 2026
Merged

fix: diff leaves empty stack in REVIEW_IN_PROGRESS#1534
aws-cdk-automation merged 1 commit into
mainfrom
mrgrain/fix/toolkit-lib/diff-cleanup-review-in-progress

Conversation

@mrgrain
Copy link
Copy Markdown
Contributor

@mrgrain mrgrain commented May 20, 2026

Fixes #1503

When cdk diff --method=change-set is run against a stack that doesn't exist in the target account, a CREATE changeset is created which puts the stack into REVIEW_IN_PROGRESS state. Previously, only the changeset was deleted after the diff completed, leaving behind an empty phantom stack that the user would have to manually delete.

This change deletes the stack after cleaning up the changeset when the stack didn't previously exist. It also treats DELETE_IN_PROGRESS as non-existent to handle the race condition where diff is run twice in quick succession — the second invocation would otherwise try to create an UPDATE changeset against the deleting stack.

Checklist

  • This change contains a major version upgrade for a dependency and I confirm all breaking changes are addressed
    • Release notes for the new version:

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

When `cdk diff --method=change-set` is run against a stack that doesn't
exist, a CREATE changeset is made which puts the stack into
REVIEW_IN_PROGRESS state. After describing the changeset, only the
changeset was deleted but the empty stack was left behind.

This change deletes the stack after cleaning up the changeset when the
stack didn't previously exist. Also treats DELETE_IN_PROGRESS as
non-existent to handle the race condition of running diff twice in quick
succession.

Closes #1503
@github-actions
Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@aws-cdk-automation aws-cdk-automation requested a review from a team May 20, 2026 09:25
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.20%. Comparing base (65084ca) to head (4ea7e96).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1534      +/-   ##
==========================================
- Coverage   88.22%   88.20%   -0.02%     
==========================================
  Files          76       76              
  Lines       10820    10820              
  Branches     1488     1489       +1     
==========================================
- Hits         9546     9544       -2     
- Misses       1246     1248       +2     
  Partials       28       28              
Flag Coverage Δ
suite.unit 88.20% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mrgrain mrgrain changed the title fix(toolkit-lib): diff leaves empty stack in REVIEW_IN_PROGRESS fix: diff leaves empty stack in REVIEW_IN_PROGRESS May 20, 2026
@aws-cdk-automation aws-cdk-automation added this pull request to the merge queue May 20, 2026
Merged via the queue into main with commit dd48c38 May 20, 2026
51 checks passed
@aws-cdk-automation aws-cdk-automation deleted the mrgrain/fix/toolkit-lib/diff-cleanup-review-in-progress branch May 20, 2026 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(cli): cdk diff will create an empty stack in REVIEW_IN_PROGRESS if run against an account the stack is not deployed to

4 participants