[layers] azd hooks run does not discover V2 layer hooks
- Dominant language
- Go
- Stars
- 569
- Forks
- 364
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 136
Description
## Description
Top-level V2 `layers` are stored in `ProjectConfig.Layers`, but `hooksRunAction` still validates, filters, and executes layer hooks through the legacy `ProjectConfig.Infra` model:
- `--layer` validation calls `projectConfig.Infra.GetLayer(...)`.
- Layer hook execution and validation iterate `projectConfig.Infra.Layers`.
For a V2 project, `ProjectConfig.Infra.Layers` is empty. As a result:
- `azd hooks run preprovision --layer ` cannot resolve a valid V2 layer.
- Running hooks without `--layer` silently skips hooks declared on V2 infrastructure entries.
## Expected behavior
`azd hooks run` should discover infrastructure entries and their hooks through the format-independent project model so V1 `infra.layers` and V2 top-level `layers` behave consistently.
## Suggested validation
Add an offline functional test modeled after `Test_CLI_Hooks_Run_RegistrationAndRun`. The test should spawn the real `azd` binary against a V2 fixture, run `azd hooks run preprovision --layer `, and assert the layer hook writes to the trace file.
## Scope
This is a follow-up issue. It is intentionally **not fixed by #9913 or by any PR in its current stack**.
Contributor guide
Assessment
This issue has not been assessed yet.