Skip to content

Fix dependency resolution when branch name contains ']' character#2313

Open
aholstrup1 wants to merge 1 commit into
mainfrom
aholstrup1-fix-literalpath-dependency-glob
Open

Fix dependency resolution when branch name contains ']' character#2313
aholstrup1 wants to merge 1 commit into
mainfrom
aholstrup1-fix-literalpath-dependency-glob

Conversation

@aholstrup1

Copy link
Copy Markdown
Collaborator

❔What, Why & How

Branch names can legally contain a ] character (git forbids [ but allows ]), for example a mangled [master] tag left over as master]. When such a branch's build-project dependencies are downloaded, the artifact folder name embeds that ]. In GetDependencies (the thisBuild path in Github-Helper.psm1), the already-resolved dependency folder was enumerated with Get-ChildItem -Path $folder. -Path treats ] as a wildcard metacharacter, so instead of listing the .app files inside the folder it returned the folder itself as a single match. That folder path was then added to the downloaded-apps list and "published" as if it were an app, resulting in 0 apps actually installed (Installing apps took 0 seconds) and downstream failures.

The fix uses -LiteralPath instead of -Path. $folder comes from Get-Item $downloadName and is already a fully resolved directory path, so there is never a reason to re-interpret it as a wildcard. For any path without [/] the two are identical, so existing behavior is unchanged; the only difference is that bracket-containing paths now enumerate their .app files correctly.

Verified against a real failing microsoft/BCApps CI run (the log printed the folder, not the .app files, as "found from previous job") and reproduced/covered with a regression test.

✅ Checklist

  • Add tests (E2E, unit tests)
  • Update RELEASENOTES.md
  • Update documentation (e.g. for new settings or scenarios)
  • Add telemetry

GetDependencies enumerated the resolved dependency folder with Get-ChildItem -Path,
which treats ']' (allowed in git branch names) as a wildcard metacharacter and returns
the folder itself instead of the contained .app files. This caused 0 apps to be
published. Use -LiteralPath since the folder is already resolved.
Copilot AI review requested due to automatic review settings July 9, 2026 14:16
@aholstrup1 aholstrup1 requested a review from a team as a code owner July 9, 2026 14:16

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

This pull request fixes a PowerShell wildcard edge case in AL-Go’s dependency resolution for thisBuild dependencies: when a resolved dependency folder path contains a ] (legal in git branch names), Get-ChildItem -Path can treat it as a wildcard pattern and return the folder itself instead of enumerating its .app files.

Changes:

  • Update GetDependencies to enumerate resolved dependency folders using Get-ChildItem -LiteralPath to avoid wildcard interpretation.
  • Add a regression test covering dependency folder paths containing ] and asserting the .app files are returned.
  • Document the fix in RELEASENOTES.md.

Reviewed changes

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

File Description
Tests/GitHub-Helper.Test.ps1 Adds regression coverage for dependency folder paths containing ], ensuring .app files are correctly enumerated.
RELEASENOTES.md Notes the dependency resolution fix for branch names containing ].
Actions/Github-Helper.psm1 Switches dependency folder enumeration from -Path to -LiteralPath to prevent wildcard matching on ].

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants