Repository navigation
Require Beta names for v1beta Go SDK surface - #10988
Victor Vazquez (vhvb1989) wants to merge 1 commit into
Conversation
Document and enforce that public pkg/azdext APIs exposing contracts/v1beta types include "Beta" in their names (<Service>Beta(), WithBeta<Capability>, Beta<Type>), so extension authors can see they depend on preview gRPC functionality and graduation stays additive. Protobuf names stay unchanged. - Add TestBetaSDKSurfaceIsNamedBeta with legacy exceptions for Compose, Copilot, CommandResult, and the deprecated ServiceTargetPreviewEnvelope. - Add Beta SDK naming guidance to contract-versioning.md, grpc/README.md, and extension-framework.md. - Update the azd-grpc-contracts skill and its eval. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ae59a44c-55d1-4b5a-a730-c4323926dcf2
|
Azure Pipelines: Successfully started running 1 pipeline(s). 26 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.
🟡 Changes recommended
The beta-naming gate misses aliased imports and beta-named local types, while the policy leaves beta-backed wrappers using SDK-native types uncovered.
4 open issues
What changed in this PR
Makes preview gRPC usage explicit in the Go extension SDK through required Beta names, while keeping graduation to stable APIs additive.
Changes:
- Adds an AST-based naming check with legacy compatibility exceptions.
- Documents SDK naming rules separately from protobuf channel naming.
- Updates contract-lifecycle skill guidance and adds a planning evaluation.
| File | Description |
|---|---|
cli/azd/test/evals/eval-azd-grpc-contracts.yaml |
Adds a beta-service planning evaluation covering SDK names. |
cli/azd/pkg/azdext/beta_naming_test.go |
Adds the SDK naming scanner and legacy exceptions. |
cli/azd/grpc/README.md |
Links protobuf channel guidance to SDK naming policy. |
cli/azd/docs/extensions/extension-framework.md |
Introduces visible beta SDK naming conventions. |
cli/azd/docs/extensions/contract-versioning.md |
Defines naming rules and additive graduation behavior. |
.github/skills/azd-grpc-contracts/SKILL.md |
Adds beta naming as a required invariant. |
.github/skills/azd-grpc-contracts/references/inspect-and-validate.md |
Adds naming checks to validation guidance. |
.github/skills/azd-grpc-contracts/references/graduate-to-v1.md |
Requires stable names alongside deprecated beta APIs. |
.github/skills/azd-grpc-contracts/references/add-to-v1beta.md |
Specifies naming for new beta SDK APIs. |
Review effort: Max
| Extension authors must be able to tell from the Go SDK call site that they | ||
| depend on preview functionality. Every new public `pkg/azdext` name whose | ||
| signature or exported shape exposes `contracts/v1beta` types, directly or | ||
| through another SDK type, must contain `Beta`: |
| // A local type is beta when its public shape references v1beta or another beta local type. | ||
| betaTypes := map[string]bool{} |
| if pkg, ok := n.X.(*ast.Ident); ok && pkg.Name == "v1beta" { | ||
| found = true |
| `Compose()`, `Copilot()`, and `CommandResult()` predate this rule and keep their | ||
| names for source compatibility. `TestBetaSDKSurfaceIsNamedBeta` in `pkg/azdext` | ||
| enforces the convention and lists these exceptions; do not add new ones. |
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|


Summary
Extension authors should be able to tell from their Go code that they're using preview gRPC functionality. Past beta APIs followed this informally (
EventsBeta(),ProjectBeta(),AccountBeta(),BetaServiceTarget(),WithBetaServiceEventHandler,WithBetaServiceTargetPreview). However, neither the docs nor theazd-grpc-contractsskill required it, so new beta SDK surface could ship with stable-looking names.The
Betanames also keep graduation additive. Graduation adds the stable name withoutBetaand deprecates theBetaone, asAccountBeta()→Account()andWithBetaServiceTargetPreview→WithServiceTargetPreviewdid. An accessor withoutBetathat returns av1betaclient can't move tov1without breaking callers' source.Changes
pkg/azdext/beta_naming_test.goaddsTestBetaSDKSurfaceIsNamedBeta. It parses the package and fails when an exported type, function, or method exposescontracts/v1beta(directly or through another package type) withoutBetain its name.Compose()andCopilot()(they predate contract versioning),CommandResult(), and the deprecatedServiceTargetPreviewEnvelope.contract-versioning.md, with short pointers ingrpc/README.mdandextension-framework.md. Protobuf names still don't useBeta, because thev1betapackage already identifies the channel.azd-grpc-contracts(SKILL.mdinvariants, the add, graduate, and validate references) plus a new eval stimulus.Validation
go test ./pkg/azdext/passes onmain.infra generate#10931's head. It flagsInfraGeneration(),WithInfraGenerationProvider,InfraGenerationProviders,InfraGenerationProvider,InfraGenerationProviderRegistration, and theInfraGenerationEnvelopemethods.golangci-lintis clean, and cspell finds nothing new in the changed lines.