Skip to content

fix(toolkit): diff prints stack name not display name #454

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kaizencc
Copy link
Contributor

@kaizencc kaizencc commented May 5, 2025

Fixes #448

Prior to #301 we were using both stackName and displayName interchangably in different areas of the CLI. #301 chose to standardize to stackName. This PR changes that to displayName.


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

@aws-cdk-automation aws-cdk-automation requested a review from a team May 5, 2025 19:54
@@ -154,7 +154,7 @@ export class DiffFormatter {
this.ioHelper = props.ioHelper;
this.oldTemplate = props.templateInfo.oldTemplate;
this.newTemplate = props.templateInfo.newTemplate;
this.stackName = props.templateInfo.newTemplate.stackName;
this.stackName = props.templateInfo.newTemplate.displayName ?? props.templateInfo.newTemplate.stackName;
Copy link
Contributor Author

@kaizencc kaizencc May 5, 2025

Choose a reason for hiding this comment

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

this is kind of iffy, but i think its safe. diff formatter is using stack name to differentiate nested stacks, and i don't think nested stacks can have a display name clash.

stack.displayName is defined as this:

/**
 * A string that represents this stack. Should only be used in user
 * interfaces. If the stackName has not been set explicitly, or has been set
 * to artifactId, it will return the hierarchicalId of the stack. Otherwise,
 * it will return something like "<hierarchicalId> (<stackName>)"
 */

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.25%. Comparing base (cf68e32) to head (f2437d1).
Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #454      +/-   ##
==========================================
+ Coverage   79.15%   79.25%   +0.09%     
==========================================
  Files          54       54              
  Lines        6889     6912      +23     
  Branches      773      777       +4     
==========================================
+ Hits         5453     5478      +25     
+ Misses       1418     1414       -4     
- Partials       18       20       +2     
Flag Coverage Δ
suite.unit 79.25% <ø> (+0.09%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cli: cdk diff showing logical IDs instead of path
2 participants