Conversation
WalkthroughRemoved legacy server-time helpers and associated gating logic from authentication; token creation now uses a single time-offset check. Tests were refactored to a parameterized helper and two wrapper cases; a test exercising Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
… as checking `replacedOptions.queryTime` flag together with `hasTimeOffset`. Address #2147 by removing setting `self.options.queryTime = NO`. Fix test to take options for the second call to `authorize`, otherwise `queryTime` is false by default and the test doesn't make much sense.
…te is behind the local clock.
408e8a4 to
eafd464
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Source/ARTAuth.m (1)
703-707: The simplified condition bypasses thequeryTimeoption, breaking test__119's expectations.The change from
if ([self hasTimeOffsetWithValue] && !replacedOptions.queryTime)toif ([self hasTimeOffset])removes the gating that previously allowed explicitqueryTime=trueto force a server query even with a cached offset.Test
test__119__authorize__server_time_offset__should_request_server_time_when_queryTime_is_true_even_if_the_time_offset_is_assignedsets a fake offset, then callsauthorizewithqueryTime=true, expecting the server to be queried and the offset to change. With the current code, the cached offset will be used regardless, causing the test to fail (expectingserverTimeRequestCount == 1but getting 0).This is a behavior regression introduced when
hasTimeOffsetWithValuewas removed.
🧹 Nitpick comments (1)
Test/AblyTests/Tests/AuthTests.swift (1)
3503-3505: Consider clarifying the server-side limitation comment.The comment "looks like 120 is out of range in server side comparison" could be more specific about what server-side validation or comparison is failing with -120. This would help future maintainers understand whether this is a temporary workaround or an expected constraint.
💡 Suggested comment improvement
- try _test__115__authorize__server_time_offset__should_obtain_server_time_once_and_persist_the_offset_from_the_local_clock(-119) // looks like 120 is out of range in server side comparison + try _test__115__authorize__server_time_offset__should_obtain_server_time_once_and_persist_the_offset_from_the_local_clock(-119) // Using -119 instead of -120 to avoid server-side time offset validation range limit
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
Source/ARTAuth.mTest/AblyTests/Tests/AuthTests.swift
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-10T14:14:47.456Z
Learnt from: lawrence-forooghian
Repo: ably/ably-cocoa PR: 2162
File: Source/ARTJsonLikeEncoder.m:522-525
Timestamp: 2025-12-10T14:14:47.456Z
Learning: In Source/ARTJsonLikeEncoder.m, ensure that artMessage.actionIsInternallySet is only set to YES when the SDK explicitly sets the action field (e.g., in ARTMessage initWithName:data:). Messages decoded from the wire must not have actionIsInternallySet set, even if they contain an action field, because the flag should distinguish SDK-internal actions from wire-provided actions. Apply this behavior broadly to Objective-C files in the Source directory that involve message encoding/decoding, and add tests to verify that decoding does not flip the flag.
Applied to files:
Source/ARTAuth.m
🧬 Code graph analysis (1)
Test/AblyTests/Tests/AuthTests.swift (2)
Test/AblyTests/Test Utilities/TestUtilities.swift (1)
commonAppSetup(107-142)Test/AblyTests/Tests/MessageUpdatesDeletesTests.swift (1)
rest(41-49)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: check (tvOS, test_tvOS18_4)
- GitHub Check: check (iOS, test_iOS18_4)
- GitHub Check: check (macOS, test_macOS)
- GitHub Check: check
- GitHub Check: build
- GitHub Check: check
🔇 Additional comments (1)
Test/AblyTests/Tests/AuthTests.swift (1)
3442-3497: Good parameterization for server time offset testing.The refactoring to accept an
offsetparameter enables testing both positive (server ahead) and negative (server behind) time offset scenarios with the same test logic. This improves test coverage and maintainability.The change at line 3482 to pass
authOptionsinstead ofnilensuresqueryTimeis available for the secondauthorize()call, which fixes the issue where options were being cleared between calls.
Closes #2148 and #2147
Summary by CodeRabbit
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.