Azure / Azure/azure-dev

Scope project extension discovery to the command and selected target

Open
#9,732 0 comments 0 reactions 0 assignees View on GitHub
area/extensions area/ux bug
Dominant language
Go
Stars
569
Forks
364
Avg merge
2d 18h
Merged PRs (30d)
130

Description

Project extension discovery currently checks every service host and every infrastructure provider before each supported project command. Most commands use only one provider type, and some commands target one service or one infrastructure layer.

This can produce unnecessary prompts and installs. It can also fail a command when an unrelated extension source is unavailable.

### Examples

`azd deploy` uses service targets. It does not use the provisioning manager, but extension discovery still checks `infra.provider` and every infrastructure layer.

`azd down` uses provisioning providers. It does not use service targets, but extension discovery still checks every `services[].host` value.

Targeted commands are also too broad:

```bash
azd deploy api
azd provision database
azd down database
```

These commands should resolve extensions only for the selected service or infrastructure layer. Today they inspect all configured targets.

### Expected scope

| Command | Providers to resolve |
|---|---|
| `up` | Provisioning providers and service target providers |
| `deploy`, `package`, `restore` | Service target providers for the selected service, or all services when no target is selected |
| `provision`, `down` | Provisioning provider for the selected layer, or all layers when no target is selected |
| `env refresh` | Provisioning providers used by refresh |

Explicit `requiredVersions.extensions` entries can remain project-wide unless that contract changes separately.

### Recommended design

Build a validated command scope before extension discovery. The scope should contain:

- whether the command needs service target providers, provisioning providers, or both
- the selected service, when one was provided
- the selected infrastructure layer, when one was provided

Pass this scope to `missingProjectExtensions`. Gate the service and infrastructure loops on it.

The command action and extension discovery must use the same target parsing and validation logic. An invalid service or layer must be reported before azd prompts for or installs extensions.

### Acceptance

- [ ] Service-only commands do not resolve provisioning providers.
- [ ] Provisioning-only commands do not resolve service target providers.
- [ ] A selected service limits provider resolution to that service.
- [ ] A selected infrastructure layer limits provider resolution to that layer.
- [ ] Invalid targets do not cause extension prompts or installs before validation.
- [ ] An unavailable source for an unrelated provider does not fail the command.
- [ ] `up` continues to resolve both provisioning and service target providers.
- [ ] Help and documentation invocations do not resolve or install extensions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.