From b6035a846122206756d05c6ca1f607fe7424406b Mon Sep 17 00:00:00 2001 From: grunch Date: Mon, 31 Aug 2026 19:39:55 -0300 Subject: [PATCH] test: wait on the observable condition in the duplicate-envelope race pin The pin was added while envelope unwrapping was synchronous; since the per-message crypto moved into Isolate.run, pumpEventQueue cannot observe the cross-isolate port reply and the assertion ran before the valid envelope finished verifying. The two isolate PRs crossed in flight (the worker-isolate branch was stacked on the conversation-key branch, which predated this test), so CI never ran this combination. Bounded 5 s condition wait, same pattern as dispute_chat_reload_test. The product behaviour is correct: the forged copy fails verification and the valid copy is processed on its own. --- .../dispute_chat_duplicate_envelope_test.dart | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/features/disputes/dispute_chat_duplicate_envelope_test.dart b/test/features/disputes/dispute_chat_duplicate_envelope_test.dart index 230b9708..8cbd4a7c 100644 --- a/test/features/disputes/dispute_chat_duplicate_envelope_test.dart +++ b/test/features/disputes/dispute_chat_duplicate_envelope_test.dart @@ -174,7 +174,17 @@ void main() { nostrService.controller.add(forged); nostrService.controller.add(real); - await pumpEventQueue(times: 200); + // Unwrapping runs through Isolate.run: wait on the observable condition + // (bounded) instead of a microtask pump count, which cannot see cross- + // isolate port replies. + final deadline = DateTime.now().add(const Duration(seconds: 5)); + while (container + .read(disputeChatNotifierProvider(disputeId)) + .messages + .isEmpty && + DateTime.now().isBefore(deadline)) { + await Future.delayed(const Duration(milliseconds: 20)); + } final messages = container.read(disputeChatNotifierProvider(disputeId)).messages;