Skip to content

Add Error List Fixer infrastructure and fixer to launch Fix Vulnerabilities - #7556

Merged
jebriede merged 2 commits into
devfrom
dev-jebriede-NuGetAuditFixer
Jul 16, 2026
Merged

jebriede merged 2 commits into
devfrom
dev-jebriede-NuGetAuditFixer

Conversation

@jebriede

Copy link
Copy Markdown
Contributor

Bug

Fixes: https://github.com/NuGet/Client.Engineering/issues/3820

Description

Adds reusable infrastructure for NuGet Error List entry fixers, and the first fixer built on it: a sparkle action that launches the existing "Fix Vulnerabilities with GitHub Copilot" flow directly from a NuGet Audit warning (in addition to the existing Solution Explorer info bar entry point).

Infrastructure (reusable for future NU* Error List fixers)

  • NuGetErrorListEntryFixerBase — base IErrorListEntryFixer providing the shared sparkle icon, CanFix/TryFix, and fix dispatch. A new fixer only supplies its supported codes, tooltip, and fix action.
  • IErrorListEntryInspector + SupportedCodesErrorListInspector — error-code matching against a fixer's supported set.
  • FixVulnerabilitiesSource — a single, type-safe source of truth mapping each entry point to both its telemetry NavigationOrigin and its Copilot client id. IFixVulnerabilitiesService.LaunchFixVulnerabilitiesAsync now takes this source, so each entry point is attributed correctly (previously every launch reported the info bar).

The fixer

  • NuGetAuditErrorListEntryFixer — surfaces the sparkle on NuGet Audit entries (NU1901–NU1904) and launches the Copilot fix flow. It is ordered before Visual Studio's built-in Copilot Error List fixer so NuGet takes priority for these codes.

Key implementation notes

  • NuGet Audit warnings flow through the build/restore pipeline, so their Error List ErrorSource is Build, not NuGet. Matching is therefore based on the error code alone (validated end-to-end: NuGetLogCode.NUxxxx.ToString() equals the entry's GetName() value).
  • The fixer lives in NuGet.SolutionRestoreManager (a lighter assembly that is already loaded when audit rows exist, and which already hosts the sibling info bar entry point). The Copilot-backed FixVulnerabilitiesService stays in NuGet.Tools and is imported lazily, so the CanFix hot path never loads NuGet.Tools/Copilot assemblies.
  • NavigationOrigin and IFixVulnerabilitiesService were moved to NuGet.VisualStudio.Common so the contract can stay strongly typed without inverting assembly references.

Localization

  • Added the Title_FixVulnerabilitiesWithCopilot string in NuGet.SolutionRestoreManager (resx + Designer + regenerated .xlf for all locales).

Testing

  • Unit tests for the fixer (code matching for all four codes, TryFix present/missing-service/non-matching paths, MEF metadata), the inspector (matching, build-sourced entries, null-guard), and the telemetry event (all origins × error types).
  • Manually smoke-tested in Visual Studio: the sparkle appears on an NU1903 entry, shows the correct tooltip, and clicking launches the Copilot fix flow.
  • Manually tested non-NuGet-Audit error codes to ensure their actions are not affected.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

@jebriede
jebriede requested a review from a team as a code owner July 10, 2026 22:43
@jebriede
jebriede requested review from donnie-msft and nkolev92 July 10, 2026 22:43
@jebriede
jebriede force-pushed the dev-jebriede-NuGetAuditFixer branch from dfa47e8 to eb953fc Compare July 14, 2026 22:30
kartheekp-ms
kartheekp-ms previously approved these changes Jul 15, 2026
Nigusu-Allehu
Nigusu-Allehu previously approved these changes Jul 15, 2026

@nkolev92 nkolev92 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for the delay.

There's been a lot of restore/pack PRs that are not assigned to me via round robin that I still have to review, and unfortunately round robin doesn't take that into account super well.

@jebriede
jebriede dismissed stale reviews from Nigusu-Allehu and kartheekp-ms via f2fec40 July 15, 2026 22:24

@donnie-msft donnie-msft left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we get a screenshot of the fixer?

@nkolev92

Copy link
Copy Markdown
Member

@jebriede

Please use re-request review when you have pushed changes and it's ready for another look. I saw the 2 approvals, I most ignore the comments until I get a ready for rereview request for efficiency sake.

image

@jebriede

Copy link
Copy Markdown
Contributor Author

Could we get a screenshot of the fixer?

image

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.

5 participants