Files
IRC-kosmi-relay/docs/GRAPHQL_OPERATIONS_AUDIT.md
cottongin db284d0677 Move troubleshooting and implementation docs to docs/
Relocate 30 non-essential .md files (investigation notes, fix summaries,
implementation details, status reports) from the project root into docs/
to reduce clutter. Core operational docs (README, quickstart guides,
configuration references) remain in the root.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-07 13:40:46 -05:00

3.4 KiB

GraphQL Operations Audit - Browser vs Bot

Operations We're Currently Sending

1. connection_init

Status: Correct

  • Sending token, ua, v, r parameters
  • Matches browser

2. ExtendedCurrentUserQuery

Status: Correct (simplified)

  • Browser: Full query with realmInfo, colorSchemes, friends, etc.
  • Bot: Simplified to just currentUser fields we need
  • Verdict: OK - we don't need all the UI-related fields

3. NewMessageSubscription

Status: Fixed (just updated)

  • Added channelId parameter
  • Added operationName
  • Added all required fields (member, reactions, etc.)

4. JoinRoom

Status: Needs verification

  • Browser: mutation JoinRoom($id: String!, $disconnectOtherConnections: Boolean)
  • Bot: mutation JoinRoom($id: String!)
  • Issue: Missing $disconnectOtherConnections parameter

5. SendMessage2

Status: Fixed (just updated)

  • Added channelId, replyToMessageId parameters
  • Added operationName
  • Matches browser

6. anonLogin

Status: Only used for anonymous - OK

Critical Operations the Browser Sends That We're Missing

Room Management

  1. RoomRootQuery - Gets room metadata
  2. WithGetMembers - Gets room members list
  3. RoomChatQuery - Gets chat history

Member Events (Important!)

  1. MemberJoins - Subscription for when members join
  2. MemberLeaves - Subscription for when members leave
  3. NewMemberSubscription - Another member join subscription

Message Events

  1. MessageDeletedSubscription - When messages are deleted
  2. MessageEditedSubscription - When messages are edited
  3. ReactionAdded - When reactions are added
  4. ReactionRemoved - When reactions are removed

Typing Indicators

  1. UserTyping - Subscription for typing indicators
  2. StartTyping - Mutation to send typing status

Room State

  1. RoomDisconnect - Subscription for disconnect events
  2. SetRole2 - Role changes subscription

Priority Operations to Add

HIGH PRIORITY (Required for basic functionality)

  1. JoinRoom - Fix to include disconnectOtherConnections parameter
  2. WithGetMembers - May be needed to see room members properly
  3. RoomChatQuery - May be needed to receive messages properly

MEDIUM PRIORITY (Nice to have)

  1. MemberJoins/MemberLeaves - For presence notifications
  2. MessageDeletedSubscription - Handle deleted messages
  3. UserTyping - Typing indicators (already on our roadmap)

LOW PRIORITY (Optional)

  1. All the media player, spaces, WebRTC subscriptions - Not needed for chat relay

Next Steps

  1. Fix JoinRoom mutation to include disconnectOtherConnections
  2. Test if current changes fix message sending/receiving
  3. Add WithGetMembers if needed
  4. Add RoomChatQuery if needed
  5. Add member join/leave subscriptions for better presence tracking

Browser Operation Sequence (First Connection)

  1. connection_init (with token)
  2. SettingsQuery
  3. ExtendedCurrentUserQuery
  4. UserRoomQuery
  5. WebRTCIceServerQuery
  6. (various other queries)
  7. JoinRoom ← We do this
  8. (many subscriptions)
  9. NewMessageSubscription ← We do this
  10. (more subscriptions)

Our Current Sequence

  1. connection_init (with token)
  2. ExtendedCurrentUserQuery
  3. NewMessageSubscription
  4. JoinRoom
  5. (start listening)

Observation: We're subscribing to messages BEFORE joining the room, but the browser does it AFTER. Let's check if order matters.