Repository navigation
Fix PR #66 review follow-ups: export --source, admin gates, upgrade selection, version compare - #67
Merged
Marc-André Moreau (mamoreau-devolutions) merged 1 commit intoNov 6, 2026
Conversation
- export: Rust lists everything and groups by source (port of ExportPayloadBuilder), so `export --source` works and REST/msstore packages re-import. Both emit $schema, CreationDate, WinGetVersion and SourceDetails.Identifier; C# no longer writes "Schema". - admin gates: LocalManifestFiles is enforced in the local-manifest loader, covering uninstall/repair --manifest. InstallerHashOverride is checked at the start of install and repair, before agreement prompts and dependency installs, and on no-op/msstore/dependencies-only paths. - upgrade: C# ports select_upgrade_targets (exact match wins, otherwise an ambiguity error). --id/--name match only their own field; --moniker triggers an install; Rust gains upgrade --version/-v for the install. - versions: C# CompareVersionStrings uses Rust's tokenizer and rules (rc2 < rc10); both compare long digit runs without overflow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Marc-André Moreau (mamoreau-devolutions)
merged commit Nov 6, 2026
f987f79
into
master
14 checks passed
Marc-André Moreau (mamoreau-devolutions)
deleted the
claude/pr66-review-followups-b6dee2
branch
November 6, 2026 17:11
Marc-André Moreau (mamoreau-devolutions)
added a commit
that referenced
this pull request
Nov 8, 2026
## Summary This PR fixes 120 defects in 12 waves of 10, in both the Rust (`rust/`) and C# (`dotnet/`) implementations, so they stay aligned. It follows #66 and #67. - **How the defects were found:** two rounds of read-only audits, six areas per round. WinGet behaviour was checked against the upstream `winget-cli` sources. - **Where only one side was wrong:** it was changed to match the other, and a test was added on both sides to pin the shared behaviour. - **Findings dropped after checking WinGet,** because WinGet does the same thing: strict `--architecture`, RequireExplicitUpgrade still skipped with `--include-pinned`, and the portable-upgrade removal order. - **Tests** live in new per-wave files: `wave{N}_tests.rs`, `wave{N}_cli_tests.rs`, `wave{N}_com_tests.rs` and `Wave{N}DefectTests.cs`. Each wave is self-contained to review. | Wave | Area | Highlights | |---|---|---| | 1 | Installer execution | `InstallerSuccessCodes`/`ExpectedReturnCodes` and 3010 (reboot-required) handled<br>Uninstall opens the exact ARP hive and view<br>Download file names taken from the URL are sanitized<br>A missing `InstallerSha256` needs `--ignore-security-hash`<br>NSIS `/D=` is passed last and unquoted<br>`--uninstall-previous` removes the installed match | | 2 | Package sources | REST single-package search moves Id/Name/Moniker into `Inclusions` (servers AND the `Filters` list)<br>`sources.json` keys now match between Rust and C#<br>LIKE wildcards in user input are escaped<br>`source update` continues past failures and saves the successes | | 3 | Pins, correlation, settings | Pinning pins block `upgrade --all`<br>`pin add --version` creates a Gating pin, compared part by part<br>Settings JSON may contain comments, trailing commas or a BOM<br>MSIX family names drop the resource id | | 4 | Manifests and selection | `--manifest <dir>` loads every file of a multi-file manifest<br>The installer is selected before dependencies are installed<br>Dependency cycles stop<br>`MinimumOSVersion` pads missing parts with zeros<br>A leading `v` in a version is ignored | | 5 | CLI | The `error` command uses WinGet's HRESULT table (from `AppInstallerErrors.h`)<br>C# YAML output quotes values like `1.10` / `true`<br>Error paths exit non-zero<br>`hash` streams the file and prints lowercase<br>`--count` must be 1–1000 | | 6 | Publisher | Correlation values in the index are lowercased<br>C# canonical JSON is byte-identical to serde_json<br>BOMs are stripped before parsing<br>WinGet's PackageIdentifier rule<br>Windows-unsafe names (trailing dot or space, device names) are rejected | | 7 | Portable installs and archives | Uninstall removes only tracked files unless `--purge`<br>Upgrade keeps user files<br>Nested zip installers actually run<br>System tools are launched from their absolute System32 path<br>MSI repair uses `msiexec /f` | | 8 | Manifest model | `download` checks agreements and `DownloadCommandProhibited`<br>`Markets`, `UnsupportedOSArchitectures` and `UpgradeBehavior` are applied<br>Dependency `MinimumVersion` and the `Upgrade` switch are honoured<br>The downloaded manifest keeps every installer field | | 9 | Sources and HTTP | **Security:** paths from a source's index can no longer escape the cache folder<br>**Security:** `source add` requires `https://`<br>REST 204 and 404 responses are handled<br>Packaged-layout tombstones and YAML round-trip | | 10 | Installed packages, round 2 | `pinning.db` uses WinGet's schema<br>Blocking and Gating pins still apply with `--include-pinned`<br>ARP version fallbacks<br>ARM architecture stripping in name normalization<br>Pin source filters are case-insensitive | | 11 | CLI, PowerShell, COM | WinGet's common flags are accepted<br>`-Scope System` works<br>`RebootRequired` is reported<br>`validate` checks content on both sides<br>`Update-PingetPackage` continues after a failure | | 12 | Publisher, round 2 | An expired or rotated signing certificate no longer blocks publishing<br>An interrupted publish can be recovered (`pendingCommit` marker)<br>ARP ranges and correlation use effective installers<br>Overlapping ARP ranges fail the build | The commit message has one line per fix for each wave. ## Behaviour changes for reviewers - **Installer hashes:** a non-msstore manifest without `InstallerSha256` now fails unless `--ignore-security-hash` is given, as in WinGet. - **`source add`:** - `http://`, `ftp://` and local paths are refused. - With no `--type`, it creates a `Microsoft.PreIndexed.Package` source (WinGet's default) instead of REST. - **Pins:** - A plain pin now hides the package from `upgrade` and `upgrade --all`. - `pin add` records the installed version. - **Exit codes:** - A named `upgrade` with no target exits 1. - Several C# error paths and `source update` with partial failures exit non-zero. - **Portable packages:** - A plain uninstall leaves untracked files in place and warns; `--purge` removes everything. - Machine-scope x86 portables use `Program Files (x86)` and WOW6432Node. - **Installer switches:** - Generic `exe` installers no longer get a guessed `/S` or `/SILENT`. - 1641 is still a failure, as in WinGet. - **Rust `sources.json`:** now written in camelCase. It still reads the old snake_case keys, but older Rust builds cannot read the new files. - **Publisher:** - Builds whose ARP ranges overlap across versions fail. - A PackageIdentifier casing change is refused for an existing destination. - The ownership marker can carry `pendingCommit`. - `contract.md` is updated. - **Output:** C# `hash` prints lowercase. Tables are no longer truncated when stdout is piped. ## Validation - `cargo +nightly fmt --check` and `cargo clippy --workspace --tests -D warnings`: clean. - `cargo test --workspace`: all pass. - pinget-core 387 - pinget-cli 63 + 2 - pinget-publisher 51 + 26 conformance - pinget-com 2 - `dotnet build` (Release): succeeds. - `dotnet test` Core.Tests: 650 passed, 1 skipped (live-network test). - `dotnet test` Publisher.Tests: 158 passed. - `RunTests.ps1`: 13 passed, 0 failed, but the run is reported as failed because its AfterAll cleanup throws "Access is denied" (a module DLL is still loaded). I did not check whether this also happens on master. - `dotnet format --verify-no-changes`: reports only IDE0060 unused-parameter warnings, mostly on signatures unchanged from master. - **Known flaky tests:** - C# `InstallerCompletion_DoesNotWaitForDetachedChildProcess` failed once under heavy load and passes when run alone. - Some Rust tests that use a local HTTP stub hung once while several builds ran in parallel, and passed on every rerun. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Summary
Follow-ups to #66 from an independent post-merge review. Each finding is fixed in both the Rust and C# implementations, with tests.
1. Rust
export --sourcefailed; export format incomplete (Rust + C#)do_exportpassed--sourceintoListQuery, andRepository::listrejects a source without a query, sopinget export -o f.json --source wingetfailed. Rust also wrote every package under one hard-codedwingetsource, so REST and msstore packages could not be re-imported.ExportPayloadBuilder.Buildasbuild_export_payload: list withListQuery::default(), skip rows without a source, filter--sourcecase-insensitively, and group bysource_name, taking the argument and type (Microsoft.Rest/Microsoft.PreIndexed.Package) fromlist_sources().$schema,CreationDate,WinGetVersionandSourceDetails.Identifier. C#PackagesExportPayloadserialized the schema key as"Schema"; it is now[JsonPropertyName("$schema")], andCliExportPayloadTestsassert the right key. Import still reads onlySourceDetails.Name.Identifier.2. Admin-setting gates had holes (Rust + C#)
--manifeston uninstall: theLocalManifestFilescheck now lives insideload_manifest_from_path_with_documents/LoadManifestFromPathWithDocuments. Every--manifestload goes through it: install, repair, download, and the uninstall paths (uninstall_request/DescribeUninstallTargetandresolve_uninstall_matches/ResolveUninstallMatches). Novalidate-style reader uses these loaders.--ignore-security-hashchecked too late:install_request/Installandrepair/Repairnow checkInstallerHashOverridefirst, before the agreement prompt and dependency installs. The check also covers the already-installed no-op,--dependencies, and msstore paths. The fetch-time check stays, fordownload.--manifestare refused withoutLocalManifestFiles.3. Upgrade selection (Rust + C#)
pinget upgrade <query>without--allupgraded every substring match. The newUpgradeTargetSelectorports Rustselect_upgrade_targets: an exact match wins; otherwise the command fails with "Multiple installed packages found matching input criteria. Please refine the input." and lists the candidates.--idis compared only to the id,--nameonly to the name, and the query /--queryto either. Before,upgrade --id GitpickedGit.Gitbecause its name isGit.--moniker: now counts as a selector indo_install/doInstall, soupgrade --moniker Xupgrades instead of only listing.ListMatchhas no moniker, so a single row from the moniker-filtered list is upgraded, and several rows are an error.upgrade --version/-v: added. It goes on the installPackageQuery, not onListQuery(which filters on the installed version).4. Version comparison drift (C#, small Rust hardening)
CompareVersionStringssplit only on./-and took a leading number from each part, so1.0.0-rc2vs1.0.0-rc10sorted differently from Rust.tokenize_version: split on.,-,_and+, and at digit/letter boundaries. It uses the same rules too: numbers compare numerically; a number or missing part (padded"0") ranks above text; text compares ASCII case-insensitively. The existing expectations still hold, including1.0.0 > 1.0.0-rc1and"< X".u64now compare by length instead of falling back to text in Rust or saturating in C#.rc2<rc10,preview2<preview10, case, separators, leading zeros and long digit runs, inVersionCompareTestsand the Rustcompare_versiontest.Validation
cargo +nightly fmt --allis clean.cargo clippy --workspace --tests -- -D warningsis clean.cargo test -p pinget-core --lib -- --test-threads=1gives 264 passed.cargo test -p pinget-cligives 33 + 2 passed.dotnet formatwas run, and its unrelated Publisher rewrites were reverted.dotnet build -c Releasesucceeds.Devolutions.Pinget.Core.Testsgives 361 passed and 1 skipped (a live network test).AfterAllcleanup hitAccess is deniedwhile deleting the temp test root, a local file lock that is unrelated to this change.🤖 Generated with Claude Code