ui pack redo

This commit is contained in:
master
2026-02-20 07:36:18 +02:00
parent 7ca0113343
commit ca5e7888d6
122 changed files with 8508 additions and 1971 deletions

View File

@@ -79,7 +79,8 @@ public sealed class PrivacyBudgetTrackerTests
var snapshot = tracker.GetSnapshot();
Assert.Equal(2, snapshot.QueriesThisPeriod);
Assert.Equal(1, snapshot.SuppressedThisPeriod);
Assert.True(snapshot.Exhausted);
Assert.False(snapshot.Exhausted);
Assert.Equal(0.1, snapshot.Remaining, precision: 10);
}
[Fact]

View File

@@ -121,6 +121,9 @@ public sealed class TelemetryAggregatorTests
{
var (aggregator, budget) = CreateAggregator(kThreshold: 1, epsilon: 0.01);
// Pre-spend enough budget so the aggregation pass must suppress some buckets.
Assert.True(budget.TrySpend(0.0095));
// Create many CVE groups to exhaust the tiny budget
var facts = new List<TelemetryFact>();
for (int i = 0; i < 100; i++)

View File

@@ -129,7 +129,7 @@ public sealed class PrivacyBudgetTracker : IPrivacyBudgetTracker
}
}
internal static double LaplacianNoise(double sensitivity, double epsilon, Random rng)
public static double LaplacianNoise(double sensitivity, double epsilon, Random rng)
{
double u = rng.NextDouble() - 0.5;
return -(sensitivity / epsilon) * Math.Sign(u) * Math.Log(1 - 2 * Math.Abs(u));