Repository navigation
Conversation
…nd tasks Refs #38880 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cms-models Adds the empty dot-storage barrel and its entry types, and moves DotPaletteViewMode, DotPaletteSortOption and the default sort (DEFAULT_PALETTE_SORT) to @dotcms/dotcms-models so the storage registry can reference them without depending on the editor. Pure move: the palette tests stay green. Tasks T001-T005 of #38880. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Unit and type tests for the entry checks and the preference builder, the registry's path assignment and the three UVE palette entries, and the core's envelope, key format, version and check handling and blocked storage. They fail because the builders, checks, core and registry don't exist yet. Tasks T006-T008 of #38880. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds the checks (asBoolean, asNumber, asString, oneOf, asArrayOf,
asRecordOf) and the preference builder; the core dotStorage get, set
and remove, which store values as { v, at, d } under
dotcms:<scope>:<path> and return the default for anything missing,
unreadable, of another version, rejected by the check or blocked; and
defineDotStorage with the three UVE palette entries in DOT_STORAGE.
Several defineDotStorage calls add to one shared index. Tasks
T011-T014 of #38880.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Identity tests for the core (unknown user reads defaults and keeps writes in memory only, switching users, clearing in-memory values on a context change, user id encoding) and for provideDotStorage (context from LoginService.auth at startup and auth$ later, the signed-in user rather than the Login As user, loginAs only when isLoginAs is true). They fail because the overlay and provideDotStorage don't exist yet. Tasks T015-T016 of #38880. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The storage context is now an Angular signal, set by provideDotStorage from LoginService: the current auth at startup, then every auth$ emission until the app is destroyed. The user id always comes from auth.user, never from the Login As user. Values that can't be saved (user not known yet, storage blocked or refusing the write) are kept in an in-memory overlay that get reads first; a change of user or Login As state clears it and bumps a revision signal for reactive readers. provideDotStorage is registered in dotcms-ui's providers. Tasks T019-T022 of #38880. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…S1 Red) Unit tests for injectStored and withStoredState, the favorites service on per-user dot-storage, the palette store and list reading view, sort and favorites from storage, the content-type picker providing no persistence token, and an e2e that the list view survives a reload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…reen) dot-storage re-reads on saves, removals and changes from other tabs. injectStored gives Angular code a writable signal on an entry, and withStoredState keeps top-level SignalStore fields in storage. The favorites service now stores per user through dotStorage. The UVE palette store keeps layoutMode, sort and favorites at the top level of its state, saved with withStoredState; the sort leaves searchParams and is sent with every request. The old localStorage keys and the DOT_PALETTE_PERSIST_PREFERENCES token are gone, so the Content Drive picker shares the user's saved sort and favorites. The e2e helper clicks the menu option by its text: PrimeNG names menu items by the raw i18n key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Red) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Green) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ms: raw key Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…US6 Green) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ontract text, no sort alias (Polish Red) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ntract text, no sort alias (Polish Green) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r helpers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When session storage is full, set removes handoff keys oldest first, after cache and history, and still never preference or contract keys (spec User Story 5 kinds table: a handoff is removed when storage is full). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…een) evictionCandidates lists handoff keys after history keys, oldest first, matching the spec's kinds table. The dotStorage and handoff JSDoc, the browser storage guide and data-model.md say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The per-kind matrix gets a full-storage case for history, cache, handoff and contract: set doesn't throw and get returns the value just set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The persistence section no longer shows hand-rolled storage reads and writes, which the new lint rule warns on. It declares a DOT_STORAGE entry, maps it with withStoredState and links the browser storage guide. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 tasks
Contributor
|
Claude finished @fmontes's task in 3m 45s —— View job PR Review — typed browser storage, adopted by the UVE palette
This is a clean, carefully built change. I traced the parts most likely to break and could not find a correctness, security, or convention bug introduced by the PR. Notes below are verification items, not defects. New Issues
Things I checked and found correct
No blocking issues. 🟢 |
…082) parseKey sits next to keyFor and is the only place that splits a dotcms: key into scope and path; evictionCandidates and the sweep's isDeclared use it. The sweep imports storageFor from the core instead of keeping a copy. One sweep test covers an empty scope, a scope with no path and an empty path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Closes #38880 · Spec-Kit PR 2 of 2: the implementation of the spec in #38881. This PR is based on that spec branch, so the diff shows only the code. When #38881 merges, GitHub retargets this PR to
main.In one paragraph
The admin UI now has one shared way to save small values in the browser:
DOT_STORAGEin@dotcms/data-access. Every saved value is declared once, with a type, a check and a kind. Values are kept per user and never throw because of what's in storage. The UVE palette is the first and only feature moved in this PR: its view, sort and favorites now go through it. Every other screen moves later, one PR each, by adding an entry. The shared code stays untouched.What changes for editors
DOT_PALETTE_PERSIST_PREFERENCESswitch is gone.How to try it
cd core-web && pnpm nx serve dotcms-ui(with dotCMS on:8080).dotcms:u=<userId>:uve.palette.layout.What's in the code
libs/data-access/src/lib/dot-storage/get/set/remove/take; five entry builders (preference,history,cache,handoff,contract); theDOT_STORAGEregistry; the startup sweep;injectStored()for components; andwithStoredState()for signal storesapps/dotcms-ui/src/app/providers.tsprovideDotStorage()sets the current user fromLoginServiceand runs the startup sweep onceDOT_STORAGE.uve.palette.*. The sort moves fromsearchParams(request state) to its ownsortfield (UI state)libs/dotcms-modelseslint.config.mjslocalStorage/sessionStorageuse in core-web, pointing toDOT_STORAGEdocs/frontend/BROWSER_STORAGE.mdSTATE_MANAGEMENT.mdnow showswithStoredStateHow dot-storage works
flowchart LR REG["DOT_STORAGE<br/>every entry declared once"] --> CORE STORE["withStoredState()<br/>signal stores"] --> SIG["injectStored()<br/>components"] SIG --> CORE["dotStorage<br/>get · set · remove · take"] BOOT["provideDotStorage()<br/>user context + startup sweep"] --> CORE CORE --> LS[("localStorage /<br/>sessionStorage")] CORE --> MEM[("in-memory values<br/>(this session only)")]There are four layers. Each one only talks to the layer below it.
1. Declare: entries and the registry (
dot-storage.entries.ts,dot-storage.registry.ts)preference,history,cache,handofforcontract) returns a frozen entry with these fields:localorsession);userorapp);(raw: unknown) => T | undefinedthat accepts or rejects what was read.DOT_STORAGE = defineDotStorage({ uve: { palette: { layout: preference(...) } } })gives each entry its path from where it sits in the tree, for exampleuve.palette.layout. It also adds the entry to apath → entryindex, which the sweep and the storage-full cleanup use.DOT_STORAGE.uve.palette.layout, never key strings. So the type of the value comes from the declaration.2. Core:
dotStorage(dot-storage.core.ts)Keys:
dotcms:app:<path>for shared entries, anddotcms:u=<encoded userId>:<path>for per-user ones. The stored value is wrapped as{ v: version, at: writeTime, d: data }. Contracts are the exception: they're stored under their fixed raw key, as plain text or JSON with no wrapper, because older code reads them.Read:
Write:
Context: a signal holding
{ userId, loginAs }. Any change of user or Login As state clears every in-memory value, so one person never sees another person's unsaved values.Reactivity: a
revisionsignal goes up on these events:setorremove;storageevent from another tab for adotcms:key, or a full clear.Everything built on top re-reads when it changes.
3. Angular adapters (
inject-stored.ts,with-stored-state.feature.ts)injectStored(entry)returns aWritableSignal<T>: alinkedSignalthat re-reads on everyrevisionchange. Itssetandupdatesave throughdotStorage, then show the value.withStoredState({ field: entry })is a signal-store feature.layoutMode,sortandfavorites, so the rest of the store keeps using plainpatchState.4. Bootstrap (
provide-dot-storage.ts,dot-storage.sweep.ts)provideDotStorage()runs as an app initializer indotcms-ui.LoginService.auth, read immediately, and then from eachauth$emission.auth.user.userId, which is the admin even during Login As.loginAsisauth.isLoginAs === true.sweepDotStorage()once. The sweep deletes everydotcms:key whose path isn't declared, or whose scope or storage doesn't match its entry. Keys without the prefix are never touched.setDotStorageContextitself (documented in the guide).Guardrail: the ESLint warning on direct
localStorage/sessionStorageuse keeps new code onDOT_STORAGE. These places are exempt:dot-storageitself;dotcms-js;Behavior worth a reviewer's eye
setmakes room: unreadable keys first, then cache, history and handoff keys, each oldest first. Preference and contract keys are never removed. If it's still full, the value lives in memory for the sessiondotcms:keys thatDOT_STORAGEno longer declaresDOT_STORAGEdefineDotStorage)Tests
Written first and confirmed failing before each story's code (TDD), one Red and one Green commit per story.
uve-palette-view-persists, "keep the palette list view after a reload @critical". It passes./speckit-convergeand docs-converge both report converged.Known, not caused by this PR
nx affected -t lintfails on four projects. Changing the root ESLint config marks every project as affected, and four of them already fail lint: dotcms-js, block-editor, dotcms-webcomponents and dotcms-scss. Their error counts are the same with the new rule turned off.🤖 Generated with Claude Code