Skip to content

Add userClaim field to all chat event types - #478

Draft
AndyTWF wants to merge 6 commits into
mainfrom
user-claims
Draft

Add userClaim field to all chat event types#478
AndyTWF wants to merge 6 commits into
mainfrom
user-claims

Conversation

@AndyTWF

@AndyTWF AndyTWF commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds an optional userClaim: String? property to Message, RoomReaction, PresenceMember, TypingSetEvent.Change, and MessageReactionRawEvent.Reaction
  • Implements spec items CHA-M2h, CHA-ER2a, CHA-PR6g, CHA-T13a1, CHA-MR7d
  • For typing indicators, the userClaim is cached per-client and persisted across heartbeat events, with the timer expiry handler updated to pass the cached claim as a parameter

Test plan

  • 26 new unit tests in UserClaimTests.swift covering extraction, all five event types, and typing timer edge cases
  • Integration test assertions added to verify userClaim is nil under standard API key auth (no JWT claims)
  • Existing TypingTimerManagerTests updated for new handler signature — all 232 tests pass

CHA-1243

🤖 Generated with Claude Code

Implements the userClaim feature from the chat SDK specification
(CHA-M2h, CHA-ER2a, CHA-PR6g, CHA-T13a1, CHA-MR7d). This adds an
optional server-provided userClaim string (extracted from JWT extras)
to Message, RoomReaction, PresenceMember, TypingSetEvent.Change, and
MessageReactionRawEvent.Reaction.

For typing indicators, the userClaim is cached per-client and persisted
across heartbeat events. The timer expiry handler signature was updated
to pass the cached userClaim as a parameter, since state is cleared
before the handler runs.

Includes 26 new unit tests and integration test assertions verifying
userClaim is nil under standard API key auth.

[CHA-1243]

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… 1.2.58

- Bump ably-cocoa dependency from 1.2.51 to 1.2.58 for userClaim support
- Add TypingMember struct pairing clientID with userClaim metadata
- Add currentTypers property to Typing protocol and TypingSetEvent
- Add currentlyTypingMembers() to TypingTimerManager
- Consolidate createSandboxChatClient/createSandboxChatClientWithJWT into
  a single helper with optional JWT parameters
- Add JWT auth helper (Sandbox.createJWT) for integration tests
- Add integration test for userClaim propagation across all event types
- Stub new ARTChannelProtocol methods from ably-cocoa 1.2.58 in mock

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Feb 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch user-claims

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
github-actions Bot temporarily deployed to staging/pull/478/AblyChat February 25, 2026 16:58 Inactive
@github-actions
github-actions Bot temporarily deployed to staging/pull/478/AblyChat February 26, 2026 14:54 Inactive
@github-actions
github-actions Bot temporarily deployed to staging/pull/478/AblyChat February 26, 2026 16:54 Inactive
@github-actions
github-actions Bot temporarily deployed to staging/pull/478/AblyChat February 26, 2026 17:16 Inactive
…ion, fix formatting

- Add missing `currentTypers` property to `MockTyping` for `Typing` protocol conformance
- Add `currentTypers` parameter to all `TypingSetEvent` initializer calls in MockTyping
- Handle new `.append` case in `ARTMessageAction` switch in Events.swift
- Fix Prettier formatting in CHA-1243-user-claims.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Sync xcworkspace Package.resolved with root (was stale at ably-cocoa 1.2.51)
- Change @specPartial to @SPEC for CHA-M2h to resolve conflicting tag types

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
github-actions Bot temporarily deployed to staging/pull/478/AblyChat March 2, 2026 10:45 Inactive
Per CHA-T13a1, when a heartbeat arrives without a userClaim, the stored
value must be cleared (not preserved). This matches the JS SDK behavior
where the internal state is always overwritten with the incoming event's
claim value.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant