From 25d5917aa1c19e3bf6ba55981cb3839dd22253fe Mon Sep 17 00:00:00 2001 From: Sebastian Gomez Date: Thu, 11 Dec 2025 10:57:10 -0500 Subject: [PATCH 1/4] LinuxApplicationLayerExperiment adjustments. --- .../Configs/LinuxApplicationLayerExperiment.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/LinuxApplicationLayerExperiment.cs b/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/LinuxApplicationLayerExperiment.cs index 5f7f3c308..6fd386879 100644 --- a/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/LinuxApplicationLayerExperiment.cs +++ b/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/LinuxApplicationLayerExperiment.cs @@ -3,6 +3,7 @@ namespace Microsoft.ComponentDetection.Orchestrator.Experiments.Configs; using Microsoft.ComponentDetection.Contracts; using Microsoft.ComponentDetection.Detectors.Linux; using Microsoft.ComponentDetection.Detectors.Npm; +using Microsoft.ComponentDetection.Detectors.NuGet; using Microsoft.ComponentDetection.Detectors.Pip; /// @@ -22,12 +23,25 @@ public bool IsInControlGroup(IComponentDetector componentDetector) => is (LinuxContainerDetector and not LinuxApplicationLayerDetector) or NpmComponentDetector or NpmLockfileDetectorBase - or PipReportComponentDetector; + or PipReportComponentDetector + or NuGetComponentDetector; /// public bool IsInExperimentGroup(IComponentDetector componentDetector) => componentDetector is LinuxApplicationLayerDetector; /// - public bool ShouldRecord(IComponentDetector componentDetector, int numComponents) => true; + public bool ShouldRecord(IComponentDetector componentDetector, int numComponents) + { + // Only record telemetry if the experiment group detector (LinuxApplicationLayerDetector) + // actually found components. + if (componentDetector is LinuxApplicationLayerDetector) + { + return numComponents > 0; + } + + // For control group detectors, record if the experiment group found anything + // This will be determined by the orchestrator based on whether the experiment group had components + return true; + } } From 59b71e5429cd40f75ba2c150f3e96b0c29f64acb Mon Sep 17 00:00:00 2001 From: Sebastian Gomez Date: Thu, 11 Dec 2025 12:50:57 -0500 Subject: [PATCH 2/4] Add tests. --- .../LinuxApplicationLayerExperiment.cs | 3 +- .../LinuxApplicationLayerExperimentTests.cs | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/LinuxApplicationLayerExperiment.cs b/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/LinuxApplicationLayerExperiment.cs index 6fd386879..c986f2a44 100644 --- a/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/LinuxApplicationLayerExperiment.cs +++ b/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/LinuxApplicationLayerExperiment.cs @@ -24,7 +24,8 @@ public bool IsInControlGroup(IComponentDetector componentDetector) => or NpmComponentDetector or NpmLockfileDetectorBase or PipReportComponentDetector - or NuGetComponentDetector; + or NuGetComponentDetector + or NuGetProjectModelProjectCentricComponentDetector; /// public bool IsInExperimentGroup(IComponentDetector componentDetector) => diff --git a/test/Microsoft.ComponentDetection.Orchestrator.Tests/Experiments/LinuxApplicationLayerExperimentTests.cs b/test/Microsoft.ComponentDetection.Orchestrator.Tests/Experiments/LinuxApplicationLayerExperimentTests.cs index 396d6d458..97a8017f3 100644 --- a/test/Microsoft.ComponentDetection.Orchestrator.Tests/Experiments/LinuxApplicationLayerExperimentTests.cs +++ b/test/Microsoft.ComponentDetection.Orchestrator.Tests/Experiments/LinuxApplicationLayerExperimentTests.cs @@ -4,6 +4,7 @@ namespace Microsoft.ComponentDetection.Orchestrator.Tests.Experiments; using AwesomeAssertions; using Microsoft.ComponentDetection.Detectors.Linux; using Microsoft.ComponentDetection.Detectors.Npm; +using Microsoft.ComponentDetection.Detectors.NuGet; using Microsoft.ComponentDetection.Detectors.Pip; using Microsoft.ComponentDetection.Orchestrator.Experiments.Configs; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -41,6 +42,20 @@ public void IsInControlGroup_NpmComponentDetectorWithRoots_ReturnsTrue() this.experiment.IsInControlGroup(npmDetectorWithRoots).Should().BeTrue(); } + [TestMethod] + public void IsInControlGroup_NuGetComponentDetector_ReturnsTrue() + { + var nuGetDetector = new NuGetComponentDetector(null, null, null); + this.experiment.IsInControlGroup(nuGetDetector).Should().BeTrue(); + } + + [TestMethod] + public void IsInControlGroup_NuGetProjectModelProjectCentricComponentDetector_ReturnsTrue() + { + var nuGetDetector = new NuGetProjectModelProjectCentricComponentDetector(null, null, null, null); + this.experiment.IsInControlGroup(nuGetDetector).Should().BeTrue(); + } + [TestMethod] public void IsInControlGroup_PipReportComponentDetector_ReturnsTrue() { @@ -118,4 +133,18 @@ public void IsInExperimentGroup_PipReportComponentDetector_ReturnsFalse() this.experiment.IsInExperimentGroup(pipDetector).Should().BeFalse(); } + + [TestMethod] + public void IsInExperimentGroup_NuGetComponentDetector_ReturnsFalse() + { + var nuGetDetector = new NuGetComponentDetector(null, null, null); + this.experiment.IsInExperimentGroup(nuGetDetector).Should().BeFalse(); + } + + [TestMethod] + public void IsInExperimentGroup_NuGetProjectModelProjectCentricComponentDetector_ReturnsFalse() + { + var nuGetDetector = new NuGetProjectModelProjectCentricComponentDetector(null, null, null, null); + this.experiment.IsInExperimentGroup(nuGetDetector).Should().BeFalse(); + } } From 98bbc3eb682978307f2db5908aa22f9eb856bdd3 Mon Sep 17 00:00:00 2001 From: Sebastian Gomez Date: Thu, 11 Dec 2025 12:55:16 -0500 Subject: [PATCH 3/4] More tests. --- .../LinuxApplicationLayerExperimentTests.cs | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/Microsoft.ComponentDetection.Orchestrator.Tests/Experiments/LinuxApplicationLayerExperimentTests.cs b/test/Microsoft.ComponentDetection.Orchestrator.Tests/Experiments/LinuxApplicationLayerExperimentTests.cs index 97a8017f3..76b4cbce1 100644 --- a/test/Microsoft.ComponentDetection.Orchestrator.Tests/Experiments/LinuxApplicationLayerExperimentTests.cs +++ b/test/Microsoft.ComponentDetection.Orchestrator.Tests/Experiments/LinuxApplicationLayerExperimentTests.cs @@ -147,4 +147,37 @@ public void IsInExperimentGroup_NuGetProjectModelProjectCentricComponentDetector var nuGetDetector = new NuGetProjectModelProjectCentricComponentDetector(null, null, null, null); this.experiment.IsInExperimentGroup(nuGetDetector).Should().BeFalse(); } + + [TestMethod] + public void ShouldRecord_ExperimentGroup_ReturnsTrue_WhenNumComponentsGreaterThanZero() + { + var experimentalDetector = new LinuxApplicationLayerDetector(null, null, null); + this.experiment.ShouldRecord(experimentalDetector, 1).Should().BeTrue(); + } + + [TestMethod] + public void ShouldRecord_ExperimentGroup_ReturnsFalse_WhenNumComponentsIsZero() + { + var experimentalDetector = new LinuxApplicationLayerDetector(null, null, null); + this.experiment.ShouldRecord(experimentalDetector, 0).Should().BeFalse(); + } + + [TestMethod] + public void ShouldRecord_ControlGroup_AlwaysReturnsTrue() + { + var linuxDetector = new LinuxContainerDetector(null, null, null); + this.experiment.ShouldRecord(linuxDetector, 0).Should().BeTrue(); + + var npmDetector = new NpmComponentDetector(null, null, null); + this.experiment.ShouldRecord(npmDetector, 0).Should().BeTrue(); + + var pipDetector = new PipReportComponentDetector(null, null, null, null, null, null, null, null, null); + this.experiment.ShouldRecord(pipDetector, 0).Should().BeTrue(); + + var nuGetDetector = new NuGetComponentDetector(null, null, null); + this.experiment.ShouldRecord(nuGetDetector, 0).Should().BeTrue(); + + var nuGetProjectCentricDetector = new NuGetProjectModelProjectCentricComponentDetector(null, null, null, null); + this.experiment.ShouldRecord(nuGetProjectCentricDetector, 0).Should().BeTrue(); + } } From 2b81039df3420ab3c02572a6672bf0dfa98ccc41 Mon Sep 17 00:00:00 2001 From: Sebastian Gomez Date: Thu, 11 Dec 2025 13:29:20 -0500 Subject: [PATCH 4/4] Add nuget packages config detector to control group. --- .../Configs/LinuxApplicationLayerExperiment.cs | 3 ++- .../LinuxApplicationLayerExperimentTests.cs | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/LinuxApplicationLayerExperiment.cs b/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/LinuxApplicationLayerExperiment.cs index c986f2a44..77063bac2 100644 --- a/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/LinuxApplicationLayerExperiment.cs +++ b/src/Microsoft.ComponentDetection.Orchestrator/Experiments/Configs/LinuxApplicationLayerExperiment.cs @@ -25,7 +25,8 @@ or NpmComponentDetector or NpmLockfileDetectorBase or PipReportComponentDetector or NuGetComponentDetector - or NuGetProjectModelProjectCentricComponentDetector; + or NuGetProjectModelProjectCentricComponentDetector + or NuGetPackagesConfigDetector; /// public bool IsInExperimentGroup(IComponentDetector componentDetector) => diff --git a/test/Microsoft.ComponentDetection.Orchestrator.Tests/Experiments/LinuxApplicationLayerExperimentTests.cs b/test/Microsoft.ComponentDetection.Orchestrator.Tests/Experiments/LinuxApplicationLayerExperimentTests.cs index 76b4cbce1..7d1528532 100644 --- a/test/Microsoft.ComponentDetection.Orchestrator.Tests/Experiments/LinuxApplicationLayerExperimentTests.cs +++ b/test/Microsoft.ComponentDetection.Orchestrator.Tests/Experiments/LinuxApplicationLayerExperimentTests.cs @@ -56,6 +56,13 @@ public void IsInControlGroup_NuGetProjectModelProjectCentricComponentDetector_Re this.experiment.IsInControlGroup(nuGetDetector).Should().BeTrue(); } + [TestMethod] + public void IsInControlGroup_NuGetPackagesConfigDetector_ReturnsTrue() + { + var nuGetPackagesConfigDetector = new NuGetPackagesConfigDetector(null, null, null); + this.experiment.IsInControlGroup(nuGetPackagesConfigDetector).Should().BeTrue(); + } + [TestMethod] public void IsInControlGroup_PipReportComponentDetector_ReturnsTrue() { @@ -179,5 +186,8 @@ public void ShouldRecord_ControlGroup_AlwaysReturnsTrue() var nuGetProjectCentricDetector = new NuGetProjectModelProjectCentricComponentDetector(null, null, null, null); this.experiment.ShouldRecord(nuGetProjectCentricDetector, 0).Should().BeTrue(); + + var nuGetPackagesConfigDetector = new NuGetPackagesConfigDetector(null, null, null); + this.experiment.ShouldRecord(nuGetPackagesConfigDetector, 0).Should().BeTrue(); } }