Skip to content

fix: Improved handling within ProviderRegistry - #560

Merged
gruebel merged 8 commits into
open-feature:mainfrom
keelerm84:feat/registry-improvements
Jan 23, 2026
Merged

fix: Improved handling within ProviderRegistry#560
gruebel merged 8 commits into
open-feature:mainfrom
keelerm84:feat/registry-improvements

Conversation

@keelerm84

@keelerm84keelerm84 commented Jan 12, 2026

Copy link
Copy Markdown
Contributor

This PR

Introduces the following changes to the ProviderRegistry.

  1. There exists logic to prevent initializing and shutting down providers if they are registered multiple times. However, this logic doesn't account for a provider being registered as both a default, and a domain specific version. There are updates to address both of these situations.
  2. A small refactor to change the way provider status clean up is handled.
  3. Introduced unit tests to cover registry directly.

All of this functionality is in this single PR, but this can be split into individual PRs if desired. Each commit contains a singular bit of functionality or change, so reviewing individually might be easier.

Assuming we keep the PR as one, I have provided the changelog override necessary for release please.

BEGIN_COMMIT_OVERRIDE
refactor: Delete provider status instead of marking as NOT_READY
fix: Prevent providers from being shutdown multiple times
fix: Prevent providers from being initialized multiple times
END_COMMIT_OVERRIDE

It is incorrect to call `ProviderRegister.set_provider` without a
provider AND a domain. A validation check exists for the provider, but
none for the domain.
In this commit, we introduce that domain validation and introduce tests
to capture this expected behavior.
Signed-off-by: Matthew Keeler <mkeeler@launchdarkly.com>
If a provider is set for two different domains, it will only be
initialized once. However, if a customer were to use a provider as both
default and domain specific, it would incorrectly be initialized twice.
Signed-off-by: Matthew Keeler <mkeeler@launchdarkly.com>
If a provider is set for two different domains, and then one of them is
replaced, it will only be shutdown once. However, if a customer were to
use a provider as both default and domain specific, replacing one or the
other would incorrectly shutdown both usages.
Signed-off-by: Matthew Keeler <mkeeler@launchdarkly.com>
Once a provider has been removed, there is no value in retaining a
reference to it in the `_provider_status` dictionary. Instead of
explicitly setting the status as `NOT_READY`, we can rely on this being
the default status served from the `get_provider_status` method,
allowing us to remove the dictionary entry entirely.
Signed-off-by: Matthew Keeler <mkeeler@launchdarkly.com>
@keelerm84
keelerm84 requested review from a team as code ownersJanuary 12, 2026 17:02
@codecov

codecovBot commented Jan 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.18%. Comparing base (71ebb9f) to head (4ca2bb8).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #560 +/- ##
==========================================
+ Coverage 98.01% 98.18% +0.17% 
==========================================
Files 41 41 Lines 1913 1982 +69 ==========================================
+ Hits 1875 1946 +71 + Misses 38 36 -2 
FlagCoverage Δ
unittests98.18% <100.00%> (+0.17%)⬆️

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.

@gruebelgruebel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

overall looks good, but as stated I'm not sure about the shutdown change

Comment threadopenfeature/provider/_registry.py Outdated
Comment threadopenfeature/provider/_registry.py Outdated
Comment threadopenfeature/provider/_registry.py
Signed-off-by: Matthew Keeler <mkeeler@launchdarkly.com>
@keelerm84
keelerm84force-pushed the feat/registry-improvements branch from 23c6877 to 69076e2CompareJanuary 13, 2026 13:36

@gruebelgruebel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice work, thanks 🍻 only thing missing is fixing DCO issue? Did you forget to sign-off a commit?

@federicobond

Copy link
Copy Markdown
Member

Thank you @keelerm84, overall looks good! Can you open a separate PR for the changes in the first commit though? Since we are squash merging by default I prefer to not batch merge several changes together with different sets of risks.

The first set of changes we can merge pretty quickly while we focus our energy on the other ones.

@keelerm84

Copy link
Copy Markdown
ContributorAuthor

@federicobond first commit as a PR is now open at #561

@keelerm84
keelerm84force-pushed the feat/registry-improvements branch from 095fe12 to 4550e53CompareJanuary 15, 2026 17:32
Signed-off-by: Matthew Keeler <mkeeler@launchdarkly.com>
@keelerm84
keelerm84force-pushed the feat/registry-improvements branch from 4550e53 to d336554CompareJanuary 15, 2026 17:32
Signed-off-by: Matthew Keeler <mkeeler@launchdarkly.com>
@keelerm84

Copy link
Copy Markdown
ContributorAuthor

@federicobond that first commit has been merged separately. I have updated the PR description and RP override block to remove mention of it.

Let me know if you want me to separate out any other bits of functionality.

@gruebel

Copy link
Copy Markdown
Member

ok, let's merge it 🙂

@gruebel
gruebel merged commit 45f7fd1 into open-feature:mainJan 23, 2026
15 checks passed
Sign up for freeto 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.

5 participants

@keelerm84@federicobond@gruebel@kinyoklion@aepfli