Repository navigation
feat: add additive opt-in support for extension features - #10635
Hui Miao (huimiu) wants to merge 2 commits into
Conversation
🔗 Linked Issue RequiredThanks for the contribution! Please link a GitHub issue to this PR by adding |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 25 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🔵 Needs a closer look
Fix case-insensitive Windows environment-variable handling and add regression coverage.
No open issues 🎉
What changed in this PR
Adds additive Alpha extension opt-ins and preserves Foundry opt-in environment variables across extension launches.
Changes:
- Adds feature metadata and source-based evaluation.
- Preserves process-level Foundry opt-ins.
- Adds tests and documentation for the opt-in contract.
| File | Summary |
|---|---|
docs/guides/creating-an-extension.md |
Documents additive opt-in guidance. |
docs/architecture/extension-framework.md |
Documents launch-boundary requirements. |
cli/azd/pkg/extensions/runner.go |
Preserves Foundry opt-ins during launches. |
cli/azd/pkg/extensions/runner_test.go |
Tests direct and listen-style launches. |
cli/azd/pkg/alpha/extension_feature_test.go |
Tests opt-in evaluation matrices. |
cli/azd/pkg/alpha/alpha_feature.go |
Adds feature metadata and evaluation APIs. |
cli/azd/pkg/alpha/alpha_feature_test.go |
Verifies core Alpha behavior. |
cli/azd/docs/environment-variables.md |
Documents the environment-variable pattern. |
cli/azd/docs/alpha-features.md |
Documents opt-in semantics and host requirements. |
Review effort: Lite
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Add the beta UserConfigService.IsFeatureEnabled RPC and the AzdClient.IsFeatureEnabled helper. The host ORs alpha.<id> user config, its process environment, the azd environment dotenv values, and every azure.yaml service env map with Feature.IsEnabledWithSources. Missing project or environment sources are skipped. Remove the AZD_FOUNDRY_EXT_ENABLE_ runner patch, which the host-side check makes unnecessary.
Summary
Add a host-side check that extensions can call to ask whether a feature is enabled. The host collects every opt-in source and ORs them with the existing
alphalogic. This is the core-only first layer. The next PR adopts it in the Foundry extensions.Changes
UserConfigService.IsFeatureEnabledand SDK helperAzdClient.IsFeatureEnabled(ctx, id, envVar).alpha.<id>oralpha.allset toon.envvaluesenvmap of every service inazure.yamlalpha_features.yaml. The caller can pass an optional env var name. Without it, the registered name orAZD_ALPHA_ENABLE_<ID>is used.alphaprimitives stay: optionalenvVarmetadata,alpha.GetFeature,Feature.IsEnabledWithSources, plus a smallFeature.EnvVarNameshelper.FeatureManager.IsEnabledbehavior is unchanged.make protosteps.No production feature, extension code, dependency pin, telemetry, or changelog is changed.
Validation
go testonpkg/alpha,pkg/extensions,pkg/azdext/...,internal/grpcserver/...,grpc/...andcmd/middlewarepassed.go build ./..., gofmt, golangci-lint and cspell on changed files passed.E2E
A tiny local extension calls
IsFeatureEnabledthrough the real host. azd was built frommainand from this PR.ononlytrueonly.envonlyazure.yamlservice env only.envfalse and process trueazure.yamltrueoffand.envtrue