Repository navigation
Add "Manage" links from Redis to Redis Commander/Insight - #19969
Damian Edwards (DamianEdwards) merged 3 commits into
Conversation
…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]>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19969Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19969" |
There was a problem hiding this comment.
🟡 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]>
There was a problem hiding this comment.
🟡 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
WithRedisCommanderXML 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
WithRedisInsightdocumentation 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]>
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Damian Edwards (DamianEdwards)
left a comment
There was a problem hiding this comment.
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.
116ed90
into
microsoft:main
|
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):
Suggested actions:
You can re-run the failed jobs from the workflow run page. |
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]>
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-wideBeforeStartEvent, 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 -
DcpResourceWatcheronly refreshed a resource's own snapshot when its endpoint changed, so a resource displaying a cross-resource URL (viaResourceUrlAnnotation.Endpoint) never had itsIsInactiveflag updated when the referenced resource's endpoint activated/deactivated — the URL got stuck.RefreshResourcesReferencingEndpointnow finds and refreshes any resource holding such a reference.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
redisresource, and clicking through opens a working, already-connected tool instance.WithUrlsTests.cs) reproduces the stuck cross-resource URL bug and confirms the DCP fix.AddRedisTests.cs) cover: every Redis resource in the app gets the link (not just ones that calledWithRedisCommander/WithRedisInsightdirectly), and the tool resource is hidden.RedisFunctionalTests.cs) cover: link tracks the tool's start/stop lifecycle,WithExplicitStartcombinations, and a single shared tool instance linking correctly from multiple Redis resources.RedisFunctionalTests/DcpExecutorTests/WithUrlsTestssuites pass with no regressions.Test plan
dotnet test—Aspire.Hosting.Tests(WithUrlsTests,DcpExecutorTests,DistributedApplicationTests)dotnet test—Aspire.Hosting.Redis.Tests(AddRedisTests,RedisFunctionalTests)🤖 Generated with Claude Code