Skip to content

Allow an empty Discover search to list every WinGet package - #5536

Open
Gabriel Dufresne (GabrielDuf) wants to merge 2 commits into
mainfrom
discover-empty-query-browse
Open

Gabriel Dufresne (GabrielDuf) wants to merge 2 commits into
mainfrom
discover-empty-query-browse

Conversation

@GabrielDuf

@GabrielDuf Gabriel Dufresne (GabrielDuf) commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Pressing Enter on an empty Discover search now lists the packages available from each configured WinGet source, mirroring winget search --query "". Users of a private WinGet repository can browse everything it offers without guessing a search term.

Normal searches are unchanged

Every manager and every WinGet backend runs exactly the same code for a non-empty query as before, so search speed for everyone else is unaffected.

Scope

  • New ManagerCapabilities.SupportsEmptySearchQuery, true only for WinGet. An empty search never calls any other manager's FindPackages, because an empty query is slow, unbounded or an error on most of them. A query that only sanitizes to empty (e.g. ;|&) still queries nothing.
  • Results are capped per source, not per manager, so a private source listed after the community winget source is not crowded out of the first 100:
    • COM: one unfiltered FindPackages per catalog with ResultLimit, instead of three Contains "" filters that would each scan the whole catalog.
    • WinGet CLI / Pinget: one search "" --source <name> --count 100 per source. With --source, winget omits the Source column, so the parser now falls back to the queried source instead of labelling every row as the default source.
    • All three backends cover the same set of sources (explicit ones included), and share the SearchLimits constant.

Loader state

  • "No search submitted" (null) is now separate from "searched for nothing" (""), so the bare ReloadPackages() callers (IPC, maintenance, manager re-init) still do nothing before a search.
  • Clearing the Discover box resets the query, so background reloads no longer re-run a cleared search.
  • The query is read once per manager task, so a search submitted mid-load cannot hand an empty query to a manager that does not support it.

UI

  • An empty search that finds nothing shows the no-results message instead of a blank page.
  • The TUI Discover page gets the same empty-query browse.

Verification

  • Real COM probe (same interop calls as the new branch): empty query returns 100 winget rows in ~450 ms, 0 from msstore without error, 2 from winget-font; a vscode query still runs the three filters.
  • winget search "" --source <s> --count 100 and pinget search "" --source <s> --count 100 --output json verified for each source.
  • New tests: empty query only reaches capable managers, per-source cap, no query before a search or after a reset, CLI parser source fallback (fixture captured from real winget output), and a TUI E2E test.
  • UniGetUI.PackageEngine.Tests (both TFMs) and UniGetUI.Tui.Tests pass; dotnet format whitespace and style are clean.

Closes #5481

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.

🟡 Changes recommended

Source parsing, per-source failure handling, and exact-match filtering can hide valid browse results.

3 open findings
What changed in this PR

Adds empty-query browsing to Discover for WinGet, supporting private-repository discovery requested in #5481.

Changes:

  • Enables capped, per-source browsing across all three WinGet backends.
  • Separates an unsubmitted search from an empty query.
  • Updates desktop and terminal behavior and adds regression tests.
File Description
src/​UniGetUI.Tui/​Views/​Pages/​PackageListPage.cs Supports empty search submissions and status messages.
src/​UniGetUI.Tui/​FakeData/​FakePackageManager.cs Enables fake WinGet empty searches.
src/​UniGetUI.Tui.Tests/​E2E/​PackagePagesE2ETests.cs Tests terminal empty-query browsing.
src/​UniGetUI.PackageEngine.Tests/​WinGetCliParsingTests.cs Tests queried-source fallback.
src/​UniGetUI.PackageEngine.Tests/​DiscoverablePackagesLoaderTests.cs Tests capability gating, limits, and reset behavior.
src/​UniGetUI.PackageEngine.PackageLoader/​DiscoverablePackagesLoader.cs Handles empty queries and per-source limits.
src/​UniGetUI.PackageEngine.Managers.WinGet/​WinGet.cs Advertises empty-search support.
src/​UniGetUI.PackageEngine.Managers.WinGet/​ClientHelpers/​WinGetCliHelper.cs Adds per-source browsing and parser fallback.
src/​UniGetUI.PackageEngine.Managers.WinGet/​ClientHelpers/​PingetCliHelper.cs Adds capped per-source JSON searches.
src/​UniGetUI.PackageEngine.Managers.WinGet/​ClientHelpers/​NativeWinGetHelper.cs Uses capped, unfiltered catalog searches.
src/​UniGetUI.PackageEngine.Enums/​ManagerCapabilities.cs Adds empty-search capability.
src/​UniGetUI.PackageEngine.Enums/​Enums.cs Defines the shared browse limit.
src/​UniGetUI.Avalonia/​ViewModels/​SoftwarePages/​PackagesPageViewModel.cs Resets cleared searches and displays empty-result states.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/WinGetCliHelper.cs Outdated

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.

🔵 Needs a closer look

The search-reset issue remains unresolved, and Windows backend integration and NativeAOT publishing still need human validation.

0 open findings

3 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Empty search query fails to reset Discover loader and initial view

src/​UniGetUI.Avalonia/​ViewModels/​SoftwarePages/​PackagesPageViewModel.cs:622

An empty submitted search leaves GlobalQueryText as "", so ClearSearchQuery() returns at line 640 without reaching this reset callback. Closing to the tray calls ClearAllSearchQueries(), but the browse results and loader query remain active; later background reloads can repeat the browse. Handle the already-empty case in ClearSearchQuery() by resetting the Discover loader and restoring the initial search view.

🧠 Review effort: Balanced

@randy-but-a-ro randy-but-a-ro Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Pull request was approved automatically: the AI review is complete and all its review threads are resolved. 🎉

Integration Details
{
	"deliveryId": "c0a00200-c9a3-11f1-8b7d-b4ef0a730318",
	"headSha": "510f3267367efc686bda3906ae0f7270445050d9",
	"reviewer": "copilot-pull-request-reviewer[bot]"
}

This branch has not been deployed

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[IMPROVEMENT] Allow user to search for all available packages (winget search --query "")

2 participants