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:
2026-11-12 03:23:22 +00:00
parent f8e081825f
commit 4f8e99f316
20 changed files with 1333 additions and 276 deletions
+3 -9
View File
@@ -46,9 +46,7 @@ mixin _ChatScreenFloat on State<ChatScreen>, _ChatScreenWorkspace {
final pane = _workspace.detach(paneId);
if (pane == null) return;
widget.windows?.float(pane.sessionId);
if (!_applyingServerWorkspace) {
unawaited(_openWorkspace?.replace(_serverWorkspaceEntries()));
}
_syncOpenWorkspace();
// Floating the last tiled chat leaves the list, as closing it does.
if (_workspace.paneCount == 0) _back();
}
@@ -64,9 +62,7 @@ mixin _ChatScreenFloat on State<ChatScreen>, _ChatScreenWorkspace {
_floatPane(pane.id);
} else {
windows.float(id);
if (!_applyingServerWorkspace) {
unawaited(_openWorkspace?.replace(_serverWorkspaceEntries()));
}
_syncOpenWorkspace();
}
}
@@ -75,9 +71,7 @@ mixin _ChatScreenFloat on State<ChatScreen>, _ChatScreenWorkspace {
_workspaceVisible = true;
if (!_pageOpen && showsListBesideDetail(context)) _usedWorkspace = true;
_workspace.dock(sessionId);
if (!_applyingServerWorkspace) {
unawaited(_openWorkspace?.replace(_serverWorkspaceEntries()));
}
_syncOpenWorkspace();
_composerFocus.request(sessionId);
}