Skip to content

Conversation

@JamesNK
Copy link
Member

@JamesNK JamesNK commented Dec 16, 2025

This pull request introduces a new "Set parameter value" command for parameter resources, allowing users to update parameter values interactively when supported. The change includes the implementation of the command, its integration into the parameter processing workflow, and the addition of localization resources for the new command in multiple languages.

New parameter command functionality:

  • Added a new command SetParameterValueCommand to KnownResourceCommands for setting parameter values on resources.
  • Implemented logic in ParameterProcessor to add the "Set parameter value" command to parameter resources when the interaction service is available and the command is not already present.
  • Added the AddSetParameterValueCommand method and the asynchronous SetParameterValueAsync method in ParameterProcessor, which prompts the user for a new value, updates the parameter resource, and persists the change if in run mode.

Addresses #13430

image image

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • 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
    • 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
    • No
  • Does the change require an update in our Aspire docs?

@JamesNK JamesNK requested a review from davidfowl December 16, 2025 02:10
@JamesNK JamesNK added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Dec 16, 2025
Copilot AI review requested due to automatic review settings December 16, 2025 02:10
@github-actions
Copy link
Contributor

github-actions bot commented Dec 16, 2025

🚀 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/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13583

Or

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

Copy link
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

This pull request adds a new interactive "Set parameter value" command to parameter resources, enabling users to update parameter values on-the-fly when an interaction service is available. The change provides a user-friendly way to modify parameter values during runtime, with full test coverage and localization support.

Key Changes

  • Added SetParameterValueCommand constant to KnownResourceCommands for identifying the new command
  • Implemented command registration logic in ParameterProcessor that conditionally adds the command when interaction services are available
  • Created SetParameterValueAsync public method to handle user input prompts, parameter value updates, and persistence to deployment state in run mode

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Aspire.Hosting/ApplicationModel/KnownResourceCommands.cs Added constant for the new set parameter value command
src/Aspire.Hosting/Orchestrator/ParameterProcessor.cs Implemented command registration and execution logic with deployment state persistence
src/Aspire.Hosting/Resources/CommandStrings.resx Added English resource strings for command name and description
src/Aspire.Hosting/Resources/CommandStrings.Designer.cs Generated designer code for new resource strings
src/Aspire.Hosting/Resources/xlf/*.xlf Added localization placeholders (marked as "new") for 13 languages
tests/Aspire.Hosting.Tests/Orchestrator/ParameterProcessorTests.cs Added comprehensive test coverage for command registration and execution scenarios
tests/Shared/TestInteractionService.cs Implemented PromptInputAsync method to support testing of single-input interactions
Files not reviewed (1)
  • src/Aspire.Hosting/Resources/CommandStrings.Designer.cs: Language not supported

@davidfowl
Copy link
Member

A few things:

  1. I love the feature!
  2. We need a clear value
  3. We need to tell people that their values make not take effect unless dependent resources are restarted

@JamesNK
Copy link
Member Author

JamesNK commented Dec 16, 2025

We need to tell people that their values make not take effect unless dependent resources are restarted

That can go in the dialog description text.

We need a clear value

What would someone use that for?
What about opening the dialog and saving it with nothing in the text box? However, that wouldn't differentate between a parameter with an empty value vs an unset parameter.
If you want something to delete the parameter then that would have to be a separate command.

@davidfowl
Copy link
Member

What would someone use that for?

You're building an onboarding experience and you want to try it out more than once without dropping to the command line (dotnet user secrets etc)

@JamesNK
Copy link
Member Author

JamesNK commented Dec 16, 2025

What would someone use that for?

You're building an onboarding experience and you want to try it out more than once without dropping to the command line (dotnet user secrets etc)

Ok. Is it needed right now? Could add in another PR in the future.

@JamesNK JamesNK marked this pull request as ready for review December 16, 2025 09:14
@JamesNK
Copy link
Member Author

JamesNK commented Dec 16, 2025

TODO: dismiss message bar when all parameters are set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants