[ECO-5397] Temporarily add logging around all awaits in integration tests#452
Conversation
For investigating #295. Asked Claude to do this; the messages look fine at a glance but haven't looked at them in any detail.
WalkthroughAdds extensive timestamped logging throughout IntegrationTests via a new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes The changes are largely repetitive logging insertions following a consistent pattern. Review effort centers on verifying that Possibly related issues
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
awaits in integration testsawaits in integration tests
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
Tests/AblyChatTests/IntegrationTests.swift (1)
203-208: Consider adding loop boundary logging for for-await loops.The current logging comprehensively covers individual await points. However, the
for awaitloops don't have entry/exit logging. If a hang occurs within one of these loops, it might be harder to identify.Consider adding
Self.logAwait("ENTERING for-await loop ...")before andSelf.logAwait("EXITING for-await loop ...")after each loop to help pinpoint hangs within iteration logic, without logging every single iteration which could be too verbose.Example for the reaction summary events loop:
+ Self.logAwait("BEFORE for-await reactionSummaryEvents loop") for await event in rxMessageReactionsSubscription { reactionSummaryEvents.append(event) if reactionSummaryEvents.count == 4 { break } } + Self.logAwait("AFTER for-await reactionSummaryEvents loop")Also applies to: 256-261, 568-571, 578-581, 602-608
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
Tests/AblyChatTests/IntegrationTests.swift(22 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.swift
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.swift: Use protocol-based design; expose SDK functionality via protocols and prefer associated types with opaque return types (some Protocol) instead of existentials (any Protocol)
Isolate all mutable state to the main actor; mark stateful objects with @mainactor
Public API must use typed throws with ErrorInfo; use InternalError internally and convert at the public API boundary
For public structs emitted by the API, provide an explicit public memberwise initializer
When using AsyncSequence operators in @mainactor contexts, mark operator closures as @sendable
Task, CheckedContinuation, and AsyncThrowingStream do not support typed errors; use Result and call .get() to surface typed errors
Do not use Dictionary.mapValues for typed throws; use ablyChat_mapValuesWithTypedThrow instead
When the compiler struggles with typed throws, explicitly declare the error type on do blocks (e.g., do throws(InternalError))
Specify error types in closures using the throws(ErrorType) syntax (e.g., try items.map { jsonValue throws(InternalError) in ... })
Mark any test-only APIs with testsOnly_ prefix and wrap them in #if DEBUG
Files:
Tests/AblyChatTests/IntegrationTests.swift
Tests/AblyChatTests/**/*.swift
📄 CodeRabbit inference engine (CLAUDE.md)
Tests/AblyChatTests/**/*.swift: Use test attribution tags to reference spec coverage: @SPEC, @specOneOf(m/n), @specPartial, @specUntested, @specNotApplicable
For Swift Testing #expect(throws:) with typed errors, move typed-throw code into a separate non-typed-throw function until Xcode 16.3+
Files:
Tests/AblyChatTests/IntegrationTests.swift
Tests/AblyChatTests/**
📄 CodeRabbit inference engine (CLAUDE.md)
Place tests under Tests/AblyChatTests/ as the root for test targets
Files:
Tests/AblyChatTests/IntegrationTests.swift
🧬 Code graph analysis (1)
Tests/AblyChatTests/IntegrationTests.swift (4)
Tests/AblyChatTests/Helpers/Sandbox.swift (1)
createAPIKey(30-49)Sources/AblyChat/Room.swift (6)
onStatusChange(155-169)onStatusChange(172-174)onStatusChange(395-398)attach(377-379)detach(382-384)release(386-391)Sources/AblyChat/DefaultMessages.swift (3)
send(122-124)subscribe(37-115)get(135-137)Sources/AblyChat/Rooms.swift (3)
get(60-63)get(164-269)release(319-357)
🔇 Additional comments (2)
Tests/AblyChatTests/IntegrationTests.swift (2)
1-9: Well-documented temporary debugging approach.The maintainer note clearly explains the purpose and scope of the logging instrumentation, which will help future contributors understand why this extensive logging exists and maintain consistency during the investigation period.
25-29: Effective helper for debugging async hangs.The
logAwaithelper provides good context with timestamps and source location information. Using Unix timestamp format is practical for calculating durations between log entries when analyzing hang behavior.
Note: This PR is based on top of #451.
For investigating #295. Asked Claude to do this; the messages look fine at a glance but haven't looked at them in any detail.
Summary by CodeRabbit