Files
pipelines/app/notes/chat-workspace-persistence.md
T

24 lines
1.4 KiB
Markdown

# Local chat workspace persistence
`ChatWorkspaceSnapshot` encodes the split tree, stable pane IDs, chat session IDs,
axes, divider ratios, active pane, and sidebar mode. It contains no message bodies,
drafts, authentication, or server-side session operations. The SharedPreferences
store scopes its key by the supplied logical server storage identity; browser and
mobile preferences remain local to their installation.
The screen owns loading and saving. Capture `controller.revision` before an async
read and supply it as `expectedRevision` to `restoreLayout` so opening, splitting,
resizing, or activating chats during loading takes precedence over stored state.
Explicit initial routes can select their chat after a successful restore. Save
mutations and sidebar changes with debounce/serialized writes. A validated empty
snapshot records deliberate closure rather than resurrecting an older workspace.
Version 1 validates IDs, uniqueness, active membership, axes and finite ratios,
with a maximum 128 KiB representation, 127 nodes and depth 32. Invalid or unknown
versions return null; unknown ordinary fields remain compatible. The store also
returns null for unavailable/corrupt preferences and false for failed writes.
Session availability is a screen/provider concern: the codec preserves identities
without contacting or reopening sessions on the server.
Focused validation: `tool/memwatch/full.sh 'test/features/chat/workspace --no-pub'`.