Skip to content

Conversation

@SimonWoolf
Copy link
Member

@SimonWoolf SimonWoolf commented Nov 24, 2025

As agreed before the preview release. I am going to add a new publishResponse type, but it won't be a Message, so until we do that, I'm removing the Message response so we don't release a version of ably-js which has a return type that anyone might try and come to rely on.

spec pr: ably/specification#403

Summary by CodeRabbit

  • Breaking Changes

    • Message update and delete operations no longer return the message object; they now return void. Callers must fetch the message separately if needed.
  • Tests

    • Tests updated to await operations without capturing a return value and verify results by retrieving the message afterward.

✏️ Tip: You can customize this high-level summary in your review settings.

@SimonWoolf SimonWoolf requested a review from ttypic November 24, 2025 17:48
@coderabbitai
Copy link

coderabbitai bot commented Nov 24, 2025

Walkthrough

Updated updateMessage and deleteMessage return types from Promise<Message> to Promise<void> across declarations and implementations (TypeScript d.ts, RestChannel, RealtimeChannel, RestChannelMixin). Methods still perform update/delete requests but no longer resolve with a Message.

Changes

Cohort / File(s) Summary
Type Declarations
ably.d.ts
Changed Channel.updateMessage() / Channel.deleteMessage() and RealtimeChannel counterparts to return Promise<void>; JSDoc @returns text generalized to indicate success (fulfilled) or failure (rejected with ErrorInfo).
RealtimeChannel Implementation
src/common/lib/client/realtimechannel.ts
Updated method signatures for updateMessage() and deleteMessage() to return Promise<void>; internal calls to restMixin.updateDeleteMessage() unchanged.
RestChannel Implementation
src/common/lib/client/restchannel.ts
Updated updateMessage() and deleteMessage() signatures to return Promise<void>; delegation to channel mixin unchanged.
Mixin Implementation
src/common/lib/client/restchannelmixin.ts
static updateDeleteMessage() now returns Promise<void>; removed decoding/return of a Message while keeping validation and HTTP request flow.
Tests
test/rest/updates-deletes.test.js
Tests await updateMessage() / deleteMessage() without capturing return values; verification now uses channel.getMessage() to assert post-update/post-delete state.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant Channel
  participant RestMixin
  participant Server

  Caller->>Channel: await updateMessage(msg, op, params)
  Channel->>RestMixin: updateDeleteMessage({isDelete:false}, msg, op, params)
  RestMixin->>Server: HTTP PUT/POST (update/delete)
  Server-->>RestMixin: 200 OK (message payload)
  note right of RestMixin `#d6f5e0`: previously decoded and returned Message\nnow resolves without value
  RestMixin-->>Channel: resolve void
  Channel-->>Caller: resolve void
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Changes are homogeneous (return-type and JSDoc updates) across a small set of related files.
  • Areas to pay extra attention:
    • restchannelmixin.ts — ensure removing decoding doesn't break side-effect expectations.
    • Tests — confirm assertions now correctly validate state via getMessage().

Poem

🐰
Messages hop, then vanish light,
No echo back, the sky is bright.
A silent promise, void and neat,
Updates done — the loop complete. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately describes the main change: removing the Message response from updateMessage and deleteMessage methods across both type declarations and implementations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 update-no-message

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.

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/common/lib/client/restchannelmixin.ts (1)

102-149: Return-type change to Promise<void> is consistent; only small cleanups possible

updateDeleteMessage now correctly exposes a Promise<void> while still awaiting the underlying Resource.post/patch so callers get proper error propagation. That matches the public API change and the tests that no longer depend on a returned Message.

If you want to tighten things further, you could:

  • Drop the unused WireMessage generic from method<WireMessage>(...) (or change it to unknown) since the response body is ignored.
  • Optionally tweak the “cannot be updated” error string to mention deletes as well, now that this helper backs both operations.
ably.d.ts (2)

2836-2852: Channel typings and docs now match the void-return behaviour

The Channel.updateMessage / deleteMessage JSDoc and signatures have been correctly updated to Promise<void>, avoiding any guarantee of a returned Message while still documenting the operation semantics.

If you want to make the usage pattern clearer, you could add a brief note that callers should use getMessage or getMessageVersions to fetch the resulting message state after an update or delete.


3079-3100: RealtimeChannel typings correctly aligned with REST counterparts

RealtimeChannel.updateMessage and deleteMessage now also return Promise<void> in the public typings, with @returns text consistent with the new contract and matching the underlying implementation.

As with the REST Channel interface, consider a short hint in the docs pointing developers to getMessage / getMessageVersions if they need the updated message object, but the current text is already accurate for this interim API.

📜 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 9b8de36 and de06650.

📒 Files selected for processing (5)
  • ably.d.ts (2 hunks)
  • src/common/lib/client/realtimechannel.ts (2 hunks)
  • src/common/lib/client/restchannel.ts (2 hunks)
  • src/common/lib/client/restchannelmixin.ts (2 hunks)
  • test/rest/updates-deletes.test.js (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
test/rest/updates-deletes.test.js (2)
src/common/lib/client/realtimechannel.ts (1)
  • updateMessage (1026-1034)
src/common/lib/client/restchannel.ts (1)
  • updateMessage (159-166)
src/common/lib/client/restchannelmixin.ts (1)
src/common/lib/types/message.ts (1)
  • WireMessage (176-228)
🪛 GitHub Actions: Lint
src/common/lib/client/realtimechannel.ts

[warning] 1-1: Code style issues found by Prettier. Run 'prettier --write' to fix.

src/common/lib/client/restchannel.ts

[warning] 1-1: Code style issues found by Prettier. Run 'prettier --write' to fix.

⏰ 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). (7)
  • GitHub Check: test-browser (chromium)
  • GitHub Check: test-browser (webkit)
  • GitHub Check: test-browser (firefox)
  • GitHub Check: test-node (16.x)
  • GitHub Check: test-node (20.x)
  • GitHub Check: test-node (18.x)
  • GitHub Check: test-npm-package
🔇 Additional comments (5)
test/rest/updates-deletes.test.js (1)

121-175: Tests correctly updated to no longer rely on a return value

Using await channel.updateMessage(...) / await channel.deleteMessage(...) and then verifying via getMessage keeps the tests aligned with the new Promise<void> contract while still asserting the resulting message state thoroughly.

src/common/lib/client/realtimechannel.ts (2)

1026-1044: Realtime update/delete wrappers correctly aligned with new void contract

Changing both updateMessage and deleteMessage to return Promise<void> while still delegating to restMixin.updateDeleteMessage keeps realtime behaviour intact and matches the new public typings and tests.


1-6: Prettier formatting issue resolved

The file now passes Prettier validation checks. The formatting issue flagged in the lint pipeline has been successfully corrected.

src/common/lib/client/restchannel.ts (2)

159-175: REST channel update/delete APIs now correctly expose Promise<void>

RestChannel.updateMessage and RestChannel.deleteMessage now just await channelMixin.updateDeleteMessage and return Promise<void>, matching the mixin and the public typings while preserving the underlying behaviour and logging.


1-8: Cannot conclusively verify CI formatting violations due to environment limitations.

The visible code in lines 1-8 appears properly formatted: no trailing whitespace, line lengths are within reasonable limits, and import syntax is correct. However, the prettier tool fails to execute in this environment, and I have no access to actual CI reports. Please manually verify this against your CI logs and run npm run format:check locally to confirm whether violations still exist.

As agreed before the preview release. I am going to add a new
publishResponse type, but it won't be a Message, so until we do that,
I'm removing the Message response so we don't release a version of
ably-js with that return type.
@github-actions github-actions bot had a problem deploying to staging/pull/2114/features November 24, 2025 17:59 Failure
@github-actions github-actions bot had a problem deploying to staging/pull/2114/typedoc November 24, 2025 17:59 Failure
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

🧹 Nitpick comments (1)
src/common/lib/client/restchannelmixin.ts (1)

140-148: Response fetched but discarded (acceptable for temporary change).

The HTTP request is still performed, but the response is no longer decoded or returned. This is slightly inefficient since the server still sends back a response body, but it's acceptable given the temporary nature of this change.

Optional: The generic type parameter <WireMessage> is no longer needed since the response isn't used:

-    await method<WireMessage>(
+    await method(
       client,
       this.basePath(channel) + '/messages/' + encodeURIComponent(message.serial) + pathSuffix,
       requestBody,
       headers,
       params || {},
       null,
       true,
     );
📜 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 de06650 and 912fdde.

📒 Files selected for processing (5)
  • ably.d.ts (2 hunks)
  • src/common/lib/client/realtimechannel.ts (1 hunks)
  • src/common/lib/client/restchannel.ts (1 hunks)
  • src/common/lib/client/restchannelmixin.ts (2 hunks)
  • test/rest/updates-deletes.test.js (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/common/lib/client/realtimechannel.ts
  • test/rest/updates-deletes.test.js
  • ably.d.ts
🧰 Additional context used
🧬 Code graph analysis (2)
src/common/lib/client/restchannelmixin.ts (1)
src/common/lib/types/message.ts (1)
  • WireMessage (176-228)
src/common/lib/client/restchannel.ts (1)
ably.d.ts (2)
  • Message (3264-3322)
  • MessageOperation (3447-3460)
⏰ 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). (7)
  • GitHub Check: test-npm-package
  • GitHub Check: test-browser (webkit)
  • GitHub Check: test-browser (firefox)
  • GitHub Check: test-browser (chromium)
  • GitHub Check: test-node (18.x)
  • GitHub Check: test-node (20.x)
  • GitHub Check: test-node (16.x)
🔇 Additional comments (3)
src/common/lib/client/restchannelmixin.ts (1)

102-108: LGTM: Return type correctly updated to Promise<void>.

The signature change aligns with the PR objective to temporarily remove the Message response. The method still performs validation and constructs the request properly.

src/common/lib/client/restchannel.ts (2)

159-162: LGTM: Return type correctly updated to Promise<void>.

The signature change is consistent with the updated channelMixin.updateDeleteMessage method and aligns with the PR objective.


164-167: LGTM: Return type correctly updated to Promise<void>.

The signature change is consistent with the updated channelMixin.updateDeleteMessage method and aligns with the PR objective.

Copy link
Collaborator

@ttypic ttypic left a comment

Choose a reason for hiding this comment

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

LGTM

@SimonWoolf SimonWoolf merged commit b2e5121 into main Dec 2, 2025
8 of 14 checks passed
@SimonWoolf SimonWoolf deleted the update-no-message branch December 2, 2025 16:54
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