mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-24 23:45:18 +00:00
Replace timing-based sleep() synchronization with continuation-based waiting in FragmentationTests to fix intermittent failures. Changes: - Add thread-safe CaptureDelegate with NSLock for array access - Add waitForPublicMessages/waitForReceivedMessages using CheckedContinuation - Update reassemblyFromFragmentsDeliversPublicMessage to use proper waiting - Update duplicateFragmentDoesNotBreakReassembly to use proper waiting - Remove fire-and-forget Task blocks that caused race conditions Root cause: Tests used fire-and-forget Tasks with sleep(0.5) but delegate callbacks go through notifyUI() which spawns another MainActor Task. The sleep didn't guarantee callback completion. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>