Skip to content

Fix 100 correctness defects in Rust and C# (waves 13–22) - #73

Merged
Marc-André Moreau (mamoreau-devolutions) merged 21 commits into
masterfrom
claude/bug-fixes-iteration-6815a3
Nov 15, 2026
Merged

Marc-André Moreau (mamoreau-devolutions) merged 21 commits into
masterfrom
claude/bug-fixes-iteration-6815a3

Conversation

@mamoreau-devolutions

Copy link
Copy Markdown
Contributor

Summary

This PR fixes 100 defects in 10 waves of 10 (waves 13–22). It follows the 12 waves in #68. Each fix covers both Rust (rust/) and C# (dotnet/) wherever the feature exists in both, so the two implementations stay aligned.

  • How the defects were found: one area audit per wave. Behaviour was checked against the upstream winget-cli sources. Findings were dropped when WinGet behaves the same way.
  • Tests: each wave adds its own test files: wave{N}_tests.rs, wave20_cli_tests.rs, wave22_com_tests.rs and Wave{N}DefectTests.cs. Each wave can be reviewed on its own, and every defect test was checked to fail before its fix.
  • History: each wave is its own commit, merged into this branch, so git log --first-parent lists the waves.
Wave Area Highlights
13 Installer execution Interactive ARP uninstall falls back to QuietUninstallString
A blank uninstall string is no longer reported as success
Per-mode switch merging now matches WinGet
--uninstall-previous applies only to updates
Downloaded installers are deleted after a successful install
An MSIX uninstall can no longer run a same-named ARP uninstaller
14 Pre-indexed sources and settings An empty winget source export no longer breaks loading
The mirror cache keys on identifier + URL and repairs itself when corrupt
source update <identifier> passes the source name to winget
A looping V1 pathparts chain no longer hangs
Packaged sources write Identifier and sort by Priority
15 REST sources ContinuationToken paging
Unsupported inclusions are dropped and unsupported filters fail the search
Null arrays in /information are tolerated
Ids and versions are trimmed
Empty switches are ignored
no-store/no-cache responses are not cached
16 Search, versions, selection Latest and > x versions sort correctly
Pre-indexed filters are combined with AND
Tag and command filters use the request's match type
WinGet's IsFirstBetter installer ranking (locale, scope, architecture, type)
Neutral architecture ranks last
REST truncation flag fixed
17 Installed packages, correlation Name normalization: NFKC, case folding (ß→ss), SAP lowercase, @@ cut-off position
Architecture-qualified normalized names are looked up first
An older installed.db no longer breaks list
list matches PackageFamilyName, ProductCode, UpgradeCode and the catalog name
ARP entries with ParentKeyName are listed
18 Manifests A null installer key no longer wipes the root value
Root ProductCode, PackageFamilyName and Nested* are inherited only by matching installer types
Dependencies are trimmed and de-duplicated
Localization is preserved
The C# legacy MSZIP path has a size limit
19 Portable installs and archives Uninstall data is written under WinGet's registry value names (TargetFullPath, SymlinkFullPath, SHA256); the old pinget names are still read
InstallDirectoryAddedToPath is removed from PATH on uninstall
A failed install is rolled back
COM¹–LPT³ device names are rejected
Archives with no or several nested installers are rejected
20 CLI The C# CLI now reports parse errors and handles --help
CJK and other wide characters are measured in display columns, and truncation uses …
export sorts and de-duplicates
import reads schema 1.0 Id
WinGet's exclusive and dependent argument rules are enforced
hash prints InstallerSha256:
Positional import/export file
21 Publisher Agreement and AgreementLabel are kept as strings
Per-installer Commands follow WinGet's rule
norm_names2 includes the architecture variant
Index terms, names and monikers are trimmed
A relative --psign-tool path resolves correctly
A build recovers when a snapshot was removed
C# PackageLocale length limit
22 PowerShell and COM COM errors are reported, not a bare E_FAIL or a stale message
A named ResetSource no longer resets every source
Piped packages are targeted by id and source
-MatchOption is honoured
WinGet version comparison
Channel and identity properties are carried through
RunTests.ps1 runs again

Reviewer notes: behaviour changes

  • PowerShell agreements: Install-, Update- and Export-PingetPackage now accept package agreements automatically, as WinGet's cmdlets do.
  • Tag and command match type: in a many-search, --tag and --command are now substring matches unless --exact is given (WinGet's SearchSourceApplyFilters). This reverses one assertion that wave 9 kept, in wave9_tests.rs and Wave9DefectTests.cs.
  • ARP ParentKeyName: list now shows these entries. WinGet's ARPHelper only skips SystemComponent entries.
  • C# CLI argument parsing: the C# CLI now rejects unknown options and invalid values it used to ignore.
  • Installer cleanup: downloaded installers are deleted after a successful install (WinGet's RemoveInstaller), and kept when the install fails.
  • Merge note: waves 15 and 16 both changed the REST search code. The merge keeps wave 15's ContinuationToken paging loop and wave 16's truncation rule: more than MaximumResults results, or a non-blank token.

Validation

  • cargo +nightly fmt and cargo clippy --workspace --tests -- -D warnings: clean.
  • cargo test --workspace: all passed (core 471, cli 81 + 2, com 7, publisher 64 + 26 conformance).
  • dotnet build dotnet/Devolutions.Pinget.slnx -c Release: 0 errors. dotnet format --verify-no-changes: no changes.
  • Core.Tests: 814 passed, 1 skipped (an existing live test).
  • Publisher.Tests: 181/181 on 4 of 5 runs. The failing run hit an intermittent IOException ("file is being used by another process") in Publish_And_VerifyDestination_RejectSignedMsixInUnsignedDevelopmentMode; that test and the code it covers are unchanged.
  • dotnet/tests/RunTests.ps1 under PowerShell 7: 13/13 passed. On the dev machine, Pester reported the container as failed because deleting its temp folder was denied (sandbox restriction).

🤖 Generated with Claude Code

- W14-1 (both): `winget source export` with no sources prints "There are no sources configured." instead of JSON; it is now an empty list, not a parse error.
- W14-2 (C#): MergeSourceCacheMetadata used ToDictionary on Identifier and threw ArgumentException when two exported sources share an identifier (e.g. a mirror of the winget CDN).
- W14-3 (both): mirror refresh carried ETag/Last-Modified/SourceVersion/LastUpdate onto a source re-added at a different Arg; metadata now requires identifier and argument to match.
- W14-4 (both): an unreadable system-sources.json mirror failed every open (Auto silently fell back to private) and blocked its own refresh; it is now treated as absent and re-exported.
- W14-5 (both): direct-mode `source update <identifier>` passed the identifier to `winget source update --name`; the resolved source name is passed instead.
- W14-6 (C#): a pre-indexed update whose candidates all returned non-success HTTP statuses failed with an empty reason; each candidate's HTTP status is now reported.
- W14-7 (Rust): a source2.msix that could not be read or lacked Public/index.db aborted the update instead of falling back to source.msix like C#.
- W14-8 (both): a V1 index whose pathparts parent chain loops made relative-path resolution spin forever; a cycle is now an error.
- W14-9 (both): packaged user_sources omitted the `Identifier` key, which is the only key WinGet's SourceList reads the identifier from.
- W14-10 (both): packaged sources were not ordered like WinGet (stable sort by descending Priority): Rust ignored Priority, C# sorted explicit sources last and alphabetized by name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Interactive ARP uninstall now falls back to QuietUninstallString when UninstallString is missing (WinGet GetUninstallInfo) instead of failing.
- Blank QuietUninstallString/UninstallString values are ignored instead of running an empty cmd.exe command that exits 0 and reports a false success.
- Direct MSI execution accepts property names WinGet accepts (e.g. MY.PROP, %VAR) instead of failing the silent install.
- The requested mode's switch now comes from the manifest, then the installer type default, before the other mode's manifest switch (an MSI with only SilentWithProgress is fully quiet under --silent).
- Delegated `winget uninstall` passes --interactive for interactive requests (Rust only; C# has no delegation).
- --uninstall-previous only applies to an update, like WinGet; a same-version reinstall no longer uninstalls first.
- The Upgrade switch is no longer appended after the previous version was uninstalled (WinGet clears InstallerExecutionUseUpdate).
- The downloaded installer is removed after a successful install (WinGet RemoveInstaller) instead of piling up in %TEMP%\pinget-install.
- The InstallLocation switch is only added when --location is supplied, even when the manifest switch has no <INSTALLPATH> token.
- Uninstalling an MSIX package never matches (and runs the uninstaller of) a same-named ARP entry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-iteration-6815a3

# Conflicts:
#	rust/crates/pinget-core/src/lib.rs
1. Version: `Latest` sorted below numeric versions; it now sorts above every version like WinGet (Rust+C#).
2. Version: `> 1.0` compared equal to `1.0`; approximate `<`/`>` now order just below/above their base (Rust+C#).
3. Search: pre-indexed search applied only the first of query/--id/--name/--moniker/--tag/--command; all are now ANDed (Rust+C#).
4. Search: many-search --tag/--command used Exact instead of the request's Substring match type (pre-indexed and REST, Rust+C#).
5. Selection: --installer-type ignored a zip installer's NestedInstallerType (and appx/msix aliasing) (Rust+C#).
6. Selection: no default installer type preference (msstore > msix > msi > wix > burn > nullsoft > inno > exe > portable) (Rust+C#).
7. Selection: neutral ranked above x86 on x64 and above emulated x64/x86 on arm64; neutral is now last (Rust+C#).
8. Search: a REST single lookup with a positional query dropped the --id/--name/--moniker/--tag/--command filters (Rust+C#).
9. Selection: scope preference (requested, else WinGet's default user) never ranked installers; ranking now follows WinGet's strong/weak comparator order (locale, scope, architecture, type) (Rust+C#).
10. Search: REST results were marked truncated when exactly MaximumResults came back, and a ContinuationToken was ignored (Rust+C#).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-iteration-6815a3

# Conflicts:
#	rust/crates/pinget-core/src/lib.rs
…efects

- Name normalization: the SAP Business Objects short-circuit returned the name un-folded, so it never matched the lowercase catalog value.
- Name normalization: no Unicode NFKC step like WinGet's PrepareForValidation (™, full-width letters, ligatures normalized differently).
- Name normalization: lowercase instead of ICU full case folding (ß/ẞ -> ss, ς -> σ), so such names/publishers never correlated.
- Name normalization: the @@ cut-off took the first @@ at any position (and in Rust a UTF-8 byte offset) instead of find(L"@@", 3).
- Normalized correlation: never tried the architecture-qualified name (foo(X64)) first, so "Foo (x64)" vs "Foo (x86)" packages stayed ambiguous.
- installed.db correlation: queried every identity table even when only one pair exists (pre-1.6 schema), failing list with "no such table".
- list <query>: did not match PackageFamilyName/ProductCode/UpgradeCode exactly like WinGet's query search.
- list --name: ignored the correlated catalog name, unlike --id and WinGet's installed search.
- MSIX enumeration: packages without a display name were dropped instead of listed under the package name.
- ARP enumeration: entries with ParentKeyName were skipped although WinGet's ARPHelper only skips SystemComponent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-iteration-6815a3

# Conflicts:
#	rust/crates/pinget-core/src/lib.rs
1. REST manifestSearch ignored ContinuationToken and returned only the first page; now resends with the ContinuationToken header until done or enough results, and fails on a repeated token (Rust+C#).
2. Single-package search sent PackageIdentifier/PackageName/Moniker inclusions even when /information lists them as unsupported; unsupported inclusions are now dropped, and a search with none left returns no results without a request (Rust+C#).
3. Filters on fields listed in UnsupportedPackageMatchFields were sent (and could be ignored, returning unfiltered results), and missing non-Market RequiredPackageMatchFields were not reported; both now fail the search like WinGet (Rust+C#).
4. An empty manifestSearch response carrying RequiredPackageMatchFields/UnsupportedPackageMatchFields was reported as "no packages found"; it is now an unsupported-request error (Rust+C#).
5. A null (or non-string-item) optional array in /information made the whole REST source fail to load; arrays are now read leniently like WinGet's GetRawStringArrayFromJsonNode (Rust+C#).
6. REST search results kept surrounding whitespace in PackageIdentifier/PackageVersion; both are now trimmed like WinGet (Rust+C#).
7. A REST manifest whose PackageVersion had surrounding whitespace did not match the requested version and failed; versions are trimmed before matching (Rust+C#).
8. An empty installer switch string ("Silent": "") overrode the version-level default and the Silent/SilentWithProgress fallback; empty switches are now treated as absent (Rust+C#).
9. /information responses marked Cache-Control no-store/no-cache were cached anyway, and Rust ignored "Max-Age" written in other casing or with spaces; such responses are no longer cached and directives parse case-insensitively (Rust+C#).
10. A C# REST search result with no versions (or a version entry without PackageVersion) became a match with version "?"; it is now invalid data, as in Rust and WinGet (C#).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve overlap with wave 16: keep the ContinuationToken paging loop from
wave 15 and wave 16's truncation rule (more than MaximumResults, or a
non-blank token), now computed from the last continuation token. Single
lookups keep wave 16's flow, so their filters reach validation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- R22-1 (Rust COM): AddSource/RemoveSource/ResetSource/ListSourcesJson/GetDefaultAppRoot never set or cleared the last error, so failures surfaced as bare E_FAIL or a stale message; they now go through the shared helpers (E_INVALIDARG kept for bad arguments).
- R22-2 (Rust COM): ResetSource(name, all) reset every source when a name was also given; a named reset now only resets that source, like Reset-WinGetSource and the managed client.
- R22-3 (C#, net + net48): a piped PSCatalogPackage added its display name and moniker as exact filters, so Find-PingetPackage | Uninstall/Update/Repair-PingetPackage missed packages whose ARP name differs; piped packages are targeted by id and source only.
- R22-4 (C#, net + net48): Uninstall/Repair of a piped found package pinned the catalog's latest version as the installed-version filter; only an installed package contributes its version.
- R22-5 (C#, net + net48): Install/Update/Export-PingetPackage never accepted package agreements (WinGet's InstallOptions/DownloadOptions default to true) and failed with a CLI-only hint; requests now accept them.
- R22-6 (C#, net): Get-PingetPackage on PowerShell 7 dropped PackageFamilyNames/ProductCodes that the Windows PowerShell path returns; the mapping now carries them.
- R22-7 (C#): CompareToVersion used System.Version/lexical ordering (1.0 < 1.0.0, 2.0.1.0.5 > 2.0.1.0.10, 1.0.0-beta > 1.0.0); it now follows WinGet version semantics.
- R22-8 (C#, net + net48): -MatchOption Equals was case-insensitive and StartsWithCaseInsensitive matched substrings for Find/Get-PingetPackage; the results are now filtered accordingly.
- R22-9 (C#, net + net48): found packages dropped the catalog channel, so GetPackageVersionInfo(v).Channel was always empty.
- R22-10 (scripts): RunTests.ps1 staged the module with -NoBuild, which failed with "Native COM DLL not found" under PowerShell 7 (which never loads it), left a half-staged dist that later runs reused, and never restaged stale dist; it now always restages and skips the Windows PowerShell half on Core, and Build-PowerShellModule resolves native DLLs before staging.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
1. Tables (both): column widths counted chars/UTF-16 units, so CJK/fullwidth names misaligned; measure East Asian Wide/Fullwidth as 2 columns like WinGet UTF8ColumnWidth.
2. Truncation (both): truncated table/search cells ended in '.', indistinguishable from a dotted package id; use WinGet's '…' and pad a wide char that no longer fits.
3. export (both): packages were neither sorted by id nor de-duplicated, so side-by-side installs exported twice; sort by id and collapse duplicates without --include-versions (SelectVersionsToExport).
4. import (both): schema 1.0 files ("Id" instead of "PackageIdentifier") were rejected (C#) or imported as "?" (Rust); read "Id" as a fallback.
5. Rust install/uninstall/repair: a failed action whose installer reported exit code 0 exited the process with 0; exit 1 instead (as the C# CLI does).
6. list (both): --include-unknown/--include-pinned were accepted without --upgrade-available; reject them like WinGet's ValidateArgumentDependency.
7. WinGet exclusive sets (both): uninstall --purge|--preserve and --all-versions|--version, pin add --version|--blocking, install --skip-dependencies|--dependencies-only were accepted; reject them (Rust also gains --dependencies-only and uninstall --all).
8. C# CLI: RootCommand.Parse().Invoke() had no middleware, so unknown options, bad --output values, --count bounds and missing required options were ignored and the handler ran (exit 0), and --help printed nothing; report parse errors (exit 1) and serve --help/-?.
9. hash (both): output was labelled "SHA256:" instead of WinGet's "InstallerSha256:", and --file/-f and -m (--msix) were rejected.
10. import/export (both): the file could only be named (-i/-o); accept it positionally too, as WinGet does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Archive portable with no NestedInstallerFiles installed silently with no command; now rejected like WinGet.
- Non-portable nested archive naming several NestedInstallerFiles ran only the first; now rejected like WinGet.
- Superscript device names (COM¹²³/LPT¹²³) were accepted in portable relative paths; now reserved like MakeSuitablePathPart.
- Portable ARP entry wrote PortableTargetFullPath/PortableSymlinkFullPath and no SHA256; now writes WinGet's TargetFullPath/SymlinkFullPath/SHA256 so WinGet can remove pinget installs.
- Portable ARP read ignored WinGet's TargetFullPath/SymlinkFullPath, so uninstalling a WinGet-installed portable left its binary; both names now read.
- Uninstall left the install directory in PATH when InstallDirectoryAddedToPath=1, and pinget set that flag for the Links dir; PATH entry now removed and flag keeps WinGet meaning.
- ARP DisplayName/DisplayVersion/Publisher ignored the installer's AppsAndFeaturesEntries and HelpLink was missing; now set like SetAppsAndFeaturesMetadata.
- --manifest portable installs were recorded under the community source; now *DefaultSource with a MakeSuitablePathPart-style product code.
- A failed fresh portable install (e.g. corrupt archive) left a partial payload; now rolled back.
- Uninstalling a portable whose install directory was already deleted (or unknown) failed without --force; now unregisters like WinGet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
1. Agreement/AgreementLabel were not string-typed, so `Agreement: 0x10` became 16 and `AgreementLabel: 1.10` became 1.1 in the merged manifest (Rust + C#).
2. Rust skipped empty leading YAML documents, publishing a manifest after `---\n---` that WinGet (first document only) and the .NET publisher reject (Rust).
3. Root `Commands` were indexed even when every installer declared its own; WinGet only inherits them into installers without Commands (Rust + C#).
4. ARP DisplayNames lacked WinGet's architecture variant in norm_names2 (e.g. `contosoapp(X64)`), so arch-aware correlation found nothing (Rust + C#).
5. .NET accepted non-sequence values for string-list fields (`Tags: foo`, mappings, nested lists) and published manifests WinGet cannot parse; Rust rejects them (C#).
6. An explicit relative `--psign-tool` was checked relative to the current directory but executed through a PATH search (Rust).
7. `repository build` failed forever once the latest snapshot directory was removed, instead of rebuilding it for unchanged input (Rust).
8. Tags, Commands and ARP ProductCode/UpgradeCode/DisplayVersion were indexed untrimmed, unlike WinGet's populator, breaking exact search and correlation (Rust + C#).
9. packages.name/moniker were stored untrimmed and an empty Moniker as '' instead of NULL (Rust + C#).
10. .NET accepted PackageLocale values longer than 35 characters that the Rust publisher rejects (C#).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- W18-1 (both): an installer key with a null value erased the root default; null keys are now ignored like WinGet's populator.
- W18-2 (both): root ProductCode/AppsAndFeaturesEntries flowed into every installer; now only into ARP-writing effective types (exe/inno/msi/nullsoft/wix/burn/portable).
- W18-3 (both): root PackageFamilyName flowed into every installer; now only into msix/appx/msstore (or AFE naming an msix type).
- W18-4 (both): root NestedInstallerType/NestedInstallerFiles flowed into non-archive installers; now only into zip installers.
- W18-5 (C#): legacy unframed MSZYML decompression was unbounded; now capped at 64 MiB like the framed path and Rust.
- W18-6 (both): an empty Description did not fall back to ShortDescription (YAML and REST manifests).
- W18-7 (both): splitting a merged manifest dropped its Localization list from show -o json|yaml and download manifests.
- W18-8 (both): dependency lists were not trimmed or de-duplicated per kind like WinGet DependencyList::Add (highest MinimumVersion kept).
- W18-9 (Rust): boolean-looking scalars lost their source text (PackageName: True became "true"), diverging from C# and WinGet.
- W18-10 (Rust): an empty YAML document (stray ---) made a singleton look multi-file and wiped the structured document.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-iteration-6815a3

# Conflicts:
#	rust/crates/pinget-core/src/lib.rs
…-iteration-6815a3

# Conflicts:
#	rust/crates/pinget-core/src/lib.rs
The temp-dir and unique-name helpers are used only by Windows-only tests, so
clippy -D warnings failed on Linux with dead-code errors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mamoreau-devolutions
Marc-André Moreau (mamoreau-devolutions) merged commit 9a4cdd6 into master Nov 15, 2026
14 checks passed
@mamoreau-devolutions
Marc-André Moreau (mamoreau-devolutions) deleted the claude/bug-fixes-iteration-6815a3 branch November 15, 2026 20:00
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.

1 participant