-
Notifications
You must be signed in to change notification settings - Fork 2
[AIT-254] Buffer operations whilst SYNCING per updated RTO8a
#109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe changes refactor the buffer-during-sync logic to accumulate OBJECT messages from the moment SYNCING state is entered, rather than only after the first OBJECT_SYNC message. A new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
347eed5 to
8396428
Compare
maratal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wasn't very deep review, but lgtm, would suggest @umair-ably also take a look.
45b2252 to
c4bf274
Compare
Grab the buffered ops from the SYNCING associated data, dedupe creation of syncObjectsPoolEntries, and handle changed sync sequence upfront.
Implement the behaviour described in the RTO8a modification made in spec commit 1956e2f. That is, buffer messages received from the point at which we become ATTACHED, not just whilst we're receiving a multi-OBJECT_SYNC sync sequence. Note that currently, these messages will incorrectly get dropped upon receipt of the sync sequence; this is a bug in all implementations and will be addressed in [1]. [1] https://ably.atlassian.net/browse/AIT-287
8396428 to
6a34938
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@Sources/AblyLiveObjects/Internal/InternalDefaultRealtimeObjects.swift`:
- Around line 544-564: The code currently clears
syncingData.bufferedObjectOperations whenever a "new" sync sequence is detected
in the .syncing(state) branch, which drops ops buffered between ATTACHED and the
first OBJECT_SYNC; change the logic in the .syncing(syncingData) handling so
buffering is only discarded when an existing syncSequence is being replaced
(i.e., syncingData.syncSequence != nil && syncingData.syncSequence?.id !=
syncCursor?.sequenceID), otherwise preserve bufferedObjectOperations when
starting the first sequence (syncingData.syncSequence == nil) and only set
syncingData.syncSequence = nil when actually replacing an existing sequence.
- Around line 458-470: The new Syncing type and its stored properties lack
explicit access control; update the declaration for class Syncing and its
members (bufferedObjectOperations, syncSequence, and init) to include explicit
access levels (e.g., internal or private as per project conventions) so they
satisfy SwiftLint explicit_acl — add the chosen access modifier to the class
declaration, both var declarations, and the initializer signature (for example:
internal class Syncing { internal var bufferedObjectOperations: ...; internal
var syncSequence: ...; internal init(...) { ... } }).
📜 Review details
Configuration used: Repository 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)
Sources/AblyLiveObjects/Internal/InternalDefaultRealtimeObjects.swift
🧰 Additional context used
📓 Path-based instructions (3)
**/*.swift
📄 CodeRabbit inference engine (.cursor/rules/swift.mdc)
**/*.swift: Specify an explicit access control level (SwiftLint explicit_acl) for all declarations in Swift code (tests are exempt)
When extending a type, put the access level on the extension declaration rather than on each member (tests are exempt)
Prefer implicit .init(...) when the type can be inferred in initializer expressions
Prefer enum case shorthand (.caseName) when the type can be inferred
For JSONValue or WireValue, prefer using literal syntax via ExpressibleBy*Literal where possible
Prefer Swift raw string literals for JSON strings instead of escaping double quotes
When an array literal begins with an initializer expression, place the initializer on the line after the opening bracket
Files:
Sources/AblyLiveObjects/Internal/InternalDefaultRealtimeObjects.swift
Sources/AblyLiveObjects/**/*.swift
📄 CodeRabbit inference engine (.cursor/rules/swift.mdc)
In AblyLiveObjects library (non-test) code, import modules as: Ably with
import Ably, and _AblyPluginSupportPrivate withinternal import _AblyPluginSupportPrivate
Files:
Sources/AblyLiveObjects/Internal/InternalDefaultRealtimeObjects.swift
Sources/**/*.swift
📄 CodeRabbit inference engine (.cursor/rules/testing.mdc)
For
testsOnly_property declarations, do not add generic explanatory comments (their meaning is understood)
Files:
Sources/AblyLiveObjects/Internal/InternalDefaultRealtimeObjects.swift
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: Xcode,
releaseconfiguration, macOS (Xcode 16.4) - GitHub Check: Xcode,
releaseconfiguration, tvOS (Xcode 16.4) - GitHub Check: Xcode, iOS (Xcode 16.4)
- GitHub Check: Xcode,
releaseconfiguration, iOS (Xcode 16.4) - GitHub Check: Example app, macOS (Xcode 16.4)
- GitHub Check: Xcode, macOS (Xcode 16.4)
- GitHub Check: Xcode, tvOS (Xcode 16.4)
- GitHub Check: Example app, iOS (Xcode 16.4)
- GitHub Check: Example app, tvOS (Xcode 16.4)
- GitHub Check: SPM (Xcode 16.4)
- GitHub Check: SPM,
releaseconfiguration (Xcode 16.4) - GitHub Check: Generate code coverage
🔇 Additional comments (3)
Sources/AblyLiveObjects/Internal/InternalDefaultRealtimeObjects.swift (3)
510-514: LGTM: SYNCING now initializes with an empty buffer.
567-636: Good: apply buffered ops after sync completion before transitioning to SYNCED.
652-657: LGTM: buffer OBJECT messages while SYNCING.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
Implement the behaviour described in the RTO8a modification made in ably/specification@1956e2f. That is, buffer messages received from the point at which we become
ATTACHED, not just whilst we're receiving a multi-OBJECT_SYNCsync sequence.Note that currently, these messages will incorrectly get dropped upon receipt of the sync sequence; this is a bug in all implementations and will be addressed in https://ably.atlassian.net/browse/AIT-287.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.