Repository navigation
Send empty WinGet searches through the CLI instead of COM - #5822
Merged
Gabriel Dufresne (GabrielDuf) merged 2 commits intoNov 23, 2026
Merged
Conversation
An empty Discover search still listed nothing from a private WinGet REST source after #5641. WinGet's COM layer (PackageCatalog.cpp, PopulateSearchRequestFromVector) skips every filter and selector whose value is empty, so the CatalogDefault "" selector added there never became a Query. COM kept sending {"FetchAllManifests":true,"MaximumResults":100}, which servers such as Winget-Repo answer with no packages: it only lists everything for Query {KeyWord:"", MatchType:"Substring"}, the body that `winget search ""` sends. The reporter's Find-WinGetPackage -Query '' test, which goes through the same COM layer, came back empty for this reason. COM has no way to send an empty keyword, so NativeWinGetHelper now hands an empty query to the CLI helper it already uses as its fallback for updates and installed packages. That helper searches each source with `search "" --source <name> --count 100`. The dead CatalogDefault branch is removed; non-empty searches keep their Name/Id/Moniker filters. The CLI helper used to search no source at all when `winget source export` failed, which showed the same "No results". It now falls back to the sources UniGetUI already knows when the export exits non-zero or lists none. Verified against a port of Winget-Repo 2.9.4's manifestSearch on a local HTTPS REST source with winget 1.29.380 (the reporter's version): the unfixed app's empty search sent FetchAllManifests and got 0 packages from that source, the fixed app sent the empty Query and listed all of them. Fixes #5812 Co-Authored-By: Claude Opus 5.5 <[email protected]>
4 tasks done
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The real empty-query CLI search needs human confirmation on the reporter’s Windows/private WinGet REST setup because prior fixes failed there and current tests cover only mocked delegation and source selection.
No open issues 🎉
What changed in this PR
This PR addresses empty Discover searches returning no results for private WinGet repositories (#5812), replacing the ineffective COM approach from #5641 with CLI searches.
Changes:
- Route empty searches through the CLI while preserving COM filters for non-empty queries.
- Fall back to UniGetUI’s known sources when CLI source export fails or returns no sources.
- Update regression tests for CLI delegation and source fallback behavior.
| File | Description |
|---|---|
src/UniGetUI.PackageEngine.Tests/WinGetManagerTests.cs |
Tests empty-query CLI delegation and retained non-empty search fields. |
src/UniGetUI.PackageEngine.Tests/WinGetCliParsingTests.cs |
Tests source selection after successful, failed, or empty exports. |
src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/WinGetCliHelper.cs |
Adds known-source fallback for empty-query browsing. |
src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs |
Delegates empty queries to the CLI and removes the ineffective COM selector. |
Review effort: Balanced
There was a problem hiding this comment.
🤖 Pull request was approved automatically: the AI review is complete and all its review threads are resolved. 🎉
Integration Details
{
"deliveryId": "ca590d56-e770-11f1-8c00-0f0ff23d805f",
"headSha": "8e2f0490ad77cd65d7f8f445157c49835e9ccd9a",
"reviewer": "copilot-pull-request-reviewer[bot]"
}
Gabriel Dufresne (GabrielDuf)
deleted the
fix/5812-empty-winget-search-cli
branch
November 23, 2026 19:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
#5641 tried to make an empty Discover search list a private WinGet REST source by sending a
CatalogDefaultselector with an empty value through COM. That never reached the server: WinGet's COM layer (PackageCatalog.cpp,PopulateSearchRequestFromVector) skips every filter and selector whose value is empty ("If the caller did not add a value it can't actually be used to filter or include anything so just ignore it"). So COM kept sending the same request as before:{"FetchAllManifests": true, "MaximumResults": 100}Winget-Repo, the reporter's server, answers that with no packages. It only lists everything when the body carries a query, which is what
winget search ""sends:{"MaximumResults": 100, "Query": {"KeyWord": "", "MatchType": "Substring"}}The reporter's
Find-WinGetPackage -Query ''test in #5639 goes through the same COM layer, and it came back empty for the same reason.Fix
COM has no way to send an empty keyword, so:
NativeWinGetHelper.FindPackages_UnSafehands an empty query to the CLI helper it already uses as its fallback for updates and installed packages. That helper searches each source withsearch "" --source <name> --count 100. The deadCatalogDefaultbranch is removed; non-empty searches keep their Name/Id/Moniker filters.WinGetCliHelper: whenwinget source exportexited non-zero or listed nothing, the empty search used to search no source at all and showed the same "No results". It now falls back to the sources UniGetUI already knows (ChooseBrowseSources).refs #5812