App: open a chat with one round trip

The thread controller asks chat_subscribe to carry the newest history page
(history: true, limit 200) and applies it from the reply; a server that
leaves the page out is asked with chat_messages as before. Deltas arriving
before the reply are recorded from the start of the subscribe, and settle
against the page's live_seq exactly as for a separate read.

Also documents the subscribe history field and benchmarks the indexed page
at limits 20 and 100.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 15:09:02 +00:00
parent 686690f7b4
commit 608b6b8edb
7 changed files with 201 additions and 61 deletions
@@ -303,9 +303,9 @@ void main() {
final channel = FakeChannel()..readyCompleter.complete();
final client = PipelinesClient(
replaceSilentSocket: false,
channelFactory: (_) => channel,
);
replaceSilentSocket: false,
channelFactory: (_) => channel,
);
final provider = PlatformRouteInformationProvider(
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat/s1')),
);
@@ -331,6 +331,8 @@ void main() {
// The exact route names the session; the request carries the same id.
expect(requestOf(channel, 'chat_subscribe')!['chat_subscribe'], {
'session_id': 's1',
'history': true,
'limit': 200,
});
expect(requestOf(channel, 'chat_messages')!['chat_query'], {
'session_id': 's1',
@@ -461,6 +463,8 @@ void main() {
expect(requestOf(channel, 'chat_subscribe', index: 1)!['chat_subscribe'], {
'session_id': 'target',
'history': true,
'limit': 200,
});
expect(requestOf(channel, 'chat_messages', index: 1)!['chat_query'], {
'session_id': 'target',
@@ -499,9 +503,9 @@ void main() {
final channel = FakeChannel()..readyCompleter.complete();
final client = PipelinesClient(
replaceSilentSocket: false,
channelFactory: (_) => channel,
);
replaceSilentSocket: false,
channelFactory: (_) => channel,
);
final provider = PlatformRouteInformationProvider(
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat')),
);
@@ -712,9 +716,9 @@ void main() {
addTearDown(tester.view.reset);
final channel = FakeChannel()..readyCompleter.complete();
final client = PipelinesClient(
replaceSilentSocket: false,
channelFactory: (_) => channel,
);
replaceSilentSocket: false,
channelFactory: (_) => channel,
);
final provider = PlatformRouteInformationProvider(
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat')),
);
@@ -797,9 +801,9 @@ void main() {
addTearDown(tester.view.reset);
final channel = FakeChannel()..readyCompleter.complete();
final client = PipelinesClient(
replaceSilentSocket: false,
channelFactory: (_) => channel,
);
replaceSilentSocket: false,
channelFactory: (_) => channel,
);
final provider = PlatformRouteInformationProvider(
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat')),
);
@@ -855,9 +859,9 @@ void main() {
addTearDown(tester.view.reset);
final channel = FakeChannel()..readyCompleter.complete();
final client = PipelinesClient(
replaceSilentSocket: false,
channelFactory: (_) => channel,
);
replaceSilentSocket: false,
channelFactory: (_) => channel,
);
final provider = PlatformRouteInformationProvider(
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat')),
);