Repository navigation
[CosmosDB] az cosmosdb: Fix computed property preservation and fleetspace validation - #34270
pjohari-ms wants to merge 1 commit into
Conversation
Port Azure/azure-cli-extensions#10509 and Azure/azure-cli-extensions#10436 to core using the existing Cosmos DB SDK. Preserve computed properties during SQL container updates, support non-pooled fleetspace creation, validate throughput bounds and account attachment inputs, and align help and examples. Add typed SDK and public-command regressions plus a stable non-pooled fleetspace recording. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟢 Approval recommended
Static review found the implementation and regression coverage consistent with the intended behavior, with no blocking issues; tests were not executed.
No open issues 🎉
What changed in this PR
Ports Cosmos DB fixes from the extension into core using the existing SDK, preserving computed properties during SQL container updates and improving fleetspace creation and validation.
Changes:
- Preserve computed properties when updating SQL containers.
- Support non-pooled fleetspace creation and validate throughput bounds and account attachment inputs.
- Align help and examples, with typed SDK tests, public-command regressions, and a non-pooled scenario recording.
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/cosmosdb/tests/latest/test_cosmosdb_sql_container_update.py |
Adds computed-property preservation regressions. |
src/azure-cli/azure/cli/command_modules/cosmosdb/tests/latest/test_cosmosdb_fleet_fleetspace_fleetspaceAccount_scenario.py |
Adds validation, command, help, and non-pooled scenario coverage. |
src/azure-cli/azure/cli/command_modules/cosmosdb/tests/latest/recordings/test_cosmosdb_fleetspace_non_pooled.yaml |
Records the non-pooled fleetspace lifecycle. |
src/azure-cli/azure/cli/command_modules/cosmosdb/custom.py |
Preserves computed properties and handles non-pooled creation and attachment-name checks. |
src/azure-cli/azure/cli/command_modules/cosmosdb/_validators.py |
Validates creation settings, throughput bounds, and account inputs. |
src/azure-cli/azure/cli/command_modules/cosmosdb/_params.py |
Wires creation-specific validation and updates argument guidance. |
src/azure-cli/azure/cli/command_modules/cosmosdb/_help.py |
Documents supported behavior and updates examples. |
Review effort: Balanced
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
az cosmosdb: Fix computed property preservation and fleetspace validation
X Engineering Agent ReportReview — Comments CI passed for reviewed head Medium — 1 findingComputed-property persistence lacks service-backed regression evidence — Tool: test-strengthAt The existing Remediation and focused validation: retain the unit tests and extend the recorded SQL scenario with two populated computed properties. Perform an indexing-policy update and a TTL update; assert both property names/queries survive each update and a subsequent independent Upstream CIThe supplied snapshot reports 54/54 checks completed and passed, with no failed or pending checks. Test validation
Risk assessment — 50/100 · HighThe High rating is driven by security-sensitive behavior, public CLI behavior.
Posted by x-engineering-agent (Reviewer) |
🤖 PR Validation — ️✔️ All clear
Related command
az cosmosdb sql container updateaz cosmosdb fleetspace createaz cosmosdb fleetspace updateaz cosmosdb fleetspace account createDescription
Port the applicable maintenance fixes from Azure/azure-cli-extensions#10509 and Azure/azure-cli-extensions#10436 into the hand-written core Cosmos DB module:
properties.throughputPoolConfigurationis omitted,null, or{}. Continue requiring a nonblank service tier and a nonempty list of nonblank data regions on create.Compatibility: malformed inputs, inverted bounds, blank locations, and attachment aliases now fail before the write. Valid pooled request payloads and existing public flags are unchanged. This does not add partial throughput updates, pooling-disable commands, new API-kind behavior, SDK upgrades, or raw HTTP workarounds.
Source provenance: Azure/azure-cli-extensions#10509 was open when ported, using head
6a1cf6778af33139be0264e9a8b2db70be8f2fc9; Azure/azure-cli-extensions#10436 was merged, using headc88c75f1d4d9dfcde269fd2e0ba8d9cb3df05491. Extension-only SDK imports and unrelated recording refreshes were not copied.Testing Guide
Validated commit:
4298fb33a41c75fbaa7882daa03c5ac99da298cb. Runtime: Python 3.14.7, Azure CLI/core 2.91.0, declared and installedazure-mgmt-cosmosdb==10.0.0, native default API2026-03-15.The existing SQL-container and pooled fleet/account scenarios first passed in playback before implementation. Only the new non-pooled fleetspace scenario needed live recording; the recording exercises create/show/delete through generated SDK operations and includes cleanup.
Run the focused tests from the repository root in the development virtual environment:
Result: 24 passed in 199.01 seconds, including the three focused playback scenarios. The equivalent direct pytest run also passed with 127 passing subtests covering numeric boundaries, omitted/null/empty values, typed request object graphs and serialization, attachment validation, inline/file input, help rendering, examples, and public update/show output.
Live recording command already executed:
Result: 1 passed in 109.51 seconds. The resulting stable-API cassette subsequently passed playback. SQL computed-property regressions use real generated SDK models with mocked operations and public commands; they were not live-recorded.
Other validation:
azdev style cosmosdbpython -m compileall -q src\azure-cli\azure\cli\command_modules\cosmosdbgit diff --check 0fb575456532726e3c83aadb300957424dde8e9c HEADazdev linter cosmosdbazure-mgmt-recoveryservicesbackup-passivestamp==1.0.0b1, whose installed wheel lacks its models. This is not a local full-linter pass.azdev.operations.linter.run_linter(modules=['cosmosdb'], min_severity='medium')with normal module loading restricted to Cosmos DB and an initialized automation command context.azdev scanand new recording checksHosted CI at the time of this description update: PR title/content format, CLI linter, CLI style, license/history/doc-map, credential/secret scans, latest-index validation, and breaking-change validation passed. Additional integration, wheel, and full-test jobs were still running or queued; this description does not claim all CI or all live scenarios passed.
History Notes
[CosmosDB]
az cosmosdb sql container update: Fix loss of existing computed properties during container updates[CosmosDB]
az cosmosdb fleetspace create: Support non-pooled creation with omitted, null, or empty throughput pool configuration[CosmosDB]
az cosmosdb fleetspace: Fix throughput-bound and database account attachment input validationThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.