Repository navigation
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR updates several NuGet package model classes to introduce deprecation capabilities alongside existing vulnerability handling. Key changes include:
- Adding a public IDeprecationCapable interface to the UI models.
- Updating constructors and method implementations in PackageModel and its derivatives (ReferencedPackageModel, RemotePackageModel, LocalPackageModel, TransitivelyReferencedPackageModel) to accept and use deprecation capability.
- Modifying and expanding tests across the project to cover the new deprecation functionality.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/IDeprecationCapable.cs | Changed interface visibility to public so it can be used by models. |
| test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Models/Package/ReferencedPackageModelTests.cs | Added mocks/tests for deprecation capability and verified deprecation-related properties and behaviors. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/PackageModel.cs | Introduced IVulnerableCapable dependency and updated PopulateDataAsync to delegate calls accordingly. |
| test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Models/Package/PackageModelTests.cs | Updated tests to use shared mocks for embedded resources and vulnerability/deprecation capabilities. |
| test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Models/Package/RemotePackageModelTests.cs | Adjusted RemotePackageModel tests to include deprecation capability verifications. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/ReferencedPackageModel.cs | Replaced IVulnerableCapable with IDeprecationCapable for deprecation-related functionality and updated PopulateDataAsync accordingly. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/RemotePackageModel.cs | Updated the capability handling to use deprecation capability instead of vulnerability and modified the PopulateDataAsync method. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/LocalPackageModel.cs | Adjusted constructor to pass the vulnerability capability to the base class without additional deprecation handling. |
| test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Models/Package/TransitivelyReferencedPackageModelTests.cs | Updated tests to pass the deprecation capability alongside the vulnerable capability. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/TransitivelyReferencedPackageModel.cs | Updated constructor signature to add a deprecation capability parameter. |
| test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Models/Package/TestPackageModel.cs | Updated constructor call to include the vulnerable capability as required by the new base class constructor. |
Comments suppressed due to low confidence (1)
src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/ReferencedPackageModel.cs:24
- [nitpick] Consider renaming the 'deprecationCapability' parameter (or adding clarifying comments) to better distinguish its role from the vulnerability capability expected by the base class, to improve readability.
IDeprecationCapable deprecationCapability,
jebriede
left a comment
There was a problem hiding this comment.
Great job! The Recommended Package should have been added now. Can we handle that one too in this PR?
There was a problem hiding this comment.
Pull Request Overview
This pull request updates the models to integrate a new deprecation capability alongside the existing vulnerability support. The changes include refactoring models and tests to inject and use deprecation capabilities, modifying access modifiers to internal where appropriate, and updating tests to cover the new behavior.
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Models/Package/ReferencedPackageModelTests.cs | Updated tests to include deprecation capability and validate its behavior. |
| test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Models/Package/RemotePackageModelTests.cs | Modified tests to use deprecation capability and updated constructor parameters. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/IEmbeddedResources.cs | Changed interface accessibility from public to internal. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/PackageModel.cs | Changed class accessibility to internal and ensured dependency injection consistency. |
| test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Models/Package/LocalPackageModelTests.cs | Updated tests to use shared mock capabilities with revised constructor parameters. |
| test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Models/Package/PackageModelTests.cs | Updated tests to consistently inject the embedded resources mock. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/RemotePackageModel.cs | Refactored to inject an IDeprecationCapable alongside IVulnerableCapable, and updated error-checking. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/IDeprecationCapable.cs | Changed interface accessibility to internal. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/VulnerableCapabilityBase.cs | Changed class accessibility to internal. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/IKnownOwnersCapable.cs | Changed interface accessibility to internal. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/IVulnerableCapable.cs | Changed interface accessibility to internal. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/ReferencedPackageModel.cs | Integrated deprecation capability and modified constructor parameters. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/LocalPackageModel.cs | Updated dependency injection and ensured proper null-checking. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/VulnerableDatabaseCapability.cs | Changed class accessibility to internal. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/KnownOwnersCapability.cs | Changed class accessibility to internal. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/EmbeddedResourcesCapability.cs | Changed class accessibility to internal. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/TransitivelyReferencedPackageModel.cs | Updated to accept a deprecation capability and modified constructor chaining. |
| test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Models/Package/TransitivelyReferencedPackageModelTests.cs | Adjusted tests for TransitivelyReferencedPackageModel to inject the additional deprecation capability. |
Comments suppressed due to low confidence (2)
src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/LocalPackageModel.cs:19
- [nitpick] Consider marking '_vulnerableCapability' as readonly if it is not meant to change after initialization for improved immutability and consistency with other injected dependencies.
private IVulnerableCapable _vulnerableCapability;
src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/RemotePackageModel.cs:21
- [nitpick] Consider renaming '_vulnerableCapable' to '_vulnerableCapability' for consistency with naming conventions used in other models.
private readonly IVulnerableCapable _vulnerableCapable;
jebriede
left a comment
There was a problem hiding this comment.
Great! Approved w/ suggestion.
…s/Package/LocalPackageModelTests.cs
* Added capabilities to different models * moved vulnerabiity off of base package * update access modifiers to internal * rename * Update test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Models/Package/LocalPackageModelTests.cs
* Added capabilities to different models * moved vulnerabiity off of base package * update access modifiers to internal * rename * Update test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Models/Package/LocalPackageModelTests.cs
Bug
Fixes:
Description
Update models to use capabilities
PR Checklist
Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.