Skip to content

feat: unique change set names for diff, bootstrap and orphan - #1985

Merged
aws-cdk-automation merged 1 commit into
mainfrom
mrgrain/feat/toolkit-lib/uuid-change-set-names
Sep 22, 2026
Merged

aws-cdk-automation merged 1 commit into
mainfrom
mrgrain/feat/toolkit-lib/uuid-change-set-names

Conversation

@mrgrain

@mrgrain mrgrain commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

The fixed default change set names collide when two operations run concurrently against the same stack: the second operation deletes and recreates the change set under the same name, breaking the first. For change sets that are ephemeral anyway, a unique name per operation avoids this entirely.

This gives unique default names to the change sets that are always cleaned up or executed:

  • cdk diff: cdk-diff-change-set-<uuid>, reusing the uuid the diff already generates for the change set's ClientToken. Diff change sets are always deleted in a finally, so nothing depends on finding them again by name. Anyone needing a deterministic name can use the --change-set-name flag from feat(cli): support --change-set-name for cdk diff #1982.
  • cdk bootstrap: cdk-bootstrap-change-set-<uuid> — but only when executing. With --no-execute the change set is deliberately left in review for the user, so it keeps the stable default name: re-running bootstrap then replaces the pending change set instead of accumulating one per run.
  • cdk orphan: cdk-orphan-step{1,2,3}-<uuid> with one uuid shared by all steps of an operation, so the change sets of one orphan run stay correlated.

The deploy default (cdk-deploy-change-set) is deliberately unchanged: the prepare-change-setexecute-change-set workflow relies on the stable name to find the change set again. Customers may use --change-set-name to provide a custom, unique name.

Because change set names are observable, a customer environments might have a condition IAM policy on them. All new names keep recognizable cdk-* prefixes, but any exact-match policy on the old names would no longer work. I think this acceptable, the names where never a documented stable contruct. Leftover uniquely-named change sets from crashed runs are purged by CloudFormation whenever any change set is executed on the stack, so they don't accumulate indefinitely.

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

…phan

Fixed default change set names collide when operations run concurrently
against the same stack: a second operation deletes and replaces the
first one's change set.

Give ephemeral change sets unique names by default:
- diff: cdk-diff-change-set-<uuid>, reusing the uuid already generated
  for the change set's ClientToken
- bootstrap: cdk-bootstrap-change-set-<uuid> when executing; --no-execute
  keeps the stable default name so re-running replaces the pending
  change set instead of accumulating one per run
- orphan: cdk-orphan-step{1,2,3}-<uuid>, one shared uuid per operation
  so the steps stay correlated

The deploy default (cdk-deploy-change-set) is deliberately unchanged:
the prepare-change-set/execute-change-set pairing relies on it.
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

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

Scanned Files

None

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.47%. Comparing base (59a01f8) to head (443c7e8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1985   +/-   ##
=======================================
  Coverage   91.47%   91.47%           
=======================================
  Files          80       80           
  Lines       12675    12675           
  Branches     1792     1792           
=======================================
  Hits        11595    11595           
  Misses       1042     1042           
  Partials       38       38           
Flag Coverage Δ
suite.unit 91.47% <100.00%> (ø)

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

☔ View full report in Codecov by Harness.
📢 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 feat(toolkit-lib): unique change set names for diff, bootstrap and orphan feat: unique change set names for diff, bootstrap and orphan Sep 22, 2026
@aws-cdk-automation
aws-cdk-automation added this pull request to the merge queue Sep 22, 2026
Merged via the queue into main with commit 29c9fe8 Sep 22, 2026
61 checks passed
@aws-cdk-automation
aws-cdk-automation deleted the mrgrain/feat/toolkit-lib/uuid-change-set-names branch September 22, 2026 12:26

This branch was successfully deployed

3 active deployments
run-tests 443c7e81 Deployed Sep 22, 2026 by mrgrain via integ_cli (cli-integ-tests, 24.19, 3) #6969
no-approval 443c7e81 Deployed Sep 22, 2026 by mrgrain via prepare #6969
automation 443c7e81 Deployed Sep 22, 2026 by mrgrain via Triage Pull Requests #2125
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.

4 participants