Skip to content

refactor(cli): require approval is a part of the CliIoHost#151

Merged
kaizencc merged 27 commits intomainfrom
conroy/requireapproval
Mar 6, 2025
Merged

refactor(cli): require approval is a part of the CliIoHost#151
kaizencc merged 27 commits intomainfrom
conroy/requireapproval

Conversation

@kaizencc
Copy link
Contributor

@kaizencc kaizencc commented Feb 25, 2025

CliIoHost now governs when to ask for approval or not. This was previously passed into deploy via deployOptions.

  • deployOptions.requireApproval was deprecated before, and now it is no longer being used (this may have to be pulled into a different change that removes the requireApproval option entirely in a minor version bump of toolkit-lib.
  • CliIoHost has a property, requireApproval that can be set. When the requestResponse API is called, we check to see if the message code is a known requireApproval code and if so, see if the request is necessary or if the default can be used.

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

@codecov-commenter
Copy link

codecov-commenter commented Feb 28, 2025

Codecov Report

Attention: Patch coverage is 96.42857% with 2 lines in your changes missing coverage. Please review.

Project coverage is 85.01%. Comparing base (47a4e1d) to head (21a65f2).
Report is 29 commits behind head on main.

Files with missing lines Patch % Lines
packages/aws-cdk/lib/toolkit/cli-io-host.ts 96.36% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #151      +/-   ##
==========================================
+ Coverage   84.84%   85.01%   +0.17%     
==========================================
  Files         207      207              
  Lines       35761    35816      +55     
  Branches     4601     4626      +25     
==========================================
+ Hits        30340    30449     +109     
+ Misses       5269     5217      -52     
+ Partials      152      150       -2     
Flag Coverage Δ
suite.unit 85.01% <96.42%> (+0.17%) ⬆️

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 February 28, 2025 01:30
@kaizencc kaizencc changed the title feat(cli): require approval is a part of the CliIoHost refactor(cli): require approval is a part of the CliIoHost Feb 28, 2025
@@ -53,10 +54,9 @@ describe('deploy', () => {

test('request response when require approval is set', async () => {
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 test tests that we are getting the approval prompt... do you also want me to test that we can respond to it? or is that self-explanitory

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that's enough. Otherwise we're just testing that the TestIoHost works.

I'd add a data prop to the expected message though.

Signed-off-by: github-actions <github-actions@github.com>

test('request response when require approval is set', async () => {
// WHEN
ioHost.requireDeployApproval = RequireApproval.ANY_CHANGE;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand that effect this has on the test?

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 is how we set require approval now. i can add a comment in the code

@@ -53,10 +54,9 @@ describe('deploy', () => {

test('request response when require approval is set', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that's enough. Otherwise we're just testing that the TestIoHost works.

I'd add a data prop to the expected message though.

@mrgrain mrgrain disabled auto-merge March 6, 2025 22:03
@kaizencc kaizencc temporarily deployed to integ-approval March 6, 2025 22:09 — with GitHub Actions Inactive
@kaizencc kaizencc enabled auto-merge March 6, 2025 22:09
@kaizencc kaizencc added this pull request to the merge queue Mar 6, 2025
Merged via the queue into main with commit 7b00dd1 Mar 6, 2025
20 checks passed
@kaizencc kaizencc deleted the conroy/requireapproval branch March 6, 2025 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants