Skip to content

[SQL] Clean up server update handling for soft-delete - #33933

Merged
Yabo Hu (VeryEarly) merged 1 commit into
Azure:devfrom
rambabu-yalla:ramyal/FixSoftDeleteRetentionDaysUpdate
Aug 21, 2026
Merged

[SQL] Clean up server update handling for soft-delete#33933
Yabo Hu (VeryEarly) merged 1 commit into
Azure:devfrom
rambabu-yalla:ramyal/FixSoftDeleteRetentionDaysUpdate

Conversation

@rambabu-yalla

@rambabu-yalla rambabu-yalla commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

🤖 PR Validation — ️✔️ All clear

Breaking Changes Tests
️✔️ None ️✔️ 130/130

Related command

az sql server update,

Description

No customer-facing behavior change

  1. az sql server update: Removed custom handling of --soft-delete-retention-days and switched to the standard update pattern. Previously the update path unconditionally reassigned instance.retention_days, which caused the PUT body to carry an empty retention value on unrelated updates. The SQL RP discards null, so nothing was actually reset — this just stops the CLI from round-tripping stale state.

Testing Guide

No commands are updated

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.

@rambabu-yalla
rambabu-yalla requested a review from a team as a code owner August 19, 2026 17:36
Copilot AI lite review requested due to automatic review settings August 19, 2026 17:36
@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi rambabu-yalla,
Since the current milestone time is less than 7 days, this pr may not catch up with this release.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI 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.

Pull request overview

This PR updates the Azure SQL command module internals to preserve retentionDays (soft-delete retention) during az sql server update when --soft-delete-retention-days is not provided, and adjusts deleted-server listing behavior/tests and their recordings accordingly.

Changes:

  • Update server_update to preserve the existing retentionDays value unless --soft-delete-retention-days is explicitly passed.
  • Adjust deleted_server_list to treat an explicitly provided empty --location "" as “location-scoped” (instead of falling back to subscription-wide listing).
  • Refresh/strengthen SQL soft-delete tests and update associated recordings (including location changes and updated CLI/sdk metadata).

Reviewed changes

Copilot reviewed 6 out of 20 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/azure-cli/azure/cli/command_modules/sql/custom.py Preserves retentionDays on update; changes deleted-server list branching for location.
src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py Updates/expands soft-delete lifecycle tests and adjusts test locations/expectations.
src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_server_create_without_soft_delete.yaml Updates recording for create-without-soft-delete scenario (westus + updated headers/timestamps).
src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_deleted_server_show_not_found.yaml Updates recording headers/timestamps for deleted-server show-not-found.
src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_deleted_server_list_empty_location.yaml Updates recording payload and metadata for deleted-server list scenario.
Suppressed comments (1)

src/azure-cli/azure/cli/command_modules/sql/custom.py:4458

  • The new location is not None behavior is intended to change how --location "" behaves, but there is no test asserting that the CLI fails fast with a clear error for an empty location value.
    if location is not None:
        return client.list_by_location(location)

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/azure-cli/azure/cli/command_modules/sql/custom.py Outdated
@rambabu-yalla rambabu-yalla changed the title {SQL} Preserve soft-delete-retention-days on server update and add validation for deleted-server command {SQL} Clean up server update and deleted-server list handling for soft-delete Aug 19, 2026
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

@rambabu-yalla
rambabu-yalla force-pushed the ramyal/FixSoftDeleteRetentionDaysUpdate branch from ae8bafa to 70f2992 Compare August 19, 2026 19:35
@rambabu-yalla rambabu-yalla changed the title {SQL} Clean up server update and deleted-server list handling for soft-delete [SQL] Clean up server update and deleted-server list handling for soft-delete Aug 19, 2026
@rambabu-yalla rambabu-yalla changed the title [SQL] Clean up server update and deleted-server list handling for soft-delete [SQL] Clean up server update handling for soft-delete Aug 19, 2026
@rambabu-yalla
rambabu-yalla requested a lite review from Copilot August 19, 2026 19:38

Copilot AI 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.

Pull request overview

Copilot reviewed 3 out of 11 changed files in this pull request and generated no new comments.

Suppressed comments (1)

src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py:9469

  • The test now asserts retentionDays == -1 on create/show, but elsewhere in this same file test_sql_server_soft_delete_retention_update_scenarios explicitly treats retentionDays as -1 or 0 when soft delete was not configured. This stricter expectation can make the test flaky across RP/API-version variations and is inconsistent with the existing test semantics; consider asserting membership in [-1, 0, None] instead of a fixed -1.
                     JMESPathCheck('retentionDays', -1)])

        # Verify via show as well: retentionDays must be -1 (never configured)
        self.cmd('sql server show -g {} --name {}'
                 .format(resource_group, server_name),

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

@azure-client-tools-agent

Copy link
Copy Markdown
Contributor

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

⚠️ NO TESTS SELECTED — changed test files did not resolve to runnable tests

Selectors: test_sql_commands (module)
PR head ref: ramyal/FixSoftDeleteRetentionDaysUpdate
PR head sha: 70f2992eb7374ca2f719f541cfd09f922cfec600
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py

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

Last 80 lines of azdev output

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


=====================
| Discovering Tests |
=====================

/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:13640: SyntaxWarning: invalid escape sequence '\]'
  self.cmd('vmss application set -g {rg} -n {vmss} --app-version-ids {vid1} {vid2} --enable-automatic-upgrade True\]', checks=[
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:18: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_compute': '\{"providers":\["Microsoft.Compute"\]\}',
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:19: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_empty': '\{"providers":\[\]\}'
WARNING: 'test_sql_commands' exists in both 'sql' and 'backup'. Resolve using `sql.test_sql_commands` or `backup.test_sql_commands`Duplication exists in: 
	/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py
	/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/backup/tests/latest/test_sql_commands.py


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

Test on modules: test_sql_commands

WARNING: RUNNING TESTS LIVE
WARNING: 'test_sql_commands' not found. If newly added, re-run with --discover
WARNING: No tests selected to run.

Posted by agent-assist live-test workflow.

@azure-client-tools-agent azure-client-tools-agent Bot added the azure-client-tools-agent Pull request reviewed by Azure Client Tools Agent label Aug 20, 2026

@azure-client-tools-agent azure-client-tools-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.

Validation Summary

Automated checks found failures on the current head commit (70f2992):

CI (GitHub Actions):

  • Azure.azure-cli Full Test — build failed (run)
  • Azure.azure-cli — build failed (run)
  • Azure.azure-cli Full Test (Automation Full Test Python314 Profile Latest instance5) — failed (run)
  • Azure.azure-cli Full Test (Automation Full Test Python312 Profile Latest instance5) — failed (run)
  • ✅ 48/53 other checks passed

Live test (azdev test --live): ❌ failed (run)

please take a look at the failing builds/tests linked above and push a fix. Re-request review once addressed.

@azure-client-tools-agent azure-client-tools-agent Bot removed the Azure Client Tools Agent Requested Request Azure Client Tools Agent testing and review label Aug 20, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

🔔 Routing this PR to @Azure/act-codegen-extensibility-squad.

@rambabu-yalla
rambabu-yalla force-pushed the ramyal/FixSoftDeleteRetentionDaysUpdate branch from 70f2992 to 976ce22 Compare August 20, 2026 11:30
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

@VeryEarly
Yabo Hu (VeryEarly) merged commit 1fa042c into Azure:dev Aug 21, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-codegen-extensibility-squad Auto-Assign Auto assign by bot azure-client-tools-agent Pull request reviewed by Azure Client Tools Agent SQL az sql

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants