From ac4627b8f22c401dc4b827a238a5cea6c6482beb Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Wed, 11 Nov 2026 10:46:05 +0000 Subject: [PATCH] Take the race out of the chat seen-sync test The open chat acknowledged after 20 ms of real time, so on a loaded machine it could fire before the assertion that the other device still shows New. That failed the delivery gate of runs 304 and 318. --- .../features/chat/ui/sessions/chat_seen_sync_test.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/test/features/chat/ui/sessions/chat_seen_sync_test.dart b/app/test/features/chat/ui/sessions/chat_seen_sync_test.dart index 51258f9d..7956f6e9 100644 --- a/app/test/features/chat/ui/sessions/chat_seen_sync_test.dart +++ b/app/test/features/chat/ui/sessions/chat_seen_sync_test.dart @@ -25,7 +25,9 @@ class _Device { ChatRepository(client), localStore: local, nowMillis: () => clock(), - activeAckDelay: const Duration(milliseconds: 20), + // Long enough that a loaded machine finishes `settle()` before the + // open chat acknowledges: at 20 ms the gate lost this race under load. + activeAckDelay: const Duration(milliseconds: 400), ); } @@ -129,8 +131,8 @@ void main() { expect(phone.isNew('ses_a'), isTrue); expect(web.isNew('ses_a'), isFalse); - // The open chat acknowledges once its stream goes quiet (20 ms here). - for (var i = 0; i < 100 && server.state.chatSeen['ses_a'] != 7000; i++) { + // The open chat acknowledges once its stream goes quiet (400 ms here). + for (var i = 0; i < 300 && server.state.chatSeen['ses_a'] != 7000; i++) { await Future.delayed(const Duration(milliseconds: 20)); } await settle();