feat: gate azd tool command group behind alpha feature flag#8111
Conversation
Register a new 'tool' alpha feature in alpha_features.yaml and gate: - Command registration in toolActions() (tool.go/root.go) - ToolFirstRunMiddleware (tool_first_run.go) - ToolUpdateCheckMiddleware (tool_update_check.go) Users enable via: azd config set alpha.tool on Or env var: AZD_ALPHA_ENABLE_TOOL=true Tests updated to set AZD_ALPHA_ENABLE_TOOL=true where needed, with new test cases verifying the feature is hidden when the flag is off. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add debug logging when user config fails to load for alpha gating - Move alpha check to call site in root.go for clearer nil-safety - Verify YAML description formatting Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR gates the azd tool command group and its related middleware (first-run tool check + background update check) behind the tool alpha feature, so the functionality is fully present but hidden by default unless explicitly enabled via config/env var.
Changes:
- Adds a new
toolentry to the alpha feature registry. - Gates
azd toolcommand registration during command-tree construction based on the alpha feature state. - Updates tool-related middleware to early-exit when the alpha feature is disabled, and adjusts tests/snapshots to enable the feature when exercising tool functionality.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/resources/alpha_features.yaml | Registers the new tool alpha feature id and description. |
| cli/azd/cmd/root.go | Constructs a feature manager early and conditionally registers azd tool commands. |
| cli/azd/cmd/tool.go | Clarifies via comment that the caller gates command registration. |
| cli/azd/cmd/middleware/tool_first_run.go | Skips first-run tool experience when tool alpha is disabled. |
| cli/azd/cmd/middleware/tool_update_check.go | Skips update notification/check behavior when tool alpha is disabled. |
| cli/azd/cmd/middleware/tool_first_run_test.go | Updates tests to enable the alpha flag where needed and adds an alpha-disabled no-op test. |
| cli/azd/cmd/middleware/tool_update_check_test.go | Updates tests to enable the alpha flag where needed and adds an alpha-disabled no-op test. |
| cli/azd/cmd/usage_test.go | Enables the alpha flag so usage snapshots include azd tool when intended. |
| cli/azd/cmd/figspec_test.go | Enables the alpha flag so Fig spec generation includes azd tool when intended. |
| .github-pr-body.md | Removes a PR body template file (not described in the PR summary). |
Comments suppressed due to low confidence (1)
.github-pr-body.md:1
- This PR removes .github-pr-body.md, but the PR description focuses on gating the
azd toolcommand group behind an alpha flag and doesn't mention repo metadata/template changes. If this deletion is intentional, it would help to call it out in the description; if not, consider reverting it to keep the PR scoped.
Agent-Logs-Url: https://github.com/Azure/azure-dev/sessions/7533f068-c1ba-4a27-8dd4-4b099411d8f9 Co-authored-by: rajeshkamal5050 <11532743+rajeshkamal5050@users.noreply.github.com>
- Define tool.FeatureAlphaTool via alpha.MustFeatureKey('tool') in pkg/tool/feature.go
- Replace hard-coded alpha.FeatureId('tool') in root.go, tool_first_run.go, tool_update_check.go
- Add TestToolCommandAlphaGating test verifying command absent/present based on flag
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jongio
left a comment
There was a problem hiding this comment.
Clean feature-gating PR. Command-tree gating plus middleware early-return is the right approach for hiding an unreleased command group - users won't see azd tool in help text when the flag is off, and the middleware skips cleanly on all commands.
FeatureAlphaTool via MustFeatureKey follows the same pattern as FeatureCopilot and FeatureDeploymentStacks. The standalone config manager in newAlphaManagerForCommandTree() is the right trade-off since DI isn't available during command-tree construction.
Tests cover both enabled and disabled paths for command registration and both middleware components.
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
|
/check-enforcer override |
Summary
Gates the
azd toolcommand group and its associated middleware (first-run tool check, background update check) behind an alpha feature flag. The feature is fully implemented but not yet ready for public release.When disabled (default),
azd toolcommands are not registered and middleware silently passes through. When enabled, all tool management functionality is available.Related
Changes
Feature Registration
resources/alpha_features.yaml— Addedtoolalpha feature entryCommand Gating
cmd/root.go— ResolvesFeatureManager, gatestoolActions()call behindIsEnabled("tool"); logs warning on config load failurecmd/tool.go— Caller gates command registration;toolActions()only called when feature enabledpkg/tool/feature.go— DefinesFeatureAlphaToolviaalpha.MustFeatureKey("tool")shared constantMiddleware Gating
cmd/middleware/tool_first_run.go— Early return inRun()when alpha flag is offcmd/middleware/tool_update_check.go— Same early return patternTests
cmd/tool_test.go— NewTestToolCommandAlphaGatingverifying command absent/present based on flagAZD_ALPHA_ENABLE_TOOL=trueto exercise full middleware logicfigspec_test.go,usage_test.go) set env var for tool command visibilityHow to Enable
Testing