Add JoinRequest custom content type with optional profile and metadata#556
Add JoinRequest custom content type with optional profile and metadata#556
Conversation
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Claude finished @yewreeka's task —— View job PR Review CompleteI've thoroughly reviewed this PR. Here's my detailed feedback: OverviewThis PR successfully adds a custom XMTP content type ( Critical Issues1. Partial Send Failure Creates False Error State
|
ApprovabilityVerdict: Needs human review This adds a new custom content type and database persistence for join request profiles, introducing user‑facing behavior and writes. I’d recommend a human verify the new functionality and data changes. You can customize Macroscope's approvability policy. Learn more. |
- New JoinRequestContent model with inviteSlug (required), profile (optional), and metadata map (optional) for extensible fields like deviceName and confirmationCode - JoinRequestCodec for encoding/decoding with JSON serialization - Update InviteCoordinator.sendJoinRequest to send structured content type instead of plain text slug - Update InviteCoordinator.processMessage to handle both new content type and legacy plain text for backward compatibility - Update processDm and lastMessageAsSignedInvite for both formats - Pass profile and metadata through JoinRequest, JoinResult, and JoinRequestResult - Register JoinRequestCodec in XMTP client codecs - 17 new tests for codec encode/decode, edge cases, and compatibility
- Add JoinRequestCodec and InviteJoinErrorCodec to test client codecs - Add integration test: JoinRequestContent type message adds member - Add integration test: InviteCoordinator.sendJoinRequest sends structured content type with profile and metadata fields - Existing plain text tests preserved for backward compatibility
Old clients without JoinRequestCodec registered will fall back to TextCodec for unknown content types, but TextCodec decodes the raw JSON bytes rather than the fallback string, causing SignedInvite.fromURLSafeSlug to fail on the JSON. Sending a second plain text message ensures old clients can still process join requests. The receiver processes whichever message it encounters first. The duplicate is harmless since processDm returns after the first success and addMembers with an existing member is a no-op failure.
16b87f5 to
3acd5b7
Compare
e7a7b29 to
10343f3
Compare
When a join request includes a profile (name, imageURL, memberKind), write it to DBMemberProfile so the new member's display name and avatar appear immediately without waiting for a ProfileUpdate message. Maps memberKind "agent" to DBMemberKind.agent for agent identification.

(optional), and metadata map (optional) for extensible fields like
deviceName and confirmationCode
type instead of plain text slug
type and legacy plain text for backward compatibility
JoinRequestResult
Note
Add JoinRequest custom content type with optional profile and metadata to invite flows
JoinRequestContentandJoinRequestCodecin JoinRequestCodec.swift as a new XMTP content type carrying an invite slug plus optional joiner profile (name, avatar, member kind) and arbitrary metadata.InviteCoordinator.sendJoinRequestnow sends a structuredJoinRequestContentmessage first, then a plain text slug as a backward-compatible fallback.InviteCoordinator.processMessageandprocessDmaccept both the new content type and legacy plain text, propagating profile and metadata throughJoinRequestandJoinResult.InviteJoinRequestsManagerpersists the joiner's profile to the local database (DBMember/DBMemberProfile) when present; all call sites now pass aDatabaseWriterto the manager.JoinRequestCodecis registered on XMTP clients created byInboxStateMachine,StreamProcessor, andSyncingManager.Macroscope summarized 5227da4.