Skip to content

Conversation

@simonrw
Copy link
Contributor

@simonrw simonrw commented Sep 11, 2025

Motivation

While executing the following set of operations:

  • Create change set
  • Execute change set
  • Delete change set
  • Create new change set
  • Describe new change set

the change set lookup failed.

We incorrectly associate the change set twice, once during the create and once during execute so after the execute stage the change set id was in the stack's list twice. Deleting the change set only disassociated one of the entries, which in effect deleted the stack from the store but left it associated with the stack.

Then calling describe or delete would iterate over the stack's change sets and reach a stale change set id, which is not present in the store.

Changes

  • Add test covering this situation
  • Do not associate the change set twice
  • Add logging statements on deletion to add clarity if an error occurs
  • Make association more robust by using a set

Questions

I'm not sure we should make the association more robust with a set. If this situation occurs, it is a programming error on our part and we should fix it.

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch cfn/v2/delete-change-set-describe
# Changes to be committed:
#	modified:   localstack-core/localstack/services/cloudformation/v2/entities.py
#	modified:   localstack-core/localstack/services/cloudformation/v2/provider.py
#	modified:   tests/aws/services/cloudformation/api/test_changesets.py
#	modified:   tests/aws/services/cloudformation/api/test_changesets.snapshot.json
#	modified:   tests/aws/services/cloudformation/api/test_changesets.validation.json
#
@simonrw simonrw added this to the 4.9 milestone Sep 11, 2025
@simonrw simonrw added aws:cloudformation AWS CloudFormation semver: patch Non-breaking changes which can be included in patch releases review: merge when ready Signals to the reviewer that a PR can be merged if accepted docs: skip Pull request does not require documentation changes labels Sep 11, 2025
@github-actions
Copy link

github-actions bot commented Sep 11, 2025

Test Results - Preflight, Unit

22 124 tests   20 386 ✅  6m 21s ⏱️
     1 suites   1 738 💤
     1 files         0 ❌

Results for commit 158f892.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Sep 11, 2025

Test Results (amd64) - Acceptance

7 tests   5 ✅  3m 7s ⏱️
1 suites  2 💤
1 files    0 ❌

Results for commit 158f892.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Sep 11, 2025

LocalStack Community integration with Pro

  2 files    2 suites   34m 46s ⏱️
559 tests 444 ✅ 115 💤 0 ❌
561 runs  444 ✅ 117 💤 0 ❌

Results for commit 158f892.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Sep 11, 2025

Test Results (amd64) - Integration, Bootstrap

  5 files    5 suites   48m 11s ⏱️
583 tests 469 ✅ 114 💤 0 ❌
589 runs  469 ✅ 120 💤 0 ❌

Results for commit 158f892.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Sep 11, 2025

Test Results - Alternative Providers

558 tests   328 ✅  23m 53s ⏱️
  1 suites  230 💤
  1 files      0 ❌

Results for commit 158f892.

♻️ This comment has been updated with latest results.

@simonrw simonrw marked this pull request as ready for review September 11, 2025 13:23
Copy link
Member

@pinzon pinzon left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this. I can see why it was hard to find the issue.

Answering your question: Though I believe the best solution would be to add a method that validates that the change set id is not duplicated I'm fine with using a set since at least it won't cause issues like an array.

@simonrw
Copy link
Contributor Author

simonrw commented Sep 11, 2025

Thanks for fixing this. I can see why it was hard to find the issue.

Answering your question: Though I believe the best solution would be to add a method that validates that the change set id is not duplicated I'm fine with using a set since at least it won't cause issues like an array.

I think my concern is how to surface the error to the user, or even more ideally in a way that we can find out about it. A runtime error is not great since it's not the user's fault and they are blocked. I think a set is a way to make sure the user is not affected. We will not find out about any future potential issues using this approach, however without blocking the user we would not find out about them in any other way either.

There is a big part of me that wants to revert the set change, because errors like this can be an indicator of bigger problems in the engine and we should learn about those. I think I've convinced myself that we should revert this change. WDYT?

@simonrw
Copy link
Contributor Author

simonrw commented Sep 12, 2025

Because this is affecting customers, I am going to merge this but I'd like to revisit this conversation soon

@simonrw simonrw merged commit 54de523 into main Sep 12, 2025
64 of 65 checks passed
@simonrw simonrw deleted the cfn/v2/delete-change-set-describe branch September 12, 2025 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aws:cloudformation AWS CloudFormation docs: skip Pull request does not require documentation changes review: merge when ready Signals to the reviewer that a PR can be merged if accepted semver: patch Non-breaking changes which can be included in patch releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants