Skip to content

[AIT-324] Add supporting API needed for apply-on-ACK#11

Open
lawrence-forooghian wants to merge 1 commit intomainfrom
AIT-324-apply-on-ACK
Open

[AIT-324] Add supporting API needed for apply-on-ACK#11
lawrence-forooghian wants to merge 1 commit intomainfrom
AIT-324-apply-on-ACK

Conversation

@lawrence-forooghian
Copy link
Collaborator

@lawrence-forooghian lawrence-forooghian commented Feb 27, 2026

Add methods for plugin to:

  • get PublishResult when performing a publish
  • learn about channel state changes
  • learn about the siteCode of the server it's connected to

Related PRs:

Summary by CodeRabbit

  • Documentation

    • Added comprehensive dependency setup documentation and playbook for managing changes across repositories, including breaking and non-breaking change guidance.
  • New Features

    • Extended plugin infrastructure to support channel state change notifications.
    • Added publish result tracking capability with per-message serial identification.
    • Enhanced connection details with optional server site code reporting.

@coderabbitai
Copy link

coderabbitai bot commented Feb 27, 2026

Walkthrough

Adds optional protocol methods and new publish-result protocols, exposes connection site code, and updates README with dependency/setup and a change playbook. No behavioral changes to existing APIs; additions are opt-in/optional.

Changes

Cohort / File(s) Summary
Documentation
README.md
Added "Dependency setup" and "Playbook for making changes" sections; expanded conventions and dependency/version guidance. No code changes.
Connection Details
Sources/_AblyPluginSupportPrivate/include/APConnectionDetails.h
Added optional - (nullable NSString *)siteCode; to APConnectionDetailsProtocol to expose server site codes.
LiveObjects Plugin Protocols
Sources/_AblyPluginSupportPrivate/include/APLiveObjectsPlugin.h
Imported APRealtimeChannelState.h; added optional + (id<APLiveObjectsInternalPluginProtocol>)internalPlugin and - (void)nosync_onChannelStateChanged:toState:reason: to internal LiveObjects plugin protocol (marked optional, Swift name annotation added).
Plugin API
Sources/_AblyPluginSupportPrivate/include/APPluginAPI.h
Forward-declared APPublishResultProtocol; added an optional overload nosync_sendObjectWithObjectMessages:channel:completionWithResult: returning an APPublishResultProtocol alongside the existing completion variant.
Publish Result Protocols
Sources/_AblyPluginSupportPrivate/include/APPublishResult.h
Added APPublishResultSerialProtocol (nullable NSString *value) and APPublishResultProtocol (NSArray<id<APPublishResultSerialProtocol>> *serials) with Swift interop annotations and nullability macros.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I nibble at headers, new methods in bloom,
Site codes and serials find room in the room.
Channels will whisper their state, soft and light,
Publish results glimmer in rosy new light.
Hoppity changes—optional, tidy, and bright!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The PR title accurately summarizes the main change: adding supporting API needed for apply-on-ACK functionality, which aligns with all documented objectives (PublishResult, channel state changes, siteCode).

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch AIT-324-apply-on-ACK

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.

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.

🧹 Nitpick comments (2)
README.md (1)

24-25: Tighten wording for clarity and consistency.

Small doc polish: replace “is able to” with “can” (Line 24, Line 65), and consider “outdated version” instead of “old version” (Line 53) for stronger wording.

Also applies to: 53-53, 65-65

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 24 - 25, Update the README wording for clarity:
replace the phrase "is able to" with "can" in both occurrences (the sentence "a
given version of the plugin is able to specify a _minimum_ version of
ably-cocoa" and the similar sentence at the other occurrence), and replace "old
version" with "outdated version" where it appears (the sentence discussing
version compatibility) to strengthen phrasing and maintain consistency.
Sources/_AblyPluginSupportPrivate/include/APPublishResult.h (1)

5-21: Consider adding NS_SWIFT_SENDABLE for consistency.

Other protocols in this PR (e.g., APConnectionDetailsProtocol, APPluginAPIProtocol, APLiveObjectsPluginProtocol) include the NS_SWIFT_SENDABLE annotation. For consistency and to ensure these protocols can be safely used across concurrency boundaries in Swift, consider adding the annotation here as well.

Note: The static analysis errors are false positives—the file uses valid Objective-C module imports and Foundation macros that require framework context to parse correctly.

Proposed change
 /// The serial for a single published message.
 NS_SWIFT_NAME(PublishResultSerialProtocol)
+NS_SWIFT_SENDABLE
 `@protocol` APPublishResultSerialProtocol <NSObject>

 /// The message serial of the published message, or `nil` if the message was discarded due to a configured conflation rule.
 `@property` (nullable, nonatomic, readonly) NSString *value;

 `@end`

 /// Contains the result of a publish operation.
 NS_SWIFT_NAME(PublishResultProtocol)
+NS_SWIFT_SENDABLE
 `@protocol` APPublishResultProtocol <NSObject>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Sources/_AblyPluginSupportPrivate/include/APPublishResult.h` around lines 5 -
21, Add the NS_SWIFT_SENDABLE annotation to the two publish-result protocols to
match other protocols in the PR: annotate APPublishResultSerialProtocol and
APPublishResultProtocol with NS_SWIFT_SENDABLE (e.g.,
NS_SWIFT_NAME(PublishResultSerialProtocol) NS_SWIFT_SENDABLE on
APPublishResultSerialProtocol and NS_SWIFT_NAME(PublishResultProtocol)
NS_SWIFT_SENDABLE on APPublishResultProtocol) so they are marked sendable for
Swift concurrency.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@README.md`:
- Around line 24-25: Update the README wording for clarity: replace the phrase
"is able to" with "can" in both occurrences (the sentence "a given version of
the plugin is able to specify a _minimum_ version of ably-cocoa" and the similar
sentence at the other occurrence), and replace "old version" with "outdated
version" where it appears (the sentence discussing version compatibility) to
strengthen phrasing and maintain consistency.

In `@Sources/_AblyPluginSupportPrivate/include/APPublishResult.h`:
- Around line 5-21: Add the NS_SWIFT_SENDABLE annotation to the two
publish-result protocols to match other protocols in the PR: annotate
APPublishResultSerialProtocol and APPublishResultProtocol with NS_SWIFT_SENDABLE
(e.g., NS_SWIFT_NAME(PublishResultSerialProtocol) NS_SWIFT_SENDABLE on
APPublishResultSerialProtocol and NS_SWIFT_NAME(PublishResultProtocol)
NS_SWIFT_SENDABLE on APPublishResultProtocol) so they are marked sendable for
Swift concurrency.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between dd11843 and 693fb5e.

📒 Files selected for processing (5)
  • README.md
  • Sources/_AblyPluginSupportPrivate/include/APConnectionDetails.h
  • Sources/_AblyPluginSupportPrivate/include/APLiveObjectsPlugin.h
  • Sources/_AblyPluginSupportPrivate/include/APPluginAPI.h
  • Sources/_AblyPluginSupportPrivate/include/APPublishResult.h

Add methods for plugin to:

- get PublishResult when performing a publish
- learn about channel state changes
- learn about the siteCode of the server it's connected to

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

🧹 Nitpick comments (1)
Sources/_AblyPluginSupportPrivate/include/APPluginAPI.h (1)

86-89: Clarify callback invariants for completionWithResult.

Please document whether publishResult is guaranteed non-null on success and expected to be null on error. That removes ambiguity for plugin-side branching.

✍️ Suggested doc tweak
-/// Same as `-nosync_sendObjectWithObjectMessages:channel:completion:`, but the completion handler additionally receives an `APPublishResultProtocol` containing the serials assigned to the published messages by the server.
+/// Same as `-nosync_sendObjectWithObjectMessages:channel:completion:`, but the completion handler additionally receives an `APPublishResultProtocol` containing the serials assigned to the published messages by the server.
+///
+/// Contract: on success, `error == nil` and `publishResult != nil`; on failure, `error != nil` and `publishResult == nil`.
 - (void)nosync_sendObjectWithObjectMessages:(NSArray<id<APObjectMessageProtocol>> *)objectMessages
                                     channel:(id<APRealtimeChannel>)channel
                        completionWithResult:(void (^ _Nullable)(_Nullable id<APPublicErrorInfo> error, _Nullable id<APPublishResultProtocol> publishResult))completion;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Sources/_AblyPluginSupportPrivate/include/APPluginAPI.h` around lines 86 -
89, Update the documentation comment for the method
nosync_sendObjectWithObjectMessages:channel:completionWithResult: to state the
callback invariants explicitly: on success the completion's error parameter is
nil and the publishResult (id<APPublishResultProtocol>) is non-nil and contains
assigned serials; on failure the error (id<APPublicErrorInfo>) is non-nil and
publishResult is nil; ensure the comment uses those exact symbols
(APPublishResultProtocol, APPublicErrorInfo, completionWithResult) so plugin
authors know how to branch.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@Sources/_AblyPluginSupportPrivate/include/APPluginAPI.h`:
- Around line 86-89: Update the documentation comment for the method
nosync_sendObjectWithObjectMessages:channel:completionWithResult: to state the
callback invariants explicitly: on success the completion's error parameter is
nil and the publishResult (id<APPublishResultProtocol>) is non-nil and contains
assigned serials; on failure the error (id<APPublicErrorInfo>) is non-nil and
publishResult is nil; ensure the comment uses those exact symbols
(APPublishResultProtocol, APPublicErrorInfo, completionWithResult) so plugin
authors know how to branch.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 693fb5e and 242fac1.

📒 Files selected for processing (5)
  • README.md
  • Sources/_AblyPluginSupportPrivate/include/APConnectionDetails.h
  • Sources/_AblyPluginSupportPrivate/include/APLiveObjectsPlugin.h
  • Sources/_AblyPluginSupportPrivate/include/APPluginAPI.h
  • Sources/_AblyPluginSupportPrivate/include/APPublishResult.h
🚧 Files skipped from review as they are similar to previous changes (1)
  • Sources/_AblyPluginSupportPrivate/include/APLiveObjectsPlugin.h

@lawrence-forooghian lawrence-forooghian changed the title Add supporting API needed for apply-on-ACK [AIT-324] Add supporting API needed for apply-on-ACK Feb 27, 2026
Copy link
Collaborator

@maratal maratal left a comment

Choose a reason for hiding this comment

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

Left few questions

/// Same as `-nosync_sendObjectWithObjectMessages:channel:completion:`, but the completion handler additionally receives an `APPublishResultProtocol` containing the serials assigned to the published messages by the server.
- (void)nosync_sendObjectWithObjectMessages:(NSArray<id<APObjectMessageProtocol>> *)objectMessages
channel:(id<APRealtimeChannel>)channel
completionWithResult:(void (^ _Nullable)(_Nullable id<APPublicErrorInfo> error, _Nullable id<APPublishResultProtocol> publishResult))completion;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why error is before the result? Usually it's the last argument.

@protocol APPublishResultProtocol <NSObject>

/// An array of serials corresponding 1:1 to the messages that were published.
@property (nonatomic, readonly) NSArray<id<APPublishResultSerialProtocol>> *serials;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't it be just an array of strings? Why this wrapping protocol?


#### Removing functionality from ably-cocoa

Since new versions of ably-cocoa can be used with old versions of the plugin, ably-cocoa must continue to provide functioning implementations of all methods.
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there any "depth" of old plugins versions support?

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