Skip to content

C#: Re-factor DependabotProxy class to allow unit-testing. - #22477

Open
michaelnebel wants to merge 4 commits into
github:mainfrom
michaelnebel:csharp/refactordependabotproxy
Open

C#: Re-factor DependabotProxy class to allow unit-testing.#22477
michaelnebel wants to merge 4 commits into
github:mainfrom
michaelnebel:csharp/refactordependabotproxy

Conversation

@michaelnebel

@michaelnebel michaelnebel commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

In this PR we re-factor the DependabotProxy class to enable unit-testing (and also add some tests).
This is in preparation for adding support for replaces-base (the RegistryUrl JSON object will become more "complex").

DCA looks good.

@github-actions github-actions Bot added the C# label Sep 1, 2026
@michaelnebel
michaelnebel force-pushed the csharp/refactordependabotproxy branch from 83746ff to 131e450 Compare September 1, 2026 13:11
@michaelnebel
michaelnebel force-pushed the csharp/refactordependabotproxy branch from 131e450 to d870a57 Compare September 1, 2026 13:16
@michaelnebel
michaelnebel requested a balanced review from Copilot September 2, 2026 06:16
@michaelnebel michaelnebel added the no-change-note-required This PR does not need a change note label Sep 2, 2026

Copilot AI 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.

Copilot review overview

🟢 Approval recommended

The refactor preserves platform and runtime behavior while adding appropriate coverage for the extracted logic.

Review tier: Balanced
Findings: None

What changed in this PR

Refactors Dependabot proxy configuration behind an injectable interface, enabling focused unit testing while preserving production behavior.

Changes:

  • Adds environment-backed proxy configuration.
  • Separates platform gating from testable proxy creation.
  • Tests credentials, certificates, and registry URL parsing.
File Description
csharp/​extractor/​Semmle.Extraction.Tests/​DependabotProxy.cs Adds proxy unit tests and stubs.
csharp/​extractor/​Semmle.Extraction.CSharp.DependencyFetching/​IDependabotProxyConfiguration.cs Defines injectable configuration.
csharp/​extractor/​Semmle.Extraction.CSharp.DependencyFetching/​DependencyManager.cs Uses the refactored factory.
csharp/​extractor/​Semmle.Extraction.CSharp.DependencyFetching/​DependabotProxyConfiguration.cs Reads configuration from environment variables.
csharp/​extractor/​Semmle.Extraction.CSharp.DependencyFetching/​DependabotProxy.cs Extracts configuration and creation logic for testing.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@michaelnebel
michaelnebel requested a review from hvitved September 2, 2026 06:20
@michaelnebel
michaelnebel marked this pull request as ready for review September 2, 2026 06:20
@michaelnebel
michaelnebel requested a review from a team as a code owner September 2, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C# no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants