Skip to content

Fix: DownloadRelease incorrectly matches release assets from projects with the same name prefix - #2311

Draft
spetersenms with Copilot wants to merge 3 commits into
mainfrom
copilot/bug-fix-locating-release-assets
Draft

Fix: DownloadRelease incorrectly matches release assets from projects with the same name prefix#2311
spetersenms with Copilot wants to merge 3 commits into
mainfrom
copilot/bug-fix-locating-release-assets

Conversation

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

When locating previous release assets, the glob pattern logis-interface-*-Apps-*.zip matched assets from logis-interface-2-core-library because * spans hyphens. This caused unrelated projects' apps to be used as the previous release baseline.

Fix

DownloadRelease in Actions/Github-Helper.psm1 already uses regex patterns with [^-]+ for the branch segment instead of glob wildcards:

# Old (glob): logis-interface-*-Apps-*.zip  ← matches logis-interface-2-core-library-main-Apps-*.zip
# New (regex): ^logis-interface-[^-]+-Apps-.+\.zip$  ← stops at first hyphen, no false match

[^-]+ prevents the branch segment from spanning hyphen-separated project name components, so logis-interface-[^-]+-Apps-.+\.zip$ correctly rejects logis-interface-2-core-library-main-Apps-1.0.64.0.zip.

Tests

Added regression tests in Tests/GitHub-Helper.Test.ps1 covering:

  • logis-interface downloads only its own assets, not logis-interface-2-core-library assets (the reported scenario)
  • logis-interface-2-core-library resolves its own assets independently
  • Wildcard * project still matches all assets
  • Legacy Pattern-2 format (no branch in asset name) still works

✅ Checklist

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

Copilot AI changed the title [WIP] Fix issue with locating release assets for similar project names Fix: DownloadRelease incorrectly matches release assets from projects with the same name prefix Jul 9, 2026
Copilot AI requested a review from spetersenms July 9, 2026 10:27

@spetersenms spetersenms 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.

@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?

Copilot AI requested review from Copilot and removed request for Copilot July 28, 2026 09:39

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

@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 [^-]+ was already in place.

I've now added the ambiguity detection in DownloadRelease (commit). After selecting assets using the strict [^-]+ pattern, a second loose pass (using .+ which allows hyphens) finds any release assets that share the $project- prefix but were excluded by strict matching. When such assets are found, a ::Warning:: annotation is emitted listing the excluded asset names — for example:

::Warning::Found 1 release asset(s) sharing the 'logis-interface' name prefix that were excluded because they appear to belong to a different project: logis-interface-2-core-library-main-Apps-1.0.64.0.zip. Only assets matching project 'logis-interface' exactly have been included. If this is unexpected, check for projects with similar names in your repository.

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 * project is excluded from the check since it intentionally matches everything. Two new tests verify the warning is emitted and suppressed appropriately.

Copilot AI requested a review from spetersenms July 28, 2026 09:40
finally {
Remove-Item -Path $tempPath -Recurse -Force -ErrorAction SilentlyContinue
}
}
finally {
Remove-Item -Path $tempPath -Recurse -Force -ErrorAction SilentlyContinue
}
}
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.

[Bug]: Locating previous release also finds release assets of projects with the same name root

3 participants