Skip to content

[Bug] AzureAppConfigurationProvider.refresh() does not update the in-memory feature flag state after the last matching flag is deleted #49108

Description

  • Package Name: azure-appconfiguration-provider
  • Package Version: 2.5.1
  • Operating System: macOS
  • Python Version: 3.14

Describe the bug
After the last feature flag matching the configured selector is deleted from Azure App Configuration,
AzureAppConfigurationProvider.refresh() keeps the old feature flag data in memory instead of updating the provider state to an empty list.

To Reproduce
Steps to reproduce the behavior:

  1. Create a feature flag: test_1 in Azure.
  2. Load configuration with feature_flag_enabled=True and feature_flag_refresh_enabled=True.
  3. Delete test_1 and call refresh().
  4. Inspect config["feature_management"]["feature_flags"].
  5. Create a new provider with load().

Actual behavior
After deleting the last flag test_1, refresh() still returns the stale test_1 entry.
A new load() call correctly returns an empty feature flag list.

Expected behavior
After the last matching feature flag is deleted, refresh() should update the provider state to an empty feature flag list.

Screenshots

Image

Additional context

from azure.appconfiguration.provider import load
from azure.appconfiguration.provider._models import SettingSelector

CONNECTION_STRING = "..."
REFRESH_INTERVAL = 5

def load_config():
    return load(
        connection_string=CONNECTION_STRING,
        feature_flag_enabled=True,
        feature_flag_refresh_enabled=True,
        feature_flag_selectors=[SettingSelector(key_filter="*", label_filter="my_custom_label")],
        refresh_interval=REFRESH_INTERVAL,
    )


config = load_config()
print(config["feature_management"]["feature_flags"])
# [
#     {'conditions': {'client_filters': []},
#      'description': None,
#      'display_name': None,
#      'enabled': False,
#      'id': 'test_1',
#      'telemetry': {'metadata': {'ETag': 'hgRX_0yhNXOSl1vtyakBlTrNeEmL2GIBoxnnsw5gsmA'}}}
# ]


# Delete the "test_1" feature flag from Azure. After REFRESH_INTERVAL has elapsed, call refresh().


config.refresh()  # after deleting the last flag 'test_1', state should become [], but stays stale
print(config["feature_management"]["feature_flags"])
# [
#     {'conditions': {'client_filters': []},
#      'description': None,
#      'display_name': None,
#      'enabled': False,
#      'id': 'test_1',
#      'telemetry': {'metadata': {'ETag': 'hgRX_0yhNXOSl1vtyakBlTrNeEmL2GIBoxnnsw5gsmA'}}}
# ]

new_config = load_config()
print(new_config["feature_management"]["feature_flags"])  # []

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions