microsoft / microsoft/FeatureManagement-Dotnet
Update feature definition returned from ConfigurationFeatureDefinitionProvider to allow determining if properties have been specifically configured
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 1.2k
- Forks
- 129
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 5
Description
I am looking at creating a decorator for IFeatureDefinitionProvider that will apply defaults for a feature if it's feature definition is not contained in configuration or if it is configured but does not have certain properties (such as telemetry) set in its configuration. The ConfigurationFeatureDefinitionProvider currently returns null if the feature is not configured which allows applying defaults in that case. However, if it is in configuration but does not contain values for certain properties those properties are still set. This makes it hard to apply defaults in those cases.
As an example, if the configuration for a feature does not contain telemetry configuration then the Telemetry property is still initialised to a non null. This makes it impossible to tell whether telemetry was specifically configured or just had default values once the decorator has got the feature definition from the ConfigurationFeatureDefinitionProvider. So, would it be possible to update the ConfigurationFeatureDefinitionProvider to not set properties if they arent configured? The feature manager classes seem to handle nulls on nullable feature definition properties so it shouldnt break that functionality, but the change could be done based on a new ConfigurationFeatureDefinitionProviderOption to avoid any breaking changes in behaviour (make it opt in).
The properties that would potentially be useful to set to null if not configured are:
- Allocation (although this looks like it is already null if not configured)
- Variants (currently defaults to empty list)
- Telemetry (currently non null and has default values for each property)
This obviously wouldnt guarantee that behaviour for all IFeatureDefinitionProvider implementations, but we would only be decorating the ConfigurationFeatureDefinitionProvider implementation at the moment. We could also make it clear on the expected behaviour of decorated IFeatureDefinitionProvider implementations when using the decorator.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ConfigurationFeatureDefinitionProvider and inspect how missing Allocation, Variants, and Telemetry values are materialized. Compare that behavior with the feature manager classes' handling of nullable definition properties, then determine how an opt-in ConfigurationFeatureDefinitionProviderOption could preserve existing behavior. Done means the provider can distinguish omitted properties from configured defaults without breaking current consumers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100