Repository navigation
Separate channel update validation with aspire update --dry-run - #22207
Conversation
Allow aspire update --force to skip candidate graph restore for explicit .NET channel updates while retaining configuration conflict checks and confirmation prompts. Co-authored-by: Copilot App <[email protected]>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 22207Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 22207" |
Co-authored-by: Copilot App <[email protected]>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
The --force escape hatch lacks end-to-end coverage against an unrestorable dependency graph, leaving forced-update persistence and normal-update rollback behavior unverified in the real pipeline.
1 open issue
2 files not reviewed
src/Aspire.Cli/Resources/ConfigSourceStrings.Designer.cs: Generated filesrc/Aspire.Cli/Resources/UpdateCommandStrings.Designer.cs: Generated file
What changed in this PR
Adds aspire update --force so explicit .NET AppHost channel updates can persist confirmed changes without a successful validation restore, while retaining configuration and transaction safeguards.
Changes:
- Adds and forwards
--force, rejects it with--config-source, and limits restore bypass to explicit channel policies. - Extends unit tests for option forwarding, restore behavior, confirmation, and configuration conflicts.
- Updates usage documentation, help text, and localization resources.
| File | Description |
|---|---|
tests/Aspire.Cli.Tests/Projects/ProjectUpdaterNuGetConfigurationTests.cs |
Tests forced updates and retained safeguards. |
tests/Aspire.Cli.Tests/Commands/UpdateCommandTests.cs |
Tests force and explicit-channel forwarding. |
tests/Aspire.Cli.Tests/Commands/ConfigSourceCommandTests.cs |
Tests incompatible --force usage. |
src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.zh-Hant.xlf |
Adds pending force-help translation. |
src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.zh-Hans.xlf |
Adds pending force-help translation. |
src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.tr.xlf |
Adds pending force-help translation. |
src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.ru.xlf |
Adds pending force-help translation. |
src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.pt-BR.xlf |
Adds pending force-help translation. |
src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.pl.xlf |
Adds pending force-help translation. |
src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.ko.xlf |
Adds pending force-help translation. |
src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.ja.xlf |
Adds pending force-help translation. |
src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.it.xlf |
Adds pending force-help translation. |
src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.fr.xlf |
Adds pending force-help translation. |
src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.es.xlf |
Adds pending force-help translation. |
src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.de.xlf |
Adds pending force-help translation. |
src/Aspire.Cli/Resources/xlf/UpdateCommandStrings.cs.xlf |
Adds pending force-help translation. |
src/Aspire.Cli/Resources/xlf/ConfigSourceStrings.zh-Hant.xlf |
Refreshes incompatible-options message. |
src/Aspire.Cli/Resources/xlf/ConfigSourceStrings.zh-Hans.xlf |
Refreshes incompatible-options message. |
src/Aspire.Cli/Resources/xlf/ConfigSourceStrings.tr.xlf |
Refreshes incompatible-options message. |
src/Aspire.Cli/Resources/xlf/ConfigSourceStrings.ru.xlf |
Refreshes incompatible-options message. |
src/Aspire.Cli/Resources/xlf/ConfigSourceStrings.pt-BR.xlf |
Refreshes incompatible-options message. |
src/Aspire.Cli/Resources/xlf/ConfigSourceStrings.pl.xlf |
Refreshes incompatible-options message. |
src/Aspire.Cli/Resources/xlf/ConfigSourceStrings.ko.xlf |
Refreshes incompatible-options message. |
src/Aspire.Cli/Resources/xlf/ConfigSourceStrings.ja.xlf |
Refreshes incompatible-options message. |
src/Aspire.Cli/Resources/xlf/ConfigSourceStrings.it.xlf |
Refreshes incompatible-options message. |
src/Aspire.Cli/Resources/xlf/ConfigSourceStrings.fr.xlf |
Refreshes incompatible-options message. |
src/Aspire.Cli/Resources/xlf/ConfigSourceStrings.es.xlf |
Refreshes incompatible-options message. |
src/Aspire.Cli/Resources/xlf/ConfigSourceStrings.de.xlf |
Refreshes incompatible-options message. |
src/Aspire.Cli/Resources/xlf/ConfigSourceStrings.cs.xlf |
Refreshes incompatible-options message. |
src/Aspire.Cli/Resources/UpdateCommandStrings.resx |
Defines force-option help text. |
src/Aspire.Cli/Resources/UpdateCommandStrings.Designer.cs |
Exposes the force-help resource accessor. |
src/Aspire.Cli/Resources/ConfigSourceStrings.resx |
Adds --force to the incompatibility error. |
src/Aspire.Cli/Resources/ConfigSourceStrings.Designer.cs |
Updates the error accessor’s documentation only. |
src/Aspire.Cli/README.md |
Documents force usage and limitations. |
src/Aspire.Cli/Projects/ProjectUpdater.cs |
Skips validation restore for eligible forced updates. |
src/Aspire.Cli/Projects/IAppHostProject.cs |
Carries force in the update context. |
src/Aspire.Cli/Commands/UpdateCommand.cs |
Registers, validates, and forwards --force. |
docs/specs/polyglot-integration-restore.md |
Documents restore bypass and retained safeguards. |
Review effort: Balanced
Apply explicit channel updates without a validation restore. Add validation-only dry runs with temporary NuGet caches and durable adjacent backups, requiring separate consent before replacing recovery data. Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
Dry runs can still modify ambient NuGet caches and prompt to replace recovery backups in non-interactive mode, violating the documented isolation and recovery guarantees.
5 open issues
Non-interactive dry runs can prompt and replace recovery backups · New Dry-run discovery can populate developer NuGet caches before isolation · New Dry-run SDK acquisition uses and modifies ambient NuGet caches · New Add CLI E2E coverage for --force with an unrestorable dependency Add CLI end-to-end coverage for dry-run recovery behavior · New
2 files not reviewed
src/Aspire.Cli/Resources/ConfigSourceStrings.Designer.cs: Generated filesrc/Aspire.Cli/Resources/UpdateCommandStrings.Designer.cs: Generated file
Review effort: Balanced
Reject non-interactive backup replacement before invoking extension prompts. Isolate initial project evaluations and in-process SDK acquisition, and cover real CLI validation, rollback, backup replacement and cold-cache failures in CI. Co-authored-by: Copilot App <[email protected]>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
The updater fails when the original SDK is available only in the warm user cache and declared in Directory.Build.props, because fallback parsing loses the imported declaration and targets the AppHost instead.
1 open issue
5 resolved since last review
Dry-run SDK acquisition uses and modifies ambient NuGet caches Dry-run discovery can populate developer NuGet caches before isolation Non-interactive dry runs can prompt and replace recovery backups Add CLI E2E coverage for --force with an unrestorable dependency Add CLI end-to-end coverage for dry-run recovery behavior
2 files not reviewed
src/Aspire.Cli/Resources/ConfigSourceStrings.Designer.cs: Generated filesrc/Aspire.Cli/Resources/UpdateCommandStrings.Designer.cs: Generated file
Review effort: Balanced
Initialize the isolated package directory in clone coverage and exercise restore arguments with and without isolation. Co-authored-by: Copilot App <[email protected]>
Use private leased directories under the Aspire home cache for validation packages and SDK acquisition scratch data, with permission and cleanup regression checks. Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because dry-run restore can falsely succeed using MSBuild-configured fallback caches even when a dependency is unavailable from every feed.
2 files not reviewed
src/Aspire.Cli/Resources/ConfigSourceStrings.Designer.cs: Generated filesrc/Aspire.Cli/Resources/UpdateCommandStrings.Designer.cs: Generated file
Review effort: Balanced
Preserve configured-channel updates alongside validation-only dry runs, and align merged test expectations and helper call sites. Co-authored-by: Copilot App <[email protected]>
Keep initial policy, project, reference, and central-property evaluation on ambient NuGet configuration and caches. Isolate candidate SDK acquisition, staged update subprocesses, and validation restore without introducing another import parser. Cover imported SDK planning and rollback after both successful and failed cold validation, and keep the invocation-directory fixture's Aspire home separate. Co-authored-by: Copilot App <[email protected]>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
The test can match stale confirmation text from the cancelled run and send Y before the new prompt appears, causing a timeout unless the screen is cleared before the second invocation.
1 open issue
1 resolved since last review
2 files not reviewed
src/Aspire.Cli/Resources/ConfigSourceStrings.Designer.cs: Generated filesrc/Aspire.Cli/Resources/UpdateCommandStrings.Designer.cs: Generated file
Review effort: Balanced
Co-authored-by: Copilot App <[email protected]>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because rollback can change Unix file permissions even after a successful dry run.
No open issues 🎉
1 resolved since last review
2 files not reviewed
src/Aspire.Cli/Resources/ConfigSourceStrings.Designer.cs: Generated filesrc/Aspire.Cli/Resources/UpdateCommandStrings.Designer.cs: Generated file
Review effort: Balanced
James Newton-King (JamesNK)
left a comment
There was a problem hiding this comment.
Found 1 correctness issue. The 499 focused CLI tests passed; the lockfile regression was reproduced with the built CLI and an isolated local NuGet feed.
Co-authored-by: Copilot App <[email protected]>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
Lockfile-name overrides can skip the project’s existing lockfile or select an unrelated one when PackageId or AssemblyName differs from the project filename, altering dry-run validation and locked-mode behavior.
1 open issue
2 files not reviewed
src/Aspire.Cli/Resources/ConfigSourceStrings.Designer.cs: Generated filesrc/Aspire.Cli/Resources/UpdateCommandStrings.Designer.cs: Generated file
Review effort: Balanced
Co-authored-by: Copilot App <[email protected]>
Tests selector3 / 101 PR test projects · 4 PR jobs, from 51 changed files. Selected PR test projects (3 / 101)
Selected PR jobs (4)
How these were chosen — grouped by what changed📦 affected project 🔧 🔧 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 Job reasons
Selection computed for commit |
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because overlapping update transactions can invalidate rollback backups, causing rollback to fail and leave staged edits in place.
No open issues 🎉
1 resolved since last review
2 files not reviewed
src/Aspire.Cli/Resources/ConfigSourceStrings.Designer.cs: Generated filesrc/Aspire.Cli/Resources/UpdateCommandStrings.Designer.cs: Generated file
Review effort: Balanced
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot App <[email protected]>
…2208) ## Description `aspire update` now captures native restore diagnostics following #22355, but those diagnostics can contain credential-bearing feed URLs that are persisted in the CLI log. This follow-up applies the existing NuGet redactor before stdout or stderr is buffered or logged, while preserving useful diagnostics for troubleshooting validation failures. The redactor uses known sources from candidate and referenced-project NuGet configurations, plus `RestoreAdditionalProjectSources` values obtained during project evaluation. Raw evaluation diagnostics are suppressed so those source properties do not leak through the probes themselves. Restore diagnostics remain logged for success and failure, and are displayed only on failure. The failure summary now includes the channel and project and explicitly states that the update was not applied. ### Redaction scope This reuses package-only polyglot restore redaction; it does not scan diagnostic text for unknown URLs or inspect restore graph files. Sources introduced only by restore-time targets, additive source changes after planning, and arbitrary non-source secrets are outside this change's coverage. Stacked on #22207. Follows up on #22355. No new dependencies. ### Validation The following command passed **10/10 cases**, covering project and file-based AppHosts, successful and failed restores, both output streams, root and referenced-project sources, evaluated additive sources, encoded credentials, probe suppression, and candidate feed configuration: ```shell dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-method "*.UpdateAsync_RestoreDiagnosticsAreRedactedBeforeLoggingAndFailureDisplay" --filter-method "*.UpdateAsync_DryRunUsesAmbientEvaluationForImportedSdkAndColdCandidateRestore" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" ``` ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] 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? - [x] Yes - If yes, have you done a threat model and had a security review? - [ ] Yes - [x] No - [ ] No --------- Co-authored-by: Copilot App <[email protected]>
(cherry picked from commit 30326eb) Co-authored-by: Copilot App <[email protected]>
…22219) Backport of #22182 to release/17.0 Also backports #22207, #22355, and #22208 using their distinct squash-merge changes, without replaying the stacked PR history. /cc @danegsta ## Description C# AppHost updates can ignore configured channels, and failed restores can block channel updates while hiding actionable diagnostics. Honor configured channels, separate applying channel updates from `--dry-run` validation, and log/display native restore diagnostics with best-effort credential redaction. Normal channel updates apply confirmed edits without requiring a validation restore. Explicit `--dry-run` validation uses isolated caches and restore outputs, then restores the original source files. Updates without a selected channel retain their existing restore behavior. These changes do not fix underlying dependency conflicts or MSBuild task DLL locks. Relates to #22214 and #22352. **Release prerequisite:** This backport is intended for 17.0.1. `release/17.0` still has `PatchVersion=0` although stable v17.0.0 is published. Advance the release branch to the next unshipped servicing version in a separate PR; no version bump is included here. ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] 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? - [x] Yes - If yes, have you done a threat model and had a security review? - [ ] Yes - [x] No - [ ] No ## Customer Impact Customers updating C# AppHosts can have their configured channel ignored or lose candidate updates when dependency conflicts cause restore to fail, with no useful restore diagnostics. The combined fixes honor the configured channel, let customers apply channel updates independently of validation, and expose actionable restore errors. Credential-bearing package source URLs are redacted on a best-effort basis before diagnostics are buffered or logged. ## Testing `./restore.sh` - passed (13 existing package vulnerability warnings, 0 errors). `git diff --check 38e4ce6..HEAD` - passed. Each of the three added commits has the same stable patch ID as its source squash commit. Focused CLI unit run on macOS ARM64 - **788 passed, 2 failed, 2 skipped**: ```shell MSBUILDTERMINALLOGGER=false dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class '*.ProjectUpdater*' --filter-class '*.UpdateCommand*' --filter-class '*.ConfigSourceCommandTests' --filter-class '*.DotNetAppHostRestorePreviewTests' --filter-class '*.DotNetAppHostUpdateTransactionTests' --filter-class '*.DotNetCliRunnerTests' --filter-class '*.ProcessInvocationOptionsTests' --filter-class '*.NuGetClientTests' --filter-class '*.ProcessExecutionFactoryEnvironmentTests' --filter-class '*.PackageSourceRedactorTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true' ``` Both failures were the native file-based restore theory, with MSB4216/MSB4027 task-host errors caused by mixing the system .NET host with the repository-local SDK. Rerunning only those cases with the repository-local host on PATH **passed 2/2**, without code changes: ```shell PATH="$PWD/.dotnet:$PATH" DOTNET_ROOT="$PWD/.dotnet" MSBUILDTERMINALLOGGER=false .dotnet/dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-method '*.UpdateAsync_FileBasedNativePackageMetadataEditsSourceAndRollsBackOnFailure' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true' ``` Across the initial run and targeted retry, all **790 runnable cases passed**. The two skips require Windows batch execution and a case-sensitive filesystem, respectively. E2E scenarios are included in the backport but were not run locally; CI validation remains outstanding. ## Risk Medium. This changes when C# channel updates restore and introduces validation-only rollback and isolated caches/restore outputs. Updates without a selected channel retain their restore behavior. Credential redaction is best effort, not a security guarantee; logs should still be checked before sharing. No supported library API changes or new dependencies are introduced. ## Regression? No. --------- Co-authored-by: David Negstad <[email protected]> Co-authored-by: Copilot App <[email protected]> Co-authored-by: James Newton-King <[email protected]> Co-authored-by: David Negstad <[email protected]>



Description
Users should be able to apply a channel update without first requiring its dependency graph to restore. This separates applying a .NET channel update from validating it: normal updates selected through an option or Aspire configuration propose and apply confirmed changes without a validation restore, while
--dry-runonly validates and restores the original source files afterward.Updates without a command-line or configured channel retain their existing restore behavior. Both paths still reject unsafe NuGet configuration changes and customized restore policies that cannot be updated cleanly.
User-facing usage
Apply an update through the existing confirmation prompts:
Validate instead, without update prompts or applying the changes:
New command option:
--packages,--no-http-cache, and--force.<file>.aspire-backupcopies and restores from them on success, failure, or cancellation. Failed rollback retains recovery backups and reports their paths. Existing backups require separate replace-or-cancel consent;--yesnever authorizes replacement, and non-interactive runs refuse.--channelor legacy--qualitywith a channel other thandefault, and a .NET AppHost. They reject--self,--migrate, and--config-source, skip repository tool updates and CLI self-update prompts, and do not require--yesin non-interactive mode.obj/project.assets.jsonretain their existing behavior and are not backed up.Screenshots / Recordings
Security considerations
Dry runs temporarily edit project files and create adjacent recovery copies, as well as an isolated temporary NuGet cache under Aspire home. Backup staging files and validation directories use owner-only Unix permissions. Existing recovery backups cannot be silently overwritten, and rollback refuses to overwrite a concurrently edited source file. Security review has not been performed.
Fixes #22214
Checklist
<remarks />and<code />elements on your triple slash comments?