Fix: DownloadRelease incorrectly matches release assets from projects with the same name prefix - #2311
Fix: DownloadRelease incorrectly matches release assets from projects with the same name prefix#2311spetersenms with Copilot wants to merge 7 commits into
Conversation
… matches for projects with same name prefix
spetersenms
left a comment
There was a problem hiding this comment.
@copilot you only made changes to tests, no actual functionality? Can we detect if multiple environments would match and throw a warning if that is the case?
You're right — only tests were added previously since the regex with I've now added the ambiguity detection in This fires whether or not any assets were matched, so users also get a helpful hint when no assets download due to a naming collision. The wildcard |
There was a problem hiding this comment.
@copilot There are some reported issues, take a look at those. Secondly for the warning, use the warning helper we got.
There was a problem hiding this comment.
🟢 Ready to approve
The warning logic is scoped correctly and the cross-platform tests cover the relevant matching scenarios.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
Adds diagnostics and regression coverage for strict release-asset matching, addressing issue #2234.
Changes:
- Warns when similarly prefixed project assets are excluded.
- Tests exact-project, wildcard, legacy, and warning behavior.
File summaries
| File | Description |
|---|---|
Actions/Github-Helper.psm1 |
Reports excluded prefix-sharing assets. |
Tests/GitHub-Helper.Test.ps1 |
Adds release matching regression tests. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Medium
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
spetersenms
left a comment
There was a problem hiding this comment.
@copilot take a look at the comments from github-advanced-security
Addressed in
Addressed in |
spetersenms
left a comment
There was a problem hiding this comment.
@copilot verify if importing the debughelper is required. I see OutputWarning used a few other places. The action runner should ensure the helper is always imported when actions are triggered.
Verified and removed in |
There was a problem hiding this comment.
🟡 Not ready to approve
Hyphenated branch names are misclassified as different projects, causing misleading warnings and valid assets to remain excluded.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
Suppressed comments (1)
Actions/Github-Helper.psm1:837
- This warning misclassifies valid assets from hyphenated branches as belonging to another project.
Get-CurrentBranchNamepreserves hyphens (Actions/AL-Go-Helper.ps1:332-338), and artifact names include that value unchanged (Actions/CalculateArtifactNames/CalculateArtifactNames.ps1:23-24,48-51), so an exact-project asset such aslogis-interface-feature-new-Apps-1.0.0.0.zipmatches this loose pattern but not the strict pattern and is excluded with a misleading explanation. The matcher needs an unambiguous project/branch boundary (for example, the expected branch or known project names), plus coverage for a hyphenated branch.
$loosePattern = "^$escapedProject-.+-$escapedMask-.+\.zip$"
$assetIds = @($assets | ForEach-Object { $_.id })
$excludedPrefixAssets = @($release.assets | Where-Object { $_.name -match $loosePattern -and $_.id -notin $assetIds })
if ($excludedPrefixAssets) {
OutputWarning -message "Found $($excludedPrefixAssets.Count) release asset(s) sharing the '$project' name prefix that were excluded because they appear to belong to a different project: $($excludedPrefixAssets.name -join ', '). Only assets matching project '$project' exactly have been included. If this is unexpected, check for projects with similar names in your repository."
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Balanced
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
When locating previous release assets, the glob pattern
logis-interface-*-Apps-*.zipmatched assets fromlogis-interface-2-core-librarybecause*spans hyphens. This caused unrelated projects' apps to be used as the previous release baseline.Fix
DownloadReleaseinActions/Github-Helper.psm1already uses regex patterns with[^-]+for the branch segment instead of glob wildcards:[^-]+prevents the branch segment from spanning hyphen-separated project name components, sologis-interface-[^-]+-Apps-.+\.zip$correctly rejectslogis-interface-2-core-library-main-Apps-1.0.64.0.zip.Tests
Added regression tests in
Tests/GitHub-Helper.Test.ps1covering:logis-interfacedownloads only its own assets, notlogis-interface-2-core-libraryassets (the reported scenario)logis-interface-2-core-libraryresolves its own assets independently*project still matches all assets✅ Checklist