Skip to content

Conversation

@lawrence-forooghian
Copy link
Collaborator

@lawrence-forooghian lawrence-forooghian commented Oct 15, 2025

Change forSerial to withSerial in Messages.delete and Messages.update. (In 103a812 I suggested forSerial because I thought withSerial would look like the serial is being used as a parameter to change the nature of the operation instead of identifying the message, but now that I've seen "for serial" being used it just looks weird.)

And change MessageReactions.delete(forMessageWithSerial:…) to delete(fromMessageWithSerial:…); i.e. "delete reaction from the message with this serial".

Summary by CodeRabbit

  • Refactor
    • Renamed argument labels in messaging APIs for consistency:
      • Messages: update(forSerial:) → update(withSerial:), delete(forSerial:) → delete(withSerial:)
      • Message Reactions: delete(forMessageWithSerial:) → delete(fromMessageWithSerial:)
    • No behavioral changes; existing functionality remains the same.
    • Action required: Update your call sites to the new labels to resolve compile-time errors.

@coderabbitai
Copy link

coderabbitai bot commented Oct 15, 2025

Walkthrough

Renames external parameter labels in message and reaction APIs: forSerial → withSerial on Messages.update/delete, and forMessageWithSerial → fromMessageWithSerial on MessageReactions.delete. Updates corresponding default implementations, mocks, example usage, and tests to match. No logic, control flow, or error-handling changes.

Changes

Cohort / File(s) Summary
Public API protocols
Sources/AblyChat/Messages.swift, Sources/AblyChat/MessageReactions.swift
Renamed external argument labels: update/delete use withSerial; reactions delete uses fromMessageWithSerial. Signatures updated without changing types or return values.
Default implementations
Sources/AblyChat/DefaultMessages.swift, Sources/AblyChat/DefaultMessageReactions.swift
Updated method signatures and call sites to new labels; internal logic unchanged.
Example app
Example/AblyChatExample/ContentView.swift
Adjusted calls to updated labels for update/delete and reaction delete.
Mocks
Example/AblyChatExample/Mocks/MockClients.swift
Mock protocol conformances updated to new external labels; bodies unchanged.
Tests
Tests/AblyChatTests/DefaultMessagesTests.swift, Tests/AblyChatTests/DefaultMessageReactionsTests.swift, Tests/AblyChatTests/IntegrationTests.swift
Updated all invocations to use withSerial/fromMessageWithSerial; test logic and assertions unchanged.

Sequence Diagram(s)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • maratal
  • umair-ably

Poem

A hop, a skip, a serial I seek,
From “for” to “with,” my whiskers tweak.
Reactions leap “from” messages bright,
Labels aligned in tidy light.
Thump-thump goes QA’s gentle drum—
Ship it quick, more carrots come! 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title “Further naming tweaks” is related to the pull request’s focus on renaming but is overly broad and does not indicate which labels were changed. It uses non-specific language that fails to summarize the main updates to the API parameter names. Reviewers scanning the history may not immediately understand the precise scope of the renaming from this title alone. Please revise the title to explicitly mention the key parameter label changes, for example “Rename forSerial to withSerial and forMessageWithSerial to fromMessageWithSerial,” so that the primary change is immediately clear.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ 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 2025-10-25-further-naming-tweaks

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira 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 efc5265 and 453abb0.

📒 Files selected for processing (9)
  • Example/AblyChatExample/ContentView.swift (3 hunks)
  • Example/AblyChatExample/Mocks/MockClients.swift (3 hunks)
  • Sources/AblyChat/DefaultMessageReactions.swift (1 hunks)
  • Sources/AblyChat/DefaultMessages.swift (1 hunks)
  • Sources/AblyChat/MessageReactions.swift (1 hunks)
  • Sources/AblyChat/Messages.swift (2 hunks)
  • Tests/AblyChatTests/DefaultMessageReactionsTests.swift (2 hunks)
  • Tests/AblyChatTests/DefaultMessagesTests.swift (4 hunks)
  • Tests/AblyChatTests/IntegrationTests.swift (4 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
Tests/AblyChatTests/**/*.swift

📄 CodeRabbit inference engine (CLAUDE.md)

Tests/AblyChatTests/**/*.swift: Place all tests under Tests/AblyChatTests
Use test attribution tags: @SPEC, @specOneOf(m/n), @specPartial, @specUntested, @specNotApplicable with appropriate spec IDs and explanations
For Swift Testing #expect(throws:) with typed errors, move typed-throw code into a separate non-typed-throw function (until Xcode 16.3+)

Files:

  • Tests/AblyChatTests/DefaultMessageReactionsTests.swift
  • Tests/AblyChatTests/DefaultMessagesTests.swift
  • Tests/AblyChatTests/IntegrationTests.swift
Sources/**/*.swift

📄 CodeRabbit inference engine (CLAUDE.md)

Sources/**/*.swift: Prefer protocol-based design; expose SDK functionality via protocols and prefer opaque return types (some Protocol) over existential any Protocol
Isolate all mutable state to the main actor; mark stateful objects with @mainactor
Public API should use typed throws with ARTErrorInfo
Use InternalError internally and convert to ARTErrorInfo at public API boundaries
Test-only APIs in the library must be prefixed testsOnly_ and wrapped in #if DEBUG
Reference Chat SDK spec items in implementation comments (e.g., // @SPEC CHA-RL3g)
For public structs exposed by the API, provide an explicit public memberwise initializer
When using AsyncSequence operators in @mainactor contexts, mark operator closures as @sendable
For Task, CheckedContinuation, and AsyncThrowingStream (which don’t support typed errors), use Result and call .get() to bridge typed errors
Avoid Dictionary.mapValues for typed-throwing transformations; use ablyChat_mapValuesWithTypedThrow
When the compiler struggles with typed throws, explicitly annotate do throws(InternalError) blocks
Specify error types in closures, e.g., try items.map { jsonValue throws(InternalError) in … }

Files:

  • Sources/AblyChat/DefaultMessageReactions.swift
  • Sources/AblyChat/MessageReactions.swift
  • Sources/AblyChat/Messages.swift
  • Sources/AblyChat/DefaultMessages.swift
🧬 Code graph analysis (9)
Example/AblyChatExample/ContentView.swift (3)
Example/AblyChatExample/Mocks/MockClients.swift (2)
  • delete (207-221)
  • delete (294-305)
Sources/AblyChat/DefaultMessageReactions.swift (1)
  • delete (41-57)
Sources/AblyChat/DefaultMessages.swift (1)
  • delete (142-148)
Tests/AblyChatTests/DefaultMessageReactionsTests.swift (3)
Example/AblyChatExample/Mocks/MockClients.swift (2)
  • delete (207-221)
  • delete (294-305)
Sources/AblyChat/DefaultMessageReactions.swift (1)
  • delete (41-57)
Sources/AblyChat/DefaultMessages.swift (1)
  • delete (142-148)
Example/AblyChatExample/Mocks/MockClients.swift (2)
Sources/AblyChat/DefaultMessages.swift (2)
  • update (134-140)
  • delete (142-148)
Sources/AblyChat/DefaultMessageReactions.swift (1)
  • delete (41-57)
Sources/AblyChat/DefaultMessageReactions.swift (2)
Example/AblyChatExample/Mocks/MockClients.swift (2)
  • delete (207-221)
  • delete (294-305)
Sources/AblyChat/DefaultMessages.swift (1)
  • delete (142-148)
Sources/AblyChat/MessageReactions.swift (3)
Example/AblyChatExample/Mocks/MockClients.swift (2)
  • delete (207-221)
  • delete (294-305)
Sources/AblyChat/DefaultMessageReactions.swift (1)
  • delete (41-57)
Sources/AblyChat/DefaultMessages.swift (1)
  • delete (142-148)
Sources/AblyChat/Messages.swift (2)
Example/AblyChatExample/Mocks/MockClients.swift (6)
  • update (187-205)
  • update (523-525)
  • update (527-529)
  • update (531-545)
  • delete (207-221)
  • delete (294-305)
Sources/AblyChat/DefaultMessages.swift (2)
  • update (134-140)
  • delete (142-148)
Tests/AblyChatTests/DefaultMessagesTests.swift (2)
Example/AblyChatExample/Mocks/MockClients.swift (2)
  • delete (207-221)
  • delete (294-305)
Sources/AblyChat/DefaultMessages.swift (1)
  • delete (142-148)
Tests/AblyChatTests/IntegrationTests.swift (3)
Example/AblyChatExample/Mocks/MockClients.swift (2)
  • delete (207-221)
  • delete (294-305)
Sources/AblyChat/DefaultMessageReactions.swift (1)
  • delete (41-57)
Sources/AblyChat/DefaultMessages.swift (1)
  • delete (142-148)
Sources/AblyChat/DefaultMessages.swift (1)
Example/AblyChatExample/Mocks/MockClients.swift (6)
  • update (187-205)
  • update (523-525)
  • update (527-529)
  • update (531-545)
  • delete (207-221)
  • delete (294-305)
⏰ 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). (10)
  • GitHub Check: Xcode, tvOS (Xcode 26.0)
  • GitHub Check: Xcode, iOS (Xcode 26.0)
  • GitHub Check: Xcode, macOS (Xcode 26.0)
  • GitHub Check: SPM, release configuration (Xcode 26.0)
  • GitHub Check: Example app, tvOS (Xcode 26.0)
  • GitHub Check: Xcode, release configuration, tvOS (Xcode 26.0)
  • GitHub Check: Xcode, release configuration, iOS (Xcode 26.0)
  • GitHub Check: Example app, macOS (Xcode 26.0)
  • GitHub Check: Example app, iOS (Xcode 26.0)
  • GitHub Check: Xcode, release configuration, macOS (Xcode 26.0)
🔇 Additional comments (5)
Sources/AblyChat/DefaultMessages.swift (2)

134-140: Rename aligns with API intent.

withSerial reads naturally and the implementation stays intact.


142-148: Consistent parameter label update.

Matches the naming convention without altering behavior.

Example/AblyChatExample/Mocks/MockClients.swift (3)

187-205: Mock signature matches production rename.

The mocks now mirror the updated withSerial label; no behavioral changes.


207-221: delete(withSerial:) mirrors the new API surface.

Keeps mock behavior consistent with DefaultMessages changes.


294-305: Reaction deletion label update looks good.

fromMessageWithSerial makes the intent explicit and stays in sync with the SDK.


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.

Change forSerial to withSerial in Messages.delete and Messages.update.
(In 103a812 I suggested forSerial because I thought withSerial would
look like the serial is being used as a parameter to change the nature
of the operation instead of identifying the message, but now that I've
seen "for serial" being used it just looks weird.)

And change MessageReactions delete(forMessageWithSerial:…) to
delete(fromMessageWithSerial:…); i.e. "delete reaction from the message
with this serial".
@lawrence-forooghian lawrence-forooghian force-pushed the 2025-10-25-further-naming-tweaks branch from 3f30bb0 to 453abb0 Compare October 15, 2025 17:33
lawrence-forooghian added a commit that referenced this pull request Oct 15, 2025
lawrence-forooghian added a commit to ably/docs that referenced this pull request Oct 15, 2025
TODO squash into previous if
ably/ably-chat-swift#429 merged, this is

453abb098d2f43d89b22474d47b0e2e1e8269252
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.

LGTM

@lawrence-forooghian lawrence-forooghian merged commit 26cdd82 into main Oct 15, 2025
17 checks passed
@lawrence-forooghian lawrence-forooghian deleted the 2025-10-25-further-naming-tweaks branch October 15, 2025 20:02
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.

3 participants