-
Notifications
You must be signed in to change notification settings - Fork 1
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-5149] Implement lifecycle contributor precedence #180
Conversation
WalkthroughThe pull request introduces modifications to the Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
Poem
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 (
|
2a697a7
to
90f436b
Compare
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: 2
🧹 Outside diff range and nitpick comments (1)
Sources/AblyChat/RoomFeature.swift (1)
4-8
: Consider Assigning Explicit Raw Values to Enum CasesRelying on the order of enum cases for precedence can lead to maintenance issues if the order is changed unintentionally. Assigning explicit raw values to
RoomFeature
cases will make the precedence explicit and the code more robust.Apply this diff to assign explicit raw values:
-import Ably /// The features offered by a chat room. -internal enum RoomFeature: CaseIterable { +internal enum RoomFeature: Int, CaseIterable { // This list MUST be kept in the same order as the list in CHA-RC2e, in order for the implementation of `areInPrecedenceListOrder` to work. - case messages - case presence - case typing - case reactions - case occupancy + case messages = 0 + case presence = 1 + case typing = 2 + case reactions = 3 + case occupancy = 4And update
areInPrecedenceListOrder
:/// Returns a `Bool` indicating whether `first` and `second` are in the same order as the list given in CHA-RC2e. internal static func areInPrecedenceListOrder(_ first: Self, _ second: Self) -> Bool { - let allCases = Self.allCases - let indexOfFirst = allCases.firstIndex(of: first)! - let indexOfSecond = allCases.firstIndex(of: second)! - return indexOfFirst < indexOfSecond + return first.rawValue < second.rawValue }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
Sources/AblyChat/Room.swift
(2 hunks)Sources/AblyChat/RoomFeature.swift
(2 hunks)Tests/AblyChatTests/DefaultRoomTests.swift
(1 hunks)
🔇 Additional comments (1)
Sources/AblyChat/Room.swift (1)
Line range hint 215-250
: Ensure Correct Ordering of Features According to Precedence
The sorting logic in createFeatureChannelPartialDependencies
uses RoomFeature.areInPrecedenceListOrder
to determine the order of contributors. Please verify that the comparison function correctly implements the precedence as per the CHA-RC2e specification. This ensures that features are processed in the intended sequence, preventing potential unintended behavior.
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.
LGTM
Implements spec points CHA-RC2e and CHA-RL10.
Resolves #153.
Summary by CodeRabbit
New Features
typing
feature in the room feature set.Bug Fixes
Tests
DefaultRoom
when all features are enabled, enhancing test coverage.