Repository navigation
[release/17.0] Store dashboard tags, resource order and metric pins in browser local storage - #22004
Closed
Mitch Denny (mitchdenny) wants to merge 1 commit into
Conversation
… 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)
14 tasks
This comment has been minimized.
This comment has been minimized.
Mitch Denny (mitchdenny)
marked this pull request as ready for review
November 10, 2026 04:24
Mitch Denny (mitchdenny)
requested review from
James Newton-King (JamesNK),
Eric Erhardt (eerhardt) and
Ankit Jain (radical)
as code owners
November 10, 2026 04:24
Member
Author
|
Approved for inclusion in release/17.0. Do not merge yet. |
Mitch Denny (mitchdenny)
requested a review
from Adam Ratzman (adamint)
as a code owner
November 10, 2026 04:24
Mitch Denny (mitchdenny)
force-pushed
the
mitchdenny-backport-17-0-07-pr21840
branch
from
November 10, 2026 05:27
bf1d57c to
8500ab3
Compare
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 22004Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 22004" |
This comment has been minimized.
This comment has been minimized.
Mitch Denny (mitchdenny)
force-pushed
the
mitchdenny-backport-17-0-07-pr21840
branch
2 times, most recently
from
November 10, 2026 07:11
bf1d57c to
8500ab3
Compare
Contributor
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Mitch Denny (mitchdenny)
changed the base branch from
mitchdenny-backport-17-0-06-pr21850
to
mitchdenny-backport-17-0-05-pr21823
November 10, 2026 08:18
Mitch Denny (mitchdenny)
force-pushed
the
mitchdenny-backport-17-0-07-pr21840
branch
from
November 10, 2026 09:18
8500ab3 to
bf1d57c
Compare
Mitch Denny (mitchdenny)
changed the base branch from
mitchdenny-backport-17-0-05-pr21823
to
mitchdenny-backport-17-0-06-pr21850
November 10, 2026 10:44
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Backport of #21840 to
release/17.0(cherry-picked from f457047 with no modifications). Layer 7 of 55 in the release/17.0 backport stack; stacked on #22003.Backport recommendation: Yes — Dashboard settings DB is new in 17.0; moving later would drop user settings. Needed before #21881.
Backport of #21840
Checklist
<remarks />and<code />elements on your triple slash comments?