[AIT-287] Implement new rules for discarding ops buffered during sync#121
[AIT-287] Implement new rules for discarding ops buffered during sync#121lawrence-forooghian wants to merge 2 commits intoAIT-324-apply-on-ACKfrom
Conversation
Port of ably-js commit b329fd2. Verifies that when an ATTACHED message is received without the HAS_OBJECTS flag, the SDK clears all local LiveObjects state (root map should have no keys). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
WalkthroughThe changes refine buffer management for OBJECT operations during Live Objects synchronization and channel attachment. The internal logic now preserves buffered operations when continuing existing sync sequences while clearing them appropriately during new syncs and channel attachment. Test coverage is expanded to validate this behavior across various flag combinations. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
07ffcf9 to
047959f
Compare
Implements spec commit 997584f. Integration tests ported from ably-js commit 9b2224d. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
047959f to
65dda76
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
Sources/AblyLiveObjects/Internal/InternalDefaultRealtimeObjects.swift (1)
87-87: Remove the generic comment on thetestsOnly_property.Line 87 adds a generic explanatory comment for a
testsOnly_declaration; repo guidance asks to omit these inSources/**/*.swift.✂️ Suggested cleanup
- /// Returns the number of buffered object operations if in the SYNCING state, or nil otherwise. internal var testsOnly_bufferedObjectOperationsCount: Int? {As per coding guidelines,
Sources/**/*.swift: “FortestsOnly_property declarations, do not add generic explanatory comments (their meaning is understood)”.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Sources/AblyLiveObjects/Internal/InternalDefaultRealtimeObjects.swift` at line 87, Remove the generic explanatory comment added for the testsOnly_ property; locate the testsOnly_ declaration in InternalDefaultRealtimeObjects (the testsOnly_ property in InternalDefaultRealtimeObjects.swift) and delete the comment above it so the property has no generic explanatory comment per Sources/**/*.swift guidelines.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Tests/AblyLiveObjectsTests/JS` Integration
Tests/ObjectsIntegrationTests.swift:
- Around line 607-622: This test case is missing the required spec-point
attribution comment; add an exact-format comment (either // `@spec`(<section
reference>) or // `@specPartial`(<section reference>)) immediately above the
.init( ... ) test declaration that references the relevant spec point governing
ATTACHED without HAS_OBJECTS behavior, choosing `@spec` vs `@specPartial` per the
guideline and avoid duplicating the same `@spec` tag elsewhere for the same spec
point; ensure the comment is placed in the same test block that contains the
action closure (the anonymous .init with description "on ATTACHED without
HAS_OBJECTS clears local state") so tools can associate it with that test.
---
Nitpick comments:
In `@Sources/AblyLiveObjects/Internal/InternalDefaultRealtimeObjects.swift`:
- Line 87: Remove the generic explanatory comment added for the testsOnly_
property; locate the testsOnly_ declaration in InternalDefaultRealtimeObjects
(the testsOnly_ property in InternalDefaultRealtimeObjects.swift) and delete the
comment above it so the property has no generic explanatory comment per
Sources/**/*.swift guidelines.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6f3ee39a-112d-4dbd-b002-94cd53865bdc
📒 Files selected for processing (3)
Sources/AblyLiveObjects/Internal/InternalDefaultRealtimeObjects.swiftTests/AblyLiveObjectsTests/InternalDefaultRealtimeObjectsTests.swiftTests/AblyLiveObjectsTests/JS Integration Tests/ObjectsIntegrationTests.swift
Note: This PR is based on top of #118; please review that one first.
Implements ably/specification@997584f. Integration tests ported from ably/ably-js@9b2224d.
Summary by CodeRabbit
Tests
Refactor