Skip to content

[DX-790] Cleans up redundant attach for one shot rest operations#189

Merged
umair-ably merged 1 commit intomainfrom
DX-790-chatCleanup
Mar 24, 2026
Merged

[DX-790] Cleans up redundant attach for one shot rest operations#189
umair-ably merged 1 commit intomainfrom
DX-790-chatCleanup

Conversation

@umair-ably
Copy link
Collaborator

@umair-ably umair-ably commented Mar 24, 2026

Cleans up redundant attach for one shot rest operations and related logging (addresses additional comments from #168)

This does not address the msgpack decoding bug (current workaround of setting useBinaryProtocol = false is still used for Chat operations. I'm still investigating this across the other SDKs + realtime)

Summary by CodeRabbit

Release Notes

  • Refactor
    • Optimized REST-only chat operations (message/reaction send, delete, update, history, and occupancy commands) to skip unnecessary WebSocket connections, improving performance and eliminating unnecessary connection state logging.

@umair-ably umair-ably requested review from AndyTWF and sacOO7 March 24, 2026 16:05
@vercel
Copy link

vercel bot commented Mar 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cli-web-cli Ready Ready Preview, Comment Mar 24, 2026 4:05pm

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Mar 24, 2026

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

This change introduces an autoConnect option to the realtime client initialization and adds a restOnly mode to chat commands. When restOnly: true is specified, the client skips automatic connection and realtime-dependent operations like connection state logging and room attachment are removed from affected commands.

Changes

Cohort / File(s) Summary
Core Infrastructure
src/base-command.ts, src/chat-base-command.ts
Added autoConnect option support to realtime client creation; updated createChatClient() to accept restOnly option and disable autoConnect when true.
Message Operations - REST-only Mode
src/commands/rooms/messages/delete.ts, src/commands/rooms/messages/history.ts, src/commands/rooms/messages/send.ts, src/commands/rooms/messages/update.ts
Updated chat client initialization to use restOnly: true; removed connection state logging setup where applicable.
Reaction Operations - REST-only Mode
src/commands/rooms/messages/reactions/remove.ts, src/commands/rooms/messages/reactions/send.ts
Updated chat client initialization to use restOnly: true; removed connection state logging, room status subscriptions, and explicit room.attach() calls.
Room Operations
src/commands/rooms/occupancy/get.ts
Updated chat client initialization to use restOnly: true.
Reaction Operations - Minor Updates
src/commands/rooms/reactions/send.ts
Removed connection state logging setup call only.
Test Updates
test/unit/commands/rooms/messages/reactions/remove.test.ts, test/unit/commands/rooms/messages/reactions/send.test.ts
Updated expectations to assert that room.attach is not called during reaction operations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 ✨ A hop toward REST, no connection to await—
Faster clients now, without the realtime fate!
Room attachments fade, like whispers in the breeze,
Messages flutter free, light as you please.

🚥 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 clearly and concisely describes the main change: removing redundant attach behavior for REST-only operations.
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
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch DX-790-chatCleanup

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.

@umair-ably umair-ably merged commit f67c148 into main Mar 24, 2026
9 of 10 checks passed
@umair-ably umair-ably deleted the DX-790-chatCleanup branch March 24, 2026 16:14
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