feat: supply the bound domain to provider initialization#393
Conversation
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe specification is extended to add domain parameter passing to provider initialization, define domain-scoped provider semantics, and constrain domain-scoped providers to single-domain binding. The provider ChangesDomain scoping for provider initialization and binding
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
|
Thank you :) this looks good to me |
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
…g enforcement Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
|
Pushed an update adding a The point that a provider isn't 1:1 with a domain is fair, so rather than relying on providers to use the bound domain correctly, this makes it an enforced contract:
Stateless providers are unaffected and can still back multiple domains; only opt-in providers are constrained. This also resolves the open question about a shared instance only seeing its first domain. OFREP cache key construction lives in the follow-up ADR: open-feature/protocol#80. |
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
…ization Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
|
Added I kept it as a provider-side |
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
toddbaert
left a comment
There was a problem hiding this comment.
I made one very small change to fix some wording that was a bit redundant, nothing substantive.
Amends provider initialization so the
domaina provider is bound to is supplied to itsinitializefunction, letting providers scope domain-specific behavior (such as partitioning a persistent cache) to that domain.Motivation
Provider-level persistent caches (e.g. the OFREP web provider's local persistence) currently have no way to know which
domainthey're bound to, so two providers on the same storage partition can collide on cache entries even though OpenFeature's domain model is supposed to keep them isolated. See slack thread, open-feature/js-sdk-contrib#1566, and ADR 0009.A follow-up OFREP ADR will add the domain to the cache key.
Changes
Two parts, both kept language-agnostic so implementations can use overloads, optional arguments, etc.:
Supply the bound domain to init (folded into the existing init requirements, per earlier review feedback):
2.4.1(provider): theinitializefunction accepts the globalevaluation contextand the bounddomain(if any).1.1.2.2(API): theprovider mutatorMUST supply the bounddomain(if any) when invokinginitialize.Let a provider declare it's domain-scoped, enforced by the API (new requirements):
2.4.3(provider): aproviderMAY declare itselfdomain-scopedwhen it holds per-domainstate such as a persistent cache.1.1.8(condition) /1.1.8.1(API): when a provider isdomain-scoped, theprovider mutatorMUST NOT bind it to more than onedomain, and rejects any attempt to do so.Resolved
The earlier open question (a provider bound to multiple
domainsis initialized once and receives only its first binding'sdomain) is now addressed for stateful providers: declaringdomain-scopedrestricts the instance to a singledomain, so thedomainit keys on is unambiguous. Stateless providers are unaffected and can still back multipledomains.