Repository navigation
Update parent resource state from replicas - #18642
Adam Ratzman (adamint) merged 24 commits into
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 18642Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 18642" |
There was a problem hiding this comment.
Pull request overview
Updates the Dashboard resources page so a “parent” resource row can reflect state changes reported by its replica child rows (specifically for nested replica rows sharing the parent display name), fixing the Azure Container Apps “Scaled to zero” row not updating when a replica becomes “Running”.
Changes:
- Recompute parent row state from matching replica child rows during initial snapshot and subsequent resource change batches.
- Add
ResourceViewModel.WithStateFrom(...)to clone a view model while overriding state-related fields. - Add a bUnit regression test covering the parent/replica state update scenario from #13909.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Dashboard.Components.Tests/Pages/ResourcesTests.cs | Adds regression test for parent state reflecting replica updates; extends test helpers to model replica display name + parent-name property. |
| src/Aspire.Dashboard/Model/ResourceViewModel.cs | Adds helper to copy state-related fields from a replica to a parent while preserving the rest of the view model. |
| src/Aspire.Dashboard/Components/Pages/Resources.razor.cs | Implements parent/replica state recomputation on snapshot and on update batches; defines replica-child detection logic. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Low
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot <[email protected]> Copilot-Session: c15db581-f525-4089-a34f-2e8f4b021465
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Co-authored-by: Copilot <[email protected]> Copilot-Session: ed40fedd-e392-4643-ba83-09245cc58bb0
Co-authored-by: Copilot <[email protected]> Copilot-Session: ed40fedd-e392-4643-ba83-09245cc58bb0
Co-authored-by: Copilot <[email protected]> Copilot-Session: ed40fedd-e392-4643-ba83-09245cc58bb0
Co-authored-by: Copilot <[email protected]> Copilot-Session: ed40fedd-e392-4643-ba83-09245cc58bb0
Co-authored-by: Copilot <[email protected]> Copilot-Session: ed40fedd-e392-4643-ba83-09245cc58bb0
Ella Hathaway (ellahathaway)
left a comment
There was a problem hiding this comment.
I reviewed the parent/replica state projection end to end, including source/display model ownership, replica selection and fallback, update-stream diffing, hidden-state behavior, projected properties and health, all IDashboardClient consumers, the stress scenario, and regression coverage.
I didn't find any concrete correctness issues or nonblocking comments to leave.
|
I don't think it is the dashboard's job to update resources. It's a dumb view of what the app host tells it to do. If resource state is wrong then it should be fixed in the app host and then the dashboard just displays what it's told to. |
This reverts commit 5639ea2. Co-authored-by: Copilot App <[email protected]> Copilot-Session: c76af9f5-7190-41f8-a761-70ba462e9e55
Description
Fixes #13909
Dashboard resource rows can now reflect the state of their replica child rows. This fixes the deployed Azure Container Apps case where the logical container app row stayed
Scaled to zeroeven after one of its replica rows reportedRunning.The resources page now recomputes the parent row state for nested replica rows that share the parent display name, while leaving ordinary child resources alone. It also keeps the raw resource snapshot separate from the derived display row so the parent can fall back to
Scaled to zeroafter the last running replica is deleted.The regression tests cover initial snapshot propagation, update-stream propagation, restore-on-delete, replica health updates, mixed-health running replicas, state-owned property updates such as exit code and timestamps, and the non-replica child case.
HasSameDisplayedReplicaStatedecides whether a replica change is worth re-emitting the parent row for, and it compares more thanState: styling, timestamps, health status, health reports, and the state-owned properties. Every test that exercised those fields did so through the initial snapshot, where the comparison never runs. Five subscription tests close those gaps:SubscribeResources_ReplicaHealthChanged_EmitsParentHealthChange— the replica staysRunningand only its health report flipsHealthytoUnhealthy.SubscribeResources_ReplicaStateOwnedPropertyChanged_EmitsParentChange— the replica staysExitedand only its exit code changes.SubscribeResources_ReplicaStateStyleChanged_EmitsParentChange— the replica staysRunningand only its state style changes.SubscribeResources_ReplicaStartedAtChanged_EmitsParentChange— the replica staysRunningand only its start timestamp changes.SubscribeResources_ReplicaStoppedAtChanged_EmitsParentChange— the replica staysExitedand only its stop timestamp changes.All five are mutation-proved. Removing the two health clauses fails the health test, removing
HasSameStateOwnedPropertiesfails the exit-code test, and removing any styling or timestamp clause fails its matching same-state test.Screenshots / Recordings
No live ACA scale-to-zero recording is attached. The issue screenshots show the before state, and the added component tests cover the parent/replica state update behavior.
Validation
Checklist
<remarks />and<code />elements on your triple slash comments?