Skip to content

Require --yes with --non-interactive for destroy cmd#16805

Merged
davidfowl merged 1 commit into
mainfrom
eerhardt/fix-destroy-non-interactive
May 6, 2026
Merged

Require --yes with --non-interactive for destroy cmd#16805
davidfowl merged 1 commit into
mainfrom
eerhardt/fix-destroy-non-interactive

Conversation

@eerhardt
Copy link
Copy Markdown
Member

@eerhardt eerhardt commented May 5, 2026

Added validation to enforce --yes when --non-interactive is used with the destroy command, returning a localized error if omitted. Introduced a new NonInteractiveRequiresYes resource and updated all localization files. Expanded DestroyCommandTests to cover new validation, multiple CLI permutations, and error scenarios for failed destroy activities.

Fix #16623

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
  • Did you add public API?
    • No
  • Does the change make any security assumptions or guarantees?
    • No
  • Does the change require an update in our Aspire docs?
    • No

Added validation to enforce --yes when --non-interactive is used with the destroy command, returning a localized error if omitted. Introduced a new NonInteractiveRequiresYes resource and updated all localization files. Expanded DestroyCommandTests to cover new validation, multiple CLI permutations, and error scenarios for failed destroy activities.

Fix #16623
Copilot AI review requested due to automatic review settings May 5, 2026 22:44
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16805

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16805"

@eerhardt
Copy link
Copy Markdown
Member Author

eerhardt commented May 5, 2026

/backport to release/13.3

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Started backporting to release/13.3 (link to workflow run)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Aspire CLI destroy command to fail fast when --non-interactive is used without explicit confirmation via --yes, and adds coverage to ensure destroy pipeline failures propagate a non-zero exit code.

Changes:

  • Added a DestroyCommand validator requiring --yes when --non-interactive is specified.
  • Introduced a new localized resource string (NonInteractiveRequiresYes) and propagated it to all DestroyCommandStrings localization files.
  • Expanded DestroyCommandTests to cover argument permutations and non-zero exit code behavior when destroy activities report failure.

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/Aspire.Cli.Tests/Commands/DestroyCommandTests.cs Adds fail-fast validation tests for --non-interactive without --yes, plus a test ensuring activity-reported failures return a non-zero exit code.
src/Aspire.Cli/Commands/DestroyCommand.cs Adds a command validator enforcing --yes when running destroy in non-interactive mode.
src/Aspire.Cli/Resources/DestroyCommandStrings.resx Adds the NonInteractiveRequiresYes localized string.
src/Aspire.Cli/Resources/DestroyCommandStrings.Designer.cs Regenerates strongly-typed accessor for NonInteractiveRequiresYes.
src/Aspire.Cli/Resources/xlf/DestroyCommandStrings.cs.xlf Adds NonInteractiveRequiresYes entry for Czech localization.
src/Aspire.Cli/Resources/xlf/DestroyCommandStrings.de.xlf Adds NonInteractiveRequiresYes entry for German localization.
src/Aspire.Cli/Resources/xlf/DestroyCommandStrings.es.xlf Adds NonInteractiveRequiresYes entry for Spanish localization.
src/Aspire.Cli/Resources/xlf/DestroyCommandStrings.fr.xlf Adds NonInteractiveRequiresYes entry for French localization.
src/Aspire.Cli/Resources/xlf/DestroyCommandStrings.it.xlf Adds NonInteractiveRequiresYes entry for Italian localization.
src/Aspire.Cli/Resources/xlf/DestroyCommandStrings.ja.xlf Adds NonInteractiveRequiresYes entry for Japanese localization.
src/Aspire.Cli/Resources/xlf/DestroyCommandStrings.ko.xlf Adds NonInteractiveRequiresYes entry for Korean localization.
src/Aspire.Cli/Resources/xlf/DestroyCommandStrings.pl.xlf Adds NonInteractiveRequiresYes entry for Polish localization.
src/Aspire.Cli/Resources/xlf/DestroyCommandStrings.pt-BR.xlf Adds NonInteractiveRequiresYes entry for Portuguese (Brazil) localization.
src/Aspire.Cli/Resources/xlf/DestroyCommandStrings.ru.xlf Adds NonInteractiveRequiresYes entry for Russian localization.
src/Aspire.Cli/Resources/xlf/DestroyCommandStrings.tr.xlf Adds NonInteractiveRequiresYes entry for Turkish localization.
src/Aspire.Cli/Resources/xlf/DestroyCommandStrings.zh-Hans.xlf Adds NonInteractiveRequiresYes entry for Simplified Chinese localization.
src/Aspire.Cli/Resources/xlf/DestroyCommandStrings.zh-Hant.xlf Adds NonInteractiveRequiresYes entry for Traditional Chinese localization.
Files not reviewed (1)
  • src/Aspire.Cli/Resources/DestroyCommandStrings.Designer.cs: Language not supported

@eerhardt
Copy link
Copy Markdown
Member Author

eerhardt commented May 5, 2026

/deployment-tests

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

🎬 CLI E2E Test Recordings — 76 recordings uploaded (commit 909cd86)

View all recordings
Status Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_DefaultSelection_InstallsSkillOnly ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AspireAddPackageVersionToDirectoryPackagesProps ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
Banner_NotDisplayedWithNoLogoFlag ▶️ View Recording
CertificatesClean_RemovesCertificates ▶️ View Recording
CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ▶️ View Recording
CertificatesTrust_WithUntrustedCert_TrustsCertificate ▶️ View Recording
ConfigSetGet_CreatesNestedJsonFormat ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunEmptyAppHostProject ▶️ View Recording
CreateAndRunJavaEmptyAppHostProject ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptEmptyAppHostProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateJavaAppHostWithViteApp ▶️ View Recording
CreateTypeScriptAppHostWithViteApp_UsesConfiguredToolchain ▶️ View Recording
DashboardRunWithOtelTracesReturnsNoTraces ▶️ View Recording
DeployK8sBasicApiService ▶️ View Recording
DeployK8sWithGarnet ▶️ View Recording
DeployK8sWithMongoDB ▶️ View Recording
DeployK8sWithMySql ▶️ View Recording
DeployK8sWithPostgres ▶️ View Recording
DeployK8sWithRabbitMQ ▶️ View Recording
DeployK8sWithRedis ▶️ View Recording
DeployK8sWithSqlServer ▶️ View Recording
DeployK8sWithValkey ▶️ View Recording
DeployTypeScriptAppToKubernetes ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DetachFormatJsonProducesValidJsonWhenRestartingExistingInstance ▶️ View Recording
DoListStepsShowsPipelineSteps ▶️ View Recording
DocsCommand_RendersInteractiveMarkdownFromLocalSource ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_TypeScriptAppHostReportsMissingConfiguredToolchain ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
GlobalMigration_HandlesCommentsAndTrailingCommas ▶️ View Recording
GlobalMigration_HandlesMalformedLegacyJson ▶️ View Recording
GlobalMigration_PreservesAllValueTypes ▶️ View Recording
GlobalMigration_SkipsWhenNewConfigExists ▶️ View Recording
GlobalSettings_MigratedFromLegacyFormat ▶️ View Recording
InitTypeScriptAppHost_AugmentsExistingViteRepoAtRoot ▶️ View Recording
InteractiveCSharpInitCreatesExpectedFiles ▶️ View Recording
InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
LatestCliCanStartStableChannelAppHost ▶️ View Recording
LatestCliCanStartStableChannelTypeScriptAppHost ▶️ View Recording
LegacySettingsMigration_AdjustsRelativeAppHostPath ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
OtelLogsReturnsStructuredLogsFromStarterAppCore ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
PublishWithConfigureEnvFileUpdatesEnvOutput ▶️ View Recording
PublishWithDockerComposeServiceCallbackSucceeds ▶️ View Recording
PublishWithoutOutputPathUsesAppHostDirectoryDefault ▶️ View Recording
RestoreGeneratesSdkFiles ▶️ View Recording
RestoreGeneratesSdkFiles_WithConfiguredToolchain ▶️ View Recording
RestoreRefreshesGeneratedSdkAfterAddingIntegration ▶️ View Recording
RestoreSupportsConfigOnlyHelperPackageAndCrossPackageTypes ▶️ View Recording
RunFromParentDirectory_UsesExistingConfigNearAppHost ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StartAndWaitForTypeScriptSqlServerAppHostWithNativeAssets ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
UnAwaitedChainsCompileWithAutoResolvePromises ▶️ View Recording

📹 Recordings uploaded automatically from CI run #25406378054

@davidfowl davidfowl merged commit 6bf5034 into main May 6, 2026
557 of 573 checks passed
@github-actions github-actions Bot added this to the 13.4 milestone May 6, 2026
@aspire-repo-bot
Copy link
Copy Markdown
Contributor

No documentation PR is required for this change.

Reason: This PR adds a validation that requires --yes when --non-interactive is used with the aspire destroy command. The destroy command does not currently have a dedicated documentation page on microsoft/aspire.dev, so there is no existing docs to update. The change is a defensive validation fix rather than a new feature or capability, and the PR author confirmed no docs update is needed.

Generated by PR Documentation Check for issue #16805 · ● 308.7K ·

nellshamrell pushed a commit to nellshamrell/aspire that referenced this pull request May 18, 2026
Added validation to enforce --yes when --non-interactive is used with the destroy command, returning a localized error if omitted. Introduced a new NonInteractiveRequiresYes resource and updated all localization files. Expanded DestroyCommandTests to cover new validation, multiple CLI permutations, and error scenarios for failed destroy activities.

Fix microsoft#16623
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aspire destroy --non-interactive requires --yes and exits 0 on failure

3 participants