Skip to content

{Core} Add prebuilt command index/help index for core modules#32929

Draft
DanielMicrosoft wants to merge 1 commit intoAzure:devfrom
DanielMicrosoft:xxxxx-prebuilt-command-index
Draft

{Core} Add prebuilt command index/help index for core modules#32929
DanielMicrosoft wants to merge 1 commit intoAzure:devfrom
DanielMicrosoft:xxxxx-prebuilt-command-index

Conversation

@DanielMicrosoft
Copy link
Contributor

@DanielMicrosoft DanielMicrosoft commented Mar 6, 2026

Related command

Description

Loop doc (WIP)

Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


This checklist is used to make sure that common guidelines for a pull request are followed.

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Mar 6, 2026

❌AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
❌core
❌latest
❌3.12
Type Test Case Error Message Line
Failed test_command_index self = <azure.cli.core.tests.test_command_registration.TestCommandRegistration testMethod=test_command_index>

    @mock.patch('importlib.import_module', mock_import_lib)
    @mock.patch('pkgutil.iter_modules', mock_iter_modules)
    @mock.patch('azure.cli.core.commands.load_command_loader', mock_load_command_loader)
    @mock.patch('azure.cli.core.extension.get_extension_modname', mock_get_extension_modname)
    @mock.patch('azure.cli.core.extension.get_extensions', mock_get_extensions)
    def test_command_index(self):
        from azure.cli.core.session import INDEX
        from azure.cli.core import CommandIndex, version
    
        cli = DummyCli()
        loader = cli.commands_loader
        command_index = CommandIndex(cli)
    
        def set_index(dict):
            INDEX[CommandIndex.COMMAND_INDEX] = dict
    
        def check_index():
            self.assertEqual(INDEX[CommandIndex.COMMAND_INDEX_VERSION], version)
            self.assertEqual(INDEX[CommandIndex.COMMAND_INDEX_CLOUD_PROFILE], cli.cloud.profile)
            self.assertDictEqual(INDEX[CommandIndex.COMMAND_INDEX], self.expected_command_index)
    
        # Clear the command index
        set_index({})
        self.assertFalse(INDEX[CommandIndex.COMMAND_INDEX])
        loader.load_command_table(None)
        # Test command index is built for None args
        check_index()
    
        # Test command index is built when args is provided
        set_index({})
        loader.load_command_table(["hello", "mod-only"])
>       check_index()

src/azure-cli-core/azure/cli/core/tests/test_command_registration.py:339: 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
                         
src/azure-cli-core/azure/cli/core/tests/test_command_registration.py:327: in _check_index
    self.assertDictEqual(INDEX[CommandIndex._COMMAND_INDEX], self.expected_command_index)
E   AssertionError: defaultdict(<class 'list'>, {'hello': ['a[107 chars]a']}) != {'hello': ['azure.cli.command_modules.hel[78 chars]ra']}
E   - defaultdict(<class 'list'>,
E   -             {'extra': ['azure.cli.command_modules.extra'],
E   ? ------------
E   
E   + {'extra': ['azure.cli.command_modules.extra'],
E   +  'hello': ['azure.cli.command_modules.hello', 'azext_hello2', 'azext_hello1']}
E   -              'hello': ['azext_hello1',
E   -                        'azext_hello2',
E   -                        'azure.cli.command_modules.hello']})
azure/cli/core/tests/test_command_registration.py:307
Failed test_command_index_positional_argument self = <azure.cli.core.tests.test_command_registration.TestCommandRegistration testMethod=test_command_index_positional_argument>

    @mock.patch('importlib.import_module', _mock_import_lib)
    @mock.patch('pkgutil.iter_modules', _mock_iter_modules)
    @mock.patch('azure.cli.core.commands._load_command_loader', _mock_load_command_loader)
    @mock.patch('azure.cli.core.extension.get_extension_modname', _mock_get_extension_modname)
    @mock.patch('azure.cli.core.extension.get_extensions', _mock_get_extensions)
    def test_command_index_positional_argument(self):
        from azure.cli.core._session import INDEX
        from azure.cli.core import CommandIndex
    
        cli = DummyCli()
        loader = cli.commands_loader
        index = CommandIndex()
        index.invalidate()
    
        # Test command index is built for command with positional argument
        cmd_tbl = loader.load_command_table(["extra", "extra", "positional_argument"])
>       self.assertDictEqual(INDEX[CommandIndex._COMMAND_INDEX], self.expected_command_index)
E       AssertionError: defaultdict(<class 'list'>, {'hello': ['a[107 chars]a']}) != {'hello': ['azure.cli.command_modules.hel[78 chars]ra']}
E       - defaultdict(<class 'list'>,
E       -             {'extra': ['azure.cli.command_modules.extra'],
E       ? ------------
E       
E       + {'extra': ['azure.cli.command_modules.extra'],
E       +  'hello': ['azure.cli.command_modules.hello', 'azext_hello2', 'azext_hello1']}
E       -              'hello': ['azext_hello1',
E       -                        'azext_hello2',
E       -                        'azure.cli.command_modules.hello']})

src/azure-cli-core/azure/cli/core/tests/test_command_registration.py:713: AssertionError
azure/cli/core/tests/test_command_registration.py:696
❌3.13
Type Test Case Error Message Line
Failed test_command_index self = <azure.cli.core.tests.test_command_registration.TestCommandRegistration testMethod=test_command_index>

    @mock.patch('importlib.import_module', mock_import_lib)
    @mock.patch('pkgutil.iter_modules', mock_iter_modules)
    @mock.patch('azure.cli.core.commands.load_command_loader', mock_load_command_loader)
    @mock.patch('azure.cli.core.extension.get_extension_modname', mock_get_extension_modname)
    @mock.patch('azure.cli.core.extension.get_extensions', mock_get_extensions)
    def test_command_index(self):
        from azure.cli.core.session import INDEX
        from azure.cli.core import CommandIndex, version
    
        cli = DummyCli()
        loader = cli.commands_loader
        command_index = CommandIndex(cli)
    
        def set_index(dict):
            INDEX[CommandIndex.COMMAND_INDEX] = dict
    
        def check_index():
            self.assertEqual(INDEX[CommandIndex.COMMAND_INDEX_VERSION], version)
            self.assertEqual(INDEX[CommandIndex.COMMAND_INDEX_CLOUD_PROFILE], cli.cloud.profile)
            self.assertDictEqual(INDEX[CommandIndex.COMMAND_INDEX], self.expected_command_index)
    
        # Clear the command index
        set_index({})
        self.assertFalse(INDEX[CommandIndex.COMMAND_INDEX])
        loader.load_command_table(None)
        # Test command index is built for None args
        check_index()
    
        # Test command index is built when args is provided
        set_index({})
        loader.load_command_table(["hello", "mod-only"])
>       check_index()

src/azure-cli-core/azure/cli/core/tests/test_command_registration.py:339: 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
                         
src/azure-cli-core/azure/cli/core/tests/test_command_registration.py:327: in _check_index
    self.assertDictEqual(INDEX[CommandIndex._COMMAND_INDEX], self.expected_command_index)
E   AssertionError: defaultdict(<class 'list'>, {'hello': ['a[107 chars]a']}) != {'hello': ['azure.cli.command_modules.hel[78 chars]ra']}
E   - defaultdict(<class 'list'>,
E   -             {'extra': ['azure.cli.command_modules.extra'],
E   ? ------------
E   
E   + {'extra': ['azure.cli.command_modules.extra'],
E   +  'hello': ['azure.cli.command_modules.hello', 'azext_hello2', 'azext_hello1']}
E   -              'hello': ['azext_hello1',
E   -                        'azext_hello2',
E   -                        'azure.cli.command_modules.hello']})
azure/cli/core/tests/test_command_registration.py:307
Failed test_command_index_positional_argument self = <azure.cli.core.tests.test_command_registration.TestCommandRegistration testMethod=test_command_index_positional_argument>

    @mock.patch('importlib.import_module', _mock_import_lib)
    @mock.patch('pkgutil.iter_modules', _mock_iter_modules)
    @mock.patch('azure.cli.core.commands._load_command_loader', _mock_load_command_loader)
    @mock.patch('azure.cli.core.extension.get_extension_modname', _mock_get_extension_modname)
    @mock.patch('azure.cli.core.extension.get_extensions', _mock_get_extensions)
    def test_command_index_positional_argument(self):
        from azure.cli.core._session import INDEX
        from azure.cli.core import CommandIndex
    
        cli = DummyCli()
        loader = cli.commands_loader
        index = CommandIndex()
        index.invalidate()
    
        # Test command index is built for command with positional argument
        cmd_tbl = loader.load_command_table(["extra", "extra", "positional_argument"])
>       self.assertDictEqual(INDEX[CommandIndex._COMMAND_INDEX], self.expected_command_index)
E       AssertionError: defaultdict(<class 'list'>, {'hello': ['a[107 chars]a']}) != {'hello': ['azure.cli.command_modules.hel[78 chars]ra']}
E       - defaultdict(<class 'list'>,
E       -             {'extra': ['azure.cli.command_modules.extra'],
E       ? ------------
E       
E       + {'extra': ['azure.cli.command_modules.extra'],
E       +  'hello': ['azure.cli.command_modules.hello', 'azext_hello2', 'azext_hello1']}
E       -              'hello': ['azext_hello1',
E       -                        'azext_hello2',
E       -                        'azure.cli.command_modules.hello']})

src/azure-cli-core/azure/cli/core/tests/test_command_registration.py:713: AssertionError
azure/cli/core/tests/test_command_registration.py:696
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Mar 6, 2026

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan
Copy link
Collaborator

yonzhan commented Mar 6, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot Core CLI core infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants