Skip to content

Conversation

@mrgrain
Copy link
Contributor

@mrgrain mrgrain commented Oct 6, 2025

This PR standardizes user confirmation flows across the CDK CLI by migrating from ad-hoc promptly.confirm usage to the structured ConfirmationRequest interface.

These are the changes as suggested here: #826 (review)

Changes

  • Convert CDK_TOOLKIT_I8910: Changed from DataRequest to ConfirmationRequest for refactor confirmation
  • Standardize destroy flow: Replace promptly.confirm with IO.CDK_TOOLKIT_I7010 message
  • Standardize deploy flow: Update askUserConfirmation to use ActionLessRequest<ConfirmationRequest> pattern
  • Clean up test infrastructure: Remove deprecated markTesting function and TESTING variable
  • Update tests: Replace promptly mocks with requestSpy for consistency

Benefits

  • Consistent user interaction patterns across all CLI commands
  • Better testability through standardized mocking
  • Improved error handling and TTY detection through the IO system
  • Cleaner separation of concerns between UI logic and business logic

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

…rmationRequest interface

- Convert CDK_TOOLKIT_I8910 from DataRequest to ConfirmationRequest for refactor confirmation
- Replace promptly.confirm usage with standardized IO message system in destroy and deploy flows
- Update askUserConfirmation to use ActionLessRequest<ConfirmationRequest> pattern
- Remove deprecated markTesting function and TESTING variable
- Update tests to use requestSpy instead of promptly mocks
@aws-cdk-automation aws-cdk-automation requested a review from a team October 6, 2025 08:40
@github-actions github-actions bot added the p2 label Oct 6, 2025
@codecov-commenter
Copy link

codecov-commenter commented Oct 6, 2025

Codecov Report

❌ Patch coverage is 38.23529% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.95%. Comparing base (09c0061) to head (ad5f7e7).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/aws-cdk/lib/cli/cdk-toolkit.ts 38.23% 21 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #904      +/-   ##
==========================================
- Coverage   83.69%   82.95%   -0.75%     
==========================================
  Files          65       65              
  Lines        9558     9546      -12     
  Branches     1135     1117      -18     
==========================================
- Hits         8000     7919      -81     
- Misses       1535     1605      +70     
+ Partials       23       22       -1     
Flag Coverage Δ
suite.unit 82.95% <38.23%> (-0.75%) ⬇️

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.

@aws-cdk-automation aws-cdk-automation added this pull request to the merge queue Oct 6, 2025
Merged via the queue into main with commit 9855c8f Oct 6, 2025
28 checks passed
@aws-cdk-automation aws-cdk-automation deleted the mrgrain/refactor/toolkit-lib/standardize-confirmation-requests branch October 6, 2025 17:51
iankhou pushed a commit that referenced this pull request Oct 7, 2025
…rmationRequest interface (#904)

This PR standardizes user confirmation flows across the CDK CLI by
migrating from ad-hoc `promptly.confirm` usage to the structured
`ConfirmationRequest` interface.

These are the changes as suggested here:
#826 (review)

## Changes

- **Convert CDK_TOOLKIT_I8910**: Changed from `DataRequest` to
`ConfirmationRequest` for refactor confirmation
- **Standardize destroy flow**: Replace `promptly.confirm` with
`IO.CDK_TOOLKIT_I7010` message
- **Standardize deploy flow**: Update `askUserConfirmation` to use
`ActionLessRequest<ConfirmationRequest>` pattern
- **Clean up test infrastructure**: Remove deprecated `markTesting`
function and `TESTING` variable
- **Update tests**: Replace `promptly` mocks with `requestSpy` for
consistency

## Benefits

- Consistent user interaction patterns across all CLI commands
- Better testability through standardized mocking
- Improved error handling and TTY detection through the IO system
- Cleaner separation of concerns between UI logic and business logic

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants