From cf78e59a304111cea93ea22416b46add935289cc Mon Sep 17 00:00:00 2001
From: Greg Villicana <58237075+grvillic@users.noreply.github.com>
Date: Tue, 19 Dec 2023 15:55:49 -0800
Subject: [PATCH] Removed experiments on released detectors: NPM Lockfile V3
and Nuget (#939)
* Removed experiments on released detectors: NPM Lockfile V3 and Nuget
---
.../Configs/IExperimentConfiguration.cs | 3 +-
.../Experiments/Configs/NewNugetExperiment.cs | 24 -----------
.../Configs/NpmLockfile3Experiment.cs | 40 -------------------
.../Extensions/ServiceCollectionExtensions.cs | 2 -
4 files changed, 1 insertion(+), 68 deletions(-)
delete mode 100644 src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/NewNugetExperiment.cs
delete mode 100644 src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/NpmLockfile3Experiment.cs
diff --git a/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/IExperimentConfiguration.cs b/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/IExperimentConfiguration.cs
index cbfdf8851..d5d01d803 100644
--- a/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/IExperimentConfiguration.cs
+++ b/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/IExperimentConfiguration.cs
@@ -1,4 +1,4 @@
-namespace Microsoft.ComponentDetection.Orchestrator.Experiments.Configs;
+namespace Microsoft.ComponentDetection.Orchestrator.Experiments.Configs;
using System.Threading.Tasks;
using Microsoft.ComponentDetection.Contracts;
@@ -41,7 +41,6 @@ public interface IExperimentConfiguration
/// components that were detected. If any call to this method returns false, the experiment will not be
/// recorded.
///
- /// .
/// The component detector.
/// The number of components found by the .
/// true if the experiment should be recorded; otherwise, false.
diff --git a/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/NewNugetExperiment.cs b/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/NewNugetExperiment.cs
deleted file mode 100644
index a826b4081..000000000
--- a/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/NewNugetExperiment.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-namespace Microsoft.ComponentDetection.Orchestrator.Experiments.Configs;
-
-using Microsoft.ComponentDetection.Contracts;
-using Microsoft.ComponentDetection.Detectors.NuGet;
-
-///
-/// Comparing the new NuGet detector approach to the old one.
-///
-public class NewNugetExperiment : IExperimentConfiguration
-{
- ///
- public string Name => "NewNugetDetector";
-
- ///
- public bool IsInControlGroup(IComponentDetector componentDetector) =>
- componentDetector is NuGetComponentDetector or NuGetProjectModelProjectCentricComponentDetector;
-
- ///
- public bool IsInExperimentGroup(IComponentDetector componentDetector) =>
- componentDetector is NuGetProjectModelProjectCentricComponentDetector or NuGetPackagesConfigDetector;
-
- ///
- public bool ShouldRecord(IComponentDetector componentDetector, int numComponents) => true;
-}
diff --git a/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/NpmLockfile3Experiment.cs b/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/NpmLockfile3Experiment.cs
deleted file mode 100644
index 682b8143f..000000000
--- a/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/NpmLockfile3Experiment.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-namespace Microsoft.ComponentDetection.Orchestrator.Experiments.Configs;
-
-using Microsoft.ComponentDetection.Contracts;
-using Microsoft.ComponentDetection.Detectors.Npm;
-using Microsoft.ComponentDetection.Detectors.Pnpm;
-using Microsoft.ComponentDetection.Detectors.Poetry;
-using Microsoft.ComponentDetection.Detectors.Yarn;
-
-///
-/// Validating the .
-///
-public class NpmLockfile3Experiment : IExperimentConfiguration
-{
- ///
- public string Name => "LockfileVersion3";
-
- ///
- public bool IsInControlGroup(IComponentDetector componentDetector) => componentDetector is NpmComponentDetector;
-
- ///
- public bool IsInExperimentGroup(IComponentDetector componentDetector) => componentDetector is NpmLockfile3Detector;
-
- ///
- public bool ShouldRecord(IComponentDetector componentDetector, int numComponents)
- {
- if (numComponents == 0)
- {
- return true;
- }
-
- return componentDetector switch
- {
- NpmComponentDetectorWithRoots
- or PnpmComponentDetector
- or PoetryComponentDetector
- or YarnLockComponentDetector => false,
- _ => true,
- };
- }
-}
diff --git a/src/Microsoft.ComponentDetection.Orchestrator/Extensions/ServiceCollectionExtensions.cs b/src/Microsoft.ComponentDetection.Orchestrator/Extensions/ServiceCollectionExtensions.cs
index efbdb0a3c..00a7fd3d0 100644
--- a/src/Microsoft.ComponentDetection.Orchestrator/Extensions/ServiceCollectionExtensions.cs
+++ b/src/Microsoft.ComponentDetection.Orchestrator/Extensions/ServiceCollectionExtensions.cs
@@ -60,8 +60,6 @@ public static IServiceCollection AddComponentDetection(this IServiceCollection s
// Experiments
services.AddSingleton();
services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
services.AddSingleton();
services.AddSingleton();