Conversation
WalkthroughConverted presence subscription closures to capture weak self, removed try/catch handling, and made processPresenceSubscribe non-throwing. Updated single- and multi-event subscription paths accordingly. No changes to public APIs or other presence behaviors. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant AblySDK as Ably SDK
participant DefaultPresence
participant Callback
Client->>AblySDK: subscribe(presence events)
AblySDK-->>DefaultPresence: PresenceMessage(event)
DefaultPresence->>DefaultPresence: processPresenceSubscribe(message, event) // non-throwing
DefaultPresence-->>Callback: callback(PresenceEvent)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes[No out-of-scope functional changes detected.] Possibly related issues
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
054b5d2 to
956f65c
Compare
5309241 to
d777a43
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
Sources/AblyChat/DefaultPresence.swift(3 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: maratal
PR: ably/ably-chat-swift#286
File: Sources/AblyChat/DefaultTyping.swift:131-138
Timestamp: 2025-05-12T21:04:36.263Z
Learning: In the AblyChat Swift codebase, SubscriptionHandle closures should capture self weakly with `[weak self]` to avoid potential retain cycles, particularly when calling channel.unsubscribe() within the closure.
Learnt from: maratal
PR: ably/ably-chat-swift#286
File: Sources/AblyChat/RoomLifecycleManager.swift:611-624
Timestamp: 2025-05-22T20:57:48.147Z
Learning: In AblyChat Swift, when using continuations with subscription callbacks, the continuation object is captured directly by the closure and doesn't depend on `self`. Even with `[weak self]` capture, the continuation will still be resumed properly.
📚 Learning: 2025-05-12T21:04:36.263Z
Learnt from: maratal
PR: ably/ably-chat-swift#286
File: Sources/AblyChat/DefaultTyping.swift:131-138
Timestamp: 2025-05-12T21:04:36.263Z
Learning: In the AblyChat Swift codebase, SubscriptionHandle closures should capture self weakly with `[weak self]` to avoid potential retain cycles, particularly when calling channel.unsubscribe() within the closure.
Applied to files:
Sources/AblyChat/DefaultPresence.swift
📚 Learning: 2025-05-22T20:57:48.147Z
Learnt from: maratal
PR: ably/ably-chat-swift#286
File: Sources/AblyChat/RoomLifecycleManager.swift:611-624
Timestamp: 2025-05-22T20:57:48.147Z
Learning: In AblyChat Swift, when using continuations with subscription callbacks, the continuation object is captured directly by the closure and doesn't depend on `self`. Even with `[weak self]` capture, the continuation will still be resumed properly.
Applied to files:
Sources/AblyChat/DefaultPresence.swift
📚 Learning: 2025-05-23T16:29:39.712Z
Learnt from: maratal
PR: ably/ably-chat-swift#262
File: Tests/AblyChatTests/DefaultRoomReactionsTests.swift:0-0
Timestamp: 2025-05-23T16:29:39.712Z
Learning: In the ably-chat-swift project, MockRealtimeChannel processes messages synchronously when subscribe is called, immediately delivering the configured messages to the callback.
Applied to files:
Sources/AblyChat/DefaultPresence.swift
📚 Learning: 2025-05-12T21:11:08.937Z
Learnt from: maratal
PR: ably/ably-chat-swift#286
File: Example/AblyChatExample/ContentView.swift:203-209
Timestamp: 2025-05-12T21:11:08.937Z
Learning: In the AblyChat Swift codebase, SubscriptionHandle doesn't need to be retained/stored to keep subscriptions active. The subscription callbacks continue to work even when the handle is not stored, as the underlying services maintain their own storage of callbacks that remain registered until explicitly unsubscribed via the handle's unsubscribe() method.
Applied to files:
Sources/AblyChat/DefaultPresence.swift
🧬 Code Graph Analysis (1)
Sources/AblyChat/DefaultPresence.swift (2)
Sources/AblyChat/Presence.swift (5)
subscribe(137-151)subscribe(164-178)subscribe(181-183)subscribe(186-188)toARTPresenceAction(244-255)Sources/AblyChat/DefaultOccupancy.swift (1)
subscribe(20-58)
🔇 Additional comments (1)
Sources/AblyChat/DefaultPresence.swift (1)
264-279: Non-throwing processing helper aligns with PR objective.
processPresenceSubscribeis now non-throwing and returns aPresenceEventdirectly. This matches the goal of removing throwing behavior from the subscription path. Implementation is straightforward and logs appropriately.
Closes #344
Summary by CodeRabbit
Bug Fixes
Refactor