Dev.to
7/6/2026

The headline is about catching data races in Swift that agents silence with @unchecked Sendable. Let me craft a concise headline.
Original: The test that catches the race your agent silenced
Short summary
Agents can silence Swift data races with @unchecked Sendable, leaving builds green but races active. Catch them with a behavioral test: use DispatchQueue.concurrentPerform to force concurrent mutations and assert the outcome breaks under contention. This pins down silent races without ThreadSanitizer, though only for races you explicitly test.
- •@unchecked Sendable silences compiler warnings but doesn't fix races—normal tests won't catch them
- •Write adversarial tests using DispatchQueue.concurrentPerform to force concurrent access and assert on broken expectations
- •Pattern is limited to specific races you anticipate, but provides reliable detection without ThreadSanitizer tooling issues
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



