QA review of the previous hardening commit identified two cross-user
infection paths created by the smart-fallback read chain (CRIT-1/2),
plus a UI-desync hazard from validation guards in setters (HIGH-1).
- Extracted localStorage helpers and migration logic into
composables/preferenceStorage.ts as a single source of truth.
- Reads now hit only the active user's namespace - no anon / legacy
fallback in the hot path. Pre-existing values are migrated **once**
per active user via migratePreferencesIntoUser, which adopts anon
and legacy keys into the user namespace and then deletes the source
keys, so a second user logging into the same browser cannot inherit
the previous user's preferences.
- Migration latch tracks which user has already been migrated this
session; auth store's reloadUserPreferences resets the latch on
setUser/logout so the next active user gets a fresh migration.
- setSansFont / setMonoFont / setFontSize / setTheme now return a
boolean; GeneralSettings.vue handlers roll the form back to the
canonical state when validation rejects a value, preventing the
UI from drifting out of sync with the source of truth.
- safeSetItem now console.warn on persistence failures so quota /
private-mode issues are at least diagnosable.
- applyFont is diff-aware: only the CSS variables that actually
changed are written to the root style, avoiding unnecessary style
recalculation when only one knob is flipped.
- applyTheme caches the last effective mode to skip redundant
attribute writes and Wails IPC calls.
https://claude.ai/code/session_01S1FVPf4jRfWXkTSnpMmMp7