Skip to content

Load feature flags from the dedicated feature flag resource endpoint - #48222

Open
yuanqu72 wants to merge 8 commits into
Azure:AppConfig-FFEndpointfrom
yuanqu72:yuan-provider-on-ffendpoint
Open

Load feature flags from the dedicated feature flag resource endpoint#48222
yuanqu72 wants to merge 8 commits into
Azure:AppConfig-FFEndpointfrom
yuanqu72:yuan-provider-on-ffendpoint

Conversation

@yuanqu72

@yuanqu72 yuanqu72 commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary

Loads feature flags from the new dedicated Feature Flag resource endpoint (FeatureFlagClient/FeatureFlag) in azure-appconfiguration-provider, in addition to the existing key-value based feature flags.

  • When feature_flag_enabled=True, feature flags created via the feature flag resource endpoint are now loaded automatically alongside key-value based feature flags.
  • Both kinds are merged into the same feature_management.feature_flags list. When a resource-based feature flag and a key-value based feature flag share the same name, the resource-based one takes precedence.
  • No new load() options are required to opt in; existing feature_flag_selectors filter both kinds.
  • Bumped minimum dependency on azure-appconfiguration to >=1.10.0b1 for FeatureFlagClient/FeatureFlag support.

Dependency on #47620

⚠️ This PR is stacked on top of #47620 (AppConfig-FFEndpoint branch), which introduces the FeatureFlagClient APIs in azure-appconfiguration that this change depends on. Because of that, this PR targets AppConfig-FFEndpoint instead of main — the diff here is scoped only to sdk/appconfiguration/azure-appconfiguration-provider.

This PR should be reviewed/merged after (or together with) #47620, once that lands in main.

Changes

  • _azureappconfigurationprovider.py / aio/_azureappconfigurationproviderasync.py: load and merge feature flags from the feature flag resource endpoint
  • _client_manager.py / aio/_async_client_manager.py: new client manager support for feature flag resource clients
  • _constants.py, _request_tracing_context.py: new constants and request tracing updates for the feature flag resource path
  • New samples: samples/feature_flag_resource_sample.py, samples/async_feature_flag_resource_sample.py
  • New tests: tests/test_provider_feature_flag_resources.py, tests/test_async_provider_feature_flag_resources.py, tests/test_azureappconfigurationproviderbase.py, tests/test_configuration_client_manager.py
  • CHANGELOG.md, README.md, samples/README.md updated

Testing

  • Added unit tests and integ tests covering feature flag resource loading, merging/precedence behavior, and client manager creation (sync + async). All of them passed locally:
✅ All 360 tests passed (7m52s, 0 failures, 0 skips)
  • Wrote script locally to make sure FeatureManagement Library is able to consume the json loaded from provider library for the enhanced feature flag.

…in the provider

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
10 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions github-actions Bot added the App Configuration Azure.ApplicationModel.Configuration label Jul 22, 2026
@mrm9084

mrm9084 commented Jul 22, 2026

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list.

@mrm9084

mrm9084 commented Jul 22, 2026

Copy link
Copy Markdown
Member

/azp run appconfiguration

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@mrm9084

mrm9084 commented Jul 22, 2026

Copy link
Copy Markdown
Member

/azp run python - appconfiguration

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@yuanqu72 yuanqu72 changed the title Load feature flags from the dedicated feature flag resource endpoint … Load feature flags from the dedicated feature flag resource endpoint Jul 22, 2026
Comment thread sdk/appconfiguration/azure-appconfiguration-provider/README.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds dedicated feature-flag resource loading to the App Configuration provider, alongside existing key-value feature flags.

Changes:

  • Adds synchronous and asynchronous loading, merging, refresh, and telemetry support.
  • Adds integration/unit tests and samples.
  • Updates dependency, version, changelog, documentation, and recordings.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/testcase.py Adds resource test helpers.
tests/test_provider_feature_flag_resources.py Tests synchronous resource loading.
tests/test_configuration_client_manager.py Tests resource paging and ETags.
tests/test_azureappconfigurationproviderbase.py Tests conversion and merging.
tests/asynctestcase.py Adds asynchronous test helpers.
tests/aio/test_async_provider_feature_flag_resources.py Tests asynchronous resource loading.
setup.py Raises the App Configuration dependency.
samples/README.md Lists the new samples.
samples/feature_flag_resource_sample.py Demonstrates synchronous usage.
samples/async_feature_flag_resource_sample.py Demonstrates asynchronous usage.
README.md Documents resource flags and testing.
CHANGELOG.md Records the feature and dependency update.
aio/_azureappconfigurationproviderasync.py Integrates asynchronous loading and refresh.
aio/_async_client_manager.py Adds asynchronous resource-client support.
_version.py Sets version 2.6.0b1.
_request_tracing_context.py Tracks filters by name.
_constants.py Adds identifier and reference constants.
_client_manager.py Adds synchronous resource-client support.
_azureappconfigurationproviderbase.py Converts, caches, and merges resource flags.
_azureappconfigurationprovider.py Integrates synchronous loading and refresh.
assets.json Updates test recording assets.
Comments suppressed due to low confidence (1)

sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azureappconfigurationproviderbase.py:455

  • An empty list is a valid refreshed result when the last resource flag is deleted, but this truthiness check leaves _processed_resource_feature_flags unchanged; the subsequent merge therefore keeps serving the deleted flag. Treat None as “not refreshed” and an empty list as “refreshed to empty” for both sources and for the merge condition.
        if feature_flag_resources:

…and address review comments

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
yuanqu72 and others added 3 commits July 30, 2026 14:20
…add enhanced feature flag telemetry with tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ion to recommend FeatureFlagSelector

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@yuanqu72
yuanqu72 requested a review from mrm9084 July 30, 2026 22:00
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…anced feature flag tracing when none are loaded

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@yuanqu72
yuanqu72 requested a review from mrm9084 July 31, 2026 18:32
@mrm9084

mrm9084 commented Jul 31, 2026

Copy link
Copy Markdown
Member

/azp run python - appconfiguration

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 26 changed files in this pull request and generated 5 comments.

Suppressed comments (7)

sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azureappconfigurationproviderbase.py:503

  • An empty list is a valid refreshed result when the last resource-based flag is deleted, but this truthiness check leaves _processed_enhanced_feature_flags unchanged. The deleted flag therefore remains in the provider indefinitely; distinguish None (not refreshed) from [] (refreshed to empty) throughout this method and the refresh-success checks.
        if enhanced_feature_flags:
            self._processed_enhanced_feature_flags = [
                self._process_enhanced_feature_flag(ff) for ff in enhanced_feature_flags
            ]

sdk/appconfiguration/azure-appconfiguration-provider/README.md:438

  • This second README snippet also looks for name, but the merged provider output exposes the identifier as id; as written, the documented example raises StopIteration.
enhanced_flag_beta = next(flag for flag in feature_flags if flag.get("name") == "EnhancedFeatureBeta")

sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azureappconfigurationproviderbase.py:495

  • When only one feature-flag endpoint changes, this resets all filter-usage telemetry, but the code below reprocesses only the changed source. Filters from the unchanged cached source then disappear from subsequent correlation headers. Preserve usage per source or recompute telemetry from both current source sets before replacing it.
        if feature_flags or enhanced_feature_flags:
            # Reset feature flag usage
            self._tracing_context.reset_feature_filter_usage()

sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azureappconfigurationproviderbase.py:504

  • A key-value-only refresh passes None here even when resource-based flags remain cached, so this clears EnhFF from future correlation headers while those flags are still served. Derive the tag from the current cached resource-based flags instead of only the latest refresh payload.
        self._tracing_context.uses_enhanced_feature_flags = bool(enhanced_feature_flags)

sdk/appconfiguration/azure-appconfiguration-provider/samples/async_enhanced_feature_flag_sample.py:82

  • This async sample uses FeatureFlagSelector, but both overloads in aio/_async_load.py still declare feature_flag_selectors: Optional[List[SettingSelector]] and document only that type. The advertised async usage therefore fails static type checking; update the async signatures and docstrings to the same union as the sync API.
            feature_flag_selectors=[FeatureFlagSelector(name_filter="Enhanced*")],

sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_version.py:7

  • Changing the package to preview version 2.6.0b1 leaves setup.py classified as Development Status :: 5 - Production/Stable. Use the Beta classifier for this prerelease; the stacked azure-appconfiguration preview does the same in its pyproject metadata.
VERSION = "2.6.0b1"

sdk/appconfiguration/azure-appconfiguration-provider/README.md:393

  • Processed resource-based flags use the Feature Management id field, so this lookup by name always exhausts the iterator and raises StopIteration. Match the sample source and query id.

This issue also appears on line 438 of the same file.

enhanced_flag_beta = next(flag for flag in feature_flags if flag.get("name") == "EnhancedFeatureBeta")

Comment thread sdk/appconfiguration/azure-appconfiguration-provider/setup.py
…ync API type hints, Python version floor, and rename tests README to avoid the package-readme section check, all addressing code review feedback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

3 participants