Open machine-scoped chats from Search

With several machines connected a chat id is chat@<base64url>; routes
rejected the @, so a search hit fell back to /chat and closed the chat.
Accept a valid machine-scoped id in chat routes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 08:40:42 +00:00
parent 93e9042a8b
commit 79e5183469
2 changed files with 33 additions and 5 deletions
+12
View File
@@ -1,5 +1,6 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/application/app_route.dart';
import 'package:pipelines_app/core/servers/chat/chat_identity.dart';
void main() {
test('parses each destination, detail and stage pane', () {
@@ -170,6 +171,9 @@ void main() {
'/chat/a/b',
'/chat/%2F',
'/chat/${'x' * 201}',
'/chat/chat@',
'/chat/chat@not-base64',
'/chat/${federatedChatId('mac', 'bad id')}',
'/unknown',
'/runs/%E0%A4%A',
]) {
@@ -194,6 +198,7 @@ void main() {
AppRoute.run.stage(3, 'build', visit: 4),
AppRoute.chat,
AppRoute.chatSession('probe_open-1'),
AppRoute.chatSession(federatedChatId('mac', 'ses_abc-1')),
AppRoute.search,
AppRoute.settings,
AppRoute.templates,
@@ -207,6 +212,13 @@ void main() {
expect(AppRoute.run(3).path, '/runs/3');
expect(AppRoute.chatSession('probe_open-1').path, '/chat/probe_open-1');
expect(AppRoute.chatSession('bad id').path, '/chat');
// A machine-scoped id (several machines connected) keeps its session.
final scoped = federatedChatId('mac', 'ses_abc-1');
expect(AppRoute.chatSession(scoped).chatSessionId, scoped);
expect(
AppRoute.parse(AppRoute.chatSession(scoped).path).chatSessionId,
scoped,
);
expect(AppRoute.templates.path, '/templates');
});