Repository navigation
chore(core): regression test for nested stack DependsOn blowup (#38406) - #38431
Merged
Merged
Conversation
…owup node.addDependency(construct) on a construct containing nested stacks flattens every resource inside the nested stacks into the source resource's DependsOn array, instead of depending on the nested stack resources only. This bloats templates past CloudFormation's size limit and references logical IDs that don't exist in the parent template.
mrgrain
force-pushed
the
mrgrain/chore/add-test-to-show-38406
branch
from
July 28, 2026 13:03
ecac23b to
2004def
Compare
aws-cdk-automation
temporarily deployed
to
automation
July 28, 2026 14:42 — with
GitHub Actions
Inactive
aws-cdk-automation
temporarily deployed
to
automation
July 28, 2026 14:43 — with
GitHub Actions
Inactive
iankhou
approved these changes
Jul 28, 2026
Contributor
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Contributor
Merge Queue Status
This pull request spent 37 minutes 33 seconds in the queue, including 37 minutes running CI. Required conditions to merge
|
Contributor
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Contributor
|
Comments on closed issues and PRs are hard for our team to see. |
aws-cdk-automation
temporarily deployed
to
automation
July 28, 2026 15:35 — with
GitHub Actions
Inactive
This branch was previously deployed
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Issue # (if applicable)
Relates to #38406.
Reason for this change
Issue #38406 reported a nasty regression: calling
construct.node.addDependency(target)where the target construct contains nested stacks caused every resource inside those nested stacks to be flattened into the source resource'sDependsOnarray. This bloated templates roughly 33x for the reporter, pushing them past CloudFormation's 1MB nested-stack template limit, and also emittedDependsOnentries for logical IDs that don't even exist in the parent template. The regression has since been resolved by reverting the change that introduced it (#38417), but nothing prevents it from being reintroduced.Description of changes
This change adds a regression test that reproduces the reported behavior: a resource that takes a construct dependency on an L3-style construct containing a nested stack must end up depending only on the construct's direct resources and the nested stack resource itself, never on the resources inside the nested stack. The test asserts both that the
DependsOnarray does not scale with the number of resources inside the nested stack (the template size blowup from the issue) and the exact expected contents of the array.Describe any new or updated permissions being added
None.
Description of how you validated changes
The test fails on the commit that introduced the regression (failing first on the
DependsOnsize assertion) and passes on current main, where the offending change has been reverted.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license