Skip to content

Conversation

@rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Mar 28, 2025

Since Nested Stack names are Tokens (resolving to { Ref: 'AWS::StackName' }), if we use this.stackName as the asset name just like we do for regular stacks, we end up with Tokens in the display name of the nested stack template asset.

This is pointless because the token will not be resolved and look like ${Token[TOKEN.639]}; plus, it breaks tests because the Token numbers are different on every run. In CDK Pipelines, it would also lead to the pipeline restarting on every pipeline run.

Instead, test for and reject Tokens, and use the nested stack's construct path instead just like we do for other assets.


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

Since Nested Stack names are Tokens (resolving to `{ Ref:
'AWS::StackName' }`), if we use `nestedStack.stackName` as the asset
name just like we do for regular stacks, we end up with Tokens in the
display name of the nested stack template asset.

This is pointless because the token will not be resolved and look like
`${Token[TOKEN.639]}`; plus, it breaks tests because the Token numbers
are different on every run. In CDK Pipelines, it would also lead to the
pipeline restarting on every pipeline run.

Instead, test for and reject Tokens, and use the nested stack's
construct path instead.
@rix0rrr rix0rrr requested a review from a team as a code owner March 28, 2025 18:39
@rix0rrr rix0rrr requested a review from a team March 28, 2025 18:39
@aws-cdk-automation aws-cdk-automation requested a review from a team March 28, 2025 18:39
@github-actions github-actions bot added the p2 label Mar 28, 2025
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Mar 28, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

(This review is outdated)

@codecov
Copy link

codecov bot commented Mar 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.39%. Comparing base (2ebac0a) to head (0b13098).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #33966      +/-   ##
==========================================
+ Coverage   82.38%   82.39%   +0.01%     
==========================================
  Files         120      120              
  Lines        6955     6960       +5     
  Branches     1173     1175       +2     
==========================================
+ Hits         5730     5735       +5     
  Misses       1120     1120              
  Partials      105      105              
Flag Coverage Δ
suite.unit 82.39% <100.00%> (+0.01%) ⬆️

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

Components Coverage Δ
packages/aws-cdk ∅ <ø> (∅)
packages/aws-cdk-lib/core 82.39% <100.00%> (+0.01%) ⬆️
🚀 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.

@rix0rrr rix0rrr added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Mar 28, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review March 28, 2025 18:50

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@kaizencc kaizencc added the pr/do-not-merge This PR should not be merged at this time. label Mar 28, 2025
Copy link
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

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

In general this is approved. But--

silly as it is, isn't this a breaking change? previously we were allowed to name an asset as a token. now we will run into a synth error. will people come knocking on our door saying we broke them?

approved and do-not-merge for @rix0rrr to make a final decision

@Leo10Gama
Copy link
Member

Leo10Gama commented Mar 28, 2025

This PR actually causes the main issues, and since it has not yet been released, this change should be safe to merge in.

@Leo10Gama Leo10Gama removed the pr/do-not-merge This PR should not be merged at this time. label Mar 28, 2025
@mergify
Copy link
Contributor

mergify bot commented Mar 28, 2025

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).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 0b13098
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify
Copy link
Contributor

mergify bot commented Mar 28, 2025

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 85fc87f into main Mar 28, 2025
20 checks passed
@mergify mergify bot deleted the huijbers/nested-stack-display-name branch March 28, 2025 23:22
@github-actions
Copy link
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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 28, 2025
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 pr-linter/exempt-integ-test The PR linter will not require integ test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants