Commit 9855c8f
authored
refactor(toolkit-lib): standardize confirmation requests to use ConfirmationRequest 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 license1 parent 05954dd commit 9855c8f
File tree
6 files changed
+49
-60
lines changed- packages
- @aws-cdk-testing/cli-integ/tests/cli-integ-tests/destroy
- @aws-cdk/toolkit-lib
- lib
- api/io/private
- toolkit
- test/actions
- aws-cdk
- lib/cli
- test/cli
6 files changed
+49
-60
lines changedLines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
391 | 390 | | |
392 | 391 | | |
393 | 392 | | |
394 | | - | |
| 393 | + | |
395 | 394 | | |
396 | 395 | | |
397 | 396 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1190 | 1190 | | |
1191 | 1191 | | |
1192 | 1192 | | |
1193 | | - | |
1194 | | - | |
1195 | | - | |
1196 | | - | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
1197 | 1196 | | |
1198 | 1197 | | |
1199 | 1198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
854 | 854 | | |
855 | 855 | | |
856 | 856 | | |
857 | | - | |
| 857 | + | |
858 | 858 | | |
859 | 859 | | |
860 | 860 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
15 | | - | |
16 | | - | |
| 14 | + | |
| 15 | + | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
74 | 73 | | |
75 | 74 | | |
76 | 75 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | 76 | | |
84 | 77 | | |
85 | 78 | | |
| |||
495 | 488 | | |
496 | 489 | | |
497 | 490 | | |
| 491 | + | |
498 | 492 | | |
499 | 493 | | |
500 | 494 | | |
501 | | - | |
502 | | - | |
503 | | - | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
504 | 501 | | |
505 | 502 | | |
506 | 503 | | |
| |||
578 | 575 | | |
579 | 576 | | |
580 | 577 | | |
581 | | - | |
582 | | - | |
583 | | - | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
584 | 582 | | |
585 | 583 | | |
586 | 584 | | |
| |||
604 | 602 | | |
605 | 603 | | |
606 | 604 | | |
607 | | - | |
608 | | - | |
609 | | - | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
610 | 609 | | |
611 | 610 | | |
612 | 611 | | |
| |||
970 | 969 | | |
971 | 970 | | |
972 | 971 | | |
973 | | - | |
| 972 | + | |
974 | 973 | | |
975 | 974 | | |
976 | | - | |
| 975 | + | |
977 | 976 | | |
978 | 977 | | |
979 | | - | |
980 | | - | |
981 | | - | |
982 | | - | |
983 | | - | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
984 | 987 | | |
985 | 988 | | |
986 | 989 | | |
987 | 990 | | |
988 | 991 | | |
989 | 992 | | |
990 | | - | |
| 993 | + | |
991 | 994 | | |
992 | 995 | | |
993 | 996 | | |
994 | 997 | | |
995 | 998 | | |
996 | 999 | | |
997 | | - | |
| 1000 | + | |
998 | 1001 | | |
999 | | - | |
| 1002 | + | |
1000 | 1003 | | |
1001 | 1004 | | |
1002 | 1005 | | |
| |||
2103 | 2106 | | |
2104 | 2107 | | |
2105 | 2108 | | |
2106 | | - | |
2107 | | - | |
2108 | | - | |
| 2109 | + | |
2109 | 2110 | | |
2110 | 2111 | | |
2111 | | - | |
2112 | | - | |
2113 | | - | |
2114 | | - | |
2115 | | - | |
2116 | | - | |
2117 | | - | |
2118 | | - | |
2119 | | - | |
2120 | | - | |
2121 | | - | |
2122 | | - | |
2123 | | - | |
2124 | | - | |
| 2112 | + | |
2125 | 2113 | | |
2126 | 2114 | | |
2127 | 2115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | 67 | | |
69 | 68 | | |
70 | 69 | | |
| |||
81 | 80 | | |
82 | 81 | | |
83 | 82 | | |
84 | | - | |
| 83 | + | |
85 | 84 | | |
86 | 85 | | |
87 | 86 | | |
| |||
99 | 98 | | |
100 | 99 | | |
101 | 100 | | |
102 | | - | |
103 | | - | |
104 | 101 | | |
105 | 102 | | |
106 | 103 | | |
107 | 104 | | |
108 | 105 | | |
109 | 106 | | |
| 107 | + | |
110 | 108 | | |
111 | 109 | | |
112 | 110 | | |
| |||
1700 | 1698 | | |
1701 | 1699 | | |
1702 | 1700 | | |
1703 | | - | |
| 1701 | + | |
| 1702 | + | |
1704 | 1703 | | |
1705 | 1704 | | |
1706 | 1705 | | |
| |||
1725 | 1724 | | |
1726 | 1725 | | |
1727 | 1726 | | |
1728 | | - | |
| 1727 | + | |
1729 | 1728 | | |
1730 | | - | |
| 1729 | + | |
1731 | 1730 | | |
1732 | 1731 | | |
1733 | 1732 | | |
| |||
0 commit comments