Skip to content

Conversation

@AdmiringWorm
Copy link
Member

Description Of Changes

Refactor handling of pinned packages by extracting a single helper GetPinnedMessage and using it upgrade, outdated, and other flows. Adjust logging and result message order so that:

  • a consolidated message is built once and augmented depending on IgnorePinned setting.
  • Warn and Inconclusive ResultMessages are added consistently.
  • RegularOutput logging is preserved.
  • Control flow continues only when pinned packages are skipped.
  • Allows overridden services to provide their own pinned message.

This reduces duplicated string formatting, clarifies when pinned packages are skipped vs upgraded.

Motivation and Context

To be able to override the pinned message in other products.

Testing

N/A - There are no differences in behavior, this is only needed for work being done elsewhere.
Will still run test kitchen against this PR.

Operating Systems Testing

  • Windows 11

Change Types Made

  • Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added.
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v3 compatibility checked?

Related Issue

Fixes #3811

@AdmiringWorm AdmiringWorm requested a review from vexx32 November 3, 2025 14:12
@AdmiringWorm AdmiringWorm self-assigned this Nov 3, 2025
@AdmiringWorm AdmiringWorm force-pushed the centralize-pinned-message branch from 3648d9f to 3c6afe4 Compare November 4, 2025 08:42
@AdmiringWorm
Copy link
Member Author

Internal builds and tests have succeeded.

Refactor handling of pinned packages by extracting a single helper
GetPinnedMessage and using it upgrade, outdated, and
other flows. Adjust logging and result message order so that:
- a consolidated message is built once and augmented depending on
  IgnorePinned setting.
- Warn and Inconclusive ResultMessages are added consistently.
- RegularOutput logging is preserved.
- Control flow continues only when pinned packages are skipped.
- Allows overridden services to provide their own pinned message.

This reduces duplicated string formatting, clarifies when pinned
packages are skipped vs upgraded.
Remove the redundant 'new' modifier from the Reset method in
ChocolateyLicenseCommandSpecs.cs. The method does not hide any base
member, so the 'new' keyword was unnecessary and could confuse readers
or suggest unintended behavior. Simplifying the declaration improves
code clarity and eliminates a potential compiler warning.
@AdmiringWorm AdmiringWorm force-pushed the centralize-pinned-message branch from 3c6afe4 to 4d632e3 Compare November 4, 2025 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add entry points to allow Pinned messages to be overridden during Upgrade/Uninstall

1 participant