Repository navigation
Conversation
…ilCallback The test checked lastFetchStatus one second after starting a fetch with a nil completion handler, which fails when the fetch is slower, as on the Xcode 27 visionOS simulator in CI. Wait until the status changes from NoFetchYet, then assert that the fetch succeeded.
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the testFetchConfigWithNilCallback unit test in RCNRemoteConfigTest.m to use predicate-based expectations instead of a fixed delay, preventing potential test flakiness. The review feedback suggests a cleaner, more idiomatic approach for the NSPredicate block by utilizing its object parameter rather than capturing the outer config variable.
Read the fetch status from the object passed to the NSPredicate block instead of capturing the config instance.
Discussion
RCNRemoteConfigTest.testFetchConfigWithNilCallbackfails intermittently on slow simulators, for example in thespm_1 / spm (xcode-27, visionOS)job ofsdk.remoteconfig.yml: the scheduled run onmainon 2026-11-20, and #17133's run, where it failed in two retry attempts in a row with((self->_configInstances[i].lastFetchStatus) equal to (FIRRemoteConfigFetchStatusSuccess)) failed: ("0") is not equal to ("1").The test fetches with a
nilcompletion handler, then checkslastFetchStatusafter a fixed delay (_checkCompletionTimeout, 1 second) withdispatch_after. The fetch completes asynchronously, so when it takes longer than a second, the status is stillFIRRemoteConfigFetchStatusNoFetchYet(0) when the check runs.The test now waits with an
XCTNSPredicateExpectationuntil each instance'slastFetchStatusis no longerNoFetchYet(up to the existing_expectationTimeoutof 5 seconds), then asserts that it'sFIRRemoteConfigFetchStatusSuccess. A fetch that finishes with a different status still fails the test.Not changed / known limitations
Other tests in the file also check results after
_checkCompletionTimeoutwithdispatch_after. I didn't change them: none has failed in the recentsdk.remoteconfigruns I checked, and most of them check state that is set synchronously.Testing
Locally with Xcode 27.2, I made the mocked fetch response arrive 2 seconds late (a temporary change to the test's
URLSessionDataTaskWithContent:stub, not part of this PR) to simulate a slow simulator. On macOS:With this change, the full
RemoteConfigUnitscheme passed 170 of 170 tests on macOS, the iPhone 17 simulator (iOS 27.2), and the Apple Vision Pro simulator (visionOS 27.2). No compiler warnings inRCNRemoteConfigTest.m.scripts/style.shreports the file as formatted (clang-format 23.1.0).API Changes
None.
#no-changelog
This PR was prepared with AI assistance.