[release/13.3] Avoid AppHost discovery when config path is valid#16680
[release/13.3] Avoid AppHost discovery when config path is valid#16680adamint wants to merge 3 commits intorelease/13.3from
Conversation
Validate configured AppHost paths before using them and skip recursive discovery for normal CLI resolution when the configured path is already a valid AppHost. Preserve candidate listing behavior so extension commands can still enumerate all AppHost candidates. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reverts an unintended verbosity change so users with a stale legacy .aspire/settings.json don't see a 'AppHost was specified but doesn't exist' warning on every aspire run when the CLI is going to fall back to discovery anyway. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add Throw-mode variant of UseOrFindAppHostProjectFileUsesValidSettingsWithoutScanning to prove recursive discovery is also skipped for non-interactive/JSON callers. - Add fast-path test with a configured guest AppHost (apphost.ts) and a throwing language discovery to cover the production guest-AppHost scenario from the issue. - Add a parameterized fallback test that verifies an existing-but-invalid configured AppHost (IsUnsupported / IsPossiblyUnbuildable) falls back to discovery. 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 -- 16680Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16680" |
There was a problem hiding this comment.
Pull request overview
Backports the AppHost resolution behavior to avoid recursive AppHost discovery (and its expensive scanning) when a valid AppHost path is already configured in aspire.config.json, while preserving “candidate listing” behavior when callers request it.
Changes:
- Short-circuits normal CLI AppHost resolution to use a validated configured AppHost path without scanning (except when
MultipleAppHostProjectsFoundBehavior.Noneis used). - Improves warning logs when a configured AppHost path is invalid by including unsupported/unbuildable reasons and an optional validation message.
- Ensures
SelectedProjectFileis always present inAllProjectFileCandidates, even when the selected AppHost lies outside the discovery scope.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/Aspire.Cli.Tests/Projects/ProjectLocatorTests.cs | Adds/updates unit tests covering “use valid configured path without scanning”, fallback-to-discovery for invalid configured paths, and candidate-listing behaviors. |
| src/Aspire.Cli/Projects/ProjectLocator.cs | Implements the early-return path for valid configured AppHost resolution (skipping scanning) and tightens candidate list invariants + improved invalid-settings diagnostics. |
|
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 Test Recordings — 66 recordings uploaded (commit View all recordings
📹 Recordings uploaded automatically from CI run #25234789012 |
|
Low risk, improves the experience. @adamint apart from unit tests added here did we do manual validation as well of these changes on top of 13.3? |
Backport of #16653 to release/13.3
/cc @adamint