Skip to content

Conversation

jescriba
Copy link
Contributor

This PR

Related Issues

#68

Follow-up Tasks

  • Update documentation

How to test

  • Adds unit test coverage, but open to ideas on additional ways to test!

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @jescriba, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a MultiProvider capability to the OpenFeature Swift SDK, allowing the client to evaluate feature flags by querying multiple underlying feature providers. It includes two distinct strategies, FirstMatchStrategy and FirstSuccessfulStrategy, to define how flag evaluations are aggregated and resolved across these providers. This implementation ports similar functionality from the OpenFeature Kotlin SDK.

Highlights

  • MultiProvider Implementation: A new MultiProvider class is added, enabling the aggregation and evaluation of feature flags across a collection of FeatureProvider instances.
  • FirstMatchStrategy: Introduces a strategy that iterates through providers, returning the first flag evaluation result that is not flagNotFound. If any other error occurs, it is propagated.
  • FirstSuccessfulStrategy: Implements a strategy that returns the first successful flag evaluation result, ignoring errors from individual providers. An error is only thrown if all providers fail to return a successful evaluation.
  • Asynchronous Initialization and Context Handling: The MultiProvider now supports asynchronous initialization and context updates, ensuring all wrapped providers are correctly configured.
  • Unified Flag Evaluation: The MultiProvider leverages a generic evaluate function within its strategies to handle all supported flag types (Boolean, String, Integer, Double, Object) consistently.
  • Provider Event Observation: The observe() method in MultiProvider merges event streams from all registered providers, allowing for consolidated event handling.
  • Comprehensive Unit Tests: New unit tests are included to verify the behavior of the MultiProvider and its strategies under various conditions, including error handling and flag resolution.
  • Mock Provider Utility: A MockProvider utility is added to simplify the testing of provider interactions and event flows.
Using Gemini Code Assist

The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize 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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a MultiProvider feature, allowing the combination of multiple feature providers with different evaluation strategies (FirstMatchStrategy and FirstSuccessfulStrategy). This is a significant enhancement, effectively porting functionality from the Kotlin SDK. The implementation is well-structured, leveraging modern Swift features like async/await and Combine. The accompanying unit tests are thorough and cover various scenarios for the new strategies.

I have a couple of minor suggestions:

  • Removing some unused properties in the new MockProvider test helper.
  • Improving the robustness of a test for observing provider events to avoid potential flakiness.

Overall, this is an excellent contribution. Once these minor points are addressed, this PR should be ready for merging.

@jescriba jescriba force-pushed the feat/add-multiprovider branch from cd4b55e to 4863f2f Compare August 25, 2025 23:30
@jescriba jescriba force-pushed the feat/add-multiprovider branch from c7b98f4 to 254cb55 Compare August 26, 2025 18:17
@jescriba jescriba force-pushed the feat/add-multiprovider branch from de515d6 to 57e54a2 Compare September 8, 2025 18:13
Copy link
Contributor

@fabriziodemaria fabriziodemaria left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! My comments are nothing major, so I feel good clicking "approve" on my side 👍

@fabriziodemaria
Copy link
Contributor

One more thing: I see the Kotlin SDK counterpart added a nice README about this new Provider. Could be nice to do the same here

@jescriba jescriba force-pushed the feat/add-multiprovider branch from fdf75f0 to f527a7b Compare September 11, 2025 00:14
@jescriba jescriba force-pushed the feat/add-multiprovider branch from 53bb9d9 to cf1baae Compare September 11, 2025 01:07
@jescriba
Copy link
Contributor Author

One more thing: I see the Kotlin SDK counterpart added a nice README about this new Provider. Could be nice to do the same here

Good call - I updated the README with some multiprovider usage details.

@jescriba
Copy link
Contributor Author

Updated per comments 👍 Let me know if there are any more changes I should make

@jescriba jescriba force-pushed the feat/add-multiprovider branch 2 times, most recently from d57a788 to 40f040e Compare September 12, 2025 17:50
Copy link
Contributor

@fabriziodemaria fabriziodemaria left a comment

Choose a reason for hiding this comment

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

LGTM 👍

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