Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Bump XMTP Version #1496

Merged
merged 1 commit into from
Jan 10, 2025
Merged

feat: Bump XMTP Version #1496

merged 1 commit into from
Jan 10, 2025

Conversation

alexrisch
Copy link
Collaborator

@alexrisch alexrisch commented Jan 10, 2025

Updated XMTP Version
Migrated from DecodedMessage
Handle as inboxIds rather than address

Summary by CodeRabbit

Release Notes

  • Dependency Updates

    • Updated XMTP React Native SDK to version 3.1.6
    • Updated XMTP iOS library to version 3.0.22
  • Improvements

    • Enhanced message handling and error checking in iOS notification extension
    • Simplified conversation listing functionality
    • Removed explicit conversation ordering options
  • Technical Updates

    • Adjusted message decoding and content type processing
    • Updated method signatures to improve type safety

Updated XMTP Version
Migrated from DecodedMessage
Handle as inboxIds rather than address
@alexrisch alexrisch requested a review from a team as a code owner January 10, 2025 02:27
Copy link
Contributor

coderabbitai bot commented Jan 10, 2025

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 SwiftLint (0.57.0)
ios/ConverseNotificationExtension/Xmtp/Messages.swift

[
{
"character" : 45,
"file" : "/ios/ConverseNotificationExtension/Xmtp/Messages.swift",
"line" : 197,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 27,
"file" : "/ios/ConverseNotificationExtension/Xmtp/Messages.swift",
"line" : 144,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 25,
"file" : "/ios/ConverseNotificationExtension/Xmtp/Messages.swift",
"line" : 58,
"reason" : "Initializing an optional variable with nil is redundant",
"rule_id" : "redundant_optional_initialization",
"severity" : "Warning",
"type" : "Redundant Optional Initialization"
},
{
"character" : 42,
"file" : "/ios/ConverseNotificationExtension/Xmtp/Messages.swift",
"line" : 59,
"reason" : "Initializing an optional variable with nil is redundant",
"rule_id" : "redundant_optional_initialization",
"severity" : "Warning",
"type" : "Redundant Optional Initialization"
},
{
"character" : 40,
"file" : "/ios/ConverseNotificationExtension/Xmtp/Messages.swift",
"line" : 91,
"reason" : "Initializing an optional variable with nil is redundant",
"rule_id" : "redundant_optional_initialization",
"severity" : "Warning",
"type" : "Redundant Optional Initialization"
},
{
"character" : 118,
"file" : "/ios/ConverseNotificationExtension/Xmtp/Messages.swift",
"line" : 67,
"reason" : "Lines should not have trailing semicolons",
"rule_id" : "trailing_semicolon",
"severity" : "Warning",
"type" : "Trailing Semicolon"
},
{
"character" : 39,
"file" : "/ios/ConverseNotificationExtension/Xmtp/Messages.swift",
"line" : 272,
"reason" : "Lines should not have trailing semicolons",
"rule_id" : "trailing_semicolon",
"severity" : "Warning",
"type" : "Trailing Semicolon"
},
{
"character" : 42,
"file" : "/ios/ConverseNotificationExtension/Xmtp/Messages.swift",
"line" : 273,
"reason" : "Lines should not have trailing semicolons",
"rule_id" : "trailing_semicolon",
"severity" : "Warning",
"type" : "Trailing Semicolon"
},
{
"character" : 42,
"file" : "/ios/ConverseNotificationExtension/Xmtp/Messages.swift",
"line" : 274,
"reason" : "Lines should not have trailing semicolons",
"rule_id" : "trailing_semicolon",
"severity" : "Warning",
"type" : "Trailing Semicolon"
},
{
"character" : 35,
"file" : "/ios/ConverseNotificationExtension/Xmtp/Messages.swift",
"line" : 275,
"reason" : "Lines should not have trailing semicolons",
"rule_id" : "trailing_semicolon",
"severity" : "Warning",
"type" : "Trailing Semicolon"
}
]

Walkthrough

This pull request introduces updates across multiple files related to XMTP message handling and dependencies. The primary changes involve modifying message type handling from DecodedMessage to Message, updating function signatures, and incrementing XMTP-related dependency versions. The modifications aim to improve type safety, error handling, and align with the latest XMTP SDK version. Changes span iOS notification extensions, React Native utilities, and package configurations.

Changes

File Change Summary
ios/ConverseNotificationExtension/Spam.swift Updated computeSpamScoreV3Message function to use Message instead of DecodedMessage, enhanced error handling
ios/ConverseNotificationExtension/Xmtp/Messages.swift Refactored message decoding and handling, updated return types and sender address retrieval
ios/Podfile Bumped XMTP version from 3.0.21 to 3.0.22
package.json Updated @xmtp/react-native-sdk from ^3.1.5 to ^3.1.6
queries/useConversationListQuery.ts Removed ordering argument from conversation list retrieval
utils/xmtpRN/conversations.ts Removed ConversationOrder import and related parameters from conversation listing functions

Possibly related PRs

Suggested reviewers

  • thierryskoda

Poem

🐰 In the realm of messages swift and bright,
Types transform with coding might!
From DecodedMessage to Message pure,
Our spam detection grows more secure 🛡️
A rabbit's code, both safe and tight! 🚀

Finishing Touches

  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

Performance Comparison Report

  • Current: c36d155 - 2025-01-10 02:31:14Z
  • Baseline: main (cc5f279) - 2025-01-10 02:29:50Z

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Type Duration Count
Avatar Image 10 runs render 0.8 ms → 0.9 ms (+0.1 ms, +12.5%) 1 → 1
Avatar Image 50 runs render 0.8 ms → 0.7 ms (-0.2 ms, -21.4%) 🟢 1 → 1
Empty Avatar 10 runs render 1.1 ms → 1.1 ms 1 → 1
Empty Avatar 50 runs render 1.1 ms → 1.0 ms (-0.1 ms, -11.1%) 1 → 1
Text Component with color prop - 10 runs render 0.6 ms → 0.8 ms (+0.2 ms, +33.3%) 🔴 1 → 1
Text Component with default props - 10 runs render 0.9 ms → 0.7 ms (-0.2 ms, -22.2%) 🟢 1 → 1
Text Component with translation key - 10 runs render 0.6 ms → 0.5 ms (-0.1 ms, -16.7%) 🟢 1 → 1
Text Component with weight and size - 10 runs render 0.7 ms → 0.5 ms (-0.2 ms, -28.6%) 🟢 1 → 1
Show details
Name Type Duration Count
Avatar Image 10 runs render Baseline
Mean: 0.8 ms
Stdev: 0.6 ms (79.1%)
Runs: 1 1 1 0 0 0 1 1 2 1
Warmup runs: 1

Current
Mean: 0.9 ms
Stdev: 0.3 ms (35.1%)
Runs: 1 1 1 1 1 0 1 1 1 1
Warmup runs: 1
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Avatar Image 50 runs render Baseline
Mean: 0.8 ms
Stdev: 0.4 ms (44.1%)
Runs: 0 1 0 1 0 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1
Warmup runs: 0

Current
Mean: 0.7 ms
Stdev: 0.5 ms (72.5%)
Runs: 0 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 0 0 1 1 0 1 0 1 1 1 0 1 0 0 0 1 0 0 1 1 1 1 0 1 0 1
Warmup runs: 0
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:
Empty Avatar 10 runs render Baseline
Mean: 1.1 ms
Stdev: 0.3 ms (28.7%)
Runs: 1 1 1 1 1 2 1 1 1 1
Warmup runs: 2

Current
Mean: 1.1 ms
Stdev: 0.6 ms (51.6%)
Runs: 1 1 0 1 2 1 2 1 1 1
Warmup runs: 2
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Empty Avatar 50 runs render Baseline
Mean: 1.1 ms
Stdev: 0.4 ms (36.7%)
Runs: 1 1 1 1 2 0 1 1 1 2 1 1 1 1 2 1 1 1 1 0 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1
Warmup runs: 1

Current
Mean: 1.0 ms
Stdev: 0.3 ms (36.2%)
Runs: 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 0 1 1 1 0
Warmup runs: 1
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with color prop - 10 runs render Baseline
Mean: 0.6 ms
Stdev: 0.5 ms (86.1%)
Runs: 1 0 1 1 0 1 1 0 1 0
Warmup runs: 1

Current
Mean: 0.8 ms
Stdev: 0.4 ms (52.7%)
Runs: 1 0 1 1 1 1 1 0 1 1
Warmup runs: 0
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with default props - 10 runs render Baseline
Mean: 0.9 ms
Stdev: 0.6 ms (63.1%)
Runs: 1 2 1 1 1 1 1 0 1 0
Warmup runs: 4

Current
Mean: 0.7 ms
Stdev: 0.5 ms (69.0%)
Runs: 1 1 1 1 1 1 0 0 1 0
Warmup runs: 4
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with translation key - 10 runs render Baseline
Mean: 0.6 ms
Stdev: 0.5 ms (86.1%)
Runs: 1 1 1 1 0 0 0 1 1 0
Warmup runs: 1

Current
Mean: 0.5 ms
Stdev: 0.5 ms (105.4%)
Runs: 1 1 1 0 0 0 1 1 0 0
Warmup runs: 1
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with weight and size - 10 runs render Baseline
Mean: 0.7 ms
Stdev: 0.5 ms (69.0%)
Runs: 0 1 0 1 1 1 1 1 1 0
Warmup runs: 0

Current
Mean: 0.5 ms
Stdev: 0.5 ms (105.4%)
Runs: 0 1 1 1 0 1 0 0 0 1
Warmup runs: 0
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Render Count Changes

There are no entries

Render Issues

There are no entries

Added Scenarios

There are no entries

Removed Scenarios

There are no entries

Generated by 🚫 dangerJS against 8277309

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
utils/xmtpRN/conversations.ts (1)

49-49: Update function documentation

The removal of the order parameter should be documented in the function's JSDoc comments to prevent confusion.

Add a comment explaining that conversation ordering is now handled internally by the XMTP SDK.

ios/ConverseNotificationExtension/Xmtp/Messages.swift (3)

81-84: LGTM! Consider enhancing the inline comment.

The transition from senderAddress to senderInboxId is well implemented. The inline comment explains the temporary nature of the address conversion, but could be more specific about the migration timeline.

Consider updating the comment to include:

-// We replaced decodedMessage.senderAddress from inboxId to actual address
-// so it appears well in the app until inboxId is a first class citizen
+// TODO(XMTP-Migration): Temporarily converting inboxId to address for backwards
+// compatibility until inboxId becomes a first-class citizen in version X.Y.Z

Line range hint 140-152: LGTM! Enhanced error tracking with Sentry breadcrumbs.

The migration from DecodedMessage to Message is well implemented with improved error tracking. However, the force unwrap on try! could be handled more gracefully.

Consider handling the potential error case:

-if let conversation = try! await xmtpClient.findConversationByTopic(topic: envelope.contentTopic) {
+if let conversation = try? await xmtpClient.findConversationByTopic(topic: envelope.contentTopic) {

166-176: LGTM! Improved type safety and content type handling.

The migration to Message type and the enhanced content type checking using typeID.starts(with:) improves code robustness. Consider extracting content type prefixes as constants for better maintainability.

Consider defining content type constants:

private enum ContentTypePrefix {
    static let text = "text"
    static let reply = "reply"
    static let remoteAttachment = "remoteStaticAttachment"
    static let transaction = "transactionReference"
    static let payment = "coinbase-messaging-payment-activity"
    // ... other types
}

Also applies to: 179-206

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cc5f279 and 8277309.

⛔ Files ignored due to path filters (2)
  • ios/Podfile.lock is excluded by !**/*.lock
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • ios/ConverseNotificationExtension/Spam.swift (2 hunks)
  • ios/ConverseNotificationExtension/Xmtp/Messages.swift (9 hunks)
  • ios/Podfile (1 hunks)
  • package.json (1 hunks)
  • queries/useConversationListQuery.ts (1 hunks)
  • utils/xmtpRN/conversations.ts (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • package.json
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: build
🔇 Additional comments (7)
ios/Podfile (1)

17-17: Verify XMTP version compatibility

The XMTP version has been bumped from 3.0.21 to 3.0.22.

Run this script to check the changelog and ensure compatibility:

✅ Verification successful

XMTP version 3.0.22 is valid

Version 3.0.22 exists as an official tag in the XMTP iOS repository, following the proper version sequence. The minor version bump from 3.0.21 appears safe to use.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check XMTP changelog for version 3.0.22

# Check if there's a changelog file
fd -t f -e md -e txt "CHANGELOG|changelog" | xargs rg -i "3\.0\.22"

# Check commit history for version bump commits
gh api graphql -f query='
{
  repository(owner: "xmtp", name: "xmtp-ios") {
    releases(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {
      nodes {
        name
        description
        tagName
      }
    }
  }
}'

Length of output: 765


Script:

#!/bin/bash
# Check for version 3.0.22 related information
gh api graphql -f query='
{
  repository(owner: "xmtp", name: "xmtp-ios") {
    refs(refPrefix: "refs/tags/", first: 5, orderBy: {field: TAG_COMMIT_DATE, direction: DESC}) {
      nodes {
        name
        target {
          ... on Tag {
            message
          }
        }
      }
    }
    issues(first: 5, states: OPEN, orderBy: {field: CREATED_AT, direction: DESC}) {
      nodes {
        title
        url
      }
    }
  }
}'

# Check if this version exists in any branch
gh api repos/xmtp/xmtp-ios/branches | jq '.[].name' | grep -i "3\.0\.22"

Length of output: 1330

queries/useConversationListQuery.ts (1)

182-190: LGTM! API usage updated correctly

The conversation list API call has been updated to use the new options object pattern, maintaining all required properties while aligning with the latest XMTP SDK version.

ios/ConverseNotificationExtension/Spam.swift (1)

155-155: Good improvements to error handling

The changes include:

  1. Updated parameter type from DecodedMessage to Message
  2. Added proper null checks for message content and type

Also applies to: 213-224

utils/xmtpRN/conversations.ts (1)

4-4: Verify impact of removing conversation ordering

The ConversationOrder parameter has been removed from the XMTP SDK. This could affect how conversations are displayed in the UI.

Run this script to check for UI components that might depend on conversation ordering:

Also applies to: 35-35, 49-49, 63-63

ios/ConverseNotificationExtension/Xmtp/Messages.swift (3)

92-95: LGTM! Consistent implementation across message types.

The profile lookup implementation is consistently applied for both group messages and DMs, maintaining a uniform approach to handling inboxIds.


248-251: LGTM! Enhanced error tracking with content type information.

The error tracking now includes the specific content type, making debugging easier.


288-288: LGTM! Consistent use of inboxId.

The change to use senderInboxId is consistent with the overall migration strategy.

@alexrisch alexrisch merged commit 1d35f00 into main Jan 10, 2025
8 checks passed
@alexrisch alexrisch deleted the ar/xmtp-bump-3-1-6 branch January 10, 2025 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants