Repository navigation
[Packaging] Fix #34187: az version: Detect Homebrew casks with symlinked prefixes - #34196
Aditya Pujara (a0x1ab) wants to merge 4 commits into
Conversation
… symlinked prefixes
|
🔔 Routing this PR to @Azure/act-platform-engineering-squad. |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
🔔 Routing this PR to @Azure/act-platform-engineering-squad. |
|
Please fix CI issues |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
🟢 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.
Live test results — changed test files only⏭️ SKIPPED — this PR changes no test files ( PR head ref: Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/37912073448 Posted by the X Engineering Agent live-test workflow. |
There was a problem hiding this comment.
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)
Related command
az versionDescription
Fixes #34187.
Detect Homebrew Casks with symlinked or custom prefixes and use Python from the matching Homebrew installation.
Support both the stable
azure-cliCask andazure-cli-*Casks such asazure-cli-preview. Preserve existing standalone tarball behavior requiringAZ_PYTHON.Testing Guide
python3 scripts/release/standalone/tests/test_az_launcher.py.az versionfrom a Cask installed under a standard, custom, or symlinked Homebrew prefix.History Notes
[Packaging]
az version: Detect Homebrew casks with symlinked prefixesThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.