[registry] Add new field to skip validation of poisson_mean in tests.
b/338055727
Change-Id: I00df5cd8f0adbc8a4799ca4957d4efc8f4f53745
Reviewed-on: https://fuchsia-review.googlesource.com/c/cobalt/+/1038959
Reviewed-by: Alex Pankhurst <pankhurst@google.com>
Commit-Queue: Alexandre Zani <azani@google.com>
diff --git a/src/bin/config_parser/src/config_validator/report_definitions.go b/src/bin/config_parser/src/config_validator/report_definitions.go
index 4742d3f..fb6b638 100644
--- a/src/bin/config_parser/src/config_validator/report_definitions.go
+++ b/src/bin/config_parser/src/config_validator/report_definitions.go
@@ -650,12 +650,25 @@
return nil
}
+func skipPoissonMeanValidationTestOnly(r *config.ReportDefinition) bool {
+ privacyConfig, ok := r.PrivacyConfig.(*config.ReportDefinition_ShuffledDp)
+ if !ok {
+ return false
+ }
+
+ return privacyConfig.ShuffledDp.SkipPoissonMeanValidationTestOnly
+}
+
func validateReportPoissonMean(m *config.MetricDefinition, r *config.ReportDefinition) error {
p, err := privacy.GetPrivacyParamsForReport(m, r)
if err != nil {
return err
}
+ if skipPoissonMeanValidationTestOnly(r) {
+ return nil
+ }
+
if err := p.Validate(); err != nil {
return err
}
diff --git a/src/bin/config_parser/src/config_validator/report_definitions_test.go b/src/bin/config_parser/src/config_validator/report_definitions_test.go
index 8220eb4..307c6cb 100644
--- a/src/bin/config_parser/src/config_validator/report_definitions_test.go
+++ b/src/bin/config_parser/src/config_validator/report_definitions_test.go
@@ -1012,6 +1012,11 @@
if err := validateReportPoissonMean(m, r); err == nil {
t.Error("Accepted report with invalid privacy parameters")
}
+
+ r.PrivacyConfig.(*config.ReportDefinition_ShuffledDp).ShuffledDp.SkipPoissonMeanValidationTestOnly = true
+ if err := validateReportPoissonMean(m, r); err != nil {
+ t.Error("Rejected report with invalid privacy parameters despite skip_poisson_mean_validation_test_only=true")
+ }
}
func TestValidateShuffledDpConfigWithValidConfig(t *testing.T) {
diff --git a/src/registry/report_definition.proto b/src/registry/report_definition.proto
index dafb186..ceb588c 100644
--- a/src/registry/report_definition.proto
+++ b/src/registry/report_definition.proto
@@ -669,10 +669,12 @@
// Lower values correspond to higher privacy.
// Epsilon must be > 0.
double epsilon = 1;
+
// This field represents the risk of the epsilon guarantee not holding. This
// is usually set as 1 over the expected number of participating devices.
// Delta must be > 0 and < 1.
double delta = 2;
+
// The generated report will exclude an Observation if there are not at
// least |reporting_threshold| number of distinct devices reporting
// Observations with the same ObservationMetadata.
@@ -689,6 +691,10 @@
// TODO(https://fxbug.dev/295053509): update this comment once the field is auto populated by
// the registry parser.
double poisson_mean = 4;
+
+ // If true, skip validating the |poisson_mean| value. This is meant to be used only
+ // in end-to-end tests where the traffic volume would not allow a reasonable |poisson_mean|.
+ bool skip_poisson_mean_validation_test_only = 5;
}
// If privacy_mechanism is SHUFFLED_DIFFERENTIAL_PRIVACY then privacy_config