Skip to content

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

Merged
lawrence-forooghian merged 1 commit intomainfrom
AIT-324-apply-on-ACK
Mar 11, 2026
Merged

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

Conversation

@lawrence-forooghian
Copy link
Copy Markdown
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 dependency setup and a playbook for managing cross-repo changes, plus version/compatibility guidance.
  • New Features

    • Plugin support for channel state change notifications.
    • Publish-result tracking with per-message serials and completion support returning publish results.
    • Connection info may include an optional server site code.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b11ac86b-2bcc-4bba-80f5-074d91f219fd

📥 Commits

Reviewing files that changed from the base of the PR and between 242fac1 and 8bfbbaa.

📒 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/APPluginAPI.h

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; clarified dependency/version semantics and change guidance.
Connection Details
Sources/_AblyPluginSupportPrivate/include/APConnectionDetails.h
Added optional - (nullable NSString *)siteCode; to APConnectionDetailsProtocol (may be absent if server omits it).
LiveObjects Plugin Protocols
Sources/_AblyPluginSupportPrivate/include/APLiveObjectsPlugin.h
Imported APRealtimeChannelState.h; added optional + (id<APLiveObjectsInternalPluginProtocol>)internalPlugin to APLiveObjectsPluginProtocol and optional - (void)nosync_onChannelStateChanged:toState:reason: to APLiveObjectsInternalPluginProtocol (NS_SWIFT_NAME annotated).
Plugin API
Sources/_AblyPluginSupportPrivate/include/APPluginAPI.h
Forward-declared APPublishResultProtocol; added optional overload nosync_sendObjectWithObjectMessages:channel:completionWithResult: that returns 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 NS_SWIFT_NAME annotations and nullability macros.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I nudge the headers, leave optional doors ajar,
Site codes tucked softly, serials like a star.
Channels hum changes, plugins listen near,
New replies arrive with a delicate cheer.
Hops of progress — small, optional, and clear.

🚥 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 'AIT-324 Add supporting API needed for apply-on-ACK' directly reflects the main objective of the pull request: adding supporting API for the apply-on-ACK feature.
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 (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

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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
Copy Markdown

@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

Copy link
Copy Markdown

@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
Copy Markdown
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

Comment thread Sources/_AblyPluginSupportPrivate/include/APPluginAPI.h Outdated
Comment thread Sources/_AblyPluginSupportPrivate/include/APPublishResult.h
Comment thread README.md
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
Copy Markdown
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.

LGTM

@lawrence-forooghian lawrence-forooghian merged commit 106424a into main Mar 11, 2026
1 check passed
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