Skip to content

LiveObjects: Test receiving two create ops for the same object ID#2156

Merged
lawrence-forooghian merged 1 commit intomainfrom
liveobjects-test-multiple-create-ops
Jan 30, 2026
Merged

LiveObjects: Test receiving two create ops for the same object ID#2156
lawrence-forooghian merged 1 commit intomainfrom
liveobjects-test-multiple-create-ops

Conversation

@lawrence-forooghian
Copy link
Collaborator

@lawrence-forooghian lawrence-forooghian commented Jan 26, 2026

These tests demonstrate the necessity of the createOperationIsMerged flag, which I had previously incorrectly proposed removing — one reason for which was that no tests failed when I tried removing it. See internal conversation.

Tests written by Claude.

Summary by CodeRabbit

  • Tests
    • Added test coverage for live object creation: verifies duplicate create operations for map and counter objects are ignored so the original create governs final state; follow-up operations confirm a later duplicate create does not change bindings or values.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 26, 2026

Walkthrough

Adds two test scenarios in test/realtime/liveobjects.test.js that verify redundant MAP_CREATE and COUNTER_CREATE operations for the same object ID from different sites are ignored when a later create has a higher timeserial; subsequent operations confirm only the initial create affects state.

Changes

Cohort / File(s) Summary
Test coverage for redundant create operations
test/realtime/liveobjects.test.js
Adds MAP_CREATE and COUNTER_CREATE test scenarios that send duplicate creates from different sites (with later timeserials) and assert only the first create is applied; includes intermediate operations to validate the second create is not applied.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐇 I hopped into tests with glee,
two creates raced, but one stayed be,
MAP and COUNTER held their ground,
later echoes made no sound,
a tidy state — a rabbit's tea.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding tests for handling multiple create operations for the same object ID in LiveObjects.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch liveobjects-test-multiple-create-ops

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.js

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@lawrence-forooghian lawrence-forooghian changed the title Test receiving two create ops for the same object ID LiveObjects: Test receiving two create ops for the same object ID Jan 26, 2026
@github-actions github-actions bot temporarily deployed to staging/pull/2156/bundle-report January 26, 2026 21:49 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/2156/features January 26, 2026 21:49 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/2156/typedoc January 26, 2026 21:49 Inactive
@lawrence-forooghian lawrence-forooghian marked this pull request as ready for review January 26, 2026 21:52
@lawrence-forooghian lawrence-forooghian force-pushed the liveobjects-test-multiple-create-ops branch from 16a62af to 1aac32a Compare January 26, 2026 21:55
@github-actions github-actions bot temporarily deployed to staging/pull/2156/bundle-report January 26, 2026 21:56 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/2156/features January 26, 2026 21:56 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/2156/typedoc January 26, 2026 21:56 Inactive
Copy link
Contributor

@VeskeR VeskeR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, have a nitpick about the timeserial comment for second CREATE message. Will leave up to you to update the comment

@lawrence-forooghian lawrence-forooghian force-pushed the liveobjects-test-multiple-create-ops branch from 1aac32a to d4c0fd1 Compare January 29, 2026 14:08
@github-actions github-actions bot temporarily deployed to staging/pull/2156/bundle-report January 29, 2026 14:09 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/2156/features January 29, 2026 14:09 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/2156/typedoc January 29, 2026 14:09 Inactive
These tests demonstrate the necessity of the createOperationIsMerged
flag, which I had previously incorrectly proposed removing — one reason
for which was that no tests failed when I tried removing it. See
internal conversation in [1].

Tests written by Claude.

[1] https://ably-real-time.slack.com/archives/C09SY1AQGK0/p1769459426372989?thread_ts=1769195388.456439&cid=C09SY1AQGK0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants