Skip to content

Conversation

@VeskeR
Copy link
Contributor

@VeskeR VeskeR commented Jun 19, 2025

This aligns Objects with the naming convention for other realtime features in the SDK and matches the spec ably/specification#332.

This is a public API breaking change, so PR will be merged into the integration branch for Objects API improvements that may introduce other API changes

Summary by CodeRabbit

  • Refactor

    • Public API and types renamed from "Objects" to "RealtimeObjects" across the library and plugin surface.
  • Documentation

    • Docs, inline references, and property/docs text updated to use "RealtimeObjects".
  • Tests

    • Test suites and assertions updated to target "RealtimeObjects" instead of "Objects".
  • Chores

    • Build/config checks and private API tracking updated to reflect the renamed public surface.

@coderabbitai
Copy link

coderabbitai bot commented Jun 19, 2025

Walkthrough

Renames the public Objects symbol to RealtimeObjects across types, imports, exports, constructor parameters, docs, private API tracking, and tests; updates module-report allowed file. No runtime logic, control flow, or behavior changed.

Changes

Cohort / File(s) Change Summary
Type declaration
ably.d.ts
Renamed public interface/type references and docs from Objects to RealtimeObjects.
Bundle check script
scripts/moduleReport.ts
Replaced allowed file 'src/plugins/objects/objects.ts' with 'src/plugins/objects/realtimeobjects.ts'.
Plugin public surface
src/plugins/objects/index.ts, src/plugins/objects/realtimeobjects.ts
Export surface changed to expose RealtimeObjects (class renamed from Objects); logging strings updated.
RealtimeChannel wiring
src/common/lib/client/realtimechannel.ts
Channel now types/instantiates RealtimeObjects and its public objects getter returns RealtimeObjects.
Plugin internals — constructors & imports
src/plugins/objects/batchcontext.ts, src/plugins/objects/batchcontextlivecounter.ts, src/plugins/objects/batchcontextlivemap.ts, src/plugins/objects/liveobject.ts, src/plugins/objects/objectspool.ts, src/plugins/objects/syncobjectsdatapool.ts
Replaced imports and constructor parameter types from ObjectsRealtimeObjects.
Live data types
src/plugins/objects/livecounter.ts, src/plugins/objects/livemap.ts
Static method signatures and constructors updated to accept RealtimeObjects instead of Objects.
Tests / private API tracking
test/common/modules/private_api_recorder.js, test/realtime/objects.test.js
Updated private API keys, test expectations, descriptions, and instrumentation from ObjectsRealtimeObjects.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant RealtimeChannel
    participant RealtimeObjects

    Client->>RealtimeChannel: create channel
    RealtimeChannel->>RealtimeObjects: new RealtimeObjects(this)
    RealtimeObjects-->>RealtimeChannel: constructed instance
    RealtimeChannel-->>Client: expose channel.objects (RealtimeObjects)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through imports, files in a row,

"Objects" to "RealtimeObjects", soft and slow.
Tests now applaud the name that fits,
Plugins and channels all tidy with bits.
A rabbit's small cheer for a clean little change.

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.38.6)
test/realtime/objects.test.js

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 Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch rename-realtime-objects

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

lawrence-forooghian added a commit to ably/ably-liveobjects-swift-plugin that referenced this pull request Jun 24, 2025
lawrence-forooghian added a commit to ably/ably-liveobjects-swift-plugin that referenced this pull request Jun 24, 2025
lawrence-forooghian added a commit to ably/ably-liveobjects-swift-plugin that referenced this pull request Jun 24, 2025
Copy link
Collaborator

@sacOO7 sacOO7 left a comment

Choose a reason for hiding this comment

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

lgtm

@VeskeR VeskeR force-pushed the rename-realtime-objects branch from f787719 to 587b545 Compare August 21, 2025 05:18
… with the naming convention for other realtime features in the SDK

This updates ably-js implementation to match the spec [1]

[1] ably/specification#332
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/realtime/objects.test.js (1)

1019-1021: Fix invalid chained comparisons in time-bound assertions (JS evaluates them unexpectedly).

JavaScript doesn’t support Python-style chained comparisons. Expressions like a <= b <= c are evaluated left-to-right and coerce to booleans (leading to false positives/negatives). Assert bounds with two comparisons or use chai’s range helpers.

Apply this diff to each occurrence:

@@
-            expect(
-              tsBeforeMsg <= obj.tombstonedAt() <= tsAfterMsg,
-              `Check object's "tombstonedAt" value is set using local clock if no "serialTimestamp" provided`,
-            ).to.be.true;
+            const ts = obj.tombstonedAt();
+            expect(ts).to.be.at.least(tsBeforeMsg);
+            expect(ts).to.be.at.most(tsAfterMsg);
+            // Check object's "tombstonedAt" value is set using local clock if no "serialTimestamp" provided
@@
-            expect(
-              tsBeforeMsg <= mapEntry.tombstonedAt <= tsAfterMsg,
-              `Check map entry's "tombstonedAt" value is set using local clock if no "serialTimestamp" provided`,
-            ).to.be.true;
+            const ts = mapEntry.tombstonedAt;
+            expect(ts).to.be.at.least(tsBeforeMsg);
+            expect(ts).to.be.at.most(tsAfterMsg);
+            // Check map entry's "tombstonedAt" value is set using local clock if no "serialTimestamp" provided
@@
-            expect(
-              tsBeforeMsg <= obj.tombstonedAt() <= tsAfterMsg,
-              `Check object's "tombstonedAt" value is set using local clock if no "serialTimestamp" provided`,
-            ).to.be.true;
+            const ts = obj.tombstonedAt();
+            expect(ts).to.be.at.least(tsBeforeMsg);
+            expect(ts).to.be.at.most(tsAfterMsg);
+            // Check object's "tombstonedAt" value is set using local clock if no "serialTimestamp" provided
@@
-            expect(
-              tsBeforeMsg <= mapEntry.tombstonedAt <= tsAfterMsg,
-              `Check map entry's "tombstonedAt" value is set using local clock if no "serialTimestamp" provided`,
-            ).to.be.true;
+            const ts = mapEntry.tombstonedAt;
+            expect(ts).to.be.at.least(tsBeforeMsg);
+            expect(ts).to.be.at.most(tsAfterMsg);
+            // Check map entry's "tombstonedAt" value is set using local clock if no "serialTimestamp" provided

Also applies to: 1098-1100, 1672-1674, 2201-2203

🧹 Nitpick comments (5)
src/plugins/objects/batchcontextlivecounter.ts (1)

4-4: Use a type-only import for RealtimeObjects

RealtimeObjects is only used as a type in this file; prefer a type-only import to avoid creating a runtime dependency and to align with existing patterns in this codebase.

-import { RealtimeObjects } from './realtimeobjects';
+import type { RealtimeObjects } from './realtimeobjects';
ably.d.ts (1)

2289-2289: Public API rename to RealtimeObjects

The interface is now RealtimeObjects, matching the runtime class and RealtimeChannel.objects property type.

If you want to ease migration for SDK consumers, consider a temporary deprecated alias. Only do this if it doesn’t conflict with the “breaking changes” plan for the integration branch.

/** @deprecated Use RealtimeObjects */
export type Objects = RealtimeObjects;
test/realtime/objects.test.js (3)

4577-4581: Use the matching default constant when priming gcGracePeriod.

You’re priming objects.gcGracePeriod with the gcInterval default. This works but is misleading and risks future coupling. Use RealtimeObjects._DEFAULTS.gcGracePeriod for clarity.

-          objects.gcGracePeriod = ObjectsPlugin.RealtimeObjects._DEFAULTS.gcInterval + 1;
+          objects.gcGracePeriod = ObjectsPlugin.RealtimeObjects._DEFAULTS.gcGracePeriod + 1;

Also applies to: 4600-4604


4711-4715: Global default mutation for GC interval can cause inter-test coupling.

Overriding RealtimeObjects._DEFAULTS.gcInterval affects all instances. You restore it in finally (good), but if the suite runs tests in parallel this can flake other specs.

Consider stubbing the timer per-instance instead of changing a global:

  • Inject a test-only GC interval via constructor/config if available, or
  • Temporarily stub objects._objectsPool._onGCInterval scheduling to use a shorter delay for this client only.

Would you like a PR-ready helper to stub the pool timer locally for these scenarios?

Also applies to: 4766-4768


23-28: Confirm intended casing for channel object modes.

Here you pass modes: ['OBJECT_SUBSCRIBE', 'OBJECT_PUBLISH'], while other tests and error messages use lowercase ('object_subscribe', 'object_publish'). If both are accepted, fine; otherwise align to one form to avoid confusion.

Possible tweak:

-      modes: ['OBJECT_SUBSCRIBE', 'OBJECT_PUBLISH'],
+      modes: ['object_subscribe', 'object_publish'],
📜 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.

📥 Commits

Reviewing files that changed from the base of the PR and between f787719 and 9b9ca8a.

📒 Files selected for processing (15)
  • ably.d.ts (6 hunks)
  • scripts/moduleReport.ts (1 hunks)
  • src/common/lib/client/realtimechannel.ts (3 hunks)
  • src/plugins/objects/batchcontext.ts (2 hunks)
  • src/plugins/objects/batchcontextlivecounter.ts (1 hunks)
  • src/plugins/objects/batchcontextlivemap.ts (1 hunks)
  • src/plugins/objects/index.ts (1 hunks)
  • src/plugins/objects/livecounter.ts (6 hunks)
  • src/plugins/objects/livemap.ts (9 hunks)
  • src/plugins/objects/liveobject.ts (2 hunks)
  • src/plugins/objects/objectspool.ts (2 hunks)
  • src/plugins/objects/realtimeobjects.ts (4 hunks)
  • src/plugins/objects/syncobjectsdatapool.ts (2 hunks)
  • test/common/modules/private_api_recorder.js (4 hunks)
  • test/realtime/objects.test.js (30 hunks)
🚧 Files skipped from review as they are similar to previous changes (11)
  • src/plugins/objects/syncobjectsdatapool.ts
  • src/plugins/objects/livecounter.ts
  • src/plugins/objects/objectspool.ts
  • src/plugins/objects/realtimeobjects.ts
  • src/plugins/objects/batchcontextlivemap.ts
  • src/plugins/objects/liveobject.ts
  • test/common/modules/private_api_recorder.js
  • src/plugins/objects/index.ts
  • src/plugins/objects/livemap.ts
  • src/common/lib/client/realtimechannel.ts
  • src/plugins/objects/batchcontext.ts
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-11-08T05:28:30.955Z
Learnt from: VeskeR
PR: ably/ably-js#1917
File: src/plugins/liveobjects/liveobject.ts:2-2
Timestamp: 2024-11-08T05:28:30.955Z
Learning: In `src/plugins/liveobjects/liveobject.ts`, `EventEmitter` is accessed via the client object, so importing it with the `type` modifier is acceptable.

Applied to files:

  • scripts/moduleReport.ts
  • src/plugins/objects/batchcontextlivecounter.ts
  • ably.d.ts
📚 Learning: 2024-10-22T13:26:59.680Z
Learnt from: VeskeR
PR: ably/ably-js#1897
File: src/plugins/liveobjects/livecounter.ts:93-93
Timestamp: 2024-10-22T13:26:59.680Z
Learning: In the `LiveCounter` class's `_applyCounterCreate` method, it's intentional to increment the counter's value using `+=` instead of initializing it with `=` because the counter may have a pre-existing non-zero value.

Applied to files:

  • test/realtime/objects.test.js
🧬 Code Graph Analysis (3)
src/plugins/objects/batchcontextlivecounter.ts (2)
src/plugins/objects/batchcontext.ts (1)
  • BatchContext (11-107)
src/plugins/objects/realtimeobjects.ts (1)
  • RealtimeObjects (39-529)
test/realtime/objects.test.js (1)
src/common/lib/client/realtimechannel.ts (1)
  • objects (153-158)
ably.d.ts (2)
src/plugins/objects/index.ts (1)
  • RealtimeObjects (4-4)
src/plugins/objects/realtimeobjects.ts (1)
  • RealtimeObjects (39-529)
⏰ 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). (5)
  • GitHub Check: test-browser (webkit)
  • GitHub Check: test-browser (firefox)
  • GitHub Check: test-browser (chromium)
  • GitHub Check: test-node (16.x)
  • GitHub Check: test-node (20.x)
🔇 Additional comments (8)
src/plugins/objects/batchcontextlivecounter.ts (1)

11-11: Rename wiring looks correct

Constructor param type updated to RealtimeObjects; usage (getClient, guards, pool access) remains unchanged. No behavioral changes; compile-time safety improved.

scripts/moduleReport.ts (1)

340-341: No stale references to objects.ts remain

All verification checks passed:

  • Confirmed there is no file named objects.ts in src/plugins/objects (only realtimeobjects.ts, which is expected).
  • No imports or exports of a type/value named Objects (excluding event-related symbols).
  • No occurrences of the old path src/plugins/objects/objects.ts.
ably.d.ts (5)

1656-1659: Doc rename to RealtimeObjects — OK

The callback doc now references RealtimeObjects. Name and linkage read correctly.


1666-1672: Batch callback doc updated to RealtimeObjects — OK

Reference to RealtimeObjects.batch is consistent with the class rename; constraints (“Must not be async”) preserved.


2267-2270: ObjectsEvent doc updated to mention RealtimeObjects — OK

Event typing remains under the Objects* naming while the class is RealtimeObjects. This is acceptable given “Objects” is the feature name.


2427-2433: BatchContext doc cross-link updated — OK

Mirrors the {@link RealtimeObjects.getRoot} matches the new interface name and keeps generics intact.


2946-2949: No lingering Objects references in ably.d.ts
All sanity checks passed—there are no remaining declarations or links still referring to the old Objects name:

• Ran ripgrep across ably.d.ts for
export declare interface Objects
objects: Objects
{@link Objects}

and found zero matches. The public API surface is fully aligned to RealtimeObjects. Changes approved.

test/realtime/objects.test.js (1)

275-280: Rename to RealtimeObjects looks consistent across tests and private API taps.

Representative assertions and private API recorder paths have been updated to RealtimeObjects, and the tests still import the plugin as Objects (as intended). This aligns with the public API rename without breaking plugin wiring.

Also applies to: 3078-3096, 3100-3124, 3204-3237, 3241-3266, 3295-3333, 3336-3362, 3366-3377, 3381-3413, 3417-3453, 3457-3490, 4530-4536, 4560-4562, 4577-4581, 4600-4604, 4625-4653, 4713-4749

@VeskeR VeskeR merged commit f40b6bb into integration/objects-breaking-api Aug 21, 2025
16 of 20 checks passed
@VeskeR VeskeR deleted the rename-realtime-objects branch August 21, 2025 05:41
VeskeR added a commit that referenced this pull request Oct 9, 2025
Change the name for the `Objects` class to `RealtimeObjects`
VeskeR added a commit that referenced this pull request Oct 9, 2025
Change the name for the `Objects` class to `RealtimeObjects`
VeskeR added a commit that referenced this pull request Oct 9, 2025
Change the name for the `Objects` class to `RealtimeObjects`
VeskeR added a commit that referenced this pull request Dec 9, 2025
Change the name for the `Objects` class to `RealtimeObjects`
VeskeR added a commit that referenced this pull request Dec 18, 2025
Change the name for the `Objects` class to `RealtimeObjects`
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.

4 participants