[config validator] Add validation for new privacy API

Validates that the new privacy API values are equivalent to the legacy
privacy field values.

Added privacy_mechanism to testing registries.

Tested: ./cobaltb.py test
Tested: core_client copybara test for validating registries in google3
Tested: fx build for validating registries in fuchsia
Fixed: b/332768573

Change-Id: I6013d551ca9000d4fd570ce2b0426627d729a582
Reviewed-on: https://fuchsia-review.googlesource.com/c/cobalt/+/1020939
Reviewed-by: Alexandre Zani <azani@google.com>
Commit-Queue: Anivia Li <aniviali@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 e3b1d7f..4742d3f 100644
--- a/src/bin/config_parser/src/config_validator/report_definitions.go
+++ b/src/bin/config_parser/src/config_validator/report_definitions.go
@@ -211,6 +211,10 @@
 		reportErrors.addError("privacy_level", fmt.Errorf("The privacy_level field is required for reports of type %s", r.ReportType))
 	}
 
+	if r.PrivacyMechanism == config.ReportDefinition_PRIVACY_MECHANISM_UNSPECIFIED {
+		reportErrors.addError("privacy_mechanism", fmt.Errorf("The privacy_mechanism field is required for reports of type %s", r.ReportType))
+	}
+
 	if err := validatePoissonFields(r); err != nil {
 		reportErrors.addError("poisson_mean, num_index_points, or string_sketch_params", err)
 	}
@@ -267,6 +271,10 @@
 		reportErrors.addError("other", err)
 	}
 
+	if err := validateNewPrivacyFieldAndLegacyPrivacyFieldMatch(r); err != nil {
+		reportErrors.addError("other", err)
+	}
+
 	return reportErrors.err()
 }
 
@@ -584,6 +592,35 @@
 	return nil
 }
 
+// Validates that new privacy field values matches the legacy private field values. This validation assumes legacy and new privacy fields are already validated.
+func validateNewPrivacyFieldAndLegacyPrivacyFieldMatch(r *config.ReportDefinition) error {
+	switch r.PrivacyLevel {
+	case config.ReportDefinition_NO_ADDED_PRIVACY:
+		if r.PrivacyMechanism != config.ReportDefinition_DE_IDENTIFICATION {
+			return fmt.Errorf("privacy_mechanism should set to DE_IDENTIFICATION when privacy_level is NO_ADDED_PRIVACY")
+		}
+	case config.ReportDefinition_LOW_PRIVACY,
+		config.ReportDefinition_MEDIUM_PRIVACY,
+		config.ReportDefinition_HIGH_PRIVACY:
+		if r.PrivacyMechanism != config.ReportDefinition_SHUFFLED_DIFFERENTIAL_PRIVACY {
+			return fmt.Errorf("privacy_mechanism should set to SHUFFLED_DIFFERENTIAL_PRIVACY when privacy_level is not NO_ADDED_PRIVACY")
+		}
+		switch op := r.PrivacyConfig.(type) {
+		case *config.ReportDefinition_ShuffledDp:
+			if op.ShuffledDp.PoissonMean != r.PoissonMean {
+				return fmt.Errorf("the value of poission_mean in shuffled_dp should match the value of poission_mean")
+			}
+			if op.ShuffledDp.ReportingThreshold != r.ReportingThreshold {
+				return fmt.Errorf("the value of reporting_threshold in shuffled_dp should match the value of reporting_threshold")
+			}
+		default:
+			return fmt.Errorf("Unhandled privacy config")
+		}
+	}
+
+	return nil
+}
+
 func validatePrivacyMechanismAndConfig(m *config.MetricDefinition, r *config.ReportDefinition) error {
 	switch r.PrivacyMechanism {
 	case config.ReportDefinition_DE_IDENTIFICATION:
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 691f343..8220eb4 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
@@ -27,10 +27,11 @@
 
 func makeValidReportWithNameAndType(name string, t config.ReportDefinition_ReportType) *config.ReportDefinition {
 	return &config.ReportDefinition{
-		Id:           10,
-		ReportName:   name,
-		ReportType:   t,
-		PrivacyLevel: config.ReportDefinition_NO_ADDED_PRIVACY,
+		Id:               10,
+		ReportName:       name,
+		ReportType:       t,
+		PrivacyLevel:     config.ReportDefinition_NO_ADDED_PRIVACY,
+		PrivacyMechanism: config.ReportDefinition_DE_IDENTIFICATION,
 	}
 }
 
@@ -1080,3 +1081,71 @@
 		}
 	}
 }
+
+func TestValidateNewPrivacyFieldAndLegacyPrivacyFieldMatch(t *testing.T) {
+	// Default valid metric uses DEBUG max_release_stage.
+	r := makeValidReportWithType(config.ReportDefinition_UNIQUE_DEVICE_COUNTS)
+
+	if err := validateNewPrivacyFieldAndLegacyPrivacyFieldMatch(r); err != nil {
+		t.Errorf("Rejected report with matched privacy_level NO_ADDED_PRIVACY and privacy_mechanism DE_IDENTIFICATION: %v", err)
+	}
+
+	r.PrivacyLevel = config.ReportDefinition_LOW_PRIVACY
+	if err := validateNewPrivacyFieldAndLegacyPrivacyFieldMatch(r); err == nil {
+		t.Errorf("Didn't reject report with unmatched privacy_level LOW_PRIVACY and privacy_mechanism DE_IDENTIFICATION: %v", err)
+	}
+
+	r.PrivacyLevel = config.ReportDefinition_MEDIUM_PRIVACY
+	if err := validateNewPrivacyFieldAndLegacyPrivacyFieldMatch(r); err == nil {
+		t.Errorf("Didn't reject report with unmatched privacy_level MEDIUM_PRIVACY and privacy_mechanism DE_IDENTIFICATION: %v", err)
+	}
+
+	r.PrivacyLevel = config.ReportDefinition_HIGH_PRIVACY
+	if err := validateNewPrivacyFieldAndLegacyPrivacyFieldMatch(r); err == nil {
+		t.Errorf("Didn't reject report with unmatched privacy_level HIGH_PRIVACY and privacy_mechanism DE_IDENTIFICATION: %v", err)
+	}
+
+	r.PrivacyMechanism = config.ReportDefinition_SHUFFLED_DIFFERENTIAL_PRIVACY
+	r.PrivacyLevel = config.ReportDefinition_NO_ADDED_PRIVACY
+	if err := validateNewPrivacyFieldAndLegacyPrivacyFieldMatch(r); err == nil {
+		t.Errorf("Didn't reject report with unmatched privacy_level NO_ADDED_PRIVACY and privacy_mechanism SHUFFLED_DIFFERENTIAL_PRIVACY: %v", err)
+	}
+
+	r.PoissonMean = 1
+	r.ReportingThreshold = 10000
+	r.PrivacyConfig = &config.ReportDefinition_ShuffledDp{
+		ShuffledDp: &config.ReportDefinition_ShuffledDifferentialPrivacyConfig{
+			Epsilon:            1,
+			Delta:              0.001,
+			ReportingThreshold: 10000,
+			PoissonMean:        1,
+		},
+	}
+
+	r.PrivacyLevel = config.ReportDefinition_LOW_PRIVACY
+	if err := validateNewPrivacyFieldAndLegacyPrivacyFieldMatch(r); err != nil {
+		t.Errorf("Rejected report with matched privacy_level LOW_PRIVACY and privacy_mechanism SHUFFLED_DIFFERENTIAL_PRIVACY: %v", err)
+	}
+
+	r.PrivacyLevel = config.ReportDefinition_MEDIUM_PRIVACY
+	if err := validateNewPrivacyFieldAndLegacyPrivacyFieldMatch(r); err != nil {
+		t.Errorf("Rejected report with matched privacy_level MEDIUM_PRIVACY and privacy_mechanism SHUFFLED_DIFFERENTIAL_PRIVACY: %v", err)
+	}
+
+	r.PrivacyLevel = config.ReportDefinition_HIGH_PRIVACY
+	if err := validateNewPrivacyFieldAndLegacyPrivacyFieldMatch(r); err != nil {
+		t.Errorf("Rejected report with matched privacy_level HIGH_PRIVACY and privacy_mechanism SHUFFLED_DIFFERENTIAL_PRIVACY: %v", err)
+	}
+
+	r.PoissonMean = 0.1
+	if err := validateNewPrivacyFieldAndLegacyPrivacyFieldMatch(r); err == nil {
+		t.Errorf("Didn't Rejected report with unmatched poisson_mean and shuffled_dp possion_mean: %v", err)
+	}
+
+	r.PoissonMean = 1
+	r.ReportingThreshold = 1
+	if err := validateNewPrivacyFieldAndLegacyPrivacyFieldMatch(r); err == nil {
+		t.Errorf("Didn't Rejected report with unmatched reporting_threshold and shuffled_dp reporting_threshold: %v", err)
+	}
+
+}
diff --git a/src/bin/config_parser/src/config_validator/validator_test.go b/src/bin/config_parser/src/config_validator/validator_test.go
index 58b927d..dcbec6f 100644
--- a/src/bin/config_parser/src/config_validator/validator_test.go
+++ b/src/bin/config_parser/src/config_validator/validator_test.go
@@ -87,6 +87,7 @@
 						Id:                     10,
 						ReportType:             config.ReportDefinition_FLEETWIDE_OCCURRENCE_COUNTS,
 						PrivacyLevel:           config.ReportDefinition_NO_ADDED_PRIVACY,
+						PrivacyMechanism:       config.ReportDefinition_DE_IDENTIFICATION,
 						SystemProfileSelection: config.SystemProfileSelectionPolicy_REPORT_ALL,
 					},
 					{
@@ -94,6 +95,7 @@
 						Id:                     20,
 						ReportType:             config.ReportDefinition_HOURLY_VALUE_NUMERIC_STATS,
 						PrivacyLevel:           config.ReportDefinition_NO_ADDED_PRIVACY,
+						PrivacyMechanism:       config.ReportDefinition_DE_IDENTIFICATION,
 						SystemProfileSelection: config.SystemProfileSelectionPolicy_REPORT_ALL,
 					},
 				},
@@ -155,6 +157,7 @@
 						Id:                     10,
 						ReportType:             config.ReportDefinition_FLEETWIDE_OCCURRENCE_COUNTS,
 						PrivacyLevel:           config.ReportDefinition_NO_ADDED_PRIVACY,
+						PrivacyMechanism:       config.ReportDefinition_DE_IDENTIFICATION,
 						SystemProfileSelection: config.SystemProfileSelectionPolicy_REPORT_ALL,
 					},
 					{
@@ -162,6 +165,7 @@
 						Id:                     20,
 						ReportType:             config.ReportDefinition_HOURLY_VALUE_NUMERIC_STATS,
 						PrivacyLevel:           config.ReportDefinition_NO_ADDED_PRIVACY,
+						PrivacyMechanism:       config.ReportDefinition_DE_IDENTIFICATION,
 						SystemProfileSelection: config.SystemProfileSelectionPolicy_REPORT_ALL,
 					},
 				},
diff --git a/src/local_aggregation/testing/test_privacy_registry/CustomerA/ProjectA1/metrics.yaml b/src/local_aggregation/testing/test_privacy_registry/CustomerA/ProjectA1/metrics.yaml
index da60b02..77bbd1a 100644
--- a/src/local_aggregation/testing/test_privacy_registry/CustomerA/ProjectA1/metrics.yaml
+++ b/src/local_aggregation/testing/test_privacy_registry/CustomerA/ProjectA1/metrics.yaml
@@ -14,6 +14,7 @@
         local_aggregation_procedure: AT_LEAST_ONCE
         local_aggregation_period: WINDOW_1_DAY
         privacy_level: LOW_PRIVACY
+        privacy_mechanism: SHUFFLED_DIFFERENTIAL_PRIVACY
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: SELECT_LAST
@@ -23,6 +24,7 @@
         local_aggregation_procedure: AT_LEAST_ONCE
         local_aggregation_period: WINDOW_7_DAYS
         privacy_level: LOW_PRIVACY
+        privacy_mechanism: SHUFFLED_DIFFERENTIAL_PRIVACY
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: SELECT_LAST
@@ -32,6 +34,7 @@
         local_aggregation_procedure: AT_LEAST_ONCE
         local_aggregation_period: WINDOW_1_DAY
         privacy_level: LOW_PRIVACY
+        privacy_mechanism: SHUFFLED_DIFFERENTIAL_PRIVACY
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: SELECT_LAST
@@ -52,6 +55,7 @@
         local_aggregation_procedure: AT_LEAST_ONCE
         local_aggregation_period: WINDOW_1_DAY
         privacy_level: LOW_PRIVACY
+        privacy_mechanism: SHUFFLED_DIFFERENTIAL_PRIVACY
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: SELECT_LAST
diff --git a/src/local_aggregation/testing/test_registry/CustomerA/ProjectA1/metrics.yaml b/src/local_aggregation/testing/test_registry/CustomerA/ProjectA1/metrics.yaml
index dbb59e5..0f223de 100644
--- a/src/local_aggregation/testing/test_registry/CustomerA/ProjectA1/metrics.yaml
+++ b/src/local_aggregation/testing/test_registry/CustomerA/ProjectA1/metrics.yaml
@@ -12,6 +12,7 @@
         report_name: "fleetwide_occurrence_counts_report"
         report_type: FLEETWIDE_OCCURRENCE_COUNTS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
         # TODO(https://fxbug.dev/42166340): This is an invalid configuration.
@@ -25,6 +26,7 @@
         local_aggregation_procedure: AT_LEAST_ONCE
         local_aggregation_period: WINDOW_1_DAY
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: SELECT_LAST
@@ -34,6 +36,7 @@
         local_aggregation_procedure: AT_LEAST_ONCE
         local_aggregation_period: WINDOW_7_DAYS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: SELECT_LAST
@@ -43,6 +46,7 @@
         local_aggregation_procedure: SELECT_FIRST
         local_aggregation_period: WINDOW_1_DAY
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         system_profile_field: [OS, SYSTEM_VERSION, EXPERIMENT_IDS]
         experiment_id: [1, 2222, 3333]
         system_profile_selection: SELECT_FIRST
@@ -52,6 +56,7 @@
         local_aggregation_procedure: SELECT_FIRST
         local_aggregation_period: WINDOW_7_DAYS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: SELECT_FIRST
       - id: 6
@@ -60,6 +65,7 @@
         local_aggregation_procedure: AT_LEAST_ONCE
         local_aggregation_period: WINDOW_1_DAY
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION, EXPERIMENT_IDS]
         experiment_id: [1, 2222, 3333]
@@ -70,6 +76,7 @@
         local_aggregation_procedure: AT_LEAST_ONCE
         local_aggregation_period: WINDOW_7_DAYS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: REPORT_ALL
@@ -79,6 +86,7 @@
         local_aggregation_procedure: SELECT_MOST_COMMON
         local_aggregation_period: WINDOW_1_DAY
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: SELECT_LAST
@@ -88,6 +96,7 @@
         local_aggregation_procedure: SELECT_MOST_COMMON
         local_aggregation_period: WINDOW_7_DAYS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: SELECT_LAST
@@ -95,6 +104,7 @@
         report_name: "hourly_device_histograms"
         report_type: HOURLY_VALUE_HISTOGRAMS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         int_buckets:
           linear:
             floor: 1
@@ -107,6 +117,7 @@
         report_name: "hourly_device_histograms_report_all"
         report_type: HOURLY_VALUE_HISTOGRAMS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         int_buckets:
           linear:
             floor: 1
@@ -119,6 +130,7 @@
         report_name: "not_collected_debug_report"
         report_type: FLEETWIDE_OCCURRENCE_COUNTS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
         max_release_stage: DEBUG
@@ -135,12 +147,14 @@
         report_name: "fleetwide_means_report"
         report_type: FLEETWIDE_MEANS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
       - id: 2
         report_name: "unique_device_numeric_stats_report_7_day_sum"
         report_type: UNIQUE_DEVICE_NUMERIC_STATS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         local_aggregation_procedure: SUM_PROCEDURE
         local_aggregation_period: WINDOW_7_DAYS
         event_vector_buffer_max: 100
@@ -149,6 +163,7 @@
         report_name: "unique_device_numeric_stats_report_7_day_min"
         report_type: UNIQUE_DEVICE_NUMERIC_STATS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         local_aggregation_procedure: MIN_PROCEDURE
         local_aggregation_period: WINDOW_7_DAYS
         event_vector_buffer_max: 100
@@ -157,6 +172,7 @@
         report_name: "unique_device_numeric_stats_report_7_day_max"
         report_type: UNIQUE_DEVICE_NUMERIC_STATS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         local_aggregation_procedure: MAX_PROCEDURE
         local_aggregation_period: WINDOW_7_DAYS
         event_vector_buffer_max: 100
@@ -165,6 +181,7 @@
         report_name: "unique_device_numeric_stats_report_7_day_mean"
         report_type: UNIQUE_DEVICE_NUMERIC_STATS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         local_aggregation_procedure: MEAN
         local_aggregation_period: WINDOW_7_DAYS
         event_vector_buffer_max: 100
@@ -173,6 +190,7 @@
         report_name: "unique_device_numeric_stats_report_7_day_median"
         report_type: UNIQUE_DEVICE_NUMERIC_STATS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         local_aggregation_procedure: MEDIAN
         local_aggregation_period: WINDOW_7_DAYS
         event_vector_buffer_max: 100
@@ -181,6 +199,7 @@
         report_name: "unique_device_numeric_stats_report_7_day_75th_percentile"
         report_type: UNIQUE_DEVICE_NUMERIC_STATS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         local_aggregation_procedure: PERCENTILE_N
         local_aggregation_procedure_percentile_n: 75
         local_aggregation_period: WINDOW_7_DAYS
@@ -190,6 +209,7 @@
         report_name: "unique_device_numeric_stats_report_7_day_99th_percentile"
         report_type: UNIQUE_DEVICE_NUMERIC_STATS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         local_aggregation_procedure: PERCENTILE_N
         local_aggregation_procedure_percentile_n: 99
         local_aggregation_period: WINDOW_7_DAYS
@@ -200,6 +220,7 @@
         report_name: "hourly_value_numeric_stats_sum"
         report_type: HOURLY_VALUE_NUMERIC_STATS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         local_aggregation_procedure: SUM_PROCEDURE
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
@@ -207,6 +228,7 @@
         report_name: "hourly_value_numeric_stats_min"
         report_type: HOURLY_VALUE_NUMERIC_STATS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         local_aggregation_procedure: MIN_PROCEDURE
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
@@ -214,6 +236,7 @@
         report_name: "hourly_value_numeric_stats_max"
         report_type: HOURLY_VALUE_NUMERIC_STATS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         local_aggregation_procedure: MAX_PROCEDURE
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
@@ -221,6 +244,7 @@
         report_name: "hourly_value_numeric_stats_mean"
         report_type: HOURLY_VALUE_NUMERIC_STATS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         local_aggregation_procedure: MEAN
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
@@ -228,6 +252,7 @@
         report_name: "hourly_value_numeric_stats_median"
         report_type: HOURLY_VALUE_NUMERIC_STATS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         local_aggregation_procedure: MEDIAN
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
@@ -235,6 +260,7 @@
         report_name: "hourly_value_numeric_stats_75th_percentile"
         report_type: HOURLY_VALUE_NUMERIC_STATS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         local_aggregation_procedure: PERCENTILE_N
         local_aggregation_procedure_percentile_n: 75
         event_vector_buffer_max: 100
@@ -243,6 +269,7 @@
         report_name: "hourly_value_numeric_stats_99th_percentile"
         report_type: HOURLY_VALUE_NUMERIC_STATS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         local_aggregation_procedure: PERCENTILE_N
         local_aggregation_procedure_percentile_n: 99
         event_vector_buffer_max: 100
@@ -252,6 +279,7 @@
         report_name: "fleetwide_histograms"
         report_type: FLEETWIDE_HISTOGRAMS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         int_buckets:
           linear:
             floor: 1
@@ -277,6 +305,7 @@
         report_name: "fleetwide_histograms"
         report_type: FLEETWIDE_HISTOGRAMS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
 
@@ -293,6 +322,7 @@
         report_name: "string_counts"
         report_type: STRING_COUNTS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         string_buffer_max: 5
         system_profile_field: [OS, SYSTEM_VERSION]
@@ -301,6 +331,7 @@
         report_type: UNIQUE_DEVICE_STRING_COUNTS
         local_aggregation_period: WINDOW_1_DAY
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         string_buffer_max: 5
         system_profile_field: [OS, SYSTEM_VERSION]
@@ -309,6 +340,7 @@
         report_type: UNIQUE_DEVICE_STRING_COUNTS
         local_aggregation_period: WINDOW_7_DAYS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         string_buffer_max: 5
         system_profile_field: [OS, SYSTEM_VERSION]
@@ -334,6 +366,7 @@
         local_aggregation_period: WINDOW_1_DAY
         expedited_sending: true
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: SELECT_LAST
@@ -344,6 +377,7 @@
         local_aggregation_period: WINDOW_7_DAYS
         expedited_sending: true
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: SELECT_LAST
@@ -354,6 +388,7 @@
         local_aggregation_period: WINDOW_1_DAY
         expedited_sending: true
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: SELECT_LAST
       - id: 4
@@ -363,6 +398,7 @@
         local_aggregation_period: WINDOW_7_DAYS
         expedited_sending: true
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: SELECT_LAST
       - id: 5
@@ -372,6 +408,7 @@
         local_aggregation_period: WINDOW_1_DAY
         expedited_sending: true
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: REPORT_ALL
@@ -382,6 +419,7 @@
         local_aggregation_period: WINDOW_7_DAYS
         expedited_sending: true
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: REPORT_ALL
@@ -401,6 +439,7 @@
         local_aggregation_period: WINDOW_1_DAY
         expedited_sending: true
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         string_buffer_max: 5
         system_profile_field: [OS, SYSTEM_VERSION]
@@ -410,6 +449,7 @@
         local_aggregation_period: WINDOW_7_DAYS
         expedited_sending: true
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         string_buffer_max: 5
         system_profile_field: [OS, SYSTEM_VERSION]
@@ -428,6 +468,7 @@
         report_name: "fleetwide_occurrence_counts_report"
         report_type: FLEETWIDE_OCCURRENCE_COUNTS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: SELECT_LAST
@@ -437,6 +478,7 @@
         local_aggregation_procedure: AT_LEAST_ONCE
         local_aggregation_period: WINDOW_1_DAY
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: SELECT_LAST
@@ -446,6 +488,7 @@
         local_aggregation_procedure: SELECT_FIRST
         local_aggregation_period: WINDOW_1_DAY
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 1
         system_profile_field: [OS, SYSTEM_VERSION, EXPERIMENT_IDS]
         experiment_id: [1, 2222, 3333]
diff --git a/src/local_aggregation/testing/test_registry_with_report_all_set/CustomerA/ProjectA1/metrics.yaml b/src/local_aggregation/testing/test_registry_with_report_all_set/CustomerA/ProjectA1/metrics.yaml
index 0953a28..3a640ca 100644
--- a/src/local_aggregation/testing/test_registry_with_report_all_set/CustomerA/ProjectA1/metrics.yaml
+++ b/src/local_aggregation/testing/test_registry_with_report_all_set/CustomerA/ProjectA1/metrics.yaml
@@ -13,5 +13,6 @@
         local_aggregation_period: WINDOW_1_DAY
         system_profile_selection: REPORT_ALL
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [SYSTEM_VERSION]
diff --git a/src/local_aggregation/testing/test_registry_with_select_last_set/CustomerA/ProjectA1/metrics.yaml b/src/local_aggregation/testing/test_registry_with_select_last_set/CustomerA/ProjectA1/metrics.yaml
index 4f4beea..fa28191 100644
--- a/src/local_aggregation/testing/test_registry_with_select_last_set/CustomerA/ProjectA1/metrics.yaml
+++ b/src/local_aggregation/testing/test_registry_with_select_last_set/CustomerA/ProjectA1/metrics.yaml
@@ -13,5 +13,6 @@
         local_aggregation_period: WINDOW_1_DAY
         system_profile_selection: SELECT_LAST
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [SYSTEM_VERSION]
diff --git a/src/logger/test_registries/test_registry/CustomerA/ProjectA1/metrics.yaml b/src/logger/test_registries/test_registry/CustomerA/ProjectA1/metrics.yaml
index 1165ed8..276c91b 100644
--- a/src/logger/test_registries/test_registry/CustomerA/ProjectA1/metrics.yaml
+++ b/src/logger/test_registries/test_registry/CustomerA/ProjectA1/metrics.yaml
@@ -121,6 +121,7 @@
         report_name: "fleetwide_occurrence_counts"
         report_type: FLEETWIDE_OCCURRENCE_COUNTS
         privacy_level: NO_ADDED_PRIVACY
+        privacy_mechanism: DE_IDENTIFICATION
         event_vector_buffer_max: 100
         system_profile_field: [OS, SYSTEM_VERSION]
         system_profile_selection: SELECT_LAST