-
Notifications
You must be signed in to change notification settings - Fork 25
feat: Add isolated API instance functionality #740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
1390587
feat: add tracking for bound API instance in FeatureProvider
askpt 1af813f
feat: clear ownership of bound API instances during provider shutdown
askpt e3db45e
feat: add CreateIsolated method and provider ownership validation to …
askpt 0132c16
feat: add unit tests for isolated API instances and provider behavior
askpt be91f57
feat: add demonstration of isolated API instance creation and usage
askpt 8b6c4b2
feat: add isolated API instance testing functionality
askpt fe72654
Fix formatting
askpt f92e3b8
Merge branch 'main' into askpt/issue734
askpt cdb1050
test: enhance exception message assertions for provider binding in is…
askpt 529bec4
Apply suggestions from code review
askpt 3da0b3f
refactor: improve provider instance binding logic
askpt 0b24bc6
Merge branch 'main' into askpt/issue734
askpt 8396ac7
Merge remote-tracking branch 'origin' into askpt/issue734
askpt 1932ee9
Move to a separate namespace.
askpt be1b1ba
feat: add experimental identifiers for Isolated API features and upda…
askpt 9241661
fix: reorder using directives for consistency in IsolatedApiTests
askpt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| namespace OpenFeature.Constant; | ||
|
|
||
| /// <summary> | ||
| /// Contains identifiers for experimental features and diagnostics in the OpenFeature framework. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// <c>Experimental</c> - This class includes identifiers that allow developers to track and conditionally enable | ||
| /// experimental features. Each identifier follows a structured code format to indicate the feature domain, | ||
| /// maturity level, and unique identifier. Note that experimental features are subject to change or removal | ||
| /// in future releases. | ||
| /// <para> | ||
| /// <strong>Basic Information</strong><br/> | ||
| /// These identifiers conform to OpenFeature’s Diagnostics Specifications, allowing developers to recognize | ||
| /// and manage experimental features effectively. | ||
| /// </para> | ||
| /// </remarks> | ||
| /// <example> | ||
| /// <code> | ||
| /// Code Structure: | ||
| /// - "OF" - Represents the OpenFeature library. | ||
| /// - "ISO" - Indicates the Isolated API domain. | ||
| /// - "001" - Unique identifier for a specific feature. | ||
| /// </code> | ||
| /// </example> | ||
| internal static class FeatureDiagnosticCodes | ||
| { | ||
| /// <summary> | ||
| /// Identifier for the experimental Isolated API features within the OpenFeature framework. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// <c>OFISO001</c> identifier marks experimental features in the Isolated (ISO) domain. | ||
| /// | ||
| /// Usage: | ||
| /// Developers can use this identifier to conditionally enable or test experimental Isolated API features. | ||
| /// It is part of the OpenFeature diagnostics system to help track experimental functionality. | ||
| /// </remarks> | ||
| public const string IsolatedApi = "OFISO001"; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #if NET8_0_OR_GREATER | ||
| using System.Diagnostics.CodeAnalysis; | ||
| #endif | ||
|
|
||
| namespace OpenFeature.Isolated; | ||
|
|
||
| /// <summary> | ||
| /// Factory for creating isolated instances of the OpenFeature API. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// This factory provides a method to create new, independent instances of the OpenFeature API with fully isolated state. Each isolated instance maintains its own providers, evaluation context, hooks, event handlers, | ||
| /// and transaction context propagators. It does not share state with the global <see cref="Api.Instance"/> singleton or with any other isolated instance. | ||
| /// </remarks> | ||
| public static class OpenFeatureFactory | ||
| { | ||
| /// <summary> | ||
| /// Creates a new, independent instance of the OpenFeature API with fully isolated state. | ||
| /// <para> | ||
| /// Each isolated instance maintains its own providers, evaluation context, hooks, event handlers, | ||
| /// and transaction context propagators. It does not share state with the global <see cref="Api.Instance"/> | ||
| /// singleton or with any other isolated instance. | ||
| /// </para> | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// <para> | ||
| /// A single provider instance should not be bound to more than one API instance at a time. | ||
| /// Attempting to do so will result in an <see cref="InvalidOperationException"/>. | ||
| /// </para> | ||
| /// </remarks> | ||
| /// <returns>A new, independent <see cref="Api"/> instance.</returns> | ||
| /// <seealso href="https://openfeature.dev/specification/sections/flag-evaluation#18-isolated-api-instances">Specification 1.8 - Isolated API Instances</seealso> | ||
| #if NET8_0_OR_GREATER | ||
| [Experimental(Constant.FeatureDiagnosticCodes.IsolatedApi)] | ||
| #endif | ||
| public static Api CreateIsolated() => new Api(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the earlier comments; the namespace move and
[Experimental]attribute look great! If I'm not mistaken though, this spot seems to have been missed;Api.CreateIsolated()no longer exists, so I think this should beOpenFeatureFactory.CreateIsolated()(with ausing OpenFeature.Isolated;added at the top).Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...
Good catch...
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#756