Files
pipelines/app/notes/chat-open-workspace-sync.md
T

35 lines
2.1 KiB
Markdown

# Server-authoritative open chat workspace
## Behaviour
The authenticated `/connect` protocol now stores one bounded ordered workspace
per server scope. Entries contain only operator session ids and a floating bit.
Opening, closing, reordering, docking and floating publish a full authoritative
snapshot; other connections receive `chat_open_workspace_changed`. The first
client may seed an empty server snapshot from its legacy local layout. Split
ratios, pane ids, window rectangles and other presentation geometry remain local.
The server drops closed, missing, unowned, or no-longer-live broker sessions
before saving. The store caps membership at 64 entries and rejects duplicates or
invalid ids. Protocol and application parsers apply the same bounds.
## Security and limits
Workspace writes use the existing authenticated websocket. The server requires
both an operator-session registry row and a live broker session, so pipeline-owned
or another user's ids cannot be retained. No credentials, transcripts, drafts,
tokens or geometry are persisted. The current scope is the authenticated local
server's single operator (`default`); multi-user identity is not yet modelled.
## Verification
* `go test ./internal/protocol -run 'Test.*Chat|Test.*Workspace'` — passed.
* `go test ./internal/pipeline -run 'TestChatOpenWorkspace'` — passed.
* `go test ./internal/server -run 'TestChat(Open|Close|NewSession)|TestEmbeddedSchedulesReadOnlyOverWebSocket|TestStorageWebsocketProtocolAndNoStartupCleanup|TestTemplatesDoNotSeedDatabaseAndCreateOnlyPreservesExisting'` — passed.
* `go build ./cmd/pipelines-server` — passed.
* `cd app && tool/memwatch/full.sh 'test/features/chat/workspace/chat_open_workspace_gateway_test.dart test/features/chat/workspace/chat_workspace_binding_test.dart'` — 7 passed, 0 failed, 0 skipped; peak 800 MB; exit 0.
* `cd app && tool/analyze.sh` — clean; 0 errors, 0 warnings, 2 infos before the brace cleanup; rerun after cleanup was not captured.
Not tested: a live two-client scratch websocket/broker check and rendered UI
captures. The shared server was not restarted or contacted.