Skip to content

[VM] Fix #34063: az vmss update: Clear the opposite zone placement filter when switching filters - #34164

Draft
Aditya Pujara (a0x1ab) wants to merge 1 commit into
Azure:devfrom
a0x1ab:agent-assist/azure-azure-cli-issue-34063-338c19fac314
Draft

Aditya Pujara (a0x1ab) wants to merge 1 commit into
Azure:devfrom
a0x1ab:agent-assist/azure-azure-cli-issue-34063-338c19fac314

Conversation

@a0x1ab

Copy link
Copy Markdown
Member

Related command

az vmss update

Description

Fixes #34063.

Clear the opposite zone placement filter when switching filters.

Testing Guide

  • Run az vmss update.
  • Focused regression coverage: src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py, src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py.
  • Repository CI and the authorized live-test workflow validate the published revision.

History Notes

[VM] az vmss update: Clear the opposite zone placement filter when switching filters


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

@x-engineering-agent x-engineering-agent Bot added the Request X Engineering Agent Request X Engineering Agent testing and review label Oct 4, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added the Auto-Assign Auto assign by bot label Oct 4, 2026
@a0x1ab

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@x-engineering-agent

This comment has been minimized.

@a0x1ab

Copy link
Copy Markdown
Member Author

@Azure/x-engineering-agent Please fix the PR-induced playback regression: the new --exclude-zones 3 step in test_vmss_update_zone_placement_policy has no matching cassette, so official full-test build 356730 fails with CannotOverwriteExistingCassetteException in both Python 3.12 and 3.14 instance 2. Preserve deterministic unit coverage for clearing the opposite zone filter, and restore the existing recorded scenario unless a complete successful live recording can be obtained. Live run 37219139154 separately failed because this test subscription is not eligible for VMSS Placement preview; do not change shared subscription configuration or publish the failed recording. Distinguish unrelated baseline ACS/SQL/core style findings from this PR regression, rerun affected playback tests, and complete the supported review cycle on the resulting head.

@x-engineering-agent x-engineering-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aditya Pujara (@a0x1ab)

Review

Correct the PR-induced playback regression before making this draft ready. At head ae90ef5a871d098d3df4f17cc047a0312c8437a1, the newly added filter-switch commands in src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py issue HTTP requests that the unchanged tests/latest/recordings/test_vmss_update_zone_placement_policy.yaml cassette cannot satisfy. Both affected full-test shards report that matching requests have already been consumed.

Restore the pre-existing recorded scenario unless a complete successful replacement recording is obtained through the authorized live-test workflow. Preserve the opposite-filter cleanup in vm/custom.py and the new TestVMSSUpdateZonePlacement unit tests, including both transition directions, full VMSSCreate(command_args=...) assertions, omitted/null placement, unchanged filters, unrelated updates, and dual-flag rejection. This also addresses the explicit reporter feedback.

Upstream CI

azdev-style

  • Result: failure
  • Relevance: Not PR-related
  • Evidence: Task log: acs/custom.py:1087,2946,2964 W0718; acs/azurecontainerstorage/_validators.py:361 R0916; sql/custom.py:1779 W0613; azure-cli-core/azure/cli/core/commands/arm.py:178 W0622; Pylint: FAILED; Flake8: PASSED; exit code 12.
  • Suggested fix: All reported files are outside this VM-only diff. No source change is requested for this failure; rerun the workflow or escalate the existing ACS/SQL/core diagnostics to their owners.
  • Verify: Rerun azdev-style on the corrected head.

Azure.azure-cli Full Test

  • Result: failure
  • Included checks: Azure.azure-cli Full Test (Automation Full Test Python312 Profile Latest instance2), Azure.azure-cli Full Test (Automation Full Test Python314 Profile Latest instance2)
  • Failure details:
      raise AssertionError(ex)

E AssertionError: Can't overwrite existing cassette ('/mnt/vss/_work/1/s/src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vmss_update_zone_placement_policy.yaml') in your current record mode (<RecordMode.ONCE: 'once'>).
E No match for the request (<Request (GET) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmss_update_zone_placement_000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss-update-include-zones?api-version=2026-04-01>) was found.
E Found 3 recorded request(s) matching (<Request (GET) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmss_update_zone_placement_000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss-update-include-zones?api-version=2026-04-01>) but they have already been consumed.
src/azure-cli-testsdk/azure/cli/testsdk/base.py:308: AssertionError
- Next action: The added VMSS filter-switch requests exhaust the unchanged test_vmss_update_zone_placement_policy.yaml cassette. Restore the pre-existing recorded scenario while retaining the new deterministic unit tests, unless the authorized live workflow can produce a complete successful replacement recording.
- Verify: Run azdev test vm.test_custom_vm_commands vm.test_vmss_update_zone_placement_policy, then rerun the Python 3.12 and 3.14 instance2 full-test jobs.

      raise AssertionError(ex)

E AssertionError: Can't overwrite existing cassette ('/mnt/vss/_work/1/s/src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vmss_update_zone_placement_policy.yaml') in your current record mode (<RecordMode.ONCE: 'once'>).
E No match for the request (<Request (GET) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmss_update_zone_placement_000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss-update-include-zones?api-version=2026-04-01>) was found.
E Found 3 recorded request(s) matching (<Request (GET) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_vmss_update_zone_placement_000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss-update-include-zones?api-version=2026-04-01>) but they have already been consumed.
src/azure-cli-testsdk/azure/cli/testsdk/base.py:308: AssertionError
- Next action: The added VMSS filter-switch requests exhaust the unchanged test_vmss_update_zone_placement_policy.yaml cassette. Restore the pre-existing recorded scenario while retaining the new deterministic unit tests, unless the authorized live workflow can produce a complete successful replacement recording.
- Verify: Run azdev test vm.test_custom_vm_commands vm.test_vmss_update_zone_placement_policy, then rerun the Python 3.12 and 3.14 instance2 full-test jobs.

Azure.azure-cli

  • Result: failure
  • Included checks: Azure.azure-cli (Check CLI Style)
  • Failure details:
    • Check CLI Style / Bash (Not PR-related)
      • Evidence: src/azure-cli/azure/cli/command_modules/acs/custom.py:2946:11: W0718: Catching too general exception Exception (broad-exception-caught)
        src/azure-cli/azure/cli/command_modules/acs/custom.py:2964:11: W0718: Catching too general exception Exception (broad-exception-caught)
        ************* Module azure.cli.command_modules.acs.azurecontainerstorage._validators
        src/azure-cli/azure/cli/command_modules/acs/azurecontainerstorage/_validators.py:361:19: R0916: Too many boolean expressions in if statement (6/5) (too-many-boolean-expressions)

Your code has been rated at 10.00/10
ERROR: Pylint: FAILED
Running flake8 on modules...
Flake8: PASSED
- Next action: The quoted ACS files are not changed by this VM PR. No unrelated source change is requested; rerun Check CLI Style or escalate these existing diagnostics to the owning component.
- Verify: Rerun Azure.azure-cli / Check CLI Style on the corrected head.

Test validation

  • Live test: Failed with conclusion failure. Workflow run
  • Regression coverage: For vm: 2 focused test file(s) changed. Scenario coverage is unverified; review the issue's required conditions, test setup, and assertions before approval. Changed tests invoke az vmss update, but invocation alone does not verify the required scenario or output. No linked issue was found in the PR timeline; inspect the source issue and its required scenario manually.

The existing Agent live-test result is not PR-related (environment): Compute returned Setting Placement on Virtual Machine Scale Sets is only allowed for preview customers. The failure occurs during the initial vmss create at test_vm_commands.py:15262, before either new transition. The run reports 16 passed and 1 failed; it does not establish successful live transition coverage.

Do not change shared subscription configuration, synthesize cassette interactions, or publish the incomplete recording from live-test-pr-34164. Successful live recording requires an already-authorized preview-enabled environment; otherwise retain the existing recorded scenario and validate the new deterministic tests through upstream CI.

I inspected the source issue directly despite the timeline lookup above finding no link. The unit tests exercise the actual update handler with persisted camelCase filters and assert the complete outgoing arguments in both directions. The changed scenario also asserts the surviving filter and absence of the opposite filter, but it lacks a successful recording of those added interactions. No additional semantic defect was confirmed in the production cleanup. The PR's testing guide is author-provided guidance, not evidence of another completed Agent live run.

Risk assessment

16/100 · Low · High confidence

The Low rating is driven by public CLI behavior.

  • Change scope: 3 changed files, 184 changed lines (+181 / -3), including 1 production file.
  • Affected components: vm
  • Risk drivers: public CLI behavior (+18)
  • Regression evidence: Changed regression tests are included, reducing risk.
  • Confidence: High because changed-line patches were available for every production file.
  • Required review: Owning-squad review is recommended for vm before merge.

Posted by x-engineering-agent (Reviewer)

@x-engineering-agent x-engineering-agent Bot added the X Engineering Agent Reviewed Pull request reviewed by X Engineering Agent label Oct 4, 2026
@a0x1ab
Aditya Pujara (a0x1ab) force-pushed the agent-assist/azure-azure-cli-issue-34063-338c19fac314 branch from ae90ef5 to 56dde0c Compare October 4, 2026 18:45
@a0x1ab

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@x-engineering-agent

Copy link
Copy Markdown
Contributor

Live test results — azdev test --live --series (changed test files only)

✅ PASS

Selectors: vm.test_custom_vm_commands (module)
PR head ref: agent-assist/azure-azure-cli-issue-34063-338c19fac314
PR head sha: 56dde0c5b19a7a8729c856465792ff0d599a426d
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/37227220502

Last 80 lines of azdev output

=============
| Run Tests |
=============


test index found: /home/runner/.azdev/env_config/home/runner/work/issue-sentinel/issue-sentinel/.venv/test_index/latest.json

Test on modules: vm.test_custom_vm_commands

WARNING: RUNNING TESTS LIVE
The tests are set to run against current profile "latest"
============================= test session starts ==============================
platform linux -- Python 3.12.14, pytest-9.1.1, pluggy-1.6.0 -- /home/runner/work/issue-sentinel/issue-sentinel/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli
plugins: forked-1.7.5, platformdirs-4.12.3, xdist-3.8.0
collecting ... collected 16 items

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_access_extension_upgrade_info PASSED [  6%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_extension_instance_name PASSED [ 12%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_extension_instance_name_when_type_none PASSED [ 18%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_merge_secrets PASSED [ 25%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMSSUpdateZonePlacement::test_vmss_update_absent_or_null_placement PASSED [ 31%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMSSUpdateZonePlacement::test_vmss_update_empty_filter_is_explicit PASSED [ 37%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMSSUpdateZonePlacement::test_vmss_update_exclude_to_include PASSED [ 43%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMSSUpdateZonePlacement::test_vmss_update_include_to_exclude PASSED [ 50%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMSSUpdateZonePlacement::test_vmss_update_policy_only_preserves_filter PASSED [ 56%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMSSUpdateZonePlacement::test_vmss_update_rejects_both_filters PASSED [ 62%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMSSUpdateZonePlacement::test_vmss_update_same_filter PASSED [ 68%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMSSUpdateZonePlacement::test_vmss_update_unrelated_property_preserves_placement PASSED [ 75%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMSSUpdateZonePlacement::test_vmss_update_without_filters_preserves_placement PASSED [ 81%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_handle_unicode PASSED [ 87%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_init_storage_sdk PASSED [ 93%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_uses_keys_property PASSED [100%]

- generated xml file: /home/runner/work/issue-sentinel/issue-sentinel/test-output/results.xml -
============================== 16 passed in 0.67s ==============================

Posted by the X Engineering Agent live-test workflow.

This branch has not been deployed

No deployments
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 Request X Engineering Agent Request X Engineering Agent testing and review X Engineering Agent Reviewed Pull request reviewed by X Engineering Agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az vmss update retains the previous zone placement filter when switching between --include-zones and --exclude-zones

1 participant