Skip to content

(#59) Add property to IChocolateyPackageSearchMetadata#60

Merged
AdmiringWorm merged 1 commit intochocolatey:developfrom
gep13:more-package-info
Feb 27, 2026
Merged

(#59) Add property to IChocolateyPackageSearchMetadata#60
AdmiringWorm merged 1 commit intochocolatey:developfrom
gep13:more-package-info

Conversation

@gep13
Copy link
Member

@gep13 gep13 commented Feb 24, 2026

Description Of Changes

This commit adds a new property to the IChocolateyPackageSearchMetadata interface, and implements this property on all instances of this interface.

Motivation and Context

This is required, since we need a mechanism to store the information about where a package was located. When running the FindPackage method in Chocolatey.CLI, the retured metadata class doesn't have this information, however, at the time of calling this method, we do know what source is being used, so we can record this information, we just need a property to store it. Once stored, it can then be retrieved furhter upstream as/when required.

Typically, properties on the IChocolateyPackageSearchMetadata interface don't have a public set, since they are typically initialised when being created, however, since we are only setting this property once the meta data is returned, we need there to be a public set method for this property.

Testing

The testing of the change here will be done with another PR into the Chocolatey CLI repository.

That PR can be found here:

https://gitlab.com/chocolatey/central-management/choco-licensed-management-ui/-/merge_requests/708

Operating Systems Testing

  • Dev VM 4

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?
  • All items are complete on the Definition of Done.

Related Issue

Fixes #59

Copy link
Member

@AdmiringWorm AdmiringWorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new AvailableVersionSource property to the IPackageSearchMetadata interface to store information about the package source where a package was located. Unlike other properties in this interface which are typically read-only, this property includes both a getter and setter to allow the source information to be set after metadata retrieval.

Changes:

  • Added AvailableVersionSource property with get/set accessors to IPackageSearchMetadata interface
  • Implemented the property in all classes that implement the interface (PackageSearchMetadata, LocalPackageSearchMetadata, PackageSearchMetadataV2Feed, ClonedPackageSearchMetadata, TransitivePackageSearchMetadata)
  • Updated PublicAPI.Unshipped.txt files for all target frameworks (net472, netcoreapp5.0, netstandard2.0) to document the new public API surface

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/NuGet.Core/NuGet.Protocol/Model/IChocolateyPackageSearchMetadata.cs Adds the AvailableVersionSource property declaration to the interface with get/set accessors
src/NuGet.Core/NuGet.Protocol/Model/ChocolateyPackageSearchMetadata.cs Implements the property as an auto-property with JsonIgnore attribute
src/NuGet.Core/NuGet.Protocol/Model/ChocolateyLocalPackageSearchMetadata.cs Implements the property with explicit getter/setter and backing field for local packages
src/NuGet.Core/NuGet.Protocol/Model/ChocolateyPackageSearchMetadataV2Feed.cs Implements the property for V2 feed with auto-property
src/NuGet.Core/NuGet.Protocol/Model/PackageSearchMetadataBuilder.cs Adds property to ClonedPackageSearchMetadata and removes trailing comma from previous last property
src/NuGet.Clients/NuGet.VisualStudio.Internal.Contracts/TransitivePackageSearchMetadata.cs Adds getter-only property forwarding to underlying metadata
src/NuGet.Core/NuGet.Protocol/PublicAPI/net472/PublicAPI.Unshipped.txt Documents new public API surface for .NET Framework 4.7.2
src/NuGet.Core/NuGet.Protocol/PublicAPI/netcoreapp5.0/PublicAPI.Unshipped.txt Documents new public API surface for .NET Core 5.0
src/NuGet.Core/NuGet.Protocol/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt Documents new public API surface for .NET Standard 2.0
src/NuGet.Clients/NuGet.VisualStudio.Internal.Contracts/PublicAPI.Unshipped.txt Documents new public API surface for VisualStudio contracts
test/TestUtilities/Test.Utility/Protocol/ChocolateyV3PackageSearchMetadataFixture.cs Adds property to test mock implementation
test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/ChocolateyTestPackageSearchMetadata.cs Adds property to test metadata class

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

This commit adds a new property to the IChocolateyPackageSearchMetadata
interface, and implements this property on all instances of this
interface.

This is required, since we need a mechanism to store the information
about _where_ a package was located.  When running the FindPackage
method in Chocolatey.CLI, the retured metadata class doesn't have this
information, however, at the time of calling this method, we do know
what source is being used, so we can record this information, we just
need a property to store it.  Once stored, it can then be retrieved
furhter upstream as/when required.

Typically, properties on the IChocolateyPackageSearchMetadata interface
don't have a public set, since they are typically initialised when being
created, however, since we are only setting this property once the meta
data is returned, we need there to be a public set method for this
property.

Due to a failing build on GitHub Actions, the CA1416 entry has been
added to the NoWarn attribute in the props file, so that the build does
not fail.  It is unclear why this is now causing a problem, when it
wasn't before, but it was felt that this was a safe change, since an
override for this warning already exists when running the build in a
different environment.
@gep13 gep13 force-pushed the more-package-info branch from 3efdd1c to 3997028 Compare February 25, 2026 08:06
Copy link
Member

@AdmiringWorm AdmiringWorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AdmiringWorm AdmiringWorm merged commit e77eab3 into chocolatey:develop Feb 27, 2026
1 check passed
@gep13 gep13 deleted the more-package-info branch March 2, 2026 09:20
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 property to IChocolateyPackageSearchMetadata interface to store package source information

3 participants