Skip to content

Conversation

jblacker
Copy link
Contributor

@jblacker jblacker commented May 15, 2025

This PR

Implements the Multiprovider specified in "Appendix A: Included Utilities" of the OpenFeature Spec. This implementation is an improvement upon what I initially implemented in the go-sdk-contrib repository here & here.

This includes implementations for all three strategies described in the spec along with some common functions. Unlike my original implementation this includes full support for hooks & event handling from the included handlers.

Related Issues

open-feature/go-sdk-contrib#599

Notes

I reimplemented this here from the go-sdk-contrib repo on suggestion of other members. This includes the refactoring improvements that I was mentioning in discussions on my open PR over there.

This PR is currently in draft because it is built on top of the exported mocks in order to provide a full unit test suite.

Follow-up Tasks

  • e2e / Gherkin tests should be written
  • Minor clean up & improvements

How to test

  • Create an application and pass a multiprovider to the OpenFeature SDK that includes 2 or more providers. Verify that the results are as expected per the selected strategy.

jblacker added 16 commits May 7, 2025 15:55
- Also updated the generated filenames to remove the test prefix allowing them to be exportable
- Added a sed command to prepend the build tag "testtools" to the mock files
- Updated test commands to include the "testtools" build tag
- Added step to delete the backups generated by sed

Signed-off-by: Jordan Blacker <jblacker@justworks.com>
- Remove legacy mocks
- Update Makefile

Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
… reports

Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
@jblacker jblacker changed the title Implement multiprovider feat: Implement multiprovider May 15, 2025
Signed-off-by: Jordan Blacker <jblacker@users.noreply.github.com>
@erka
Copy link
Contributor

erka commented Jun 3, 2025

Hey @jblacker.

Is there any road block to move this forward? Do you need any help?

@jblacker
Copy link
Contributor Author

jblacker commented Jun 3, 2025

I've actually been on vacation. I'm going to pick back up on this tomorrow.

jblacker and others added 7 commits June 4, 2025 17:05
Signed-off-by: Jordan Blacker <jblacker@users.noreply.github.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
This is due to the fact that slog.DiscardHandler is not introduced until go 1.24

Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
This reverts commit ea29d0f.

Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Copy link

codecov bot commented Jun 4, 2025

Codecov Report

❌ Patch coverage is 71.96368% with 247 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.65%. Comparing base (40fe27e) to head (500bcb1).

Files with missing lines Patch % Lines
openfeature/multi/multiprovider.go 63.20% 119 Missing and 5 partials ⚠️
openfeature/multi/isolation.go 61.16% 82 Missing and 5 partials ⚠️
openfeature/multi/comparison_strategy.go 86.24% 21 Missing and 5 partials ⚠️
openfeature/multi/strategies.go 88.37% 8 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #354      +/-   ##
==========================================
- Coverage   85.57%   80.65%   -4.92%     
==========================================
  Files          20       27       +7     
  Lines        1435     2316     +881     
==========================================
+ Hits         1228     1868     +640     
- Misses        186      411     +225     
- Partials       21       37      +16     
Flag Coverage Δ
e2e 80.65% <71.96%> (-4.92%) ⬇️
unit 80.65% <71.96%> (-4.92%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sahidvelji
Copy link
Contributor

If we take into account how little free time Jordan has and how perfect this PR needs to be, it will never get merged.... It’s been open since May — we’ll be throwing it a six-month birthday party soon. This is insane 😂

Please merge it so other members can do the cleanup or close it....

You're right that it has taken quite long. To be fair, it is a very large PR and I don't get enough free time to review this in one pass. And even if I approved the PR, I would still need a second approval before being able to merge it anyways.

But I'll try to focus on the exported API only in my review so that we can get this merged and work on other, internal aspects afterwards.

@beeme1mr
Copy link
Member

beeme1mr commented Oct 6, 2025

Yeah, this is a big one. Let's focus the reviews on the API surface and consider marking it as experimental for now. That's what we did in the .NET SDK.

jblacker and others added 7 commits October 6, 2025 16:04
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
- totalStatus -> overallStatus
- totalStatusLock -> overallStatusLock
- strategy -> strategyFunc

Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Co-authored-by: Sahid Velji <sahidvelji@gmail.com>
Signed-off-by: Jordan Blacker <jblacker@users.noreply.github.com>
Co-authored-by: Sahid Velji <sahidvelji@gmail.com>
Signed-off-by: Jordan Blacker <jblacker@users.noreply.github.com>
@jblacker
Copy link
Contributor Author

jblacker commented Oct 6, 2025

I handled all of the additional comments. IMHO most of the latest comments are nits rather than true blockers, but I've handled them nonetheless.

I like the idea of considering this experimental until it has some more usage under its belt by someone other than me.

@jblacker jblacker requested a review from sahidvelji October 6, 2025 20:25
@sahidvelji
Copy link
Contributor

@jblacker Ok let's add a package doc comment stating that the package is experimental and that breaking changes are to be expected. Once added, I think we're good to merge.

While reviewing the code to write additional documentation I noticed that there's a problem with the way custom strategies
are implemented. There's no way for it to process multiple providers! All the other strategy functions are created using
a closure to include the providers. This didn't exist for custom strategies so it would never actually have a provider to call!

I corrected this by adding a new function type `StrategyConstructor` for custom strategies to use to be able to close over
the providers.

Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Include info & links to multiprovider and call out that it's experimental

Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
@jblacker
Copy link
Contributor Author

jblacker commented Oct 7, 2025

I want to call out that while I was writing additional documentation* I found a major bug in how the custom strategy is implemented. I realized that there's no way to provide the providers in this case since all of the other strategies have "constructors" to close over the provider slice. I added a new type StrategyConstructor to allow implementers to also close over the providers and added tests.

* put together a full readme with a big warning that the multi package is experimental in addition to the package comment

Signed-off-by: Jordan Blacker <jblacker@users.noreply.github.com>
@sahidvelji
Copy link
Contributor

Thanks for all the work here @jblacker!

@erka
Copy link
Contributor

erka commented Oct 15, 2025

@jblacker Could you please look into the DCO issue?

@jblacker
Copy link
Contributor Author

jblacker commented Oct 15, 2025

@erka The DCO issue is because I merged in your PR to my branch too quickly because you had two unsigned commits. @toddbaert said to not worry about it because he can squash them at merge time to eliminate that error here.

@beeme1mr
Copy link
Member

Yeah, I can bypass the check. If we're ready, I can merge tomorrow.

@sahidvelji
Copy link
Contributor

@beeme1mr I think we're good to merge, especially since we decided to mark the package experimental.

@beeme1mr beeme1mr enabled auto-merge (squash) October 17, 2025 02:52
@beeme1mr beeme1mr disabled auto-merge October 17, 2025 02:53
@beeme1mr beeme1mr enabled auto-merge (squash) October 17, 2025 02:53
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.

Move multi-provider into SDK

7 participants