Skip to content

Filter upgrade visibility based on host architecture compatibility#25

Merged
Gabriel Dufresne (GabrielDuf) merged 5 commits into
masterfrom
FilterUpgrades
May 19, 2026
Merged

Filter upgrade visibility based on host architecture compatibility#25
Gabriel Dufresne (GabrielDuf) merged 5 commits into
masterfrom
FilterUpgrades

Conversation

@GabrielDuf
Copy link
Copy Markdown
Contributor

This pull request improves the upgrade logic for packages in both the Rust and .NET implementations of Pinget. The main focus is to ensure that packages whose latest catalog version has no installer compatible with the user's system architecture are hidden from bulk upgrade listings, matching the behavior of winget. The changes also include thorough test coverage and internal refactoring to support this logic.

Upgrade filtering enhancements:

  • Added a new field correlated_lacks_compatible_installer to InstalledPackage (Rust: struct InstalledPackage, .NET: InstalledPackage class) to track whether the latest catalog version has a compatible installer for the host architecture.
  • Updated the upgrade filter logic in both Rust and .NET to hide packages lacking a compatible installer from bulk upgrade output, unless the user explicitly filters by package ID.

winget hides upgrades whose latest catalog version has no installer for
an architecture the host can execute. On arm64 Windows, x86 and x64
installers are runnable via emulation, so they stay; a manifest that
only ships installers for an arch outside the host's preference list
disappears from `upgrade` output entirely.
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.

see comments from GitHub Copilot, there are some things that may be problematic for NativeAOT

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds host-architecture compatibility filtering so packages whose latest catalog version publishes no installer the host can run are hidden from bulk upgrade output (mirroring winget), in both the Rust and .NET implementations. Also includes unrelated PowerShell/CI changes to honor PINGET_APPROOT when locating settings, so parity tests can share state with packaged winget.

Changes:

  • New correlated_lacks_compatible_installer / CorrelatedLacksCompatibleInstaller field on InstalledPackage, populated from the latest manifest's installer architectures during catalog enrichment, and consulted in the upgrade filter (bypassed when an explicit id/etc. filter is active).
  • New manifest_has_compatible_installer / ManifestHasCompatibleInstaller helper plus a Windows-aware current_architecture() in Rust that uses IsWow64Process2 to detect the native machine (avoiding mis-reporting when running emulated). Added Win32_System_SystemInformation feature to windows-sys.
  • Parity script/workflow updates: Get-ExpectedUserSettingsPath honors $env:PINGET_APPROOT (packaged-layout aware), and parity-test.yml sets PINGET_APPROOT to winget's packaged LocalState so cross-CLI coherence tests share stores.
  • Test coverage for the new filter behavior and helper in both Rust and .NET.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
rust/crates/pinget-core/src/lib.rs New field, filter rule, manifest compatibility helper, Windows native-arch detection, and supporting tests.
rust/crates/pinget-core/Cargo.toml Adds Win32_System_SystemInformation feature for IsWow64Process2.
dotnet/src/Devolutions.Pinget.Core/Models.cs Adds CorrelatedLacksCompatibleInstaller to InstalledPackage.
dotnet/src/Devolutions.Pinget.Core/Repository.cs Populates the flag during enrichment, adds filter rule and ManifestHasCompatibleInstaller helper plus test hook.
dotnet/src/Devolutions.Pinget.Core.Tests/CoreTests.cs xUnit tests for the new filter behavior and helper.
scripts/Parity-Compare-WingetParity.ps1 Get-ExpectedUserSettingsPath now honors PINGET_APPROOT with packaged-layout detection.
.github/workflows/parity-test.yml Sets PINGET_APPROOT to winget's packaged LocalState for parity tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Repository.ParseYamlManifest/ParseYamlManifestDocuments now walk
YamlDotNet's IParser events directly instead of calling
Deserialize<object?>/Deserialize<Dictionary<string, object?>>, which
require dynamic code (IL3050) and trim-unsafe reflection (IL2026)
under AOT. The walker produces the same Dictionary<object,object> /
List<object> / string tree, so all downstream pattern matches and
ReadBool calls work unchanged.

NameNormalization is now a partial class with [GeneratedRegex]
methods. RegexOptions.Compiled silently falls back to the interpreter
under AOT, so the 32-regex hot path on ARP normalization would have
regressed; source-generated regex restores native-quality
performance and removes AOT warnings.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread dotnet/src/Devolutions.Pinget.Core/Repository.cs Outdated
Comment thread dotnet/src/Devolutions.Pinget.Core/Repository.cs
@GabrielDuf Gabriel Dufresne (GabrielDuf) merged commit 18d027a into master May 19, 2026
13 checks passed
@GabrielDuf Gabriel Dufresne (GabrielDuf) deleted the FilterUpgrades branch May 19, 2026 15:29
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.

4 participants