Azure / AppConfiguration-DotnetProvider

The .NET Standard configuration provider for Azure App Configuration
https://github.com/Azure/AppConfiguration
MIT License
76 stars 32 forks source link

Bug: Duplicated feature flags in configuration when there are two feature flags with the same name #562

Open zhiyuanliang-ms opened 2 weeks ago

zhiyuanliang-ms commented 2 weeks ago

Currently, .NET provider will not dedupe feature flag based on id. It just overwrites the previous one.

The implementation details can be found here: https://github.com/Azure/AppConfiguration-DotnetProvider/blob/main/src/Microsoft.Extensions.Configuration.AzureAppConfiguration/FeatureManagement/FeatureManagementKeyValueAdapter.cs#L35

Then, there is a bug when there are two feature flags with the same name and different keys.

Here, we have two Beta feature flags with different keys. FeatureFlags

The beta1 has a time window filter and the beta2 has a targeting filter. The .NET provider will produce such configuration:

Bug

You can see there is one Beta feature flag with two feature filters in the configuration.

The example I provided above is not a valid use case, but it illustrates the bug well.

Assuming that the user has a feature flag in a snapshot and there is another feature flag with the same name but different settings in the app config store (this could be a valid use case), this bug might cause some strange behaviors.