Skip to content

[Container Apps] Fix #10375: az containerapp show: Return exit code 3 for missing apps - #10507

Draft
Aditya Pujara (a0x1ab) wants to merge 1 commit into
Azure:mainfrom
a0x1ab:agent-assist/azure-azure-cli-extensions-issue-10375-5f2d77a20fad
Draft

Aditya Pujara (a0x1ab) wants to merge 1 commit into
Azure:mainfrom
a0x1ab:agent-assist/azure-azure-cli-extensions-issue-10375-5f2d77a20fad

Conversation

@a0x1ab

@a0x1ab Aditya Pujara (a0x1ab) commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

🤖 PR Validation — ️✔️ All clear

Breaking Changes
️✔️ None

Description

Fixes #10375.

Return exit code 3 for missing apps.

Root cause: src/containerapp/azext_containerapp/_clients.py: ContainerAppPreviewClient inherited ContainerAppClient.show without classifying HTTP 404. custom.py: show_containerapp delegates to core BaseContainerAppDecorator.show and BaseResource.show, whose handle_raw_exception converts structured ARM ResourceNotFound JSON from core HTTPError into CLIInternalError, losing the not-found exit classification.

Fix: Convert only core HTTPError 404 from handwritten ContainerAppPreviewClient.show into CLI ResourceNotFoundError with a clean message identifying the app and resource group. Preserve the original response for existing 404-tolerant create/existence checks. Leave other errors and successful show/secrets behavior unchanged. Add six focused command/client tests, a release history note and patch version 1.3.1b1.

How verified (trusted validation output):

  • Trusted validation passed (1 command).
  • New or changed tests fail on the base revision and pass with the change: src/containerapp/azext_containerapp/tests/latest/test_containerapp_show_unit.py::ContainerappShowClientTest::test_404_is_classified_without_parsing_the_body, src/containerapp/azext_containerapp/tests/latest/test_containerapp_show_unit.py::ContainerappShowClientTest::test_not_found_keeps_response_for_existing_resource_checks, src/containerapp/azext_containerapp/tests/latest/test_containerapp_show_unit.py::ContainerappShowCommandTest::test_missing_app_show_returns_exit_code_3.
  • Unit tests: 6 executed, 0 skipped.
  • flake8 and pylint passed.
  • Pre-publication gates passed: release-artifact, generated-ownership, command-help, regression-test, independent-review.
  • Repository CI and live tests run on this PR.

Risks and limitations (from the job report):

  • BLOCKED: latest requested self_check rerun (2026-10-22T12:51:50Z) exited 1 with status failed and zero source findings. …
  • The validator labels playback failures as candidate regressions because the snapshot has no base revision …
  • Full repository CI and Azure live-service testing remain required. No new live ScenarioTest or recording …

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

Related command

az containerapp show

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install azdev required)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

Independent review: an independent reviewer checked this change against 5 acceptance criteria derived from the issue (2 required); every required criterion is backed by evidence in the diff.

… code 3 for missing apps

Root cause: src/containerapp/azext_containerapp/_clients.py:
ContainerAppPreviewClient inherited ContainerAppClient.show without
classifying HTTP 404. custom.py: show_containerapp delegates to core
BaseContainerAppDecorator.show and BaseResource.show, whose
handle_raw_exception converts structured ARM ResourceNotFound JSON from
core HTTPError into CLIInternalError, losing the not-found exit
classification.

Change: Convert only core HTTPError 404 from handwritten
ContainerAppPreviewClient.show into CLI ResourceNotFoundError with a
clean message identifying the app and resource group. Preserve the
original response for existing 404-tolerant create/existence checks.
Leave other errors and successful show/secrets behavior unchanged. Add
six focused command/client tests, a release history note and patch
version 1.3.1b1.

Alternatives considered:
- Changing shared core handle_raw_exception requires a separate
  Azure/azure-cli change and broadens scope.
- Parsing ARM body error codes instead of HTTP status would miss empty
  or malformed 404 responses.

Verified:
- Trusted validation passed (1 command).
- New or changed tests fail on the base revision and pass with the
  change:
  `src/containerapp/azext_containerapp/tests/latest/test_containerapp_show_unit.py::ContainerappShowClientTest::test_404_is_classified_without_parsing_the_body`,
  `src/containerapp/azext_containerapp/tests/latest/test_containerapp_show_unit.py::ContainerappShowClientTest::test_not_found_keeps_response_for_existing_resource_checks`,
  `src/containerapp/azext_containerapp/tests/latest/test_containerapp_show_unit.py::ContainerappShowCommandTest::test_missing_app_show_returns_exit_code_3`.
- Unit tests: 6 executed, 0 skipped.
- flake8 and pylint passed.
- Pre-publication gates passed: release-artifact, generated-ownership,
  command-help, regression-test, independent-review.
- Repository CI and live tests run on this PR.

Fixes Azure#10375
@x-engineering-agent

x-engineering-agent Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

X Engineering Agent Report

Live test — Passed (6/6)

PASS

Selectors: azext_containerapp.test_containerapp_show_unit (extension)
PR head ref: agent-assist/azure-azure-cli-extensions-issue-10375-5f2d77a20fad
PR head sha: 6545e1d6780adeec755d059f7eb3c4e829e2b74c
PR base ref: main
New test files in PR: true

Changed test files run
src/containerapp/azext_containerapp/tests/latest/test_containerapp_show_unit.py

New test files
src/containerapp/azext_containerapp/tests/latest/test_containerapp_show_unit.py

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

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: azext_containerapp.test_containerapp_show_unit

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

azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show_unit.py::ContainerappShowCommandTest::test_missing_app_show_returns_exit_code_3 PASSED [ 16%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show_unit.py::ContainerappShowCommandTest::test_non_404_show_keeps_exit_code_1_and_service_error PASSED [ 33%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show_unit.py::ContainerappShowCommandTest::test_successful_show_with_and_without_secrets PASSED [ 50%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show_unit.py::ContainerappShowClientTest::test_404_is_classified_without_parsing_the_body PASSED [ 66%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show_unit.py::ContainerappShowClientTest::test_not_found_keeps_response_for_existing_resource_checks PASSED [ 83%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show_unit.py::ContainerappShowClientTest::test_other_http_errors_are_reraised_unchanged PASSED [100%]

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

Workflow run

Posted by x-engineering-agent (Tester)

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Auto-Assign Auto assign by bot label Oct 22, 2026
@x-engineering-agent

Copy link
Copy Markdown

Live reproduction on the PR head is inconclusive

The issue was reproduced live before this change, but the re-run on head 6545e1d6780a could not confirm the fix: the PR head could not run the reproduction to the end.

This PR stays a draft until a maintainer verifies the fix (or a new push re-runs the reproduction).

Run: https://github.com/Azure/issue-sentinel/actions/runs/39783708288

@x-engineering-agent
x-engineering-agent Bot requested a review from a team October 22, 2026 13:12
@yonzhan

Copy link
Copy Markdown
Collaborator

Please fix CI issues

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 do-not-merge Request X Engineering Agent Ask the agent to triage this issue or review this PR X Engineering Agent Generated Agent opened this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[containerapp] "az containerapp show" does not return exit code 3 when the Container App does not exist

2 participants