fix(cli): guide Stage users to a working pattern in stack-selection error - #1847
Open
lemon0333 wants to merge 1 commit into
Open
fix(cli): guide Stage users to a working pattern in stack-selection error#1847lemon0333 wants to merge 1 commit into
lemon0333 wants to merge 1 commit into
Conversation
…rror When an app has more than one stack and no selector is given, the CLI prints "specify which stacks to use ... or `--all`". When the stacks live inside a Stage, `--all` and a bare stack name are not the obvious way to target them, so the message was unhelpful for Stage users. Detect stacks that are nested inside a Stage (i.e. not top-level stacks) and additionally point the user at a wildcard pattern that selects them, e.g. `'StageName/*'`. Applied to both the CLI stack selection path and the toolkit-lib `selectStacksV2` path, which share the same message. Fixes aws#1451
lemon0333
requested a deployment
to
integ-approval
August 18, 2026 13:52 — with
GitHub Actions
Waiting
aws-cdk-automation
enabled auto-merge
August 18, 2026 13:52
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1847 +/- ##
==========================================
+ Coverage 90.31% 90.44% +0.12%
==========================================
Files 80 80
Lines 12159 12188 +29
Branches 1725 1737 +12
==========================================
+ Hits 10982 11024 +42
+ Misses 1143 1130 -13
Partials 34 34
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1451
When an app has more than one stack and no selector is given,
cdk deployprints:When the stacks live inside a Stage, this message is unhelpful: their ids are namespaced like
StageName/StackName, and neither a bare stack name nor--allis the obvious way to target them, so users are left guessing (see #1451).This change detects stacks that are nested inside a Stage (i.e. stacks that are not top-level stacks) and additionally points the user at a wildcard pattern that selects them, e.g.:
The hint is only appended when staged stacks are actually present, so flat apps are unaffected. The Stage detection is structural (stacks present recursively but not at the top level) rather than string-based, so a top-level stack whose display name happens to contain
/is not misclassified. The same message is shared by the CLI stack-selection path (cloud-assembly.ts) and thetoolkit-libselectStacksV2path, so both are updated for consistency.Unit tests were added on both selector/error paths (Stage guidance present when nested, absent for flat apps, and stage patterns de-duplicated across multiple stages).
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license