Serialize open-chat sync writes by server revision and fan out prunes
Server: chat_open_workspace is a compare-and-swap on base_revision; a stale write is refused and answered with the current snapshot (rejected: true). Each stored change increments the revision; identical writes store nothing. A request with no body reads the set. Seeds apply only to a never-stored set. Validation uses the operator registry (recorded, not closed). chat_close and connection-time pruning store a new revision and push it to every connection; otherwise a new connection gets the current set to catch up. App: ChatOpenWorkspaceController keeps one write in flight, coalesces later changes, sends from the last replied revision and ignores lower revisions; pushes and rejected replies win over unsent changes. It starts after the local layout restores (seed or read), keeps a deep-linked chat, and is disposed on server/gateway rebind. Remote membership is applied by reconcileChatWorkspaceTree, keeping pane ids and split sizes. Federated lists keep their local layout. Tests: Go store/handler fan-out tests; app controller, reconcile and screen sync tests. Notes record a live two-client scratch check.
This commit is contained in:
+2
-10
@@ -214,11 +214,7 @@ func handleChat(ctx context.Context, request protocol.Message, broker chatBroker
|
||||
handleChatDirectories(ctx, request, registry, write)
|
||||
return true
|
||||
case protocol.ChatClose:
|
||||
var store chatOpenWorkspaceStore
|
||||
if candidate, ok := registry.(chatOpenWorkspaceStore); ok {
|
||||
store = candidate
|
||||
}
|
||||
handleChatClose(ctx, request, broker, hub, registry, store, write)
|
||||
handleChatClose(ctx, request, broker, hub, registry, write)
|
||||
return true
|
||||
case protocol.ChatReopen:
|
||||
handleChatReopen(ctx, request, registry, write)
|
||||
@@ -230,11 +226,7 @@ func handleChat(ctx context.Context, request protocol.Message, broker chatBroker
|
||||
handleChatColor(ctx, request, registry, hub.changes(), clientID, write)
|
||||
return true
|
||||
case protocol.ChatOpenWorkspace:
|
||||
var store chatOpenWorkspaceStore
|
||||
if candidate, ok := registry.(chatOpenWorkspaceStore); ok {
|
||||
store = candidate
|
||||
}
|
||||
handleChatOpenWorkspace(ctx, request, broker, registry, store, hub.changes(), clientID, write)
|
||||
handleChatOpenWorkspace(ctx, request, registry, hub.changes(), clientID, write)
|
||||
return true
|
||||
case protocol.ChatRename:
|
||||
handleChatRename(ctx, request, broker, registry, hub.changes(), clientID, write)
|
||||
|
||||
Reference in New Issue
Block a user