Skip to content

Prototype beta extension input providers - #10872

Draft
Victor Vazquez (vhvb1989) wants to merge 2 commits into
mainfrom
invisibleAzure-inputsProtoccol
Draft

Victor Vazquez (vhvb1989) wants to merge 2 commits into
mainfrom
invisibleAzure-inputsProtoccol

Conversation

@vhvb1989

@vhvb1989 Victor Vazquez (vhvb1989) commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Summary

Prototype a provider-independent input-provider protocol for the Invisible Azure work. Core describes a missing input; installed extensions contribute options, recommendations, rationales, and optional required sets; core validates and selects a value or prompts.

  • Add a native beta-only InputService.Stream, authenticated capability registration, and Go SDK helpers WithBetaInputProvider / InputsBeta(). Stable v1 and legacy routes remain unchanged.
  • Union suggestions, intersect required sets and native constraints, and merge provenance. Automatically select a sole valid option or unique recommendation; otherwise prompt, or report a required selection under --no-prompt.
  • Resolve missing environment names and infrastructure locations through existing core consumers without adding template syntax. Keep explicit values, existing environments, parameter values, and native defaults ahead of recommendations.
  • Activate listeners lazily for input requests across commands, share startup with normal extension middleware, and clean up at the parent command boundary.
  • Extend the demo extension to offer names and locations and attribute automatic choices to their source extensions.
  • Document the protocol, selection policy, beta status, and initial scope; add unit and command integration coverage.

Initial scope

This iteration supports core-defined, immediate string inputs only. Runtime input definitions, resource creation, generated infrastructure, deferred fulfillment, and authored azure.yaml input declarations are not implemented. Required sets apply during missing-input resolution, not as global policy over explicit or persisted values.

Validation already completed locally

  • Affected-package tests covering commands, middleware, gRPC, SDK, environment management, input selection, provisioning, extensions, and the demo.
  • Full ./cmd and ./cmd/middleware short suites after command-wide activation changes.
  • Focused race checks for input-provider commands and middleware.
  • Go lint, spelling, and git diff --check.
  • Protobuf generation, lint, stable-to-beta compatibility, and historical breaking checks.
  • Offline smoke tests with the locally built and installed demo, including template-based azd init.

No Azure resources were deployed. Full repository preflight and live provisioning have not been run.

Review follow-ups

  • Preserve inactive initialization: skip provider-only binding discovery without providers or with an existing location; inspect Terraform references without evaluating substitutions.
  • Fail explicitly for input-provider startup failures and disconnected providers; retain best-effort startup for unrelated listeners and cover real startup failures.
  • Add process-environment precedence/conflict regressions for initialization and provisioning, including explicit flags and dotenv precedence.
  • Clarify the existing azd env new exception and provide consumer-specific remediation: this command does not consume AZURE_ENV_NAME.

The first Copilot review also prompted existing-name collision filtering, safe stream re-registration, shared Bicep location-constraint resolution, batched and strict provider quota validation, and removal of the unreleased singular response field. The affected-package short suites, focused race checks, lint, spelling, and protobuf compatibility checks pass after these fixes.

Local extension user-contract inspection: complete (6 files inspected; no new or removed command, positional parameter, flag, or YAML schema component). Capability values and runtime behavior are outside that structural pass.

Add a native beta input protocol, option and constraint coordination, command-wide lazy activation, environment and location consumers, and a demo provider with documentation and tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7a1605b8-7261-40f0-bffe-d92985ee7682
@azure-pipelines

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

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.

🟡 Changes recommended

Unresolved critical issues can let provider failures bypass required input constraints and environment-name collisions overwrite existing configuration.

10 open issues
What changed in this PR

Prototypes beta input providers within azd’s extension framework, letting extensions suggest missing environment names and infrastructure locations while core validates and selects values.

Changes:

  • Adds the beta input stream, capability authorization, and Go SDK helpers without changing stable or legacy routes.
  • Integrates option selection and lazy listener activation with environment creation, Bicep, and Terraform.
  • Adds a demo provider, regression coverage, and protocol documentation.

Extension user-contract review: blocked on unavailable review history. All 6 changed extension files were inspected; no structural contract changes or new contract comments were identified. Existing-thread counts remain unverified.

File Description
docs/​reference/​feature-status.md Records beta input-provider status and host requirements.
docs/​guides/​creating-an-extension.md Introduces input-provider authoring guidance.
docs/​architecture/​extension-framework.md Adds the input capability and coordination model.
cli/​azd/​test/​mocks/​mockinputs/​resolver.go Provides resolver mocks for consumer tests.
cli/​azd/​pkg/​prompt/​input.go Validates suggested locations against subscription locations.
cli/​azd/​pkg/​inputs/​inputs.go Combines constraints and selects or prompts for values.
cli/​azd/​pkg/​inputs/​inputs_test.go Covers combination, validation, and selection behavior.
cli/​azd/​pkg/​infra/​provisioning/​terraform/​terraform_provider.go Connects Terraform location bindings to input resolution.
cli/​azd/​pkg/​infra/​provisioning/​terraform/​terraform_provider_test.go Tests Terraform location-binding behavior.
cli/​azd/​pkg/​infra/​provisioning/​manager.go Resolves missing locations before native fallback.
cli/​azd/​pkg/​infra/​provisioning/​bicep/​prompt.go Distinguishes insufficient-quota results with a sentinel error.
cli/​azd/​pkg/​infra/​provisioning/​bicep/​input_test.go Tests Bicep precedence and location validation.
cli/​azd/​pkg/​infra/​provisioning/​bicep/​bicep_provider.go Resolves missing Bicep location parameters.
cli/​azd/​pkg/​extensions/​validate_registry.go Recognizes the input-provider capability.
cli/​azd/​pkg/​extensions/​registry.go Defines the input-provider capability constant.
cli/​azd/​pkg/​environment/​manager.go Resolves unnamed environments before fallback.
cli/​azd/​pkg/​environment/​manager_test.go Covers provider-driven environment naming.
cli/​azd/​pkg/​azdext/​input_provider.go Implements SDK registration and request handling.
cli/​azd/​pkg/​azdext/​input_envelope.go Supplies correlation and structured stream errors.
cli/​azd/​pkg/​azdext/​extension_host.go Wires beta providers into host lifecycle management.
cli/​azd/​pkg/​azdext/​contracts/​v1beta/​input.pb.go Adds generated beta input message types.
cli/​azd/​pkg/​azdext/​contracts/​v1beta/​input_grpc.pb.go Adds generated beta stream interfaces.
cli/​azd/​pkg/​azdext/​beta_service_event_manager.go Generalizes shared beta conversion and error helpers.
cli/​azd/​pkg/​azdext/​beta_service_event_manager_test.go Updates tests for renamed shared helpers.
cli/​azd/​pkg/​azdext/​azd_client.go Exposes the beta input client.
cli/​azd/​internal/​grpcserver/​versioned_services.go Supplies the native beta input implementation.
cli/​azd/​internal/​grpcserver/​versioned_services_test.go Extends beta registration fixtures.
cli/​azd/​internal/​grpcserver/​versioned_services_generated.go Registers the beta-only input service.
cli/​azd/​internal/​grpcserver/​server.go Adds the input service dependency.
cli/​azd/​internal/​grpcserver/​server_test.go Verifies beta-only routing and updates fixtures.
cli/​azd/​internal/​grpcserver/​prompt_service_test.go Updates server construction for input support.
cli/​azd/​internal/​grpcserver/​project_service_beta_e2e_test.go Updates the project-service server fixture.
cli/​azd/​internal/​grpcserver/​input_service.go Authorizes providers and gathers their contributions.
cli/​azd/​internal/​grpcserver/​input_service_test.go Covers stream authorization, resolution, and cleanup.
cli/​azd/​internal/​grpcserver/​beta_event_service_test.go Updates the event-service server fixture.
cli/​azd/​internal/​grpcserver/​account_service_test.go Updates the account-service server fixture.
cli/​azd/​internal/​cmd/​service_event_messages_graph_test.go Updates the graph command’s server fixture.
cli/​azd/​grpc/​README.md Documents the beta stream and response shapes.
cli/​azd/​grpc/​proto/​azd/​extensions/​v1beta/​input.proto Defines the beta input-provider wire contract.
cli/​azd/​extensions/​registry.schema.json Allows input-provider registry entries.
cli/​azd/​extensions/​microsoft.azd.demo/​README.md Documents demo options and selection behavior.
cli/​azd/​extensions/​microsoft.azd.demo/​internal/​cmd/​listen.go Registers static environment-name and location suggestions.
cli/​azd/​extensions/​microsoft.azd.demo/​internal/​cmd/​input_test.go Tests demo responses and recommendations.
cli/​azd/​extensions/​microsoft.azd.demo/​extension.yaml Declares input support and the newer host requirement.
cli/​azd/​extensions/​extension.schema.json Adds the input-provider manifest capability.
cli/​azd/​docs/​extensions/​extension-sdk-reference.md Documents provider registration and client access.
cli/​azd/​docs/​extensions/​extension-framework.md Explains matching, precedence, selection, and limitations.
cli/​azd/​docs/​extensions/​contract-versioning.md Describes native beta-only input routing.
cli/​azd/​cmd/​root.go Registers command-wide input-provider middleware.
cli/​azd/​cmd/​root_test.go Updates expected middleware registration order.
cli/​azd/​cmd/​middleware/​middleware_test.go Tests lazy activation, reuse, and startup errors.
cli/​azd/​cmd/​middleware/​input_providers.go Activates providers on demand with parent-owned cleanup.
cli/​azd/​cmd/​middleware/​extensions.go Shares listener startup with input activation.
cli/​azd/​cmd/​middleware/​extensions_start_test.go Updates listener-startup server fixtures.
cli/​azd/​cmd/​input_provider_test.go Adds command integration coverage using the demo.
cli/​azd/​cmd/​extension_action_test.go Updates the extension-action server fixture.
cli/​azd/​cmd/​container.go Registers the shared input service and resolver.

Review effort: Max

Comment thread cli/azd/cmd/middleware/extensions.go Resolved
Comment thread cli/azd/pkg/environment/manager.go Resolved
Comment thread cli/azd/pkg/inputs/inputs.go Resolved
Preserve native input precedence and inactive initialization, harden provider lifecycle failures, reject existing environment names, and validate shared Bicep bindings with batched strict quota checks. Remove the unreleased singular beta response field.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7a1605b8-7261-40f0-bffe-d92985ee7682

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.

🟡 Changes recommended

Unresolved input-provider issues can abort commands that need no input, cause refresh timeouts through duplicate activation, and persist locations that violate template constraints.

2 open issues
4 previously missed issues

In code that hasn't changed since last review

Medium severity Reuse the existing listener when the activator starts the demo first

cli/​azd/​cmd/​middleware/​input_providers.go:87

ExtensionActivator can already have started the demo for a provisioning layer before azd env refresh requests a missing native location. This path launches it again; its one-shot readiness signal was consumed by the first activation, so the second startup times out and refresh fails. Reuse shared listener/server ownership with ExtensionActivator and cover the activator-first path.

Medium severity Enforce template constraints before saving provider-selected values

cli/​azd/​pkg/​infra/​provisioning/​bicep/​bicep_provider.go:364

In .bicepparam mode, this selects and saves a provider location without the bound parameter's allowed-value, length, or quota constraints. With a template allowing only westus3, the demo can persist its eastus2 recommendation even though it also offers a valid alternative. Apply the template constraints before selecting and saving a provider value, or retain the existing fallback until those constraints are available.

Medium severity Report ambiguous no-prompt inputs in the missing-input guidance

cli/​azd/​pkg/​infra/​provisioning/​bicep/​bicep_provider.go:3963

For an unmapped location with ambiguous provider options under --no-prompt, this returns a PromptRequiredError with no source explaining how to supply the value. It exits before buildMissingInputsError, losing the infra.parameters.<name> guidance and the other missing parameters. Treat this no-prompt ambiguity as unresolved so the caller includes the group in its normal missing-input report.

Low severity Update BetaInputHandler documentation to use the response type

cli/​azd/​docs/​extensions/​extension-sdk-reference.md:742

This still describes the removed singular-value shape. BetaInputHandler (pkg/azdext/input_provider.go:22) returns (*v1beta.ResolveInputResponse, error), which matches the WithBetaInputProvider row above (line 697) and the framework guide. An SDK user following this paragraph would write a handler that doesn't compile.

10 resolved since last review

Review effort: Max

Comment on lines +336 to +338
if err := errors.Join(inputFailures...); err != nil {
cleanup()
return nil, err
Comment on lines +180 to +182
if len(valid) == 0 {
return nil, fmt.Errorf("no valid input provider options remain for input %q", definition.Id)
}

This branch has not been deployed

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

Labels

ext-demo microsoft.azd.demo extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants