feat: change v4 payload topic to v3 format, add topicBytes field#102
Merged
Conversation
The topic field in V4 delivery notification payloads now uses the V3 string format (e.g., /xmtp/mls/1/g-<hex>/proto). A new topicBytes field (topicBytesB64 in JSON/APNS/FCM) carries the V4 binary topic as base64. This applies to all delivery channels: APNS, FCM, and HTTP. Resolves xmtp#101 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
neekolas
reviewed
Apr 9, 2026
Rename the Go struct field from TopicBytes to TopicBytesB64 to match the JSON field name everywhere and avoid confusion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The previous CI run failed with "xnet-node did not become ready for message-source v3-direct" — a transient container readiness timeout unrelated to code changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
neekolas
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #101
Summary
buildV4SendRequestnow setsTopicto V3 string format (TopicToLegacy) instead of V4 base64 (TopicToBase64)TopicBytesfield onSendRequestcarries the V4 binary topic as base64topicBytesB64custom field when presenttopicBytesB64in data map and APNS custom data when presenttopicBytesB64included in JSON viaMarshalJSON(omitted when empty)topicBytesB64only appears for V4 payloadsFiles Changed
pkg/interfaces/interfaces.goTopicBytestoSendRequest,topicBytesB64to JSON marshalingpkg/xmtp/v4_listener.gobuildV4SendRequestusesTopicToLegacyfor Topic,TopicToBase64for TopicBytespkg/delivery/apns.gotopicBytesB64to APNS notification payloadpkg/delivery/fcm.gotopicBytesB64to FCM data and APNS custom dataTest plan
pkg/interfaces— new tests for TopicBytes JSON marshaling (included + omitted when empty)pkg/delivery— new V4 tests for APNS and FCMtopicBytesB64fieldpkg/xmtp— updated V4 listener tests assert V3 topic format + TopicBytes fieldgo build ./...— compiles cleanlygo vet ./...— no issuespkg/interfaces,pkg/delivery,pkg/topics)pkg/xmtp,pkg/db) require PostgreSQL — verified logic changes only🤖 Generated with Claude Code
Note
Add
topicBytesB64field to V4 push notification payloads and set V4 topic to legacy formatSendRequestnow carries both a legacy stringTopicand a newTopicBytesB64field containing the base64-encoded topic bytes, set inv4_listener.go.topicBytesB64is conditionally included in APNS custom payloads and FCMData/APNS.CustomDatawhen the field is non-empty.SendRequest.MarshalJSONemitstopicBytesB64in the JSON wire format when set, via theinterfaces.gocustom marshaler.Topicis now set to the legacy string representation instead of raw topic bytes, which affects downstream consumers reading theTopicfield.Macroscope summarized 5507525.