Skip to content

{AKS} Fix empty alert configuration name validation - #10352

Merged
Julie Zhu (yanzhudd) merged 1 commit into
Azure:mainfrom
mamortat:fix/aks-alert-config-empty-name
Sep 17, 2026
Merged

Julie Zhu (yanzhudd) merged 1 commit into
Azure:mainfrom
mamortat:fix/aks-alert-config-empty-name

Conversation

@mamortat

@mamortat Matheus Mortatti (mamortat) commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🤖 PR Validation — ️✔️ All clear

Breaking Changes
️✔️ None

Summary

az aks alert-config add --name '' currently performs its duplicate-resource lookup before checking the name. The empty name resolves to the collection endpoint; its response can deserialize into a truthy AlertConfiguration, producing a misleading "already exists" error.

  • Move duplicate detection into the internal add helper, immediately after the existing required-name check. Empty names now raise Please specify --name for the alert configuration. before any client call.
  • Preserve duplicate-name protection and creation after an SDK 404 for valid names.
  • Add public-wrapper regression coverage for empty and missing names with an SDK model initialized from {"value": []}, asserting zero client calls; cover valid 1-character, 63-character, and internal separator names.
  • Document the fix under Pending; no extension version bump or index change.

Related command

az aks alert-config add

Validation

  • PYTHONPATH=src/aks-preview python -m unittest azext_aks_preview.tests.latest.test_alert_configuration -q (27 tests pass on the current upstream base).
  • git diff --cached --check.
  • Confirmed the new regression reproduced the misleading duplicate error before the fix.
  • No live Azure resources were accessed or modified for this fix.

General Guidelines

  • Have you run azdev style aks-preview locally? (azdev is not installed; local commit/push hooks also reported a missing virtualenv activation script.)
  • Have you run python scripts/ci/test_index.py -q locally? (Not run; no index or metadata changes.)
  • My extension version conforms to the extension version schema (existing version unchanged).

Validate the name before duplicate detection so an empty name cannot
resolve to the collection endpoint and report a false duplicate.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 16, 2026 19:01
@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi Matheus Mortatti (@mamortat),
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in pyproject.toml (or setup.py, if the extension has not migrated yet) as well.

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.

🟢 Approval recommended

The fix is covered by regression tests and no unresolved issues remain.

Pull request overview

Fixes az aks alert-config add to reject empty or missing names before SDK calls.

Changes:

  • Moves duplicate detection after name validation.
  • Adds regression coverage for invalid and valid names.
  • Documents the fix in pending release notes.
File summaries
File Summary
src/aks-preview/HISTORY.rst Documents the validation fix.
src/aks-preview/azext_aks_preview/tests/latest/test_alert_configuration.py Adds validation and name-boundary tests.
src/aks-preview/azext_aks_preview/custom.py Delegates duplicate detection to the internal helper.
src/aks-preview/azext_aks_preview/alertconfiguration.py Validates names before lookup and preserves duplicate protection.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

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

@yonzhan

Copy link
Copy Markdown
Collaborator

AKS

@yanzhudd
Julie Zhu (yanzhudd) merged commit c4dc942 into Azure:main Sep 17, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants