Skip to content

Conversation

otaviomacedo
Copy link
Contributor

@otaviomacedo otaviomacedo commented Jul 1, 2025

This change introduces the creation and execution of stack refactors. It builds on previous work that put all the pieces in place (mapping computation, mapping file reading, exclude lists, dry-run etc). The following flowcharts summarize the behavior in interactive and non-interactive modes, for each environment in the application:

Non-interactive case

flowchart LR
    mapping{Refactor file present?}
    empty{Empty mapping?}
    dryrun{--dry-run?}
    compute[Compute mapping]
    use[Use mapping]
    print[Print mapping]
    mapping ---|No| compute
    mapping ---|Yes| use
    compute --- empty
    use --- empty
    empty ---|Yes| Exit
    empty ---|No| print
    print --- dryrun
    dryrun ---|Yes| Exit
    dryrun ---|No| Refactor
    Refactor --- Exit
Loading

Interactive case

flowchart LR
    mapping{Refactor file present?}
    empty{Empty mapping?}
    dryrun{--dry-run?}
    force{--force?}
    compute[Compute mapping]
    use[Use mapping]
    print[Print mapping]
    ask[Ask user]
    mapping ---|No| compute
    mapping ---|Yes| use
    compute --- empty
    use --- empty
    empty ---|Yes| Exit
    empty ---|No| print
    print --- dryrun
    dryrun ---|Yes| Exit
    dryrun ---|No| force
    force ---|Yes| Refactor
    force ---|No| ask
    ask ---|Yes| Refactor
    ask ---|No| Exit
    Refactor --- Exit
Loading

Closes #140.


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 July 1, 2025 10:42
@github-actions github-actions bot added the p2 label Jul 1, 2025
Base automatically changed from otaviom/forbid-modifications to main July 10, 2025 15:19
# Conflicts:
#	packages/@aws-cdk/toolkit-lib/.projen/tasks.json
#	packages/@aws-cdk/toolkit-lib/lib/actions/refactor/index.ts
#	packages/@aws-cdk/toolkit-lib/lib/api/refactoring/context.ts
#	packages/@aws-cdk/toolkit-lib/lib/api/refactoring/digest.ts
#	packages/@aws-cdk/toolkit-lib/lib/api/refactoring/index.ts
#	packages/@aws-cdk/toolkit-lib/lib/toolkit/toolkit.ts
#	packages/@aws-cdk/toolkit-lib/test/_fixtures/stack-with-two-buckets/index.ts
#	packages/@aws-cdk/toolkit-lib/test/actions/refactor.test.ts
#	packages/aws-cdk/README.md
#	packages/aws-cdk/lib/cli/cdk-toolkit.ts
#	packages/aws-cdk/lib/cli/cli-config.ts
#	packages/aws-cdk/lib/cli/cli.ts
#	packages/aws-cdk/lib/cli/convert-to-user-input.ts
#	packages/aws-cdk/lib/cli/parse-command-line-arguments.ts
#	packages/aws-cdk/lib/cli/user-input.ts
# Conflicts:
#	packages/@aws-cdk/toolkit-lib/.projen/tasks.json
#	packages/@aws-cdk/toolkit-lib/lib/actions/refactor/index.ts
@codecov-commenter
Copy link

codecov-commenter commented Aug 21, 2025

Codecov Report

❌ Patch coverage is 80.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.30%. Comparing base (455c017) to head (a6a0e60).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
packages/aws-cdk/lib/cli/cdk-toolkit.ts 84.61% 2 Missing ⚠️
packages/aws-cdk/lib/cli/cli.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #674      +/-   ##
==========================================
+ Coverage   81.46%   82.30%   +0.83%     
==========================================
  Files          63       65       +2     
  Lines        8611     9528     +917     
  Branches     1039     1104      +65     
==========================================
+ Hits         7015     7842     +827     
- Misses       1565     1653      +88     
- Partials       31       33       +2     
Flag Coverage Δ
suite.unit 82.30% <80.00%> (+0.83%) ⬆️

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.

Implement refactor API calls
2 participants