Skip to content

Improve winget upgrade parity#37

Merged
Gabriel Dufresne (GabrielDuf) merged 3 commits into
masterfrom
mamoreau-devolutions/pinget-update-failure
Jun 4, 2026
Merged

Improve winget upgrade parity#37
Gabriel Dufresne (GabrielDuf) merged 3 commits into
masterfrom
mamoreau-devolutions/pinget-update-failure

Conversation

@mamoreau-devolutions

@mamoreau-devolutions Marc-André Moreau (mamoreau-devolutions) commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR improves Pinget parity with WinGet for package upgrades in both the Rust and C# implementations. It addresses several issues found while comparing local Pinget behavior against WinGet on real installed packages.

Fixes and behavior changes

MSI/WiX elevation parity

  • Detects machine-scope MSI/WiX installs that need elevation during silent upgrade/install flows.
  • Launches msiexec.exe through the elevated shell-execute path instead of trying to execute the MSI package directly.
  • Aligns Pinget with WinGet behavior for packages like Node.js where WinGet pops UAC and Pinget previously returned MSI exit code 1603.

Resilient installer downloads

  • Streams installer downloads directly to disk instead of buffering the full response body.
  • Writes partial downloads as .part files with sidecar metadata for resume support.
  • Resumes downloads with Range and If-Range when the server provides a strong ETag or Last-Modified validator.
  • Handles 200, 206, and 416 responses explicitly.
  • Adds connect, idle, and total timeout safeguards so Pinget does not wait indefinitely when a connection stalls or no bytes arrive.
  • Verifies installer SHA256 from disk before committing the completed download.

Source error diagnostics

  • Stops converting explicit-source search failures into misleading no package matched the supplied query errors.
  • Explicit --source winget single-package operations now surface source/search failures directly, which makes transient source-cache or index-open issues easier to diagnose.

Upgrade-list parity with WinGet

  • Allows list --upgrade-available --source winget, matching WinGet's accepted command shape.
  • Treats ARP uninstall subkey names as strong product-code identities, not only GUID-shaped keys.
  • Improves matching for packages whose WinGet source identity is based on string product codes, including Chrome, Zoom, Inno Setup, and similar ARP entries.
  • Avoids unsafe loose-name whole-catalog matching during bulk upgrade listing, preventing false positives such as unrelated packages being reported as upgrades.
  • Uses WinGet-style ARP versionData mapping for packages with coarse DisplayVersion values.
  • Preserves the < latest display form only for the Snagit-style case where the installed ARP version is equal to the catalog version but below the catalog's ARP build range.
  • Keeps ordinary older installed versions, such as OpenJDK 17.0.18.8, displayed as their actual installed version instead of rewriting them to < 17.0.19.10.

Local comparison results

After the fixes, the locally built Rust executable reports the same upgrade count as WinGet on this machine:

D:\dev\.copilot\copilot-worktrees\pinget\mamoreau-devolutions-laughing-disco\rust\target\release\pinget.exe list --upgrade-available --source winget
winget list --upgrade-available --source winget --disable-interactivity

Both commands reported 45 upgrades. Pinget now includes the previously missed entries and no longer includes the investigated false positives.

Validation

  • cargo +nightly fmt --manifest-path rust\Cargo.toml --all
  • cargo clippy -q --manifest-path rust\Cargo.toml --workspace --tests -- -D warnings
  • cargo test -p pinget-core --manifest-path rust\Cargo.toml
  • cargo test -p pinget-cli --manifest-path rust\Cargo.toml
  • cargo build -p pinget-cli --manifest-path rust\Cargo.toml --release
  • dotnet format dotnet\Devolutions.Pinget.slnx
  • dotnet build dotnet\Devolutions.Pinget.slnx -c Release
  • dotnet test dotnet\src\Devolutions.Pinget.Core.Tests\Devolutions.Pinget.Core.Tests.csproj -c Release --no-build
  • pwsh -NoLogo -NoProfile -File (Resolve-Path 'dotnet\tests\RunTests.ps1')

The branch was rebased onto origin/master; this repository does not currently have an origin/main ref.

@mamoreau-devolutions Marc-André Moreau (mamoreau-devolutions) force-pushed the mamoreau-devolutions/pinget-update-failure branch from 6973e3d to e8fcfe9 Compare June 4, 2026 10:57
Fix Pinget installer and upgrade behavior to better match WinGet, including elevated MSI/WiX dispatch, resumable installer downloads, source error reporting, and upgrade-list correlation/version parity in both Rust and C#.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mamoreau-devolutions Marc-André Moreau (mamoreau-devolutions) force-pushed the mamoreau-devolutions/pinget-update-failure branch from e8fcfe9 to 048324f Compare June 4, 2026 14:03
The test machine_scope_silent_msi_uses_shell_execute_instead_of_direct_msi
calls should_run_msi_direct and should_elevate_msi_shell_execute, which
are both #[cfg(windows)]-only functions (since MSI direct/ShellExecute paths
only apply on Windows). The test binary therefore failed to compile on the
Linux CI runner with E0425 (cannot find function in this scope).

Fix: add #[cfg(windows)] to the test itself.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@GabrielDuf Gabriel Dufresne (GabrielDuf) merged commit f6adc06 into master Jun 4, 2026
13 checks passed
@GabrielDuf Gabriel Dufresne (GabrielDuf) deleted the mamoreau-devolutions/pinget-update-failure branch June 4, 2026 15:38
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.

2 participants