You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Store dashboard tags, resource order and metric pins in browser local storage - #21840
Moves the dashboard's application-level settings (resource tags, resource and group order, and pinned metrics) out of the SQLite settings database (dashboard-settings.db) and into browser localStorage, like the dashboard's other preferences. These settings no longer live in the data directory on disk, and aren't shared between browsers or users.
What changed
DashboardSettingsDatabase is removed, along with the now-unused DashboardRunStore.GetApplicationSettingsDirectory.
ResourceTagStore, ResourceOrderStore and MetricPinStore are now scoped per circuit and keep their synchronous read API. Each loads once from localStorage (EnsureLoadedAsync) under a key scoped to the application name, built with the same DashboardApplicationNameKey as the existing collapsed-resources key: Aspire_Resources_Tags_<app>, Aspire_Resources_Order_<app> and Aspire_Metrics_Pins_<app>.
A new LocalStorageSetting<T> owns each setting's in-memory value and its saves:
Tabs don't overwrite each other. Every tab has its own circuit but shares localStorage. Changes are idempotent functions applied in memory immediately and queued; each save re-reads the stored value, replays the queued changes onto it, and adopts the result, so a tab also picks up what other tabs saved.
Unreadable values are never silently replaced.StorageResult now tells transient read failures (ReadFailed: disconnected circuit, JS errors, timeouts) apart from values that will never read (InvalidValue: bad JSON, data protection mismatch, or a bug such as an unregistered type). Transient failures block writes, and the save is retried with backoff through TimeProvider. An invalid value is copied once to <key>_Unreadable and then replaced, so saving keeps working.
A load that read storage before a save completed doesn't replace the newer saved value.
Values are stored unprotected. Protected values are encrypted with the dashboard's data protection key, which changes across Aspire versions and on every run of the standalone dashboard, so they would be lost regularly. These are names chosen by the user or reported by the app, not secrets.
Moves can no longer fail to save synchronously, so the "Unable to save the resource/group order" messages and their resource strings are removed (.xlf regenerated). TryMove and TryMoveGroup return false when an item has no position, and the existing reorder-unavailable toast is shown.
ResourcesLayout starts loading tags and order early and waits for them only before showing resources. ResourceOverview no longer waits for pins.
Reviewer notes
No migration. Data in an existing dashboard-settings.db isn't carried over. That file was added in Modernize the dashboard experience #21412 and hasn't shipped in a release.
Settings are tied to the browser origin, port included. If an app's dashboard is served on a different port, its tags, order and pins don't carry over. The other browser-stored preferences already work this way.
Tabs pick up each other's changes when they save or load, not live.
Tests
Unit tests run the stores against the real LocalBrowserStorage over an in-memory localStorage, so they cover the stored JSON and source-generated serialization. They cover cross-tab merging, unreadable and invalid values, retries with FakeTimeProvider, and the stale-load race. The race test fails if the guard is removed.
The shared TestJSRuntime gains an optional callback (replacing a private copy). TestLocalStorage returns saved values like a browser, and can simulate failed reads.
Playwright tag tests seed localStorage with an init script instead of using the server-side store.
Ran: Aspire.Dashboard.Tests (2,618 passed), Aspire.Dashboard.Components.Tests (1,269 passed), and the two affected outerloop Playwright tests (TagHeader_SelectsTaggedResourcesAndChevronTogglesGroup, ContextMenu_RepeatedTagRowsRestoreExactTriggerAndRespectLightDismissal).
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?
Replace the dashboard settings SQLite database (dashboard-settings.db) with
browser local storage, like other dashboard preferences. Settings aren't
shared between browsers, which keeps them out of the data directory.
- ResourceTagStore, ResourceOrderStore and MetricPinStore are now scoped per
circuit and keep their synchronous read API. Each loads once from local
storage (EnsureLoadedAsync) under a key scoped to the application name.
- LocalStorageSetting<T> writes snapshots in the background, one at a time,
latest wins. Nothing is written before the stored value is read; changes
made earlier are merged at load so they never replace stored settings.
- Values are stored unprotected because the data protection key changes
across versions and standalone runs.
- Moves can no longer fail to save, so drop the reorder-failed toasts and
their resource strings.
- Unit tests use the real LocalBrowserStorage over an in-memory localStorage
to cover the stored JSON and source-generated serialization. Playwright
tests seed tags through localStorage.
…alues
Each tab has its own circuit and copy of resource tags, order and metric
pins, but they share local storage, so saving a tab's whole snapshot
replaced changes saved by other tabs.
- LocalStorageSetting now owns the in-memory value. Changes are idempotent
functions applied in memory right away and queued; each write reads the
latest stored value, replays the queued changes and saves the result,
which becomes the tab's value so it also picks up other tabs' changes.
- StorageResult.ReadFailed distinguishes a failed read (disconnected
circuit, JS error, undeserializable value) from a missing one. A value
that can't be read is never overwritten; changes stay in memory and a
failed load is retried.
- The three stores are thin wrappers that provide normalization and
changes. Stored tags reuse the first casing of each tag, like AddTag.
- ResourcesLayout starts loading tags and order early and waits only
before showing resources.
- Tests reuse the shared TestJSRuntime, and TestLocalStorage returns saved
values like a browser.
- Track completed saves so a load that read storage before a save finished
doesn't replace the newer value the save adopted.
- Distinguish unavailable storage (StorageResult.ReadFailed, retried) from
a stored value that can't be deserialized (StorageResult.InvalidValue).
An invalid value is copied to <key>_Unreadable, logged once, and replaced
by the next change instead of disabling saving; loads are only retried
when storage was unavailable.
- Retry failed saves with backoff (1, 2, 4, 8 seconds) and resume pending
saves when a view loads the setting again.
- Catch load errors so the load task always completes.
- Detect changes with per-store equality instead of comparing JSON, so the
order of resources or groupings doesn't raise Changed.
- Append order keys with an allocation-free scan on resource updates.
- TestLocalStorage can simulate missing keys and failed reads.
…on-throwing
- Settings retries wait through the injected TimeProvider, so tests advance
fake time instead of waiting on the clock.
- Only browser errors (JSException, timeouts) are transient read failures;
invalid JSON, data protection mismatches and other errors (such as a type
missing from the serializer context) are invalid values, so they aren't
retried forever. Unexpected errors are logged as warnings.
- An unreadable value is copied to <key>_Unreadable only when no backup
exists, so alternating dashboard versions don't replace the first backup.
- ResourceOrderStore.TryMove/TryMoveGroup return false for items without a
position; ResourcesLayout shows the reorder-unavailable toast instead of
throwing from the JS-invokable reorder.
- ResourceOverview no longer waits for pins before initializing.
- Tests cover a load that reads before a save completes and component
behavior when storage can't be read.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Concurrent cross-tab saves can silently overwrite edits, while malformed JSON can be replaced without a backup and rejected reorders can incorrectly report success.
Moves the redesigned dashboard’s tags, resource and group order, and metric pins from SQLite to browser-local preferences scoped by application name. Existing settings are intentionally not migrated because the database feature has not shipped.
Changes:
Replaces database-backed stores with circuit-scoped localStorage stores and shared loading, save merging, retries, and invalid-value handling.
Updates component initialization and reorder feedback, removing obsolete save-error strings.
Reworks unit and browser tests around localStorage persistence and failure scenarios.
…rbatim
- Hold a per-key lock (LocalStorageLocks, a singleton shared by all
circuits) around the whole read, merge and write of a setting, so two
tabs saving at the same time can't both read the same value and drop
each other's change. Waiting gives up after 10 seconds and the save is
retried like any failed one.
- Copy the stored text as is to <key>_Unreadable through new raw
ILocalStorage methods, so malformed JSON is kept too, not only valid
JSON of the wrong shape. Remove the JsonElement serializer registration.
- ResourceOrderStore.TryMove returns whether the move was applied, so a
save that drops the items between the check and the move shows the
reorder-unavailable toast.
- Tests cover overlapping saves from two tabs and a malformed stored value.
An edit that is a no-op against this tab's stale cache can still change storage: re-adding a cached tag that another tab removed is discarded here, and removing a tag added elsewhere can be lost while this tab's save is still reading storage. Queue explicit tag and pin edits even when the cached value is unchanged, while keeping change notifications conditional and avoiding writes for automatic no-op EnsureResources calls. Add regression tests with stale caches and delayed reads.
The write-exception retry path is not exercised by the failure tests: InMemoryBrowserLocalStorage only fails reads, so those tests return before reaching SetUnprotectedAsync. Please add a failed-setItem regression test using FakeTimeProvider that verifies the cached edit and pending changes survive, existing stored data is retained, and the edit is saved automatically after writes recover without requiring another user action.
Source Checkout: Detached checkout at the exact PR head
Status: ✅ Verified
Changes Analyzed
The PR removes the dashboard settings SQLite database and stores resource tags, resource/group order, and metric pins in application-scoped browser localStorage. It adds queued cross-tab merging, retry behavior for transient reads, and _Unreadable backup/replacement for permanently invalid values.
Change Categories
CLI changes
Hosting integration changes
Dashboard changes
Template changes
Client/component integration changes
VS Code extension changes
Test changes
CI infrastructure changes
Test Scenarios Executed
Scenario 1: Targeted dashboard storage regression suite
Objective: Validate persistence, serialization, cross-tab merging, retry behavior, stale-load protection, application scoping, and invalid-value recovery for tags, order, and metric pins. Coverage Type: Unit/integration regression Status: ✅ Passed
Scenario 2: Resource tag editor component regression
Objective: Verify the dashboard tag editor remains correct with the new scoped browser-backed store. Coverage Type: Component regression Status: ✅ Passed
Command:
dotnet test --project tests\Aspire.Dashboard.Components.Tests\Aspire.Dashboard.Components.Tests.csproj --no-launch-profile ----filter-class '*.ResourceTagEditorTests'--filter-not-trait 'quarantined=true'--filter-not-trait 'outerloop=true'
Result: 10 passed, 0 failed.
Evidence:dashboard-components-tests.log
Scenario 3: Browser persistence happy path
Objective: Add a resource tag through the real dashboard UI, verify tag grouping, then navigate/reload the resource URL and verify the tag remains visible. Coverage Type: Happy path, real browser Status: ✅ Passed
Command:
dotnet test --project tests\Aspire.Dashboard.Playwright.Tests\Aspire.Dashboard.Playwright.Tests.csproj --no-launch-profile ----filter-method '*.ResourceTag_AddedFromOverviewGroupsResourceInResourcePane'--filter-not-trait 'quarantined=true'
Result: 1 passed, 0 failed.
Evidence:playwright-persistence.log
Scenario 4: Concurrent-tab and isolation boundaries
Objective: Verify changes from another tab are merged rather than overwritten, overlapping saves keep both updates, and application names use separate storage keys. Coverage Type: Boundary/concurrency Status: ✅ Passed
Covered tests include:
Tags_ChangesFromAnotherTabAreKept
Tags_OverlappingSavesFromTwoTabsKeepBothChanges
Order_ChangesFromAnotherTabAreKept
SetPinned_ChangesFromAnotherTabAreKept
Tags_AreScopedToApplicationName
Expected outcome: No lost updates; settings for another application remain isolated.
Evidence:dashboard-tests-retry.log
Scenario 5: Corrupted or unavailable storage recovery
Objective: Verify transient reads do not overwrite existing data and permanently invalid values are preserved under the _Unreadable key before replacement. Coverage Type: Unhappy path Status: ✅ Passed
Covered tests include:
Tags_UnreadableStorageIsNotOverwritten
Tags_InvalidStoredValueIsKeptAndReplaced
Order_UnreadableStorageIsNotOverwritten
Order_InvalidStoredValueIsKeptAndReplaced
Expected outcome: Transient failures defer writes and retry safely; invalid values are backed up and replaced without making the dashboard unusable.
Evidence:dashboard-tests-retry.log
Scenario 6: Affected Playwright regressions
Objective: Verify seeded local-storage tags render correctly in the resource pane and repeated context-menu tag rows retain correct trigger/light-dismiss behavior. Coverage Type: Browser regression Status: ✅ Passed
Command:
dotnet test --project tests\Aspire.Dashboard.Playwright.Tests\Aspire.Dashboard.Playwright.Tests.csproj --no-launch-profile ----filter-method '*.TagHeader_SelectsTaggedResourcesAndChevronTogglesGroup'--filter-method '*.ContextMenu_RepeatedTagRowsRestoreExactTriggerAndRespectLightDismissal'--filter-not-trait 'quarantined=true'
Result: 2 passed, 0 failed.
Evidence:playwright-targeted.log
Observations
The first storage-suite attempt overlapped compilation with the component suite and hit Windows file locks in shared build outputs. Rerunning the storage suite alone passed 52/52; this was a test orchestration issue, not a PR failure.
Builds emitted the repository SDK warning for Microsoft.DotNet.ILCompiler advisory GHSA-p3jp-9v83-76w9; it is unrelated to this PR.
Playwright logs contain expected circuit-disconnect cleanup diagnostics after page/context disposal; all selected tests passed.
Summary
Scenario
Status
Notes
Storage regression suite
✅ Passed
52/52
Tag editor components
✅ Passed
10/10
Browser persistence
✅ Passed
1/1 real Playwright UI test
Concurrent tabs and isolation
✅ Passed
Tags, order, pins, app scoping covered
Corrupted storage recovery
✅ Passed
Transient and invalid values covered
Affected Playwright regressions
✅ Passed
2/2
Overall Result
✅ PR VERIFIED
The tested PR artifact matches the current head commit, and all targeted dashboard persistence, concurrency, recovery, component, and browser scenarios passed.
Refactor tag assertion to use retry logic for stability.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because storage synchronization can discard explicit pin or tag edits, and pending settings reads can trigger resource updates or redirects after layout disposal.
Added a "Browser-stored settings" section to dashboard/data-persistence.mdx. It covers tags, order and pins moving to browser local storage. Triggered signals: dashboard_user_facing_page_changed (Metrics.razor.cs, ResourceOverview.razor.cs) and new_public_type (LocalStorageLocks).
…1881)
## Description
Renames the reserved trait used by `WithTags` from
`Aspire_Dashboard_Tag` to `Aspire_Tag`.
AppHost tags aren't dashboard-only. The CLI backchannel adds traits to
resource snapshots the same way the dashboard does, so `aspire describe
--format json` already includes them:
```json
"properties": {
"resource.trait.Aspire_Tag": ["frontend", "critical"]
}
```
With the old name, tools reading that output had to know a
dashboard-scoped name for something that isn't dashboard-specific, and
the method name (`WithTags`) and the trait name didn't match in scope.
### What changed
- `KnownResourceTraits.DashboardTag = "Aspire_Dashboard_Tag"` →
`KnownResourceTraits.Tag = "Aspire_Tag"`, with a comment explaining the
naming.
- The `Aspire_` prefix stays so the reserved name can't collide with
user traits added through `WithTrait` (a bare `tag` would pick up tag
validation and dashboard tag behavior).
- `Aspire_Dashboard_Position` / `WithDashboardPosition` are unchanged:
only the dashboard uses a position, so the name matches the scope.
- The `TraitAnnotation` validation message now says "Tags must…" instead
of "Dashboard tags must…".
- `docs/specs/dashboard-persistence.md` uses the new name, says that the
tags appear in `aspire describe`, and no longer says that user-added
tags live in the settings database (they're in browser local storage
since #21840).
- The resource string key `ResourceTraitDashboardTags` keeps its name.
Renaming it would mean editing the resx and Designer files and
regenerating the `.xlf` files, and users never see the key.
### Reviewer notes
- **No compatibility shim.** The trait was added in #21412 and isn't in
any release tag yet, so nothing shipped reads the old name.
### Validation
- `Aspire.Hosting.Tests` (`ResourceTraitBuilderTests`,
`DashboardServiceDataTerminalTests`): 16 passed.
- `Aspire.Dashboard.Tests` (`ResourceTagStoreTests`): 20 passed.
- `Aspire.Dashboard.Components.Tests` (`ResourcesLayoutTests`,
`ResourceDetailsTests`): 168 passed.
- `Aspire.Dashboard.Playwright.Tests` builds. Its tests weren't run
locally.
## Checklist
- Is this feature complete?
- [x] Yes. Ready to ship.
- [ ] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
- [x] Yes
- [ ] No
- Did you add public API?
- [ ] Yes
- [x] No
- Does the change make any security assumptions or guarantees?
- [ ] Yes
- [x] No
Co-authored-by: Sébastien Ros <1165805+sebastienros@users.noreply.github.com>
… storage (#21840)
## Description
Moves the dashboard's application-level settings (resource tags,
resource and group order, and pinned metrics) out of the SQLite settings
database (`dashboard-settings.db`) and into browser `localStorage`, like
the dashboard's other preferences. These settings no longer live in the
data directory on disk, and aren't shared between browsers or users.
### What changed
- `DashboardSettingsDatabase` is removed, along with the now-unused
`DashboardRunStore.GetApplicationSettingsDirectory`.
- `ResourceTagStore`, `ResourceOrderStore` and `MetricPinStore` are now
scoped per circuit and keep their synchronous read API. Each loads once
from `localStorage` (`EnsureLoadedAsync`) under a key scoped to the
application name, built with the same `DashboardApplicationNameKey` as
the existing collapsed-resources key: `Aspire_Resources_Tags_<app>`,
`Aspire_Resources_Order_<app>` and `Aspire_Metrics_Pins_<app>`.
- A new `LocalStorageSetting<T>` owns each setting's in-memory value and
its saves:
- **Tabs don't overwrite each other.** Every tab has its own circuit but
shares `localStorage`. Changes are idempotent functions applied in
memory immediately and queued; each save re-reads the stored value,
replays the queued changes onto it, and adopts the result, so a tab also
picks up what other tabs saved.
- **Unreadable values are never silently replaced.** `StorageResult` now
tells transient read failures (`ReadFailed`: disconnected circuit, JS
errors, timeouts) apart from values that will never read
(`InvalidValue`: bad JSON, data protection mismatch, or a bug such as an
unregistered type). Transient failures block writes, and the save is
retried with backoff through `TimeProvider`. An invalid value is copied
once to `<key>_Unreadable` and then replaced, so saving keeps working.
- A load that read storage before a save completed doesn't replace the
newer saved value.
- Values are stored unprotected. Protected values are encrypted with the
dashboard's data protection key, which changes across Aspire versions
and on every run of the standalone dashboard, so they would be lost
regularly. These are names chosen by the user or reported by the app,
not secrets.
- Moves can no longer fail to save synchronously, so the "Unable to save
the resource/group order" messages and their resource strings are
removed (`.xlf` regenerated). `TryMove` and `TryMoveGroup` return
`false` when an item has no position, and the existing
reorder-unavailable toast is shown.
- `ResourcesLayout` starts loading tags and order early and waits for
them only before showing resources. `ResourceOverview` no longer waits
for pins.
### Reviewer notes
- **No migration.** Data in an existing `dashboard-settings.db` isn't
carried over. That file was added in #21412 and hasn't shipped in a
release.
- **Settings are tied to the browser origin, port included.** If an
app's dashboard is served on a different port, its tags, order and pins
don't carry over. The other browser-stored preferences already work this
way.
- Tabs pick up each other's changes when they save or load, not live.
### Tests
- Unit tests run the stores against the real `LocalBrowserStorage` over
an in-memory `localStorage`, so they cover the stored JSON and
source-generated serialization. They cover cross-tab merging, unreadable
and invalid values, retries with `FakeTimeProvider`, and the stale-load
race. The race test fails if the guard is removed.
- The shared `TestJSRuntime` gains an optional callback (replacing a
private copy). `TestLocalStorage` returns saved values like a browser,
and can simulate failed reads.
- Playwright tag tests seed `localStorage` with an init script instead
of using the server-side store.
- Ran: `Aspire.Dashboard.Tests` (2,618 passed),
`Aspire.Dashboard.Components.Tests` (1,269 passed), and the two affected
outerloop Playwright tests
(`TagHeader_SelectsTaggedResourcesAndChevronTogglesGroup`,
`ContextMenu_RepeatedTagRowsRestoreExactTriggerAndRespectLightDismissal`).
## Checklist
- Is this feature complete?
- [x] Yes. Ready to ship.
- [ ] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
- [x] 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
- [x] 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
- [x] No
---------
Co-authored-by: Sébastien Ros <1165805+sebastienros@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
(cherry picked from commit f457047)
…1881)
## Description
Renames the reserved trait used by `WithTags` from
`Aspire_Dashboard_Tag` to `Aspire_Tag`.
AppHost tags aren't dashboard-only. The CLI backchannel adds traits to
resource snapshots the same way the dashboard does, so `aspire describe
--format json` already includes them:
```json
"properties": {
"resource.trait.Aspire_Tag": ["frontend", "critical"]
}
```
With the old name, tools reading that output had to know a
dashboard-scoped name for something that isn't dashboard-specific, and
the method name (`WithTags`) and the trait name didn't match in scope.
### What changed
- `KnownResourceTraits.DashboardTag = "Aspire_Dashboard_Tag"` →
`KnownResourceTraits.Tag = "Aspire_Tag"`, with a comment explaining the
naming.
- The `Aspire_` prefix stays so the reserved name can't collide with
user traits added through `WithTrait` (a bare `tag` would pick up tag
validation and dashboard tag behavior).
- `Aspire_Dashboard_Position` / `WithDashboardPosition` are unchanged:
only the dashboard uses a position, so the name matches the scope.
- The `TraitAnnotation` validation message now says "Tags must…" instead
of "Dashboard tags must…".
- `docs/specs/dashboard-persistence.md` uses the new name, says that the
tags appear in `aspire describe`, and no longer says that user-added
tags live in the settings database (they're in browser local storage
since #21840).
- The resource string key `ResourceTraitDashboardTags` keeps its name.
Renaming it would mean editing the resx and Designer files and
regenerating the `.xlf` files, and users never see the key.
### Reviewer notes
- **No compatibility shim.** The trait was added in #21412 and isn't in
any release tag yet, so nothing shipped reads the old name.
### Validation
- `Aspire.Hosting.Tests` (`ResourceTraitBuilderTests`,
`DashboardServiceDataTerminalTests`): 16 passed.
- `Aspire.Dashboard.Tests` (`ResourceTagStoreTests`): 20 passed.
- `Aspire.Dashboard.Components.Tests` (`ResourcesLayoutTests`,
`ResourceDetailsTests`): 168 passed.
- `Aspire.Dashboard.Playwright.Tests` builds. Its tests weren't run
locally.
## Checklist
- Is this feature complete?
- [x] Yes. Ready to ship.
- [ ] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
- [x] Yes
- [ ] No
- Did you add public API?
- [ ] Yes
- [x] No
- Does the change make any security assumptions or guarantees?
- [ ] Yes
- [x] No
Co-authored-by: Sébastien Ros <1165805+sebastienros@users.noreply.github.com>
(cherry picked from commit 09f1aba)
… storage (#21840)
## Description
Moves the dashboard's application-level settings (resource tags,
resource and group order, and pinned metrics) out of the SQLite settings
database (`dashboard-settings.db`) and into browser `localStorage`, like
the dashboard's other preferences. These settings no longer live in the
data directory on disk, and aren't shared between browsers or users.
### What changed
- `DashboardSettingsDatabase` is removed, along with the now-unused
`DashboardRunStore.GetApplicationSettingsDirectory`.
- `ResourceTagStore`, `ResourceOrderStore` and `MetricPinStore` are now
scoped per circuit and keep their synchronous read API. Each loads once
from `localStorage` (`EnsureLoadedAsync`) under a key scoped to the
application name, built with the same `DashboardApplicationNameKey` as
the existing collapsed-resources key: `Aspire_Resources_Tags_<app>`,
`Aspire_Resources_Order_<app>` and `Aspire_Metrics_Pins_<app>`.
- A new `LocalStorageSetting<T>` owns each setting's in-memory value and
its saves:
- **Tabs don't overwrite each other.** Every tab has its own circuit but
shares `localStorage`. Changes are idempotent functions applied in
memory immediately and queued; each save re-reads the stored value,
replays the queued changes onto it, and adopts the result, so a tab also
picks up what other tabs saved.
- **Unreadable values are never silently replaced.** `StorageResult` now
tells transient read failures (`ReadFailed`: disconnected circuit, JS
errors, timeouts) apart from values that will never read
(`InvalidValue`: bad JSON, data protection mismatch, or a bug such as an
unregistered type). Transient failures block writes, and the save is
retried with backoff through `TimeProvider`. An invalid value is copied
once to `<key>_Unreadable` and then replaced, so saving keeps working.
- A load that read storage before a save completed doesn't replace the
newer saved value.
- Values are stored unprotected. Protected values are encrypted with the
dashboard's data protection key, which changes across Aspire versions
and on every run of the standalone dashboard, so they would be lost
regularly. These are names chosen by the user or reported by the app,
not secrets.
- Moves can no longer fail to save synchronously, so the "Unable to save
the resource/group order" messages and their resource strings are
removed (`.xlf` regenerated). `TryMove` and `TryMoveGroup` return
`false` when an item has no position, and the existing
reorder-unavailable toast is shown.
- `ResourcesLayout` starts loading tags and order early and waits for
them only before showing resources. `ResourceOverview` no longer waits
for pins.
### Reviewer notes
- **No migration.** Data in an existing `dashboard-settings.db` isn't
carried over. That file was added in #21412 and hasn't shipped in a
release.
- **Settings are tied to the browser origin, port included.** If an
app's dashboard is served on a different port, its tags, order and pins
don't carry over. The other browser-stored preferences already work this
way.
- Tabs pick up each other's changes when they save or load, not live.
### Tests
- Unit tests run the stores against the real `LocalBrowserStorage` over
an in-memory `localStorage`, so they cover the stored JSON and
source-generated serialization. They cover cross-tab merging, unreadable
and invalid values, retries with `FakeTimeProvider`, and the stale-load
race. The race test fails if the guard is removed.
- The shared `TestJSRuntime` gains an optional callback (replacing a
private copy). `TestLocalStorage` returns saved values like a browser,
and can simulate failed reads.
- Playwright tag tests seed `localStorage` with an init script instead
of using the server-side store.
- Ran: `Aspire.Dashboard.Tests` (2,618 passed),
`Aspire.Dashboard.Components.Tests` (1,269 passed), and the two affected
outerloop Playwright tests
(`TagHeader_SelectsTaggedResourcesAndChevronTogglesGroup`,
`ContextMenu_RepeatedTagRowsRestoreExactTriggerAndRespectLightDismissal`).
## Checklist
- Is this feature complete?
- [x] Yes. Ready to ship.
- [ ] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
- [x] 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
- [x] 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
- [x] No
---------
Co-authored-by: Sébastien Ros <1165805+sebastienros@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
(cherry picked from commit f457047)
…1881)
## Description
Renames the reserved trait used by `WithTags` from
`Aspire_Dashboard_Tag` to `Aspire_Tag`.
AppHost tags aren't dashboard-only. The CLI backchannel adds traits to
resource snapshots the same way the dashboard does, so `aspire describe
--format json` already includes them:
```json
"properties": {
"resource.trait.Aspire_Tag": ["frontend", "critical"]
}
```
With the old name, tools reading that output had to know a
dashboard-scoped name for something that isn't dashboard-specific, and
the method name (`WithTags`) and the trait name didn't match in scope.
### What changed
- `KnownResourceTraits.DashboardTag = "Aspire_Dashboard_Tag"` →
`KnownResourceTraits.Tag = "Aspire_Tag"`, with a comment explaining the
naming.
- The `Aspire_` prefix stays so the reserved name can't collide with
user traits added through `WithTrait` (a bare `tag` would pick up tag
validation and dashboard tag behavior).
- `Aspire_Dashboard_Position` / `WithDashboardPosition` are unchanged:
only the dashboard uses a position, so the name matches the scope.
- The `TraitAnnotation` validation message now says "Tags must…" instead
of "Dashboard tags must…".
- `docs/specs/dashboard-persistence.md` uses the new name, says that the
tags appear in `aspire describe`, and no longer says that user-added
tags live in the settings database (they're in browser local storage
since #21840).
- The resource string key `ResourceTraitDashboardTags` keeps its name.
Renaming it would mean editing the resx and Designer files and
regenerating the `.xlf` files, and users never see the key.
### Reviewer notes
- **No compatibility shim.** The trait was added in #21412 and isn't in
any release tag yet, so nothing shipped reads the old name.
### Validation
- `Aspire.Hosting.Tests` (`ResourceTraitBuilderTests`,
`DashboardServiceDataTerminalTests`): 16 passed.
- `Aspire.Dashboard.Tests` (`ResourceTagStoreTests`): 20 passed.
- `Aspire.Dashboard.Components.Tests` (`ResourcesLayoutTests`,
`ResourceDetailsTests`): 168 passed.
- `Aspire.Dashboard.Playwright.Tests` builds. Its tests weren't run
locally.
## Checklist
- Is this feature complete?
- [x] Yes. Ready to ship.
- [ ] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
- [x] Yes
- [ ] No
- Did you add public API?
- [ ] Yes
- [x] No
- Does the change make any security assumptions or guarantees?
- [ ] Yes
- [x] No
Co-authored-by: Sébastien Ros <1165805+sebastienros@users.noreply.github.com>
(cherry picked from commit 09f1aba)
Addresses the review feedback from #21412 (Modernize the dashboard
experience) that was deferred to the tracking issue #21421. Each item
was checked against the current code first. Item 17 was already fixed,
and every other item is addressed here. The design questions are
answered in a comment below.
Fixes#21421
| Items | Change |
|---|---|
| 1, 3, 6 | Replaces `WithDashboardPosition` with `WithDisplayOrder`,
backed by its own `DisplayOrderAnnotation` and transported as
`resource.displayOrder`. Like `ResourceUrlAnnotation.DisplayOrder`, it's
a relative sort key: higher values appear first and resources without
one count as 0. The API isn't in a release yet. Polyglot snapshots and
AppHosts are updated. |
| 2 | Keeps traits as resource properties, as decided in the review, and
corrects the comment that described them. |
| 4 | Moves tag validation out of the `TraitAnnotation` constructor into
`WithTrait`, which `WithTags` goes through. An `int` parameter covers
display order validation. |
| 5 | Replaces `unresolved_parameter_names` with a generic
`related_resource_names` on the notification message, keeping field
number 5. The dashboard offers to show the related resources in place of
the primary button, and the parameter form still accepts the
notification. |
| 7 | Restores the `CircularBuffer` removal checks under `#if DEBUG`,
for buffers up to 1,024 items, so large console log buffers don't bring
back the CPU cost. |
| 8, 20 | Recordings don't mount a live terminal. The missing-parameters
form is read-only for recordings and doesn't accept the live AppHost's
prompt. |
| 9 | `ParameterOverview` and `MissingParametersPanel` edit their own
copy of the shared command inputs. |
| 10 | Keeps generated input names when a prompt has a dynamically
loaded input, because callbacks can read `AllInputs` regardless of
`DependsOnInputs`. Names that aren't unique are still renamed, because
the prompt can't be shown otherwise, and every other input keeps its
name. Each prompt input also carries the parameter it is for
(`InteractionInput.related_resource_name`), and the parameter form
matches inputs by that field rather than by name. A generated name can
then match another, already resolved parameter without the form editing
the wrong input. |
| 11, 19 | The inline form forwards `UpdateStateOnChange`. Without an
active interaction, its file button runs the set-parameter command. |
| 12 | Sums delta counter observations per bucket. Repeated delta
numbers are no longer merged at ingestion, because that lost their
times, and the SQLite rollup now sums them by observation time instead
of keeping the largest, without overflowing. Delta numbers are selected
by their end, so one that arrives out of order isn't lost. Rollups and
chart totals stay finite without depending on the order of the values,
so a sum too large for a double no longer stops the chart from
rendering, and chart intervals compare times in nanoseconds like the
rollup query. Cloning metric values keeps their count, and delta counter
cards show the latest change. |
| 13 | Preserves negative levels. The main metrics chart shares this
calculation, so it's corrected too. |
| 14, 15 | A recording's activity window ends at its last request, or
its last error log if it has no requests, and has its own labels. In the
summary layout, the live window now refreshes every 30 seconds. |
| 16 | Scopes the overview's pending refresh flag to the selection, and
queues a refresh after console filter changes cancel one. Adds an
internal `TelemetryRefreshDelayAsync` seam so a test can hold a refresh
open. |
| 18 | Ctrl-click after "select all" no longer adds a resource kind
that's switched off. |
| 21, 22 | Display orders come from the requesting run rather than the
store, and moves use the displayed tie-break. |
| 23 | Localizes the trace back button. `main` has since localized the
activity and insights strings, so this PR only adds the
recording-specific ones. |
- `Aspire.Dashboard.Tests`: 2,655 passed
- `Aspire.Dashboard.Components.Tests`: 1,384 passed, after merging
`main`
- `Aspire.Hosting.Tests`, limited to the trait, parameter processor,
dashboard service and interaction service test classes: 257 passed
- Code generation tests for TypeScript, Python, Go, Java and Rust: 412
passed, before the last review fixes, which didn't change exported API
- `TestShop.AppHost` builds
The regression tests for items 14, 15 and 16 were checked by temporarily
undoing each fix and confirming they failed.
Not covered: the polyglot AppHosts were renamed but not run, and nothing
was checked in a browser.
- Is this feature complete?
- [x] Yes. Ready to ship.
- [ ] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
- [x] Yes
- [ ] No
- Did you add public API?
- [x] Yes
- If yes, did you have an API Review for it?
- [ ] Yes
- [x] No. Not needed for `WithDisplayOrder` and
`DisplayOrderAnnotation`, as decided in the review.
- Did you add `<remarks />` and `<code />` elements on your triple slash
comments?
- [ ] Yes
- [x] 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
- [x] No
---------
Co-authored-by: Sébastien Ros <1165805+sebastienros@users.noreply.github.com>
(cherry picked from commit 727eaa7)
Adapted for release/17.0, which doesn't have the dashboard changes this
built on in main (#21840, #21861, #21880, #21881, #21943):
- Tags keep release/17.0's Aspire_Dashboard_Tag name
(KnownResourceTraits.DashboardTag); the Aspire_Tag rename is #21881.
- ResourceOrderStore keeps its SQLite storage. The AppHost display order
semantics, GetPositions(resources) and TryMove(..., resources) are ported
onto it, and the store no longer keeps AppHost positions itself.
- ResourceOrderStoreTests: the four new display order tests run against the
SQLite store, with a new store instance standing in for a restart.
- Tests for code that isn't on release/17.0 aren't brought over
(ParameterFormReplacedAndPromptShownAgain, Standalone_RemovedTelemetrySource).
- Resources.Designer.cs and the Go TwoPassScanningGeneratedAspire snapshot
are regenerated against release/17.0.
Combines the stacked dashboard backports into one PR for `release/17.0`.
The commits are cherry-picked in stack order, one per source PR, onto
the current `release/17.0` tip:
1. #22125: Store dashboard tags,
resource order and metric pins in browser local storage (#21840)
2. #22126: Add dashboard
resource-selector dropdown (#21861)
3. #22127: Rename the WithTags
trait from Aspire_Dashboard_Tag to Aspire_Tag (#21881)
4. #22128: Restore single-line
compact rows in the dashboard resource list (#21880)
5. #22129: Allocate the next
dashboard run ID when two dashboards start in the same millisecond
(#21913)
6. #22130: Simplify the
dashboard around its two main jobs (#21943)
7. #22131: Return 400 for OTLP
JSON requests with malformed ids (#21436)
8. #22132: Address deferred
review feedback for the modern dashboard (#21766)
## Conflict resolution
The stack was cut from an older `release/17.0`. Since then, #22123
(Harden Go SDK runtime) landed and regenerated
`TwoPassScanningGeneratedAspire.verified.go`. That conflicted with
#21766, which replaces `WithDashboardPosition` with `WithDisplayOrder`.
The resolution drops `WithDashboardPosition` and regenerates the
snapshot with the current Go generator, so `WithDisplayOrder` now uses
the hardened `s.Err()` pattern. The other seven commits applied cleanly.
## Validation
All `Aspire.Hosting.CodeGeneration.*.Tests` projects pass locally (Go,
Java, Python, Rust, TypeScript).
---------
Co-authored-by: Sébastien Ros <1165805+sebastienros@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: James Newton-King <james@newtonking.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: David Fowler <davidfowl@gmail.com>
Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Co-authored-by: Maddy Montaquila <maddyleger1@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Maddy Montaquila <maddy@MadBook-Pro-20.local>
Co-authored-by: Taha Koçal <tahakocalgs@gmail.com>
Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Moves the dashboard's application-level settings (resource tags, resource and group order, and pinned metrics) out of the SQLite settings database (
dashboard-settings.db) and into browserlocalStorage, like the dashboard's other preferences. These settings no longer live in the data directory on disk, and aren't shared between browsers or users.What changed
DashboardSettingsDatabaseis removed, along with the now-unusedDashboardRunStore.GetApplicationSettingsDirectory.ResourceTagStore,ResourceOrderStoreandMetricPinStoreare now scoped per circuit and keep their synchronous read API. Each loads once fromlocalStorage(EnsureLoadedAsync) under a key scoped to the application name, built with the sameDashboardApplicationNameKeyas the existing collapsed-resources key:Aspire_Resources_Tags_<app>,Aspire_Resources_Order_<app>andAspire_Metrics_Pins_<app>.LocalStorageSetting<T>owns each setting's in-memory value and its saves:localStorage. Changes are idempotent functions applied in memory immediately and queued; each save re-reads the stored value, replays the queued changes onto it, and adopts the result, so a tab also picks up what other tabs saved.StorageResultnow tells transient read failures (ReadFailed: disconnected circuit, JS errors, timeouts) apart from values that will never read (InvalidValue: bad JSON, data protection mismatch, or a bug such as an unregistered type). Transient failures block writes, and the save is retried with backoff throughTimeProvider. An invalid value is copied once to<key>_Unreadableand then replaced, so saving keeps working..xlfregenerated).TryMoveandTryMoveGroupreturnfalsewhen an item has no position, and the existing reorder-unavailable toast is shown.ResourcesLayoutstarts loading tags and order early and waits for them only before showing resources.ResourceOverviewno longer waits for pins.Reviewer notes
dashboard-settings.dbisn't carried over. That file was added in Modernize the dashboard experience #21412 and hasn't shipped in a release.Tests
LocalBrowserStorageover an in-memorylocalStorage, so they cover the stored JSON and source-generated serialization. They cover cross-tab merging, unreadable and invalid values, retries withFakeTimeProvider, and the stale-load race. The race test fails if the guard is removed.TestJSRuntimegains an optional callback (replacing a private copy).TestLocalStoragereturns saved values like a browser, and can simulate failed reads.localStoragewith an init script instead of using the server-side store.Aspire.Dashboard.Tests(2,618 passed),Aspire.Dashboard.Components.Tests(1,269 passed), and the two affected outerloop Playwright tests (TagHeader_SelectsTaggedResourcesAndChevronTogglesGroup,ContextMenu_RepeatedTagRowsRestoreExactTriggerAndRespectLightDismissal).Checklist
<remarks />and<code />elements on your triple slash comments?