Skip to content

[Packaging] Fix #34187: az version: Detect Homebrew casks with symlinked prefixes - #34196

Open
Aditya Pujara (a0x1ab) wants to merge 4 commits into
Azure:devfrom
a0x1ab:agent-assist/azure-azure-cli-issue-34187-e16a8bbe24e1
Open

Aditya Pujara (a0x1ab) wants to merge 4 commits into
Azure:devfrom
a0x1ab:agent-assist/azure-azure-cli-issue-34187-e16a8bbe24e1

Conversation

@a0x1ab

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

Copy link
Copy Markdown
Member

Related command

az version

Description

Fixes #34187.

Detect Homebrew Casks with symlinked or custom prefixes and use Python from the matching Homebrew installation.

Support both the stable azure-cli Cask and azure-cli-* Casks such as azure-cli-preview. Preserve existing standalone tarball behavior requiring AZ_PYTHON.

Testing Guide

  • Run python3 scripts/release/standalone/tests/test_az_launcher.py.
  • Run az version from a Cask installed under a standard, custom, or symlinked Homebrew prefix.

History Notes

[Packaging] az version: Detect Homebrew casks with symlinked prefixes


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

@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

🔔 Routing this PR to @Azure/act-platform-engineering-squad.

@a0x1ab

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

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

x-engineering-agent[bot]

This comment was marked as outdated.

@x-engineering-agent x-engineering-agent Bot added the X Engineering Agent Reviewed Pull request reviewed by X Engineering Agent label Oct 8, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

🔔 Routing this PR to @Azure/act-platform-engineering-squad.

@yonzhan

Copy link
Copy Markdown
Collaborator

Please fix CI issues

@a0x1ab

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

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

@naga-nandyala
Naga Nandyala (naga-nandyala) marked this pull request as ready for review October 8, 2026 22:51
Copilot AI balanced review requested due to automatic review settings October 8, 2026 22:51
Comment thread scripts/release/standalone/templates/az_launcher.sh.in Outdated

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 focused launcher change addresses the reported path-resolution failure and has comprehensive coverage.

0 open findings

What changed in this PR

Updates the standalone launcher to recognize Homebrew Casks under custom or symlinked prefixes and select Python from the matching installation.

Changes:

  • Detects stable and preview-style Azure CLI Casks by resolved path.
  • Searches the matching Homebrew prefix for supported Python executables.
  • Adds comprehensive launcher tests for Cask, symlink, tarball, and error scenarios.
File Description
scripts/​release/​standalone/​templates/​az_launcher.sh.in Implements prefix-independent Cask detection and Python selection.
scripts/​release/​standalone/​tests/​test_az_launcher.py Tests launcher behavior across supported layouts and failure cases.

🧠 Review effort: Balanced


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

x-engineering-agent[bot]

This comment was marked as outdated.

@x-engineering-agent x-engineering-agent Bot removed the Request X Engineering Agent Request X Engineering Agent testing and review label Oct 9, 2026
x-engineering-agent[bot]

This comment was marked as outdated.

x-engineering-agent[bot]

This comment was marked as outdated.

@x-engineering-agent

Copy link
Copy Markdown
Contributor

Live test results — changed test files only

⏭️ SKIPPED — this PR changes no test files (tests/**/test_*.py), so there is nothing to live-test.

PR head ref: agent-assist/azure-azure-cli-issue-34187-e16a8bbe24e1
PR head sha: 98807589f4b92c8a1e2e2cd790e26abea9e5b511
PR base ref: dev

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

Posted by the X Engineering Agent live-test workflow.

@x-engineering-agent x-engineering-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.

Aditya Pujara (@a0x1ab)

Review

One PR-related launcher classification issue remains despite the passing validation snapshot.

Launcher classification

P2 - Nested preview/test tarballs are recognized as Homebrew casks. In az_launcher.sh.in:33-34, the * in */Caskroom/azure-cli-* also matches /. For a standalone install at <prefix>/Caskroom/azure-cli-preview/2.85.0/nested, CASK_DIR ends in azure-cli-preview/2.85.0 and incorrectly matches. The launcher then ignores AZ_PYTHON and searches an incorrectly derived Homebrew prefix instead of using the explicit tarball interpreter.

Match the cask basename separately and require its immediate parent to be Caskroom. Extend test_tarball_paths_are_not_casks in scripts/release/standalone/tests/test_az_launcher.py with nested azure-cli-preview and azure-cli-test-ci layouts, asserting the explicit interpreter and AZ_INSTALLER=TARBALL. Rerun the focused launcher suite (python3 scripts/release/standalone/tests/test_az_launcher.py) after adding those cases; retain the positive stable/preview/test-cask cases.

Upstream CI

The current-head snapshot has 50 completed, successful checks and no pending or failed checks.

Test validation

  • Live test: Passed. Workflow run
  • Regression coverage: Not applicable to the changed files.

The author-added launcher assertions cover symlinked/custom prefixes, interpreter ordering and isolation, argument/exit propagation, and tarball errors. The nested-tarball negative case currently covers only the stable cask. These are packaging assertions; the module-level coverage classification above is not an installed-macOS-cask verification.

Manual follow-up

Packaging owners should address the classification issue. The PR's durable Foundry publication/head provenance is unverified, so no automated repair is being queued and the review request remains open. The automated risk classifier below does not identify standalone packaging as production code; its low-confidence score does not clear this concrete runtime finding.

Risk assessment

0/100 · Low · Low confidence

The Low rating reflects the detected change scope with no elevated security, reliability, customer, operational, dependency, sovereign-cloud, generated-output, or cross-component signal.

  • Change scope: 2 changed files, 326 changed lines (+310 / -16), including 0 production files.
  • Affected components: No production component was identified.
  • Risk drivers: No elevated risk signal was detected.
  • Regression evidence: No production-code regression-test signal applies.
  • Confidence: Low because no production changed-line evidence was available.
  • Required review: No additional owning-squad review signal was detected.

Posted by x-engineering-agent (Reviewer)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-platform-engineering-squad Auto-Assign Auto assign by bot do-not-merge Packaging X Engineering Agent Generated Pull request generated by X Engineering Agent X Engineering Agent Reviewed Pull request reviewed by X Engineering Agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Homebrew cask launcher asks for AZ_PYTHON when the Homebrew prefix is a symlink

4 participants