You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support config source adoption and explicit project opt-out - #21678
Existing AppHosts have no opportunity to adopt an available organization configuration source unless they are recreated. This adds opt-in adoption to aspire update and persists an explicit project opt-out so declining does not cause repeated prompts.
PR stack:main -> this brownfield PR -> doctor diagnostics in #21677. The doctor PR targets this branch; it is not included in this PR's diff.
Offer the existing configuration-source consent prompt during project updates when a candidate exists and the nearest local configuration has neither a saved binding nor an opt-out.
Accepting materializes the existing allowlisted settings and records the source binding; declining saves "configSource": { "optOut": true } while preserving other project settings.
Persist the same opt-out when a source is declined during aspire new or aspire init.
Preserve existing unattended automation: without --use-config-source, non-interactive updates skip adoption without writing an opt-out. --yes alone is not consent to configuration-source adoption.
Keep saved bindings authoritative. CLI self-update, repository-tool-only updates, and refresh-only aspire update --config-source do not discover or adopt sources. A local opt-out does not prevent refreshing a separate global binding.
User-facing usage
With an available source and no saved choice, run aspire update to accept or decline interactively. To make the choice explicitly in automation:
Usage:
aspire update [options]
Options:
--use-config-source Use the proposed Git configuration source. Specify false to decline it.
Declining records this project choice alongside existing settings:
{
"configSource": {
"optOut": true
}
}
An existing binding or opt-out suppresses adoption, including when --use-config-source is supplied. Remove the configSource entry to allow a later adoption prompt.
Screenshots / Recordings
This PR includes UI changes. Please add screenshots or screen recordings so reviewers can evaluate the visual changes without running locally.
For before/after comparisons, place them side-by-side or label them clearly.
For interactive changes (animations, transitions, new flows), prefer a short screen recording (GIF or video).
If you cannot capture visuals now, note what scenario to test and mark this section as TODO.
TODO: Capture aspire update in an existing AppHost with an available source and no saved choice. Show the consent prompt, acceptance, and declining followed by a second update without another adoption prompt. No visual capture was made during this change.
Security considerations
This makes the existing Git acquisition and configuration materialization flow available during project updates. Environment variables and employee detection provide candidates, not consent; unattended package updates and --yes must not silently enable a source. Accepted sources continue through the existing validation and setting allowlist. Opt-outs are written using the workspace configuration lock and atomic settings writer. A separate threat model and security review have not been performed for this change.
Validation
Brownfield regression tests run earlier in this session, before the doctor changes were added: passed, 915 succeeded, 0 failed, 2 skipped.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The consent test still expects no configSource after opt-out is persisted, and update-time lookup can miss unnormalized colon-separated settings, prompting again and overwriting saved choices.
Adds configuration-source adoption to existing AppHosts through aspire update and persists explicit project opt-outs. This provides the foundation for the separate doctor diagnostics in #21677.
Changes:
Offers consent-based adoption during project updates while preserving unattended behavior and saved choices.
Persists declined choices across new, init, and update without acquiring the source.
Adds regression tests, snapshots, and documentation for adoption and opt-out behavior.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The opt-out setting is excluded from the configuration schema and fails validation, while the new consent flow lacks terminal E2E coverage for saved choices and unattended behavior.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Add CLI coverage for update consent and unattended behavior
src/Aspire.Cli/Commands/UpdateCommand.cs:303
The new plain aspire update consent flow has no terminal E2E coverage in ConfigSourceTests, leaving its prompt sequence and unattended behavior unverified through the real CLI. Add scenarios that accept and decline adoption in an existing AppHost, then run update again to verify that the saved choice suppresses the prompt. Also cover --yes --non-interactive without explicit source consent and verify that it neither prompts nor writes a source choice.
Expose configSource.optOut in the generated settings schema
SettingsSchemaBuilder.BuildPropertiesForType() skips every property with JsonIgnoreAttribute, so this conditional attribute excludes configSource.optOut from aspire config info --json. The extension's schema generator disallows additional properties on typed objects, causing the opt-out configuration written here to fail validation even after schema regeneration. Preserve the serialization suppression, but make the schema builder skip only unconditional ignores and add a regression assertion for configSource.optOut.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The schema builder omits conditionally ignored optOut from the generated configuration schema, causing VS Code to flag opt-out files produced by this change as invalid.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Include conditionally ignored properties in generated config schema
SettingsSchemaBuilder.BuildPropertiesForType skips every property carrying JsonIgnoreAttribute, regardless of its condition. This therefore omits optOut from aspire config info --json; extension/scripts/generate-schema.js uses that output to generate a configSource schema with additionalProperties: false, so VS Code flags the opt-out files produced by this PR as invalid. Update the schema builder to exclude only unconditionally ignored properties and add a regression assertion that configSource.optOut is present.
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking naming question: are we sticking with optOut, rather than disabled or enabled? optOut captures the explicit decision not to adopt a source, whereas enabled/disabled might suggest toggling an existing binding. Happy to keep optOut; this is not a blocker. Approving.
Updated aspire-update.mdx to document config source adoption, the --use-config-source option, and project opt-out. Signals: cli_command_file_changed (UpdateCommand.cs), pr_body_has_cli_flag_mention (--use-config-source), pr_body_has_user_facing_section ("User-facing usage"). Please confirm that --config-source (refresh-only), mentioned in the PR body, is documented elsewhere.
## Description
Existing AppHosts do not currently tell users when an organization
configuration source is available but has not been adopted. `aspire
doctor` now reports machine source availability and the current
AppHost's saved configuration-source choice, with a non-blocking
suggestion to run `aspire update` when no choice has been recorded.
**PR stack:** `main` -> #21678 (brownfield adoption) -> this doctor PR.
**Stacked PR:** depends on #21678 and targets
[`jamesnk/config-source-brownfield`](https://github.com/microsoft/aspire/tree/jamesnk/config-source-brownfield),
which contains brownfield adoption and persisted `configSource.optOut`
support. This PR adds only the doctor diagnostics and their supporting
discovery extraction, tests, localization, and documentation.
- Report environment-variable and Microsoft-employee source candidates,
including their discovery origin.
- Report an AppHost's saved binding or explicit opt-out without
suggesting adoption.
- Include stable diagnostic names and metadata in JSON output.
- Reuse doctor's shallow AppHost discovery and extract candidate
resolution without consent prompts, Git acquisition, remote-version
checks, or configuration writes.
Project diagnostics currently inspect the nearest local configuration.
Reporting and accounting for saved global source bindings remains
follow-up work; a project using global defaults can still receive the
local-adoption warning.
### User-facing usage
```shell
aspire doctor
aspire doctor --format json
```
Relevant existing command help, also exercised by the doctor tests:
```text
Usage:
aspire doctor [options]
Options:
--format <Json|Table> Output format (Table or Json)
```
When a candidate is available and the AppHost has no recorded choice,
doctor reports a warning with:
```text
Run 'aspire update' to choose whether this AppHost should use the available configuration source.
```
JSON output includes the `config-source` environment check and, when
applicable, the `apphost-config-source` check with a `bound`,
`optedOut`, or `unconfigured` state. An explicit opt-out is reported as
an intentional choice, not something to fix.
### Screenshots / Recordings
> **This PR includes UI changes.** Please add screenshots or screen
recordings so reviewers can evaluate the visual changes without running
locally.
>
> - For before/after comparisons, place them side-by-side or label them
clearly.
> - For interactive changes (animations, transitions, new flows), prefer
a short screen recording (GIF or video).
> - If you cannot capture visuals now, note what scenario to test and
mark this section as TODO.
TODO: Capture `aspire doctor` with `ASPIRE_INIT_SOURCE_URL` set in an
AppHost with no saved source choice, showing availability, the adoption
warning, and its suggested fix. Also capture saved-binding and
explicit-opt-out states. No visual capture was made during this change.
<!-- Add screenshots/recordings here -->
### Validation
Focused validation rerun after splitting the branches: **passed, 52
succeeded, 0 failed, 0 skipped**.
```powershell
$env:MSBUILDTERMINALLOGGER='false'
dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.ConfigSourceCheckTests" --filter-class "*.DoctorCommandTests" --filter-class "*.EnvironmentCheckerTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"
```
Broader doctor, creation, and config-source regression coverage, run
before splitting the same implementation into commits: **passed, 784
succeeded, 0 failed, 2 skipped**.
```powershell
$env:MSBUILDTERMINALLOGGER='false'
dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.ConfigSourceCheckTests" --filter-class "*.DoctorCommandTests" --filter-class "*.EnvironmentCheckerTests" --filter-class "*.ConfigSourceServiceTests" --filter-class "*.ConfigSourceCommandTests" --filter-class "*.NewCommandLocalTemplateTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"
```
Localization regeneration: **passed, 0 warnings and 0 errors**.
```powershell
dotnet build src\Aspire.Cli\Aspire.Cli.csproj /t:UpdateXlf
```
Doctor-only diff whitespace validation: **passed**.
```powershell
git diff --check jamesnk/config-source-brownfield...jamesnk/doctor-config-sources
```
The full repository suite and manual visual verification were not run.
Fixes # (issue)
## Checklist
- Is this feature complete?
- [ ] Yes. Ready to ship.
- [x] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
- [x] Yes
- [ ] No
- Did you add public API?
- [ ] Yes
- If yes, did you have an API Review for it?
- [ ] Yes
- [ ] No
- Did you add `<remarks />` and `<code />` elements on your triple slash
comments?
- [ ] Yes
- [ ] No
- [x] No
- Does the change make any security assumptions or guarantees?
- [ ] Yes
- If yes, have you done a threat model and had a security review?
- [ ] Yes
- [ ] No
- [x] No
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
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.
Description
Existing AppHosts have no opportunity to adopt an available organization configuration source unless they are recreated. This adds opt-in adoption to
aspire updateand persists an explicit project opt-out so declining does not cause repeated prompts.PR stack:
main-> this brownfield PR -> doctor diagnostics in #21677. The doctor PR targets this branch; it is not included in this PR's diff."configSource": { "optOut": true }while preserving other project settings.aspire neworaspire init.--use-config-source, non-interactive updates skip adoption without writing an opt-out.--yesalone is not consent to configuration-source adoption.aspire update --config-sourcedo not discover or adopt sources. A local opt-out does not prevent refreshing a separate global binding.User-facing usage
With an available source and no saved choice, run
aspire updateto accept or decline interactively. To make the choice explicitly in automation:aspire update --yes --non-interactive --use-config-source aspire update --yes --non-interactive --use-config-source falseRelevant generated help from the built CLI:
Declining records this project choice alongside existing settings:
{ "configSource": { "optOut": true } }An existing binding or opt-out suppresses adoption, including when
--use-config-sourceis supplied. Remove theconfigSourceentry to allow a later adoption prompt.Screenshots / Recordings
TODO: Capture
aspire updatein an existing AppHost with an available source and no saved choice. Show the consent prompt, acceptance, and declining followed by a second update without another adoption prompt. No visual capture was made during this change.Security considerations
This makes the existing Git acquisition and configuration materialization flow available during project updates. Environment variables and employee detection provide candidates, not consent; unattended package updates and
--yesmust not silently enable a source. Accepted sources continue through the existing validation and setting allowlist. Opt-outs are written using the workspace configuration lock and atomic settings writer. A separate threat model and security review have not been performed for this change.Validation
Brownfield regression tests run earlier in this session, before the doctor changes were added: passed, 915 succeeded, 0 failed, 2 skipped.
Brownfield-only diff whitespace validation: passed.
Generated update help checked using the current built CLI: passed.
No additional test run was needed for PR creation. The full repository suite and manual visual verification were not run.
Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?