-
Notifications
You must be signed in to change notification settings - Fork 25
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
[ECO-5027] Marked types with only readonly members as NS_SWIFT_SENDABLE
#1988
Conversation
NS_SWIFT_SENDABLE
NS_SWIFT_SENDABLE
Note Currently processing new changes in this PR. This may take a few minutes, please wait... 📒 Files selected for processing (1)
WalkthroughThe changes in this pull request primarily involve the addition of new enumerations and interfaces in the Changes
Assessment against linked issues
Possibly related issues
Tip CodeRabbit can approve the review once all CodeRabbit's comments are resolved.Enable the 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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
🧹 Outside diff range and nitpick comments (1)
Source/include/Ably/ARTTypes.h (1)
Mutable properties found in the following classes:
- ARTConnectionStateChange
- ARTChannelStateChange
🔗 Analysis chain
Line range hint
233-242
: Verify that types marked asNS_SWIFT_SENDABLE
comply with sendable requirementsThe classes have been marked with
NS_SWIFT_SENDABLE
to indicate they are safe for concurrent use in Swift. To ensure correctness, we should verify that these types contain only immutable, readonly properties and do not have any mutable state.Run the following script to check for any mutable properties in these classes:
This script searches for any
@property
declarations within the specified classes that are not marked as(readonly)
. The absence of mutable properties confirms that the classes are appropriate for theNS_SWIFT_SENDABLE
attribute.Also applies to: 277-292, 323-345, 369-377, 385-395, 406-414
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that classes marked as NS_SWIFT_SENDABLE contain only readonly properties. # Classes to check classes=( "ARTConnectionStateChange" "ARTChannelStateChange" "ARTChannelMetrics" "ARTChannelOccupancy" "ARTChannelStatus" "ARTChannelDetails" ) # Use ast-grep to find mutable properties in each class for class in "${classes[@]}"; do echo "Checking class $class..." ast-grep --lang objective-c --pattern $'@interface '$class' : $_ { $$$ } %{ @property ($$$) $__ __$__; }' | grep -v '(readonly)' | grep '@property' && echo "Mutable property found in $class" || echo "No mutable properties in $class" doneLength of output: 3203
Script:
#!/bin/bash # Description: Verify that classes marked as NS_SWIFT_SENDABLE contain only readonly properties using ast-grep with corrected language. # Classes to check classes=( "ARTConnectionStateChange" "ARTChannelStateChange" "ARTChannelMetrics" "ARTChannelOccupancy" "ARTChannelStatus" "ARTChannelDetails" ) # Use ast-grep to find mutable properties in each class with corrected language identifier for class in "${classes[@]}"; do echo "Checking class $class..." ast-grep --lang objc --pattern $'@interface '$class' : $_ { $$$ } %{ @property ($$$) $__ __$__; }' | grep -v '(readonly)' | grep '@property' && echo "Mutable property found in $class" || echo "No mutable properties in $class" doneLength of output: 3077
Script:
#!/bin/bash # Description: Verify that classes marked as NS_SWIFT_SENDABLE contain only readonly properties using ripgrep. # Classes to check classes=( "ARTConnectionStateChange" "ARTChannelStateChange" "ARTChannelMetrics" "ARTChannelOccupancy" "ARTChannelStatus" "ARTChannelDetails" ) # Use ripgrep to find mutable properties in each class for class in "${classes[@]}"; do echo "Checking class $class..." # Extract the @interface block for the class and search for @property without (readonly) rg -A 50 "@interface $class" | rg "@property" | grep -v "readonly" && echo "Mutable property found in $class" || echo "No mutable properties in $class" doneLength of output: 2102
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- Source/include/Ably/ARTTypes.h (6 hunks)
🧰 Additional context used
🔇 Additional comments (7)
Source/include/Ably/ARTTypes.h (7)
Line range hint
233-242
: Addition ofretryIn
parameter enhances reconnection control inARTConnectionStateChange
The introduction of the
retryIn
parameter and property allows clients to specify the retry interval after a connection state change, providing finer control over reconnection behavior.
Line range hint
277-292
: Inclusion ofresumed
parameter inARTChannelStateChange
improves continuity handlingBy adding the
resumed
parameter and property, theARTChannelStateChange
class now indicates whether message continuity on a channel is preserved, which is essential for client applications to handle reconnections and data consistency.
Line range hint
323-345
: NewARTChannelMetrics
class accurately defines channel metrics propertiesThe
ARTChannelMetrics
interface introduces properties that provide comprehensive metrics about the channel, such as the number of connections, publishers, and subscribers. This enhancement facilitates better monitoring and analytics of channel usage.
Line range hint
369-377
:ARTChannelOccupancy
class encapsulates channel occupancy metrics effectivelyThe
ARTChannelOccupancy
class, containing theARTChannelMetrics
object, provides a clear structure for accessing occupancy information of a channel, aiding in resource management and optimization.
Line range hint
385-395
:ARTChannelStatus
class accurately represents channel active state and occupancyIntroducing the
ARTChannelStatus
class withactive
andoccupancy
properties allows clients to determine the current status of a channel easily, improving the ability to make informed decisions based on channel state.
Line range hint
406-414
:ARTChannelDetails
class provides comprehensive channel informationThe
ARTChannelDetails
class encapsulates both the channel identifier and its status, offering a detailed view of the channel's state and metrics, which is beneficial for management and debugging purposes.
Line range hint
432-433
: Addition of callback typedefs enhances code readability and maintainabilityThe new typedefs
ARTChannelDetailsCallback
andARTStatusCallback
improve the clarity of asynchronous code by providing descriptive names for callback blocks, making the codebase more understandable and easier to maintain.
ed8f4ac
to
9125b11
Compare
Closes #1987
Summary by CodeRabbit
New Features
ARTDataQueryError
,ARTRealtimeHistoryError
, andARTCustomRequestError
.ARTChannelMetrics
,ARTChannelOccupancy
,ARTChannelStatus
, andARTChannelDetails
.ARTChannelDetailsCallback
andARTStatusCallback
.Improvements