Skip to content

Test that the device factory carries over the plugins - #2291

Merged
maratal merged 1 commit into
integration/v2from
test/device-door-plugin-options
Sep 18, 2026
Merged

maratal merged 1 commit into
integration/v2from
test/device-door-plugin-options

Conversation

@maratal

@maratal maratal commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #2265, and addresses the MAJOR finding on it (#2265 (comment)).

PubSubDevice.createClient(options:) works by copying the caller's options, and nothing checked that ARTClientOptions.plugins survives that copy. Losing it is invisible at construction and fatal later: a client built without the plugin traps on first access to channel.object, so every LiveObjects application reaching Ably through the factory would break.

test__011__createClient__carries_over_the_plugins puts a plugin in the options, builds through the factory, and reads the plugins back off the client. It sits with the five other contract tests for the same call and uses their idiom, client.internal.options.

No manifest change was needed. The finding expected AblyTests to gain a dependency on AblyLiveObjects; instead the test reuses PluginAPITests.MockLiveObjectsPlugin, which already exists in this target and already conforms to the real LiveObjectsPluginProtocol. So the core SDK's test target stays clear of the plugin, and the test needs no network — it runs in every existing lane on all three platforms.

Checked that it can fail: with options.plugins = self.plugins; removed from ARTClientOptions.m's copyWithZone:, it fails with XCTUnwrap failed: expected non-nil value of type "Dictionary<ARTPluginName, Any>".

The behavioural half of the finding — that channel.object works on a factory-built client — is #2292, at the top of the stack where the LiveObjects test target already depends on AblyPubSubDevice.

Summary by CodeRabbit

  • Tests
    • Added coverage to verify that client creation preserves the caller’s configured plugins.

PubSubDevice.createClient copies the caller's options, and nothing checked that
the plugin hook survives that copy. Losing it is invisible at construction and
fatal later: a client built without it traps on first access to channel.object,
so every LiveObjects application reaching Ably through the factory would break.

The test reuses PluginAPITests' mock plugin, so the AblyTests target needs no
dependency on AblyLiveObjects.
@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: fe077224-c601-494d-9257-8136b08cc084

📥 Commits

Reviewing files that changed from the base of the PR and between 356a206 and 3b139a1.

📒 Files selected for processing (1)
  • Test/AblyTests/Tests/PubSubDeviceTests.swift

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The pull request adds a test for PubSubDevice.createClient(options:). The test verifies that the created client retains the caller’s liveObjects plugin option.

Changes

Plugin option propagation

Layer / File(s) Summary
Validate plugin option propagation
Test/AblyTests/Tests/PubSubDeviceTests.swift
Adds a test that sets a mock liveObjects plugin, creates a client, and verifies the client contains the plugin entry.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Suggested reviewers: sacoo7, ttypic

Merge Risk: ⚪ Minimal · up to 3b139

The change adds focused test coverage for plugin option propagation without introducing production behavior changes.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: a test verifies that the device factory carries over plugin configuration.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

A rabbit checks the plugin trail
A live object rides the client sail
Options hop from source to side
One mock plugin stays inside
Green tests cheer the carried tide

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change adds focused regression coverage with no unresolved issues.

Pull request overview

Adds regression coverage verifying PubSubDevice.createClient(options:) preserves configured plugins.

Changes:

  • Reuses the existing mock plugin.
  • Confirms the copied client retains the plugin entry.
File summaries
File Description
Test/AblyTests/Tests/PubSubDeviceTests.swift Adds plugin-copy regression coverage.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@sacOO7 sacOO7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

An error occurred while trying to automatically change base from split/device-door to split/restructure-core September 18, 2026 19:26
@maratal
maratal changed the base branch from split/device-door to integration/v2 September 18, 2026 19:33
@maratal
maratal merged commit d9bfb23 into integration/v2 Sep 18, 2026
29 checks passed
@maratal
maratal deleted the test/device-door-plugin-options branch September 18, 2026 21:17

This branch was successfully deployed

4 active deployments
staging/pull/2291/markdown-api-reference — 3b139a11 Deployed Sep 18, 2026 by github-actions[bot]
staging/pull/2291/jazzydoc — 3b139a11 Deployed Sep 18, 2026 by github-actions[bot]
staging/pull/2291/AblyLiveObjects — 3b139a11 Deployed Sep 18, 2026 by github-actions[bot]
staging/pull/2291/features — 3b139a11 Deployed Sep 18, 2026 by github-actions[bot]
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