Skip to content

Conversation

@mrm9084
Copy link
Member

@mrm9084 mrm9084 commented Jan 28, 2026

Description

Fixes for feature Flags:

  • Feature Flag Selects could be passed None which would cause an exception
  • When selecting snapshots they were never loading feature flags when using feature_flag_selects, it actually resulted in loading all feature flags with the null label.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copilot AI review requested due to automatic review settings January 28, 2026 21:26
@github-actions github-actions bot added the App Configuration Azure.ApplicationModel.Configuration label Jan 28, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes two bugs in the Azure App Configuration Provider related to feature flags and snapshots:

  1. Handling None values for feature_flag_selectors parameter
  2. Adding snapshot support to the load_feature_flags method

Changes:

  • Fixed feature_flag_selectors=None causing exceptions by adding a null check in initialization
  • Added snapshot support to the sync load_feature_flags method in _client_manager.py
  • Added comprehensive test coverage for snapshot feature flag handling
  • Added helper functions for test resource management and snapshot creation

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azureappconfigurationproviderbase.py Added null check for feature_flag_selectors to prevent exceptions when set to None
sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_client_manager.py Added snapshot support to load_feature_flags method and added configurations variable initialization
sdk/appconfiguration/azure-appconfiguration-provider/tests/testcase.py Added helper functions for test cleanup, settings setup, and snapshot creation
sdk/appconfiguration/azure-appconfiguration-provider/tests/asynctestcase.py Added async versions of test helper functions
sdk/appconfiguration/azure-appconfiguration-provider/tests/test_snapshots.py Enhanced tests for snapshot functionality with feature flags and refactored cleanup code
sdk/appconfiguration/azure-appconfiguration-provider/tests/aio/test_async_snapshots.py Enhanced async tests for snapshot functionality with feature flags
sdk/appconfiguration/azure-appconfiguration-provider/samples/aad_sample.py Demonstrated usage of feature_flag_selectors=None parameter

…ad_sample.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment on lines +234 to +235
if self._feature_flag_selectors is None:
self._feature_flag_selectors = [SettingSelector(key_filter="*")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesnt the previous line cover this case already? How can self._feature_flag_selectors be None?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, if someone passes in kwargs and it's kwargs['feature_flag_selectors']=None it results in an error without this line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesnt kwargs.pop("feature_flag_selectors", [SettingSelector(key_filter="*")]) handle the case where if feature_flag_selectors is None, then we use a default list of SettingSelector?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that only handles the case where the item doesn't exist in the dictionary

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, defaulting to None when the key isn’t present in kwargs makes the intent clearer, since the next line already checks for None. It also ensures the default value is defined in only one place.

self._feature_flag_selectors = kwargs.pop("feature_flag_selectors", None)
if self._feature_flag_selectors is None:
    self._feature_flag_selectors = [SettingSelector(key_filter="*")]

mrm9084 and others added 3 commits January 30, 2026 09:23
Co-authored-by: Avani Gupta <avanigupta@users.noreply.github.com>
async for feature_flag in feature_flags:
if isinstance(feature_flag, FeatureFlagConfigurationSetting):
loaded_feature_flags.append(feature_flag)
if not isinstance(feature_flag, FeatureFlagConfigurationSetting):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if block is not needed

for feature_flag in feature_flags:
if isinstance(feature_flag, FeatureFlagConfigurationSetting):
loaded_feature_flags.append(feature_flag)
if not isinstance(feature_flag, FeatureFlagConfigurationSetting):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, not needed

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

Labels

App Configuration Azure.ApplicationModel.Configuration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants