Skip to content

fix(toolkit-lib): diff leaves a deleting shell stack behind, breaking the next deploy - #1994

Merged
aws-cdk-automation merged 1 commit into
aws:mainfrom
akagr:fix/diff-wait-for-shell-stack-delete
Sep 23, 2026
Merged

aws-cdk-automation merged 1 commit into
aws:mainfrom
akagr:fix/diff-wait-for-shell-stack-delete

Conversation

@akagr

@akagr akagr commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #1993

cdk diff --method=change-set materialises a REVIEW_IN_PROGRESS shell stack for a stack that does not exist yet, then deletes it without waiting for the delete to complete. A cdk deploy started shortly afterwards still sees the shell via DescribeStacks, so canSkipDeploy calls template() → GetTemplate, which fails with Stack [<name>] does not exist because a deleting shell has no template. That error is not caught (lookup only matches the Stack with id <name> does not exist wording), so the deploy exits 1.

Deployments.cleanupChangeSet already waits after the equivalent delete; this makes createChangeSetAndCleanup do the same, and applies the same fix to createValidationChangeSet.

The wait is gated on a new stackExistedBefore flag rather than the existing exists, so a diff only ever waits for a shell that its own change set created. exists reports a stack in REVIEW_IN_PROGRESS/DELETE_IN_PROGRESS as absent, so gating on it would make a read-only diff block on an unrelated stack that someone else already had in flight. CreateChangeSetOptions is module-internal (not re-exported from lib/index.ts), so the added field is not an API change.

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

@akagr
akagr deployed to automation September 23, 2026 12:03 — with GitHub Actions Active
@akagr
akagr deployed to automation September 23, 2026 12:03 — with GitHub Actions Active
@akagr
akagr deployed to integ-approval September 23, 2026 12:03 — with GitHub Actions Active
@github-actions github-actions Bot added the p2 label Sep 23, 2026
@aws-cdk-automation
aws-cdk-automation requested a review from a team September 23, 2026 12:03
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@akagr
akagr deployed to run-tests September 23, 2026 13:52 — with GitHub Actions Active
@aws-cdk-automation
aws-cdk-automation added this pull request to the merge queue Sep 23, 2026
Merged via the queue into aws:main with commit 9c6bd0e Sep 23, 2026
51 checks passed

This branch was successfully deployed

3 active deployments
run-tests — 5507a198 Deployed Sep 23, 2026 by akagr via integ_cli (cli-integ-tests, 24.19, 8) #6989
integ-approval — 5507a198 Deployed Sep 23, 2026 by akagr via prepare #6989
automation — 5507a198 Deployed Sep 23, 2026 by akagr via Set AutoQueue on PR #1994 #3613
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.

cdk diff leaves a deleting shell stack behind, so the next cdk deploy fails with "Stack [<name>] does not exist"

3 participants