[registry] Validate that projects can't add new metrics without replacement metrics

Change-Id: I34bbf120e3ddcac9acbe2a77d738eb8737060a2e
Reviewed-on: https://fuchsia-review.googlesource.com/c/cobalt/+/474155
Commit-Queue: Zach Bush <zmbush@google.com>
Reviewed-by: Cameron Dale <camrdale@google.com>
Fuchsia-Auto-Submit: Zach Bush <zmbush@google.com>
diff --git a/src/bin/config_parser/src/config_validator/validator.go b/src/bin/config_parser/src/config_validator/validator.go
index b80d34a..53cddd5 100644
--- a/src/bin/config_parser/src/config_validator/validator.go
+++ b/src/bin/config_parser/src/config_validator/validator.go
@@ -5,6 +5,7 @@
 package config_validator
 
 import (
+	"config"
 	"config_parser"
 	"fmt"
 )
@@ -27,5 +28,29 @@
 	if err = validateConfiguredMetricDefinitions(c.ProjectConfig.MetricDefinitions); err != nil {
 		return fmt.Errorf("Error in configuration for project %s: %v", c.ProjectName, err)
 	}
+
+	if err = validateReplacementMetricSaturation(c.ProjectConfig.MetricDefinitions); err != nil {
+		return fmt.Errorf("Error in configuration for project %s: %v", c.ProjectName, err)
+	}
+	return nil
+}
+
+func validateReplacementMetricSaturation(metrics []*config.MetricDefinition) (err error) {
+	hasAnyReplacementMetrics := false
+	hasAllReplacementMetrics := true
+	metricsMissingReplacement := []string{}
+
+	for _, m := range metrics {
+		if m.ReplacementMetricId != 0 || m.NoReplacementMetric != "" {
+			hasAnyReplacementMetrics = true
+		} else if !config_parser.Cobalt11MetricTypesSet[m.MetricType] {
+			hasAllReplacementMetrics = false
+			metricsMissingReplacement = append(metricsMissingReplacement, m.MetricName)
+		}
+	}
+
+	if hasAnyReplacementMetrics && !hasAllReplacementMetrics {
+		return fmt.Errorf("the following metrics do not include replacement_metric_id or no_replacement_metric: %v", metricsMissingReplacement)
+	}
 	return nil
 }
diff --git a/third_party/cobalt_config b/third_party/cobalt_config
index 26d0167..1276d2f 160000
--- a/third_party/cobalt_config
+++ b/third_party/cobalt_config
@@ -1 +1 @@
-Subproject commit 26d01674a1d1a8a072fe7be77ea351f970e828ed
+Subproject commit 1276d2fff1e33b897265321ff047d6dd63239707