Skip to content

Show anonymous dashboard URLs in aspire ps - #15731

Merged
James Newton-King (JamesNK) merged 4 commits into
mainfrom
copilot/fix-dashboard-url-display
Apr 1, 2026
Merged

James Newton-King (JamesNK) merged 4 commits into
mainfrom
copilot/fix-dashboard-url-display

Conversation

Copilot AI commented Mar 31, 2026 •

Copy link
Copy Markdown
Contributor

Description

aspire ps left the Dashboard column empty when the AppHost was configured with ASPIRE_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS / DOTNET_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS, even though the dashboard was running and reachable. This change makes the backchannel surface the dashboard base URL in anonymous mode so CLI output can display it the same way it already does for tokenized dashboards.

  • Backchannel behavior

    • Return the dashboard base URL when browser-token auth is not configured.
    • Preserve existing /login?t=... behavior when a browser token is configured.
    • Keep Codespaces URL rewriting on the resolved dashboard URL.
  • CLI coverage

    • Add a regression test for ps --format json to verify anonymous dashboard URLs are included.
  • Hosting coverage

    • Add a regression test for the auxiliary backchannel to verify anonymous dashboard mode returns the base URL.
    • Configure the anonymous dashboard settings before the test builder is created so the test exercises the real dashboard initialization path without clearing default configuration sources.
  • Follow-up cleanup

    • Align internal backchannel comments with the updated behavior so the contract reflects that anonymous mode can return plain dashboard URLs, while tokenized mode still returns login URLs.
baseUrlWithLoginToken = !string.IsNullOrEmpty(dashboardOptions.DashboardToken)
    ? $"{apiBaseUrl.TrimEnd('/')}/login?t={dashboardOptions.DashboardToken}"
    : apiBaseUrl;

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?

Copilot AI changed the title [WIP] Fix dashboard URL display when using ASPIRE_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS Show anonymous dashboard URLs in aspire ps Mar 31, 2026
{
baseUrlWithLoginToken = $"{apiBaseUrl.TrimEnd('/')}/login?t={dashboardOptions.DashboardToken}";
baseUrlWithLoginToken = !string.IsNullOrEmpty(dashboardOptions.DashboardToken)
? $"{apiBaseUrl.TrimEnd('/')}/login?t={dashboardOptions.DashboardToken}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should it Uri.EscapeDataString the token?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copilot Ensure the dashboardtoken used in the query value is valid. Escape/encode invalid characters

@JamesNK James Newton-King (JamesNK) Apr 1, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Cool, copilot did something else and ignored this comment.

I don't think this is nessessary because the token is always a hex string.

@github-actions

github-actions Bot commented Mar 31, 2026 •

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 -- 15731

Or

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

@davidfowl

Copy link
Copy Markdown
Collaborator

Copilot address the feeback

Copilot AI commented Mar 31, 2026

Copy link
Copy Markdown
Contributor Author

Copilot address the feeback

Addressed in 4fbff98. I aligned the backchannel/XML comments with the anonymous dashboard behavior so the contract now clearly covers both plain base URLs and tokenized login URLs, and re-ran the targeted hosting and CLI tests.

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

Updates the Aspire Hosting backchannel so aspire ps can display a dashboard URL even when the dashboard is configured for anonymous (unsecured) access, aligning CLI output behavior with tokenized dashboards.

Changes:

  • Update dashboard URL resolution to return the base dashboard URL when no browser token is configured (while preserving /login?t=... when a token exists).
  • Add a hosting regression test covering anonymous dashboard URL behavior via the auxiliary backchannel.
  • Add a CLI regression test ensuring ps --format json includes the anonymous dashboard URL.

Reviewed changes

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

File Description
src/Aspire.Hosting/Backchannel/DashboardUrlsHelper.cs Returns the base URL when no dashboard browser token is configured; keeps tokenized /login?t=... behavior and Codespaces rewriting.
tests/Aspire.Hosting.Tests/Backchannel/AuxiliaryBackchannelRpcTargetTests.cs Adds a regression test for anonymous dashboard mode in the auxiliary backchannel.
tests/Aspire.Cli.Tests/Commands/PsCommandTests.cs Adds a regression test verifying ps --format json includes the dashboard URL in anonymous mode.

@JamesNK
James Newton-King (JamesNK) enabled auto-merge (squash) April 1, 2026 01:46
@JamesNK

Copy link
Copy Markdown
Member

Confirmed this works with run, start and ps:
image

@JamesNK
James Newton-King (JamesNK) force-pushed the copilot/fix-dashboard-url-display branch from e0ab2e5 to 716e7c9 Compare April 1, 2026 05:42
@JamesNK
James Newton-King (JamesNK) merged commit 010f4a7 into main Apr 1, 2026
506 of 510 checks passed
@JamesNK
James Newton-King (JamesNK) deleted the copilot/fix-dashboard-url-display branch April 1, 2026 07:06
@JamesNK

Copy link
Copy Markdown
Member

/backport to release/13.2

@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

🎬 CLI E2E Test Recordings — 52 recordings uploaded (commit 716e7c9)

View recordings
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
CreateStartAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ 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
InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
PublishWithDockerComposeServiceCallbackSucceeds ▶️ View Recording
RestoreGeneratesSdkFiles ▶️ View Recording
RunWithMissingAwaitShowsHelpfulError ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
TypeScriptAppHostWithProjectReferenceIntegration ▶️ View Recording

📹 Recordings uploaded automatically from CI run #23833883431

@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

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

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

James Newton-King (@JamesNK) backporting to release/13.2 failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Creating an empty commit: Initial plan
Applying: fix: show anonymous dashboard url in ps output
Applying: docs: align dashboard url contract comments
error: sha1 information is lacking or useless (src/Aspire.Hosting/Backchannel/DashboardUrlsHelper.cs).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0003 docs: align dashboard url contract comments
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

James Newton-King (JamesNK) added a commit that referenced this pull request Apr 1, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: davidfowl <[email protected]>
Co-authored-by: JamesNK <[email protected]>
Jose Perez Rodriguez (joperezr) pushed a commit that referenced this pull request Apr 1, 2026
Co-authored-by: Copilot <[email protected]>
Co-authored-by: davidfowl <[email protected]>
Co-authored-by: JamesNK <[email protected]>
@joperezr Jose Perez Rodriguez (joperezr) added this to the 13.3 milestone Apr 14, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

No documentation PR is required for this change.

Reason: This is a bug fix that restores expected behavior — aspire ps now correctly displays the dashboard URL when anonymous access is configured (ASPIRE_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS). The change is internal to the backchannel plumbing with no new public APIs, new configuration options, or behavioral changes beyond fixing the missing URL. The PR author also confirmed no docs update was needed.

Generated by PR Documentation Check · ● 125.9K · ◷

@github-actions github-actions Bot locked and limited conversation to collaborators Jun 4, 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 ps doesn't show dashboard URL when using ASPIRE_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS

6 participants