[Change Safety] Generator: emit static -AcquirePolicyToken/-ChangeReference on write cmdlets (Stage D)#1549
Draft
YangAn-microsoft wants to merge 4 commits into
Conversation
… to VTable dynamic-parameter delegate) Emit -AcquirePolicyToken (switch) and -ChangeReference (string) as static [Parameter] properties on azure write-verb cmdlets, categorized Azure. No IDynamicParameters, no Module.cs/VTable delegate wiring; the module-level HTTP pipeline step reads the values from BoundParameters by name.
…eters Gate implementChangeSafetyParameters on !endpointResourceIdKeyName (the generator's canonical data-plane signal, matching isDataPlane in module-class.ts), so only management-plane (ARM) write-verb cmdlets get -AcquirePolicyToken/-ChangeReference.
…meters) Use the exact parameter names and help messages defined in azure-powershell-common ChangeSafetyParameters so AutoRest and SDK cmdlets present identically to users.
…flag Add a change-safety project flag (default false) read from the module readme. implementChangeSafetyParameters only emits -AcquirePolicyToken/-ChangeReference when it is true, so the ~180-module rollout is deliberate (a module opts in alongside bumping its Az.Accounts minimum) rather than triggered by any unrelated regeneration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Emits the Change Safety opt-in parameters
-AcquirePolicyToken(SwitchParameter) and-ChangeReference(string) as static[Parameter]properties on generated Azure management-plane write-verb cmdlets, for modules that opt in via achange-safetyconfig flag. Their values flow through the cmdlet'sBoundParametersto the module-level pipeline step in Az.Accounts (Azure/azure-powershell#29840), which callsacquirePolicyTokenand stamps thex-ms-policy-external-evaluationsheader.What it does
implementChangeSafetyParameters()incmdlets/class.ts, invoked frominit().change-safetyconfig value (default false), read intoProject.changeSafetyininternal/project.ts. Nothing is emitted unless a module setschange-safety: truein its readme. This keeps the ~180-module rollout deliberate (a module opts in alongside bumping its Az.Accounts minimum) rather than triggered by any unrelated regeneration.change-safety: true→state.project.azure→ not data-plane (endpointResourceIdKeyName, matchingmodule-class.ts'sisDataPlane) → HTTP verb ∈ {PUT, POST, DELETE, PATCH}.azure-powershell-common'sChangeSafetyParameters, so SDK and AutoRest cmdlets present identically to users.IDynamicParameters, noModule.cs/.psm1wiring, nomodule-class.ts/powershell-declarations.tschanges.Scope
Two files:
powershell/cmdlets/class.tsandpowershell/internal/project.ts. With the flag off (the default), every module is a zero diff. With the flag on, read cmdlets (Get/List/Show/Test), data-plane cmdlets, and non-azure projects still get a zero diff.Verification
npm run build+npm run eslint: clean.Azure,ChangeReferencewithValidateNotNull), the read (Get) cmdlet gets none.tests-sdk1-support(-AllowList -SkipCsharp): 52 ×Equal— unaffected. That suite compares the shared SDK/model layer; cmdlets are PowerShell-only and out of scope.Dependencies / release order
BoundParameters.