Skip to content

chore(core): regression test for nested stack DependsOn blowup (#38406) - #38431

Merged
mergify[bot] merged 2 commits into
mainfrom
mrgrain/chore/add-test-to-show-38406
Jul 28, 2026
Merged

mergify[bot] merged 2 commits into
mainfrom
mrgrain/chore/add-test-to-show-38406

Conversation

@mrgrain

@mrgrain mrgrain commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

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's DependsOn array. This bloated templates roughly 33x for the reporter, pushing them past CloudFormation's 1MB nested-stack template limit, and also emitted DependsOn entries 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 DependsOn array 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 DependsOn size 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

@mrgrain
mrgrain requested a review from a team as a code owner July 28, 2026 13:02
@aws-cdk-automation
aws-cdk-automation requested a review from a team July 28, 2026 13:03
@github-actions github-actions Bot added the p2 label Jul 28, 2026
…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.
@mergify mergify Bot added the contribution/core This is a PR that came from AWS. label Jul 28, 2026
@mergify
mergify Bot temporarily deployed to automation July 28, 2026 13:03 Inactive
@mrgrain
mrgrain force-pushed the mrgrain/chore/add-test-to-show-38406 branch from ecac23b to 2004def Compare July 28, 2026 13:03
@mrgrain mrgrain changed the title test(core): regression test for nested stack DependsOn blowup (#38406) chore(core): regression test for nested stack DependsOn blowup (#38406) Jul 28, 2026
@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jul 28, 2026
@mergify

mergify Bot commented Jul 28, 2026

Copy link
Copy Markdown
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).

@mergify

mergify Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-07-28 14:57 UTC · Rule: default-squash · triggered by rule automatic merge
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-07-28 15:34 UTC · at db064ccd4ff4f03ddf7cd8c53bbdd7bf50c160e5 · squash

This pull request spent 37 minutes 33 seconds in the queue, including 37 minutes running CI.

Required conditions to merge

@mergify

mergify Bot commented Jul 28, 2026

Copy link
Copy Markdown
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).

@mergify
mergify Bot merged commit 2ae093e into main Jul 28, 2026
18 of 19 checks passed
@mergify
mergify Bot deleted the mrgrain/chore/add-test-to-show-38406 branch July 28, 2026 15:34
@github-actions

Copy link
Copy Markdown
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jul 28, 2026
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 28, 2026

This branch was previously deployed

1 inactive deployment
automation — db064ccd Deployed Jul 28, 2026 by aws-cdk-automation via validate-pr #357034
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

contribution/core This is a PR that came from AWS. p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants