microsoft / microsoft/winget-cli
Add IsReinstallAvailable and ReinstallRequiredReason to CatalogPackage
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 26.4k
- Forks
- 1.8k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 15
Description
Relevant area(s)
COM API
Description of the new feature / enhancement
CatalogPackage currently exposes IsUpdateAvailable, which only indicates whether a newer version has an applicable in-place update path.
Please add support to identify reinstall-required updates, where a newer version exists but cannot be upgraded in place and instead requires uninstall + reinstall. A typical example is installer technology mismatch.
This would let API consumers distinguish between:
- No newer version exists
- A newer version exists and is updateable
- A newer version exists but is reinstall-required
Without this distinction, API consumers cannot reliably guide users toward the correct remediation path.
Proposed technical implementation details
Add two new properties to CatalogPackage:
IsReinstallAvailable(Boolean)ReinstallRequiredReason(enum)
Keep IsUpdateAvailable semantics unchanged.
Suggested enum values
NoneInstallerTechnologyMismatchInstalledTypeMismatchInstalledScopeMismatchOther
Expected behavior
-
Applicable update exists
IsUpdateAvailable = trueIsReinstallAvailable = falseReinstallRequiredReason = None
-
Newer version exists, but in-place update is blocked by installer technology mismatch
IsUpdateAvailable = falseIsReinstallAvailable = trueReinstallRequiredReason = InstallerTechnologyMismatch
-
Newer version exists, but is blocked by non-reinstall constraints
For example: OS version, architecture, market, or other general applicability constraints.IsUpdateAvailable = falseIsReinstallAvailable = falseReinstallRequiredReason = Other(orNone, depending on final API design)
-
No newer version exists
IsUpdateAvailable = falseIsReinstallAvailable = falseReinstallRequiredReason = None
Suggested implementation approach
The relevant implementation path appears to be:
RepositoryCore applicability selection
-> COM projection
-> CatalogPackage properties
Concrete areas:
- Extend the result returned by repository-side version selection so it can carry:
- latest applicable version
- update availability
- reinstall availability
- reinstall reason
- Reuse existing installer applicability analysis and mismatch classification already used during upgrade selection.
Potential implementation points:
src/AppInstallerRepositoryCore/Public/winget/PackageVersionSelection.hsrc/AppInstallerRepositoryCore/PackageVersionSelection.cppsrc/AppInstallerCommonCore/Public/winget/ManifestComparator.hsrc/Microsoft.Management.Deployment/PackageManager.idlsrc/Microsoft.Management.Deployment/CatalogPackage.hsrc/Microsoft.Management.Deployment/CatalogPackage.cpp
Compatibility requirements
- Do not change existing IsUpdateAvailable behavior.
- Add new properties in a backward-compatible COM contract version.
- Preserve existing callers that only understand update vs no-update.
Acceptance criteria
- Existing
IsUpdateAvailablebehavior remains backward compatible. - Reinstall-required scenarios are reported deterministically.
- The reason enum is documented and stable.
- API contract versioning remains backward compatible.
- Tests cover:
- update available
- reinstall available
- neither available
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/AppInstallerRepositoryCore/Public/winget/PackageVersionSelection.h and PackageVersionSelection.cpp to trace applicability selection, then follow the COM projection in CatalogPackage.h, CatalogPackage.cpp, and PackageManager.idl. Review ManifestComparator.h for existing mismatch classification and the contract-versioning requirements. Done means deterministic update/reinstall states, a documented stable reason enum, backward-compatible IsUpdateAvailable behavior, and tests for update, reinstall, and neither available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100