Conversation
WalkthroughImplements apply-on-ACK semantics for LiveObjects operations. Operations published via Changes
Sequence Diagram(s)sequenceDiagram
actor Client
participant LO as RealtimeObject
participant RC as Realtime Channel
participant Server as Ably Server
Client->>LO: publishAndApply(messages)
LO->>RC: publish(messages)
RC->>Server: Send OBJECT messages
par Local Application
LO->>LO: Buffer messages in _bufferedAcks
and Server Processing
Server->>RC: ACK received
end
RC->>LO: onAck callback triggered
LO->>LO: Apply buffered messages locally<br/>(source: ObjectsOperationSource.local)
LO->>LO: Update _appliedOnAckSerials
LO->>Client: Promise resolves
Note over LO,Server: When channel OBJECT messages arrive later,<br/>serials in _appliedOnAckSerials are skipped<br/>to prevent duplicate application
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.40.5)test/realtime/liveobjects.test.jsThanks 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 |
1361dea to
32c6075
Compare
a4bed5f to
37bd08d
Compare
37bd08d to
1c5e13e
Compare
1c5e13e to
a5d3751
Compare
d8d2419 to
905c895
Compare
This reflects the functionality implemented in [1], based on the DR [2] and spec [3]. Written by Claude. [1] ably/ably-js#2155 [2] https://ably.atlassian.net/wiki/spaces/LOB/pages/4671832082/LODR-054+SDK+apply+operations+on+ACK) [3] ably/specification#419
905c895 to
52b6521
Compare
This reflects the functionality implemented in [1], based on the DR [2] and spec [3]. Written by Claude. [1] ably/ably-js#2155 [2] https://ably.atlassian.net/wiki/spaces/LOB/pages/4671832082/LODR-054+SDK+apply+operations+on+ACK) [3] ably/specification#419
1f52161 to
a36fb2a
Compare
This informs the compiler that the function throws.
Based on [1] at d809334. Implementation and tests are Claude-generated from the spec; I've reviewed them and given plenty of feedback, but largely resisted the temptation to tweak things that aren't quite how I'd write them but which are still correct. The only behaviour here that's not in the spec is to also apply-on-ACK for batch operations (the batch API isn't in the spec yet). Summary of decisions re modifications to existing tests (written by Claude): - Removed redundant `waitFor*` calls after SDK operations (`map.set()`, `counter.increment()`, etc.) - with apply-on-ACK, values are available immediately after the operation promise resolves - Kept `waitFor*` calls after REST operations (`objectsHelper.operationRequest()`, `objectsHelper.createAndSetOnMap()`) - these still require waiting for the echo to arrive over Realtime - Added explanatory comment to `applyOperationsScenarios` noting that those tests cover operations received over Realtime (via REST), and pointing to the new "Apply on ACK" section for tests of locally-applied operations [1] ably/specification#419
a36fb2a to
28b6371
Compare
This reflects the functionality implemented in [1], based on the DR [2] and spec [3]. Written by Claude. [1] ably/ably-js#2155 [2] https://ably.atlassian.net/wiki/spaces/LOB/pages/4671832082/LODR-054+SDK+apply+operations+on+ACK) [3] ably/specification#419
Based on ably/specification#419 at
d809334. Implementation and tests are Claude-generated from the spec; I've reviewed them and given plenty of feedback, but largely resisted the temptation to tweak things that aren't quite how I'd write them but which are still correct.The only behaviour here that's not in the spec is to also apply-on-ACK for batch operations (the batch API isn't in the spec yet).
Summary of decisions re modifications to existing tests (written by Claude):
waitFor*calls after SDK operations (map.set(),counter.increment(), etc.) - with apply-on-ACK, values are available immediately after the operation promise resolveswaitFor*calls after REST operations (objectsHelper.operationRequest(),objectsHelper.createAndSetOnMap()) - these still require waiting for the echo to arrive over RealtimeapplyOperationsScenariosnoting that those tests cover operations received over Realtime (via REST), and pointing to the new "Apply on ACK" section for tests of locally-applied operationsDocs PR: ably/docs#3161
Summary by CodeRabbit
Release Notes
Bug Fixes
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.