Skip to content

feat(toolkit-lib): diff #279

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

Merged
merged 34 commits into from
Mar 29, 2025
Merged

feat(toolkit-lib): diff #279

merged 34 commits into from
Mar 29, 2025

Conversation

kaizencc
Copy link
Contributor

@kaizencc kaizencc commented Mar 24, 2025

introduces diff support for programmatic toolkit.

  • has feature parity with the existing CLI diff
  • programmatic toolkit functionality is unit tested.
  • AI disclosure: no AI

does most of aws/aws-cdk#33182, but typed return will come later


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 March 24, 2025 21:00
@github-actions github-actions bot added the p2 label Mar 24, 2025
@codecov-commenter
Copy link

codecov-commenter commented Mar 24, 2025

Codecov Report

Attention: Patch coverage is 97.77778% with 1 line in your changes missing coverage. Please review.

Project coverage is 85.43%. Comparing base (f9f6d1d) to head (c96788f).
Report is 202 commits behind head on main.

Files with missing lines Patch % Lines
packages/aws-cdk/lib/api/deployments/cfn-api.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #279      +/-   ##
==========================================
+ Coverage   85.34%   85.43%   +0.09%     
==========================================
  Files         222      222              
  Lines       36885    36898      +13     
  Branches     4448     4451       +3     
==========================================
+ Hits        31478    31524      +46     
+ Misses       5310     5280      -30     
+ Partials       97       94       -3     
Flag Coverage Δ
suite.unit 85.43% <97.77%> (+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.

@kaizencc kaizencc marked this pull request as ready for review March 26, 2025 21:01
@@ -12,6 +12,7 @@ export { CloudWatchLogEventMonitor, findCloudWatchLogGroups } from '../../../../
export { type WorkGraph, WorkGraphBuilder, AssetBuildNode, AssetPublishNode, StackNode, Concurrency } from '../../../../aws-cdk/lib/api/work-graph';
export { Bootstrapper } from '../../../../aws-cdk/lib/api/bootstrap';
export { loadTree, some } from '../../../../aws-cdk/lib/api/tree';
export { createDiffChangeSet } from '../../../../aws-cdk/lib/api/deployments/cfn-api';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i also need to use this function and there's not a good way of moving it to tmp-toolkit-helpers because i would basically be moving the entire deployments folder. wonder if this is ok for now

Copy link
Contributor

@mrgrain mrgrain Mar 26, 2025

Choose a reason for hiding this comment

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

Yes fine. Will move soon. But add it to the existing import further up, you might need to export the function from the api module.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, but doing so means that i export the cfn-api file out of aws-cdk

Comment on lines 226 to 231
expect(ioHost.notifySpy).toHaveBeenCalledWith(expect.objectContaining({
action: 'diff',
level: 'warn',
code: 'CDK_TOOLKIT_W0000',
message: expect.stringContaining('This deployment will make potentially sensitive changes according to your current security approval level (--require-approval broadening)'),
}));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

sanity check: do we expect to have this as a warning notification when we run toolkit.diff?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, probably not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this comes from here

it was previously a warning() before being refactored into ioDefaultHelper.warning, so it was always printed as a warning even when the command was cdk diff (and not cdk deploy, where presumably you would need to stop and confirm the diff). cdk deploy has its own confirm message that actually prompts the user.

i think we should be able to just delete those two lines -- i don't think they are useful. alternatively, i don't think its harmful to leave them in.

@kaizencc kaizencc requested a review from mrgrain March 26, 2025 21:25
Signed-off-by: github-actions <[email protected]>
@aws-cdk-automation aws-cdk-automation added this pull request to the merge queue Mar 29, 2025
Merged via the queue into main with commit cd35a1c Mar 29, 2025
20 checks passed
@aws-cdk-automation aws-cdk-automation deleted the conroy/diffs branch March 29, 2025 07:04
@kaizencc kaizencc self-assigned this Apr 15, 2025
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.

4 participants