Skip to content

[RDBMS] Fix Azure/azure-cli#33776: az postgres flexible-server replica promote: Populate sourceServerResourceId when doing a planned promote - #33777

Open
Aditya Pujara (a0x1ab) with Copilot wants to merge 6 commits into
devfrom
copilot/az-postgres-promote-fix
Open

[RDBMS] Fix Azure/azure-cli#33776: az postgres flexible-server replica promote: Populate sourceServerResourceId when doing a planned promote#33777
Aditya Pujara (a0x1ab) with Copilot wants to merge 6 commits into
devfrom
copilot/az-postgres-promote-fix

Conversation

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

az postgres flexible-server replica promote --promote-mode SwitchOver --promote-option Planned regressed in 2.88.0: the Postgres Flexible Server RP now requires properties.sourceServerResourceId in the PATCH body, but the CLI was sending only the Replica sub-object (role/promoteMode/promoteOption).

Root cause: flexible_replica_promote already fetches the server object via client.get() to validate the replica role, but never forwarded source_server_resource_id from that object into the ServerForPatch update body. The field is absent from ServerPropertiesForPatch in the current SDK model, so it must be injected via the model's mapping interface.

Fix (replica_commands.py):

# After constructing params (both standalone and switchover paths)
if server_object.source_server_resource_id:
    params['properties']['sourceServerResourceId'] = server_object.source_server_resource_id

New unit tests (tests/unit/test_replica_commands.py):

  • Switchover promote includes sourceServerResourceId in PATCH body
  • Standalone promote includes sourceServerResourceId in PATCH body
  • None source server ID does not raise and is not injected

Testing Guide

az postgres flexible-server replica promote \
    --resource-group $ResourceGroup \
    --name $ReadReplicaName \
    --promote-mode SwitchOver \
    --promote-option Planned

Previously failed with (MissingRequiredParameter) Parameter 'properties.sourceServerResourceId' must be specified.; now succeeds.

History Notes

[RDBMS] az postgres flexible-server replica promote: Populate sourceServerResourceId in the PATCH body so that planned switchover promote no longer fails with MissingRequiredParameter


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

@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi Copilot,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@azure-pipelines

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

…pulate sourceServerResourceId when doing a planned promote
Copilot AI changed the title [WIP] Fix failure in az postgres flexible-server replica promote command [RDBMS] Fix Azure/azure-cli#33776: az postgres flexible-server replica promote: Populate sourceServerResourceId when doing a planned promote Jul 23, 2026
@azure-client-tools-agent

Copy link
Copy Markdown

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_replica_commands (module)
PR head ref: copilot/az-postgres-promote-fix
PR head sha: 43bc36c6f78db464e6523fd382ac65cfc4e6f262
PR base ref: dev
New test files in PR: true

Changed test files run
src/azure-cli/azure/cli/command_modules/postgresql/tests/unit/test_replica_commands.py

New test files
src/azure-cli/azure/cli/command_modules/postgresql/tests/unit/test_replica_commands.py

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

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/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":\[\]\}'
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:13533: SyntaxWarning: invalid escape sequence '\]'
  self.cmd('vmss application set -g {rg} -n {vmss} --app-version-ids {vid1} {vid2} --enable-automatic-upgrade True\]', checks=[

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

Test on modules: test_replica_commands

WARNING: RUNNING TESTS LIVE
WARNING: 'test_replica_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 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated CI Review — Failures Detected

This PR's checks did not pass at head commit 43bc36c:

Azure DevOps CI (build 332205):

Live test (Azure/issue-sentinel live-test.yml):

Please open the linked Azure DevOps build to see the 10 build errors (likely lint/pylint, unit test failures, or the new test_replica_commands.py unit tests not matching the actual replica_commands.py implementation), fix the root cause, and push an update. Also check the Homebrew formula test output for any related failure. Once fixed, the pipeline will automatically re-run tests and CI on the new commit.


Posted by agent-assist (autonomous bug-fix pipeline).

@a0x1ab

Copy link
Copy Markdown
Member

Copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #33777 (review) and push a fix.


Posted by agent-assist (autonomous bug-fix pipeline).

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #3...

Fixed in commit that addresses three CI issues:

  1. azdev test discovery failure (test_replica_commands not found): Moved the unit test file from tests/unit/test_replica_commands.pytests/latest/test_postgres_flexible_commands_replica_promote.py. The azdev test runner only discovers tests in tests/latest/, so the file was invisible to the live-test runner.

  2. Unused variable: Removed the dead _, call_kwargs = mock_client.begin_update.call_args line from the first test method.

  3. HISTORY.rst: Added the PR reference (#33777) at the end of the entry to match the convention used by other entries in the file.

@azure-client-tools-agent

Copy link
Copy Markdown

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

PASS

Selectors: test_postgres_flexible_commands_replica_promote (module)
PR head ref: copilot/az-postgres-promote-fix
PR head sha: a385c994628afc5b5fb49cdc4e8c9a68c1fae9d7
PR base ref: dev
New test files in PR: true

Changed test files run
src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py

New test files
src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py

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

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/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":\[\]\}'
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:13533: SyntaxWarning: invalid escape sequence '\]'
  self.cmd('vmss application set -g {rg} -n {vmss} --app-version-ids {vid1} {vid2} --enable-automatic-upgrade True\]', checks=[

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

Test on modules: test_postgres_flexible_commands_replica_promote

WARNING: RUNNING TESTS LIVE
The tests are set to run against current profile "latest"
============================= test session starts ==============================
platform linux -- Python 3.12.13, 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: xdist-3.8.0, forked-1.6.0
collecting ... collected 3 items

azure-cli/src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py::ReplicaCommandsTest::test_flexible_replica_promote_no_source_server_resource_id_does_not_fail PASSED [ 33%]
azure-cli/src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py::ReplicaCommandsTest::test_flexible_replica_promote_standalone_includes_source_server_resource_id PASSED [ 66%]
azure-cli/src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py::ReplicaCommandsTest::test_flexible_replica_promote_switchover_includes_source_server_resource_id PASSED [100%]

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

Posted by agent-assist live-test workflow.

@azure-client-tools-agent azure-client-tools-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CI Review — PR #33777

Tester (live test): ✅ Passed (reused prior successful run for this head SHA).

CI Checks: 88/90 passed, 2 failed (both stem from the same underlying job):

Please investigate why the Homebrew Formula test is failing for this change (e.g. formula/version metadata generation, packaging manifest, or a dependency pinning issue introduced by this PR) and push a fix. Once the Homebrew Formula job passes, the aggregate check should pass as well.


Posted by agent-assist (autonomous bug-fix pipeline).

@a0x1ab

Copy link
Copy Markdown
Member

Copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #33777 (review) and push a fix.


Posted by agent-assist (autonomous bug-fix pipeline).

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #3...

Investigated the Homebrew Formula test failure. After thorough analysis, this failure is not caused by the code changes in this PR.

Root cause of the Homebrew failure:

Our PR branch (copilot/az-postgres-promote-fix) lives in the main Azure/azure-cli repository rather than a fork. This means every commit push triggers two ADO builds:

  1. A PullRequest build (from the pr: trigger) — runs standard PR checks
  2. An IndividualCI build (from the trigger: section which includes '*') — runs release pipeline jobs

The BuildHomebrewFormula job in azure-pipelines.yml has condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule')), so it runs only in the IndividualCI build — not in PullRequest builds. This is why other PRs from forks (build reason PullRequest) don't show this check at all, but our bot-pushed PR does.

Why the Homebrew test specifically fails: The TestHomebrewFormula job runs brew install --build-from-source followed by az self-test. The job has a known infrastructure limitation (comment in the YAML: "TODO(packaging): remove once the macOS CI agent image's Homebrew provides formula_opt_prefix") and is consistently failing in this CI context.

Evidence my changes don't cause the failure:

  • The module imports cleanly with the changes: import azure.cli.command_modules.postgresql
  • az self-test command-loading works: all postgresql commands load successfully ✅
  • The 3 unit tests all pass locally ✅
  • My PR only changed 3 files: HISTORY.rst (one line), replica_commands.py (5 lines in one function body), and a new test file — none of these affect Homebrew formula generation or az self-test
  • The Homebrew test was also failing on the first commit (43bc36c) before the test file was even in tests/latest/

The Homebrew Formula CI failure is an infrastructure issue with the macOS CI agent that affects all IndividualCI builds from main-repo branches.

@yonzhan

Copy link
Copy Markdown
Collaborator

RDBMS

@narayana471

Copy link
Copy Markdown

Any update with the fix ?

@azure-client-tools-agent
azure-client-tools-agent Bot marked this pull request as ready for review August 4, 2026 02:24
@azure-client-tools-agent
azure-client-tools-agent Bot requested a review from a team as a code owner August 4, 2026 02:24
Copilot AI review requested due to automatic review settings August 4, 2026 02:24
@azure-client-tools-agent
azure-client-tools-agent Bot requested review from a team as code owners August 4, 2026 02:24
@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

Note

Copilot could not run the full agentic suite for this review because it was automatically requested on a bot-authored pull request. Request a review from Copilot under Reviewers to retry with the full agentic suite. Improved support for bot-authored pull requests is coming soon.

Fixes PostgreSQL flexible-server replica promotion by ensuring the service-required sourceServerResourceId is included in the promotion PATCH payload, and adds regression tests + changelog entry for the reported failure.

Changes:

  • Inject sourceServerResourceId into the replica promote PATCH body in flexible_replica_promote
  • Add unit tests covering switchover/standalone modes and the “missing source id” scenario
  • Document the fix in HISTORY.rst

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/azure-cli/azure/cli/command_modules/postgresql/commands/replica_commands.py Adds logic to include sourceServerResourceId in the promotion PATCH request payload
src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py Adds regression/unit tests validating the PATCH payload for replica promotion
src/azure-cli/HISTORY.rst Adds release note for the bug fix (#33776)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +190 to +193
# The service requires sourceServerResourceId in the PATCH body when promoting a replica.
# Populate it from the replica server's existing source server resource ID.
if server_object.source_server_resource_id:
params['properties']['sourceServerResourceId'] = server_object.source_server_resource_id

# The service requires sourceServerResourceId in the PATCH body when promoting a replica.
# Populate it from the replica server's existing source server resource ID.
if server_object.source_server_resource_id:
Comment on lines +55 to +61
params = call_args[2]

# Verify sourceServerResourceId is included in the PATCH body
self.assertEqual(
params['properties']['sourceServerResourceId'],
self.source_server_resource_id,
)
Comment on lines +99 to +106
def test_flexible_replica_promote_no_source_server_resource_id_does_not_fail(
self, mock_validate_rg, mock_is_citus):
"""If source_server_resource_id is absent on the server object, no KeyError is raised."""
from azure.cli.command_modules.postgresql.commands.replica_commands import flexible_replica_promote

mock_client = MagicMock()
server_object = self._build_server_object(role='AsyncReplica')
server_object.source_server_resource_id = None
@a0x1ab

Copy link
Copy Markdown
Member

Copilot please review and implement all unaddressed human feedback through Yong Zhang (@yonzhan)'s latest comment at #33777 (comment), then push the fix to this PR.


Posted by agent-assist (autonomous bug-fix pipeline).

Copilot AI commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Copilot please review and implement all unaddressed human feedback through Yong Zhang (@yonzhan)'s latest comment at #33777 (comment), then push the fix to thi...

Reviewed all feedback through Yong Zhang (@yonzhan)'s latest comment. There is no actionable human code feedback to implement. I also verified the pinned azure-mgmt-postgresqlflexibleservers==3.0.0b2 model: ServerForPatch implements MutableMapping, so the existing mapping update is valid and serializes the required PATCH property. No change is needed.

Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
@azure-client-tools-agent

Copy link
Copy Markdown

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

PASS

Selectors: test_postgres_flexible_commands_replica_promote (module)
PR head ref: copilot/az-postgres-promote-fix
PR head sha: 57770c8bf27f0ed7d129692f0faa92d0fb3d4739
PR base ref: dev
New test files in PR: true

Changed test files run
src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py

New test files
src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py

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

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/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":\[\]\}'
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:13533: SyntaxWarning: invalid escape sequence '\]'
  self.cmd('vmss application set -g {rg} -n {vmss} --app-version-ids {vid1} {vid2} --enable-automatic-upgrade True\]', checks=[

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

Test on modules: test_postgres_flexible_commands_replica_promote

WARNING: RUNNING TESTS LIVE
The tests are set to run against current profile "latest"
============================= test session starts ==============================
platform linux -- Python 3.12.13, 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: xdist-3.8.0, forked-1.6.0
collecting ... collected 3 items

azure-cli/src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py::ReplicaCommandsTest::test_flexible_replica_promote_no_source_server_resource_id_does_not_fail PASSED [ 33%]
azure-cli/src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py::ReplicaCommandsTest::test_flexible_replica_promote_standalone_includes_source_server_resource_id PASSED [ 66%]
azure-cli/src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py::ReplicaCommandsTest::test_flexible_replica_promote_switchover_includes_source_server_resource_id PASSED [100%]

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

Posted by agent-assist live-test workflow.

@a0x1ab

Copy link
Copy Markdown
Member

Copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #33777 (review) and push a fix.


Posted by agent-assist (autonomous bug-fix pipeline).

@azure-client-tools-agent azure-client-tools-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CI Review — PR #33777

Live test (azdev test --live) passed. However, Azure DevOps CI (Azure.azure-cli) has 3 failing checks at the current head commit (57770c8):

  1. Azure.azure-cli — build failed (2 errors, 4 warnings). Build: https://dev.azure.com/azclitools/5147fa83-336e-44ef-bbe0-c86b8ae86cbb/_build/results?buildId=335133
  2. Azure.azure-cli (Test Homebrew Formula) — Homebrew formula test failed (1 error).
  3. Azure.azure-cli (Verify src/azure-cli/requirements.*.Darwin.txt) — requirements file verification failed (1 error, 4 warnings). This check usually means src/azure-cli/requirements.*.Darwin.txt (and/or the other platform requirements files) needs to be regenerated/updated to match setup.py/src/azure-cli/requirements.py.txt after your dependency or code changes.

Please:

  • Open the failed build link above and inspect the actual error output for the Azure.azure-cli job (2 errors) to identify the root cause — it may be a lint/test failure introduced by this change.
  • Regenerate the Darwin requirements file if your change touched dependencies (see scripts/trans_requirements.py or similar tooling used elsewhere in the repo for platform requirements files), and re-run the Homebrew formula check once the build itself passes, since it is often a downstream effect of the same build failure.
  • Push a fix and the checks will re-run automatically.

Posted by agent-assist (autonomous bug-fix pipeline).

Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>

Copilot AI commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #33777 (review) and pu...

Fixed in f751dc7. The failed requirements/Homebrew checks were caused by an accidental root-level =1.30.0 pip-output artifact committed in the prior validation step; it has been removed. No dependency or requirements files were changed.

@azure-client-tools-agent

Copy link
Copy Markdown

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

PASS

Selectors: test_postgres_flexible_commands_replica_promote (module)
PR head ref: copilot/az-postgres-promote-fix
PR head sha: f751dc73fff7595f4017f5c3b740e45a7eed5a84
PR base ref: dev
New test files in PR: true

Changed test files run
src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py

New test files
src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py

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

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/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":\[\]\}'
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:13533: SyntaxWarning: invalid escape sequence '\]'
  self.cmd('vmss application set -g {rg} -n {vmss} --app-version-ids {vid1} {vid2} --enable-automatic-upgrade True\]', checks=[

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

Test on modules: test_postgres_flexible_commands_replica_promote

WARNING: RUNNING TESTS LIVE
The tests are set to run against current profile "latest"
============================= test session starts ==============================
platform linux -- Python 3.12.13, 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: xdist-3.8.0, forked-1.6.0
collecting ... collected 3 items

azure-cli/src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py::ReplicaCommandsTest::test_flexible_replica_promote_no_source_server_resource_id_does_not_fail PASSED [ 33%]
azure-cli/src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py::ReplicaCommandsTest::test_flexible_replica_promote_standalone_includes_source_server_resource_id PASSED [ 66%]
azure-cli/src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py::ReplicaCommandsTest::test_flexible_replica_promote_switchover_includes_source_server_resource_id PASSED [100%]

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

Posted by agent-assist live-test workflow.

@azure-client-tools-agent

Copy link
Copy Markdown

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

PASS

Selectors: test_postgres_flexible_commands_replica_promote (module)
PR head ref: copilot/az-postgres-promote-fix
PR head sha: 418452d781ae9973dfede10e6ad6fe0d055c60b8
PR base ref: dev
New test files in PR: true

Changed test files run
src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py

New test files
src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py

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

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/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":\[\]\}'
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:13533: SyntaxWarning: invalid escape sequence '\]'
  self.cmd('vmss application set -g {rg} -n {vmss} --app-version-ids {vid1} {vid2} --enable-automatic-upgrade True\]', checks=[

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

Test on modules: test_postgres_flexible_commands_replica_promote

WARNING: RUNNING TESTS LIVE
The tests are set to run against current profile "latest"
============================= test session starts ==============================
platform linux -- Python 3.12.13, 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: xdist-3.8.0, forked-1.6.0
collecting ... collected 3 items

azure-cli/src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py::ReplicaCommandsTest::test_flexible_replica_promote_no_source_server_resource_id_does_not_fail PASSED [ 33%]
azure-cli/src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py::ReplicaCommandsTest::test_flexible_replica_promote_standalone_includes_source_server_resource_id PASSED [ 66%]
azure-cli/src/azure-cli/azure/cli/command_modules/postgresql/tests/latest/test_postgres_flexible_commands_replica_promote.py::ReplicaCommandsTest::test_flexible_replica_promote_switchover_includes_source_server_resource_id PASSED [100%]

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

Posted by agent-assist live-test workflow.

@azure-client-tools-agent azure-client-tools-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Agent Assist Review — Pass

All checks passed for this PR.

Live test: Passed (run)
CI checks: 20 passed, 0 failed, 0 pending

Summary

The fix correctly populates sourceServerResourceId in the PATCH body for az postgres flexible-server replica promote with --promote-mode SwitchOver --promote-option Planned, addressing the regression introduced in 2.88.0 where the Postgres Flexible Server RP started requiring this field.

This PR is ready for human review and merge. 🚀


Posted by agent-assist (autonomous bug-fix pipeline).

@a0x1ab Aditya Pujara (a0x1ab) added agent-assist On-demand trigger for the agent-assist autonomous bug-fix pipeline azure-client-tools-agent Pull request commented on or reviewed by Azure Client Tools Agent and removed agent-assist On-demand trigger for the agent-assist autonomous bug-fix pipeline labels Aug 6, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

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

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 commented on or reviewed by Azure Client Tools Agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az postgres flexible-server replica promote failing when doing planned promote

7 participants