Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): implicit app for root stacks #9342

Merged
merged 11 commits into from
Aug 3, 2020

Conversation

eladb
Copy link
Contributor

@eladb eladb commented Jul 29, 2020

When a stack is created as the root of the construct tree, we now implicitly create an App that serves as its parent scope.

The root stack is created with the ID Default, which ensures that node.uniqueId of constructs within that stack is preserved.

BREAKING CHANGE: in unit tests, the node.path of constructs within stacks created the root of the tree via new Stack() will now have a prefix Default/ which represents an implicit App root.

Related: aws/aws-cdk-rfcs#192


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

When a stack is created as the root of the construct tree, we now implicitly create an `App` that serves as its parent scope.

The root stack is created with the ID `Default`, which ensures that `node.uniqueId` of constructs within that stack is preserved.

BREAKING CHANGE: in unit tests, the `node.path` of constructs within stacks created the root of the tree via `new Stack()` will now have a prefix `Default/` which represents an implicit `App` root.

Related: aws/aws-cdk-rfcs#192
@eladb eladb requested a review from a team July 29, 2020 20:25
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jul 29, 2020
Copy link
Contributor

@NetaNir NetaNir left a comment

Choose a reason for hiding this comment

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

Just making sure Im not missing something in the context of this PR. ConstructNode.synth was replaced with synthesize in several location, but it seems like this was possible before this PR, is that true?

packages/@aws-cdk/core/test/fs/test.fs.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/core/lib/stack.ts Outdated Show resolved Hide resolved
Comment on lines +132 to +134
test.equal(stack.node.findChild(p.node.id), p);
test.equal(stack.node.findChild(o.node.id), o);
test.equal(stack.node.findChild(c.node.id), c);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to make sure I understand, this was broken before? The test name is still Stack.getByPath but it's not verifying that anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yap

@eladb eladb added the pr-linter/exempt-readme The PR linter will not require README changes label Aug 3, 2020
@eladb eladb requested a review from NetaNir August 3, 2020 09:28
Elad Ben-Israel and others added 2 commits August 3, 2020 12:28
@mergify
Copy link
Contributor

mergify bot commented Aug 3, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Contributor

mergify bot commented Aug 3, 2020

Thank you for contributing! Your pull request will be updated from master 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 1d85a9f into master Aug 3, 2020
@mergify mergify bot deleted the benisrae/implicit-app-root-stack branch August 3, 2020 10:45
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 319bbf9
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

curtiseppel pushed a commit to curtiseppel/aws-cdk that referenced this pull request Aug 11, 2020
When a stack is created as the root of the construct tree, we now implicitly create an `App` that serves as its parent scope.

The root stack is created with the ID `Default`, which ensures that `node.uniqueId` of constructs within that stack is preserved.

BREAKING CHANGE: in unit tests, the `node.path` of constructs within stacks created the root of the tree via `new Stack()` will now have a prefix `Default/` which represents an implicit `App` root.

Related: aws/aws-cdk-rfcs#192


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. pr-linter/exempt-readme The PR linter will not require README changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants