Fix test interference from shared notification IDs#524
Conversation
Test fixtures in IncomingMessageWriterExplodeTests and ExpiredConversationsWorkerTests both used the hardcoded conversation ID "test-conversation-id". When Swift Testing runs suites in parallel, a .conversationExpired notification posted by one suite's test could be captured by another suite's NotificationCapture, causing testPastDatePostsExpiredNotification to see count == 2 instead of 1. Fix: use unique UUIDs for conversation IDs in test fixtures and filter captured notifications by conversationId.
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Claude finished @yewreeka's task —— View job Code ReviewSummaryThis PR effectively fixes test interference from shared notification IDs. The changes are minimal, targeted, and correctly address the root cause of parallel test failures. ✅ Code Quality & CorrectnessStrong Points:
File: ExpiredConversationsWorkerTests.swift:173 let conversationId: String = "expired-worker-test-\(UUID().uuidString)"This change ensures each test suite instance has a unique conversation ID. File: IncomingMessageWriterExplodeTests.swift:269 let conversationId: String = "explode-test-\(UUID().uuidString)"Same pattern applied consistently. 🔍 Analysis of Notification FilteringThe fix includes proper filtering in all tests that capture notifications. Key examples: ExpiredConversationsWorkerTests.swift:233-236 let matching = capture.notifications(named: .conversationExpired).filter {
$0.userInfo?["conversationId"] as? String == fixtures.conversationId
}
#expect(matching.count == 1)This ensures the test only counts notifications matching its own conversation ID, preventing cross-contamination from other parallel suites. 🎯 Best PracticesFollows Project Conventions:
🧪 Test CoverageExcellent coverage of the interference scenario:
⚡ Performance ConsiderationsNegligible impact:
🔒 Security ConcernsNone identified:
💡 Potential ImprovementsMinor suggestions (not blockers):
✅ Final VerdictLGTM - Approved ✅ This is a clean, well-reasoned fix that:
The fix is production-ready and can be merged. |

Test fixtures in IncomingMessageWriterExplodeTests and
ExpiredConversationsWorkerTests both used the hardcoded conversation ID
"test-conversation-id". When Swift Testing runs suites in parallel,
a .conversationExpired notification posted by one suite's test could be
captured by another suite's NotificationCapture, causing
testPastDatePostsExpiredNotification to see count == 2 instead of 1.
Fix: use unique UUIDs for conversation IDs in test fixtures and filter
captured notifications by conversationId.
Note
Use per-instance UUID-prefixed
conversationIdinExpiredWorkerTestFixturesandExplodeTestFixturesto fix test interference from shared notification IDsTests generate unique
conversationIdvalues via UUID and update.conversationExpirednotification assertions to filter by matchingconversationIdand expect a count of 1.📍Where to Start
Start with the notification filtering assertion in
IncomingMessageWriterExplodeTests.testFromCreatorSchedulesExplosionin IncomingMessageWriterExplodeTests.swift, then review fixtureconversationIdgeneration in ExpiredConversationsWorkerTests.swift.Macroscope summarized 3428af8.