fix: unblock CLI generator when local aaz repo misses command models or versions - #572
Open
Jian Hui (huiii99) wants to merge 1 commit into
Open
Jian Hui (huiii99) wants to merge 1 commit into
Jian Hui (huiii99) wants to merge 1 commit into
Conversation
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.
Problem
Opening the CLI generator page for a module fails hard when the local
aazrepo is out of sync with the generated code inazure-cli:Miss command groups in aaz: 'az network virtual-appliance migration'blocks the page from loading at all. The only workaround is to manually delete the generated code undersrc/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/....ResponseError: Version '2025-07-01' of command 'network application-gateway address-pool create' not exist in AAZblocks generation, even when the commands being generated are unrelated.Both are caused by drift between

azure-cliandaaz, and they block work on completely unrelated commands.Solution
Commands and command groups that have no model in the local
aazrepo no longer abort the page or the generation, they are reported instead of raising:AzAtomicProfileBuilder(patch mode only).Generate Edited Only(PATCH) no longer deletes anything and keeps the existing files imported by the generated__init__.py, so code with no model inaazsurvives untouched.Generate All(PUT) is unchanged, it still regenerates the wholeaazfolder from the localaazrepo, and the dialog now warns that this deletes/downgrades the listed commands.The
aaz-dev cli generatecommand line path is unchanged, it still fails loudly on missing models.Testing
src/aaz_dev/cli/tests/test_codegen_regressions.py: patch generation keeps files missing fromaazand accepts a removed command version.src/web/src/__tests__/unit/cli/CLIModGeneratorProfileCommandTree.test.ts: missing groups are reported instead of thrown, removed versions are replaced and collected for the warning.pytest src/aaz_dev/cli/tests/test_codegen_regressions.py,pnpm -C src/web test(383 passed),tsc --noEmit, andpnpm lintreports no new issue in the changed files.networkmodule inazure-cliagainst a localaazrepo that misses thenetwork virtual-appliance migrationcommand group and the version of 113 commands (2025-07-01, only2022-05-01is inaaz).Version '2025-07-01' of command 'network application-gateway address-pool create' not exist in AAZ.pnpm build:web+pnpm bundle, the served UI is a build artifact so the frontend fix needs a rebuild): the page opens without deleting any generated code, the generate dialog lists the 1 missing group and the 113 missing versions,Generate Edited Onlyremoves 0 files and 0 folders, and the target commands are generated.Docs
docs/pages/usage/cli_generator.mdupdated: theMiss command modelssection now describes the warning instead of the error, andRemove commandsstates that unpicked commands are removed byGenerate All.