Skip to content

Always register dashboard resource with ExplicitStartupAnnotation when disabled - #18746

Draft
Alex Crome (afscrome) wants to merge 11 commits into
microsoft:mainfrom
afscrome:afscrome-explicit-start-dashboard
Draft

Always register dashboard resource with ExplicitStartupAnnotation when disabled#18746
Alex Crome (afscrome) wants to merge 11 commits into
microsoft:mainfrom
afscrome:afscrome-explicit-start-dashboard

Conversation

@afscrome

@afscrome Alex Crome (afscrome) commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Description

Fixes #15999

When DisableDashboard = true, the dashboard resource was previously excluded from the app model entirely, making it impossible for the Aspire CLI to start it on demand. This change always registers the dashboard resource but marks it with ExplicitStartupAnnotation when DisableDashboard = true, so DCP sets Spec.Start = false and the dashboard stays in NotStarted state until explicitly started (e.g. via aspire resource start aspire-dashboard).

Key changes:

  • DistributedApplicationBuilder: dashboard service registration is now unconditional in run mode (previously gated on !DisableDashboard).
  • DashboardEventHandlers: stamps ExplicitStartupAnnotation onto the dashboard resource when DisableDashboard = true, preventing auto-start.
  • DashboardServiceHost: removes the early-exit for disabled dashboard; publish mode still skips as before.
  • AppHostRpcTarget: removes the early-exit in GetDashboardUrlsAsync for disabled dashboard; DashboardUrlsHelper already handles the unhealthy case via the resource health wait path.
  • DistributedApplicationPipeline: excludes the explicit-start disabled dashboard from multi-compute-environment binding validation, so DisableDashboard=true does not require assigning aspire-dashboard to a compute environment.
  • TransportOptionsValidator and InteractionService.IsAvailable are intentionally unchanged -- transport validation and interaction availability remain gated on DisableDashboard because those only matter when the dashboard actually starts.

Test updates:

  • DashboardIsNotAddedIfDisabled renamed to DashboardIsAddedWithExplicitStartIfDisabled and updated to assert the dashboard resource is present with ExplicitStartupAnnotation.
  • Backchannel tests that used Assert.Single(result) over all resources now use Assert.Single(result, s => s.Name == "myresource") since the dashboard resource is present (as explicit-start) in the testing builder context.
  • ComputeEnvironmentValidationTests.MultipleComputeEnvironments_WithAllResourcesBound_DoesNotThrow now passes with the explicit-start disabled dashboard present.

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
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
    • No

Instead of skipping dashboard resource registration entirely when
DisableDashboard=true, always register the dashboard resource but mark it
with ExplicitStartupAnnotation so it starts in NotStarted state. This
allows the Aspire CLI to start the dashboard on demand via
`aspire resource start aspire-dashboard`.

Key changes:
- DistributedApplicationBuilder: unconditionally registers dashboard
  services in run mode (previously gated on !DisableDashboard)
- DashboardEventHandlers: applies ExplicitStartupAnnotation when
  DisableDashboard=true, preventing auto-start
- DashboardServiceHost: removes early-exit for disabled dashboard
  (publish mode still skips as before)
- AppHostRpcTarget: removes early-exit in GetDashboardUrlsAsync for
  disabled dashboard; DashboardUrlsHelper handles the unhealthy case
  via the resource health wait path
- Tests updated: DashboardIsNotAddedIfDisabled renamed and assertions
  updated; backchannel tests use targeted resource lookups instead of
  Assert.Single over all resources since the dashboard is now present

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 12, 2026 09:34
@github-actions

Copy link
Copy Markdown
Contributor

🚀 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 -- 18746

Or

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Attempts to keep a disabled dashboard in the app model as an explicit-start resource, supporting later CLI startup.

Changes:

  • Registers dashboard services unconditionally in run mode.
  • Marks disabled dashboards for explicit startup.
  • Updates dashboard URL handling and affected tests.

Reviewed changes

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

Show a summary per file
File Description
src/Aspire.Hosting/DistributedApplicationBuilder.cs Registers dashboard infrastructure in run mode.
src/Aspire.Hosting/DistributedApplicationOptions.cs Clarifies disabled-dashboard semantics.
src/Aspire.Hosting/Ats/CreateBuilderOptions.cs Aligns option documentation.
src/Aspire.Hosting/Dashboard/DashboardEventHandlers.cs Adds explicit-start annotation.
src/Aspire.Hosting/Dashboard/DashboardServiceHost.cs Hosts resource services when dashboard startup is disabled.
src/Aspire.Hosting/Backchannel/AppHostRpcTarget.cs Delegates disabled-dashboard URL requests to the helper.
src/Aspire.Hosting/Backchannel/DashboardUrlsHelper.cs Updates absent-resource documentation.
tests/Aspire.Hosting.Tests/Dashboard/DashboardResourceTests.cs Verifies explicit-start dashboard registration.
tests/Aspire.Hosting.Tests/Dashboard/DashboardEventHandlersTests.cs Supplies the new constructor dependency.
tests/Aspire.Hosting.Tests/Backchannel/AuxiliaryBackchannelRpcTargetTests.cs Accounts for the additional dashboard resource.

Comment thread src/Aspire.Hosting/Dashboard/DashboardEventHandlers.cs Outdated
@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

When DisableDashboard=true, the dashboard is now present in the model with
ExplicitStartupAnnotation so it can be started on demand. In models with
multiple compute environments, validation incorrectly treated this hidden
explicit-start dashboard as an unbound compute resource.

Update ValidateComputeEnvironmentBindings to skip the Aspire dashboard when
it has ExplicitStartupAnnotation, so disabled dashboard scenarios do not fail
compute environment validation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 12, 2026 13:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Comment thread src/Aspire.Hosting/Dashboard/DashboardEventHandlers.cs Outdated
Comment thread src/Aspire.Hosting/Dashboard/DashboardServiceHost.cs
@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

- Keep dashboard lifecycle controls hidden while still registering a Start
  command when DisableDashboard=true so Scanning for running AppHosts...
ℹ️ No running AppHosts found in the current directory. Select from all running AppHosts.
  works.
- Return dashboard URL state as unhealthy for explicit-start NotStarted
  dashboard snapshots instead of waiting for healthy indefinitely.
- Remove the transport-validation bypass for DisableDashboard now that disabled
  means explicit-start rather than fully disabled services.
- Regenerate TypeScript codegen API snapshot via
  AtsTypeScriptCodeGeneratorTests.TwoPassScanning_GeneratesWithEnvironmentOnTestRedisBuilder.
- Add/adjust tests covering dashboard start command availability, NotStarted URL
  behavior, and transport validation behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 15, 2026 17:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Comment thread src/Aspire.Hosting/Backchannel/DashboardUrlsHelper.cs Outdated
Comment thread src/Aspire.Hosting/Dashboard/TransportOptionsValidator.cs
@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

…bled

When DisableDashboard=true, the dashboard resource is explicit-start and can remain
unused during test scenarios. Logging a missing dashboard DLL as an error in this
mode causes Playground tests to fail due to an expected missing local dashboard
binary in CI environments.

Log the condition as debug when auto-start is disabled, while keeping error logging
for normal dashboard startup scenarios.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 15, 2026 18:55
Avoid waiting for dashboard health when the dashboard is explicit-start and in a
non-runnable state (for example NotStarted, Waiting, Unknown, or null state).
Only Starting/Building/Running continue through healthy wait.

Adds regression coverage for explicit-start Waiting and Unknown states.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Comment thread src/Aspire.Hosting/Backchannel/DashboardUrlsHelper.cs Outdated
Comment thread src/Aspire.Hosting/Dashboard/TransportOptionsValidator.cs
Comment thread src/Aspire.Hosting/Ats/CreateBuilderOptions.cs Outdated
Comment thread src/Aspire.Hosting/Dashboard/DashboardEventHandlers.cs
Copilot AI review requested due to automatic review settings July 15, 2026 19:02
- Treat explicit-start dashboard states without a runnable state (including null,
  Waiting, and Unknown) as unavailable in dashboard URL lookup.
- Add regression coverage for Waiting/Unknown explicit-start dashboard states.
- Add a non-validate command execution test that exercises the dashboard start
  callback path and verifies Waiting->Starting transition.
- Align polyglot docs for DisableDashboard semantics in ATS and Python generator
  output (auto-start disabled, explicit start still available), including updated
  Python snapshots.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs
Comment thread tests/Aspire.Hosting.Tests/Dashboard/DashboardEventHandlersTests.cs Outdated
Comment thread src/Aspire.Hosting/Ats/CreateBuilderOptions.cs Outdated
Copilot AI review requested due to automatic review settings July 15, 2026 19:08
- Limit the unbound compute-environment exception for explicit-start dashboard
  resources to run mode only, preventing unintended publish-mode bypass.
- Add publish-mode regression coverage for an explicit-start resource named
  aspire-dashboard in multi-environment models.
- Tighten disabled-dashboard lifecycle command test to assert the command set
  is exactly one command and that it is Start.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.

Comment thread src/Aspire.Hosting/DistributedApplicationOptions.cs Outdated
Comment thread tests/Aspire.Hosting.Tests/Dashboard/DashboardEventHandlersTests.cs Outdated
Comment thread tests/Aspire.Hosting.Tests/Dashboard/DashboardEventHandlersTests.cs Outdated
Comment thread tests/Aspire.Hosting.Tests/Dashboard/DashboardEventHandlersTests.cs Outdated
Comment thread tests/Aspire.Hosting.Tests/Dashboard/DashboardEventHandlersTests.cs Outdated
Copilot AI review requested due to automatic review settings July 15, 2026 19:15
- Update DistributedApplicationOptions.DisableDashboard XML doc to describe
  auto-start disabling with explicit start availability.
- Regenerate TypeScript two-pass snapshot so CreateBuilderOptions docs reflect
  startup-only semantics for disableDashboard.
- Remove Arrange/Act/Assert marker comments from the disabled-dashboard command
  test and keep exact single-command assertion for start-only behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread tests/Aspire.Hosting.Tests/Dashboard/DashboardEventHandlersTests.cs Outdated
Copilot AI review requested due to automatic review settings July 15, 2026 19:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Update the non-validate dashboard start-command test to start from a real
NotStarted snapshot (instead of forcing Waiting) and verify command execution
moves the dashboard away from NotStarted.

This exercises the start-command execution path for explicit-start dashboard
resources without relying on the waiting-state short-circuit.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 15, 2026 19:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Comment thread src/Aspire.Hosting/DistributedApplicationOptions.cs Outdated
Comment thread src/Aspire.Hosting/Ats/CreateBuilderOptions.cs Outdated
Comment thread src/Aspire.Hosting.CodeGeneration.Python/PythonModuleBuilder.cs Outdated
- Scope DisableDashboard summaries to run mode in public/ATS option docs.
- Update Python generator docstring and regenerate Python snapshots.
- Regenerate TypeScript two-pass snapshot so CreateBuilderOptions docs reflect
  the same run-mode-only explicit-start behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 15, 2026 19:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

Comment thread src/Aspire.Hosting/DistributedApplicationOptions.cs
Comment thread src/Aspire.Hosting/Dashboard/DashboardEventHandlers.cs
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 15, 2026 19:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated no new comments.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ExplicitStart Dashboard rather than excluding it when Dashboard is disabled

2 participants