Friendly error for 'aspire do --list-steps' without a step#17535
Conversation
'aspire do' is always step-targeted, so '--list-steps' with no step has no meaningful scope. The validator previously allowed it, which caused the CLI to launch the AppHost and race ahead executing the full pipeline before the CLI could fetch steps and stop. That race surfaced as 'InvalidOperationException: Sequence contains more than one matching element' from AzurePublishingContext (#17526). Tighten the DoCommand validator to always require the step argument (outside the extension host, which prompts interactively). When the user specifies '--list-steps' without a step, emit a friendly, localized error pointing at concrete examples: 'aspire do deploy --list-steps' or 'aspire do publish --list-steps'. Adds StepArgumentRequired and ListStepsRequiresStep entries to DoCommandStrings.resx + Designer.cs and refreshes all xlf translations via UpdateXlf. Tests: - DoCommandTests: new DoCommandWithListStepsAndNoStepArgumentShowsFriendlyError regression case; existing list-steps tests updated to pass a step. - ListStepsTests (E2E): single Docker-backed test now exercises 'aspire do --list-steps' (asserts friendly error and the absence of the 'Sequence contains more than one matching element' crash) plus 'aspire do deploy --list-steps', 'aspire publish --list-steps' and 'aspire deploy --list-steps' against a freshly created starter app. Fixes: #17526 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17535Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17535" |
Expand the 'aspire do --list-steps' validation error to enumerate every well-known pipeline step instead of just naming 'deploy' and 'publish'. The step names are hand-maintained in DoCommand alongside a comment pointing at src/Aspire.Hosting/Pipelines/WellKnownPipelineSteps.cs (the CLI does not reference Aspire.Hosting). Updated unit and E2E assertions to match the new message shape. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the long enumeration of well-known step names with a short, opinionated suggestion (build, publish, deploy) and a link to the official 'aspire do' reference page on aspire.dev for the full list. This removes the hand-maintained mirror of WellKnownPipelineSteps in DoCommand and simplifies localization since the message no longer takes a format parameter. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PR Testing ReportPR Information
CLI Version Verification
Changes AnalyzedFiles Changed
Change Categories
Test Scenarios ExecutedScenario 1:
|
| Scenario | Status |
|---|---|
1. aspire do --list-steps → friendly error |
✅ Passed |
2. aspire do → step required |
✅ Passed |
3. aspire do deploy --list-steps → list |
✅ Passed |
4. aspire publish --list-steps → list |
✅ Passed |
5. aspire deploy --list-steps → list |
✅ Passed |
Overall Result
✅ PR VERIFIED
Issue #17526 is fixed: aspire do --list-steps without a step now exits with a friendly localized error that points users at build/publish/deploy and the aspire.dev pipeline-steps docs, instead of crashing with Sequence contains more than one matching element. The --list-steps happy paths for do <step>, publish, and deploy are unaffected.
mitchdenny
left a comment
There was a problem hiding this comment.
Code review (2 findings) — both moderate, see inline comments.
There was a problem hiding this comment.
Pull request overview
Tightens aspire do validation so --list-steps requires a positional step argument, preventing the AppHost from launching and crashing with "Sequence contains more than one matching element" (#17526). When the step is missing, the CLI now emits a friendly localized error referencing common steps and the docs URL.
Changes:
DoCommandvalidator always requires a step argument outside the extension host, with a list-steps-specific friendly error.- New localized resources
StepArgumentRequiredandListStepsRequiresStep(resx, Designer, and xlf for all locales). - Unit test for the new parse-error path; existing
do --list-stepstests updated to pass a step; E2E test expanded to cover the friendly error andpublish/deploy --list-steps.
Show a summary per file
| File | Description |
|---|---|
| src/Aspire.Cli/Commands/DoCommand.cs | Validator now errors on missing step (branching message for --list-steps). |
| src/Aspire.Cli/Resources/DoCommandStrings.resx | Adds StepArgumentRequired and ListStepsRequiresStep. |
| src/Aspire.Cli/Resources/DoCommandStrings.Designer.cs | Generated accessors for the new strings. |
| src/Aspire.Cli/Resources/xlf/DoCommandStrings.*.xlf (13 locales) | New trans-units added via UpdateXlf. |
| tests/Aspire.Cli.Tests/Commands/DoCommandTests.cs | New parse-error test; existing --list-steps tests pass deploy. |
| tests/Aspire.Cli.EndToEnd.Tests/ListStepsTests.cs | Renamed/expanded E2E to cover friendly error plus do/publish/deploy --list-steps. |
Copilot's findings
Files not reviewed (1)
- src/Aspire.Cli/Resources/DoCommandStrings.Designer.cs: Language not supported
- Files reviewed: 17/18 changed files
- Comments generated: 0
- DoCommand validator: fire the ListStepsRequiresStep friendly error for `aspire do --list-steps` even when running in the extension host, because --list-steps does not flow through GetRunArgumentsAsync's interactive step prompt and would otherwise still hit the original pipeline crash from #17526. - ListStepsTests (E2E): replace long, wrap-sensitive substrings with short fragments ("required when using --list-steps", "aspire.dev/") so the assertion does not fail when the friendly error wraps in a narrow Docker terminal. - DoCommandTests: add DoCommandWithListStepsAndNoStepArgumentInExtensionHostShowsFriendlyError to regression-test the extension-host path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PR Testing Report (re-test after review fixes)PR Information
CLI Version Verification
CI Status (run 26502110363)
Test Scenarios Re-Executed
No Review Fixes Verified
Overall Result✅ PR VERIFIED The two review findings are addressed, the regression unit test and the E2E test both pass in CI, and the original #17526 crash is gone in all five local scenarios. |
|
Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
|
|
❓ CLI E2E Tests unknown — 107 passed, 0 failed, 2 unknown (commit View all recordings
📹 Recordings uploaded automatically from CI run #26502110363 |
|
/backport to release/13.4 |
|
Started backporting to |
The aspire do command now requires a step argument when using --list-steps. Running 'aspire do --list-steps' without a step emits a friendly error message pointing at concrete examples like 'aspire do deploy --list-steps'. Documents changes from microsoft/aspire#17535. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Pull request created: #1091
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#1091 targeting Updated Note This draft PR needs human review before merging. |
…1091) * docs: update aspire do --list-steps to require step argument The aspire do command now requires a step argument when using --list-steps. Running 'aspire do --list-steps' without a step emits a friendly error message pointing at concrete examples like 'aspire do deploy --list-steps'. Documents changes from microsoft/aspire#17535. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address review feedback (2 threads) - Format the `step` argument as inline code in the quick listing section (PRRT_kwDOQK_VN86FIbZ7) - Format the `step` argument as inline code in the examples section (PRRT_kwDOQK_VN86FIbah) Verified against microsoft/aspire@0cbaf82 on branch release/13.4. Edited per the doc-writer skill. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: aspire-repo-bot[bot] <268009190+aspire-repo-bot[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: David Pine <7679720+IEvangelist@users.noreply.github.com>
Description
aspire dois always step-targeted, so--list-stepswith no step has no meaningful scope. The validator previously allowedaspire do --list-stepsto run, which launched the AppHost and raced ahead executing the full pipeline before the CLI could fetch steps and stop it. That race surfaced asInvalidOperationException: Sequence contains more than one matching elementfromAzurePublishingContext(#17526).This change tightens the
DoCommandvalidator to always require thestepargument (outside the extension host, which prompts interactively). When the user specifies--list-stepswithout a step, the CLI now emits a friendly, localized error pointing at concrete examples drawn from the well-known step names:aspire publish --list-stepsandaspire deploy --list-stepsare unchanged - they already pass a fixed--stepand continue to work.Scope was kept intentionally narrow: no changes to
PipelineOptions/PipelineExecutor/ AppHost. The underlying "more than one matching element" condition inResourceExtensions.GetDeploymentTargetAnnotationis a separate latent bug that only surfaced because the pipeline ran when it shouldn't have.Files of note
src/Aspire.Cli/Commands/DoCommand.cs- tightened validator with branch-specific friendly message.src/Aspire.Cli/Resources/DoCommandStrings.resx+Designer.cs- newStepArgumentRequiredandListStepsRequiresStepentries (and the previously inlined English error promoted to a resource).src/Aspire.Cli/Resources/xlf/DoCommandStrings.*.xlf- refreshed viadotnet build /t:UpdateXlf(translation pipeline owns the actual translations).tests/Aspire.Cli.Tests/Commands/DoCommandTests.cs- newDoCommandWithListStepsAndNoStepArgumentShowsFriendlyErrorregression test; three existing list-steps tests updated to pass a step.tests/Aspire.Cli.EndToEnd.Tests/ListStepsTests.cs- single Docker-backed E2E now exercisesaspire do --list-steps(asserts the friendly error and explicitly fails if theSequence contains more than one matching elementcrash returns), plusaspire do deploy --list-steps,aspire publish --list-steps, andaspire deploy --list-stepsagainst a freshly created starter app.Fixes: #17526
Checklist
<remarks />and<code />elements on your triple slash comments?