Label machine provenance and choose server before chat harness

This commit is contained in:
2026-11-08 16:46:23 +00:00
parent 3fbfb85ace
commit 4c57c50a0f
18 changed files with 466 additions and 21 deletions
@@ -1,3 +1,6 @@
import 'package:pipelines_app/application/app.dart';
import 'package:pipelines_app/application/app_router.dart';
import 'package:pipelines_app/application/app_route.dart';
import 'dart:convert';
import 'package:flutter/material.dart';
@@ -162,6 +165,31 @@ void main() {
oldClient.connect(Uri.parse(home.endpoints.first)),
throwsStateError,
);
// A create intent must survive the root replacing the app/socket.
final createSwitch = selected.servers!.requestNewChat('home');
await frames(tester);
expect(await createSwitch, isTrue);
final creating = tester.widget<PipelinesApp>(find.byType(PipelinesApp));
expect(creating.serverId, 'home');
final host = tester.widget<MyApp>(find.byType(MyApp));
final router = host.routerConfig!.routerDelegate as AppRouterDelegate;
expect(router.route.kind, AppRouteKind.chat);
// The new socket is connected; harness discovery belongs only to it.
expect(find.byKey(const Key('chat-create-confirm')), findsOneWidget);
expect(creating.servers!.newChatServerId, isNull);
final newRequests = channels.last.outgoing
.map((frame) => jsonDecode(frame as String))
.toList();
expect(
newRequests.where((frame) => frame['type'] == 'chat_create'),
isEmpty,
);
expect(
channels[1].outgoing
.map((frame) => jsonDecode(frame as String))
.where((frame) => frame['type'] == 'chat_backends'),
isEmpty,
);
await tester.pumpWidget(const SizedBox.shrink());
},
);