Skip to content

Update WinGet catalog snapshot and ensure successful index refresh - #5365

Merged
Gabriel Dufresne (GabrielDuf) merged 3 commits into
mainfrom
fix/winget-stale-catalog-snapshot-5294
Sep 9, 2026
Merged

Update WinGet catalog snapshot and ensure successful index refresh#5365
Gabriel Dufresne (GabrielDuf) merged 3 commits into
mainfrom
fix/winget-stale-catalog-snapshot-5294

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

This pull request introduces improvements to how package index refreshing and catalog snapshotting are handled in the WinGet package manager integration. The main focus is to ensure that catalog snapshots are only refreshed when the package source index changes, improving efficiency and correctness. Additionally, the retry logic for update retrieval is enhanced to avoid unnecessary index refreshes, and new tests are added to verify these behaviors.

Catalog snapshotting and source index generation:

  • Introduced a SourceIndexGeneration counter in WinGet, which is incremented every time package indexes are refreshed (including on failure), and used as a cache key in NativeWinGetHelper to ensure catalog snapshots are only refreshed when necessary. (src/UniGetUI.PackageEngine.Managers.WinGet/WinGet.cs, src/UniGetUI.PackageEngine.Managers.WinGet/ClientHelpers/NativeWinGetHelper.cs) [1] [2] [3]

Update retrieval retry logic:

  • Modified the update retrieval logic in PackageManager so that the package indexes are only refreshed once per update attempt, and not redundantly on retries after fast repair; if the first refresh fails, a second attempt will refresh again. (src/UniGetUI.PackageEngine.PackageManagerClasses/Manager/PackageManager.cs) [1] [2] [3] [4] [5]

Testing improvements:

  • Enhanced the TestPackageManager fake to allow injection of custom index refresh logic, and added/updated tests to verify catalog snapshotting, index refresh behavior, and retry logic. (src/UniGetUI.PackageEngine.Tests/Infrastructure/Fakes/TestPackageManager.cs, src/UniGetUI.PackageEngine.Tests/PackageManagerTests.cs, src/UniGetUI.PackageEngine.Tests/WinGetManagerTests.cs) [1] [2] [3] [4] [5] [6]

These changes make the package manager more efficient and reliable by reducing unnecessary work and improving error handling during update checks.

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

Nonzero refresh exit codes are treated as successful, preventing the required retry.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Improves WinGet catalog cache invalidation and package-index refresh retry behavior.

Changes:

  • Keys native WinGet snapshots by source-index generation.
  • Avoids redundant refreshes after successful attempts.
  • Adds tests for caching and refresh retries.
File summaries
File Description
WinGetManagerTests.cs Tests snapshot invalidation and generation updates.
PackageManagerTests.cs Tests refresh retry behavior.
TestPackageManager.cs Adds injectable refresh behavior.
PackageManager.cs Tracks refresh success across retries.
WinGet.cs Adds and advances the index generation.
NativeWinGetHelper.cs Includes generation in snapshot cache keys.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: 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.PackageManagerClasses/Manager/PackageManager.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.

🟢 Approval recommended

The implementation and focused tests consistently cover generation-based invalidation and single-refresh retry behavior.

Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new
  • Review effort level: 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": "31636d60-ac8a-11f1-8474-925abbd4d437",
	"headSha": "83f8910da9c06fbcdb9e19be471c7d5e87564fba",
	"reviewer": "copilot-pull-request-reviewer[bot]"
}

@GabrielDuf
Gabriel Dufresne (GabrielDuf) merged commit 1f4bd2d into main Sep 9, 2026
9 of 10 checks passed
@GabrielDuf
Gabriel Dufresne (GabrielDuf) deleted the fix/winget-stale-catalog-snapshot-5294 branch September 9, 2026 20:31
@GabrielDuf Gabriel Dufresne (GabrielDuf) linked an issue Sep 9, 2026 that may be closed by this pull request
4 tasks
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.

[BUG] v2026.2.7 does not detect all updates at first scan

2 participants