Skip to content

Add "Manage" links from Redis to Redis Commander/Insight - #19969

Merged
Damian Edwards (DamianEdwards) merged 3 commits into
microsoft:mainfrom
afscrome:claude/aspire-11603-fix-validation-058a20
Sep 9, 2026
Merged

Damian Edwards (DamianEdwards) merged 3 commits into
microsoft:mainfrom
afscrome:claude/aspire-11603-fix-validation-058a20

Conversation

@afscrome

@afscrome Alex Crome (afscrome) commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

With that fixed, WithRedisCommander()/WithRedisInsight() now hide the tool container and add a "Manage" URL back onto every Redis resource in the app (not just the one the method happened to be called on, since the tool manages all of them). The link is registered once via the app-wide BeforeStartEvent, early enough for Aspire's standard URL-processing pipeline to resolve it against the tool's allocated endpoint. Fixes #11603.

Also Fixes Underlying DCP bug behind #14061 - DcpResourceWatcher only refreshed a resource's own snapshot when its endpoint changed, so a resource displaying a cross-resource URL (via ResourceUrlAnnotation.Endpoint) never had its IsInactive flag updated when the referenced resource's endpoint activated/deactivated — the URL got stuck. RefreshResourcesReferencingEndpoint now finds and refreshes any resource holding such a reference.

image

For now, only applying this against Redis Insights/Commander. Assuming this works out, I'd like to expand this pattern to other management resources. (phpmyadmin, dbgate etc.)

Validation

  • Verified live against the Redis playground dashboard: the "Manage (Commander)"/"Manage (Insights)" links render as real, absolute, clickable URLs on the redis resource, and clicking through opens a working, already-connected tool instance.
  • New regression test (WithUrlsTests.cs) reproduces the stuck cross-resource URL bug and confirms the DCP fix.
  • Unit tests (AddRedisTests.cs) cover: every Redis resource in the app gets the link (not just ones that called WithRedisCommander/WithRedisInsight directly), and the tool resource is hidden.
  • Real-container functional tests (RedisFunctionalTests.cs) cover: link tracks the tool's start/stop lifecycle, WithExplicitStart combinations, and a single shared tool instance linking correctly from multiple Redis resources.
  • Full existing RedisFunctionalTests/DcpExecutorTests/WithUrlsTests suites pass with no regressions.

Test plan

  • dotnet test — Aspire.Hosting.Tests (WithUrlsTests, DcpExecutorTests, DistributedApplicationTests)
  • dotnet test — Aspire.Hosting.Redis.Tests (AddRedisTests, RedisFunctionalTests)
  • Manual verification against the Redis playground dashboard

🤖 Generated with Claude Code

…1603)

Fixes the underlying DCP bug that blocked microsoft#11603, microsoft#13647, and microsoft#14061:
DcpResourceWatcher only refreshed a resource's own snapshot when its
endpoint changed, so a resource displaying a cross-resource URL (via
ResourceUrlAnnotation.Endpoint) never had its IsInactive flag updated
when the *referenced* resource's endpoint activated or deactivated,
leaving the URL stuck. RefreshResourcesReferencingEndpoint now finds
and refreshes any resource holding such a reference.

With that fixed, WithRedisCommander()/WithRedisInsight() now hide the
tool container and add a "Manage" URL back onto every Redis resource
in the app (not just the one the method was called on, since the tool
manages all of them), registered once via the app-wide BeforeStartEvent
so the standard URL pipeline can resolve it against the tool's endpoint.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings September 6, 2026 13:55
@github-actions

github-actions Bot commented Sep 6, 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 -- 19969

Or

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

@github-actions github-actions Bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Sep 6, 2026

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.

🟡 Changes recommended

The endpoint/service watch ordering can still leave URLs stale, and one functional assertion is ineffective.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds run-only Redis admin-tool links and fixes cross-resource endpoint lifecycle updates.

Changes:

  • Adds “Manage” links for Redis Commander and Redis Insight.
  • Hides companion tool resources.
  • Refreshes dependent resource URLs when referenced endpoints change.
File summaries
File Description
src/Aspire.Hosting/Dcp/DcpResourceWatcher.cs Refreshes cross-resource endpoint URLs.
src/Aspire.Hosting.Redis/RedisBuilderExtensions.cs Adds Redis management links and hides tools.
tests/Aspire.Hosting.Tests/WithUrlsTests.cs Tests cross-resource URL lifecycle.
tests/Aspire.Hosting.Redis.Tests/AddRedisTests.cs Tests Redis model annotations.
tests/Aspire.Hosting.Redis.Tests/RedisFunctionalTests.cs Tests runtime management links.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Balanced

- Resolve the endpoint's owning service from AppResources instead of
  ServicesMap in RefreshResourcesReferencingEndpoint. AppResources is
  built synchronously from the app model before the resource watcher
  starts, so it can't race against the separate Service watch loop
  that populates ServicesMap on a genuinely new endpoint activation.
- Fix a self-comparing assertion in
  VerifyRedisCommanderManagementLinkCoversEveryRedisResourceItManages
  that always passed regardless of the actual URL value; it now
  compares against Commander's own resolved endpoint URL.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Copilot AI review requested due to automatic review settings September 6, 2026 14:23
@afscrome Alex Crome (afscrome) added area-integrations Issues pertaining to Aspire Integrations packages redis Issues related to redis integrations and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Sep 6, 2026

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.

🟡 Changes recommended

Public API documentation is incomplete, and the new functional tests share timeout budgets that can cause CI flakiness.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (3)

Previously missed (1) — in code that hasn't changed since the last review.

src/Aspire.Hosting.Redis/RedisBuilderExtensions.cs:248

  • This adds surprising public behavior that the WithRedisCommander XML documentation does not describe: the tool is hidden and a link is added to every Redis resource, not only the receiver. Document both effects on the public method so IntelliSense accurately explains the app-wide mutation.

This issue also appears on line 397 of the same file.

src/Aspire.Hosting.Redis/RedisBuilderExtensions.cs:397

  • The public WithRedisInsight documentation does not mention this new behavior: it now hides Redis Insight and adds a management link to every Redis resource in the application. Update its XML documentation so consumers are aware of the app-wide side effect.
            AddManagementLinks(resourceBuilder, "http", "Manage (Insights)");

tests/Aspire.Hosting.Redis.Tests/RedisFunctionalTests.cs:139

  • The same cancellation token covers startup, multiple lifecycle commands, and all readiness assertions. A slow startup leaves later start/stop checks with little or no timeout budget, making this regression test flaky; give each phase an independent timeout.
        var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Balanced

…mmander tests

A single shared CancellationTokenSource meant slow container startup
under CI contention could consume most of the budget, leaving too
little for the subsequent WaitForResourceAsync/command assertions and
causing spurious failures. Startup now gets its own timeout window,
separate from verification.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Copilot AI review requested due to automatic review settings September 6, 2026 14: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.

🟢 Approval recommended

The implementation addresses both linked issues with focused unit and functional regression coverage.

Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@github-actions

github-actions Bot commented Sep 6, 2026

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.

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.

Nice! If we don't already, we should log issues to do the same for the equivalents on other container resources with separate management containers, e.g. Postgres.

@DamianEdwards
Damian Edwards (DamianEdwards) merged commit 116ed90 into microsoft:main Sep 9, 2026
371 of 376 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.6 milestone Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Analysis: Possible Flaky Test(s)

The CI build failed due to test failure(s) that appear unrelated to the PR changes. These may be flaky tests.

Suspected flaky test(s):

  • Aspire.Hosting.Azure.Tests.AzureKubernetesInfrastructureTests.DestroyPipelineUsesPersistedAksResourceIdWhenScopeIsAbsent in job Hosting.Azure.Kubernetes (windows-latest)
    • Error: System.TimeoutException : The operation has timed out.
    • Stack Trace (first frames):
      at Aspire.Hosting.Azure.Tests.AzureKubernetesInfrastructureTests.DestroyPipelineUsesPersistedAksResourceIdWhenScopeIsAbsent() in D:\a\aspire\aspire\tests\Aspire.Hosting.Azure.Kubernetes.Tests\AzureKubernetesInfrastructureTests.cs:line 565
         at Aspire.Hosting.Azure.Tests.AzureKubernetesInfrastructureTests.DestroyPipelineUsesPersistedAksResourceIdWhenScopeIsAbsent() in D:\a\aspire\aspire\tests\Aspire.Hosting.Azure.Kubernetes.Tests\AzureKubernetesInfrastructureTests.cs:line 575
      
    • Why likely flaky: Matches prior known cause 'hosting-azure-kubernetes-destroypipeline-timeout' (issue [CI Failure] Flaky: AzureKubernetesInfrastructureTests DestroyPipeline tests time out on windows-latest #19982); test times out intermittently on windows-latest and the PR does not touch Azure Kubernetes hosting code.

Suggested actions:

  • Re-run the failed CI jobs to confirm if the failure is intermittent
  • If the test continues to fail, consider quarantining it using /quarantine-test <test name> <issue URL>
  • Search existing issues to see if this test is already known to be flaky

You can re-run the failed jobs from the workflow run page.

James Newton-King (JamesNK) pushed a commit to afscrome/aspire that referenced this pull request Sep 23, 2026
Follows up on the scoping comment on microsoft#11603 (and the pattern introduced in
microsoft#19969 for Redis): hides the dedicated tool container and adds a
prioritized "Manage" URL back onto the resource(s) it manages, for
phpMyAdmin, pgAdmin, pgweb, Kafka UI, Mongo Express, and Attu. Also wires
up the relationship annotations that were previously missing for
phpMyAdmin, Kafka UI, and Attu.

Standardizes the "built-in" management links (no separate container to
hide) on the same "Manage" text: Qdrant's dashboard, RabbitMQ's
management plugin, the Durable Task Scheduler emulator's dashboard, and
Cosmos DB's Data Explorer.

Consolidating Cosmos DB onto plain "Manage" removed the need for the
dashboard-side KnownUrls/KnownUrlsDisplay localization shim that special
cased its endpoint name and display text - deleted it along with the
now-unused shared KnownUrls.cs, so the Aspire.Dashboard project no longer
has any Cosmos DB specific knowledge.

Sets DisplayOrder = 1 on every "Manage" link (including Redis's, for
consistency) so it sorts above a resource's other URLs.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-integrations Issues pertaining to Aspire Integrations packages redis Issues related to redis integrations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Have Mangement UIs add Manage links to the resources they manage

3 participants