Reland "[report_definition] Rename COOKIE_BUCKET_ID to COOKIE_BUCKET to avoid"
This reverts commit 0e7602f31c0ebcf5cee4c61308be303523298ec1.
Reason for revert: not the culprit for the size increase
Original change's description:
> Revert "[report_definition] Rename COOKIE_BUCKET_ID to COOKIE_BUCKET to avoid"
>
> This reverts commit 8663e54ecaacdba49b560572391cf07a52a18eb9.
>
> Reason for revert: Might related to the vim3 size increase, b/423965621
>
> Original change's description:
> > [report_definition] Rename COOKIE_BUCKET_ID to COOKIE_BUCKET to avoid
> > confusion
> >
> > The SystemProfileField.COOKIE_BUCKET is not an identifier, but describes
> > which cookie bucket the contributing device falls in for specific scope.
> > Remove the "id" in the name to avoid confusion.
> >
> > Fixed: 423693695
> > Change-Id: I69e8a58c6b26e268a256d6abf119a4da0c5367d5
> > Reviewed-on: https://fuchsia-review.googlesource.com/c/cobalt/+/1296824
> > Commit-Queue: Anivia Li <aniviali@google.com>
> > Reviewed-by: Alex Pankhurst <pankhurst@google.com>
>
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Change-Id: Ia510298dd04dd74d071558b32b08512626783937
> Reviewed-on: https://fuchsia-review.googlesource.com/c/cobalt/+/1297325
> Reviewed-by: RubberStamper 🤖 <android-build-ayeaye@system.gserviceaccount.com>
> Commit-Queue: Haowei Wu <haowei@google.com>
Change-Id: Ie4e365736f02e8900695e42f34d1f9c7833e6964
Reviewed-on: https://fuchsia-review.googlesource.com/c/cobalt/+/1297673
Reviewed-by: RubberStamper 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Commit-Queue: Ina Huh <ihuh@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 b559a7f..4830baf 100644
--- a/src/bin/config_parser/src/config_validator/report_definitions.go
+++ b/src/bin/config_parser/src/config_validator/report_definitions.go
@@ -781,12 +781,12 @@
}
func validateCookieBucketFields(r *config.ReportDefinition, allowed bool) error {
- if !containsCookieBucketId(r.GetSystemProfileField()) {
+ if !containsCookieBucket(r.GetSystemProfileField()) {
if r.GetNumCookieBuckets() != 0 {
- return fmt.Errorf("num_cookie_buckets must be 0 if COOKIE_BUCKET_ID is not included in the system profile field")
+ return fmt.Errorf("num_cookie_buckets must be 0 if COOKIE_BUCKET is not included in the system profile field")
}
if r.GetCookieBucketScope() != "" {
- return fmt.Errorf("cookie_bucket_scope must be empty if COOKIE_BUCKET_ID is not included in the system profile field")
+ return fmt.Errorf("cookie_bucket_scope must be empty if COOKIE_BUCKET is not included in the system profile field")
}
return nil
}
@@ -798,7 +798,7 @@
return fmt.Errorf("cookie buckets must not be used on non-experiment reports")
}
if r.GetNumCookieBuckets() == 0 {
- return fmt.Errorf("num_cookie_buckets must be non-zero if COOKIE_BUCKET_ID is included in the system profile field")
+ return fmt.Errorf("num_cookie_buckets must be non-zero if COOKIE_BUCKET is included in the system profile field")
}
if r.GetNumCookieBuckets() != 20 {
return fmt.Errorf("num_cookie_buckets must be either 0 or 20")
@@ -822,9 +822,9 @@
return false
}
-func containsCookieBucketId(s []config.SystemProfileField) bool {
+func containsCookieBucket(s []config.SystemProfileField) bool {
for _, spf := range s {
- if spf == config.SystemProfileField_COOKIE_BUCKET_ID {
+ if spf == config.SystemProfileField_COOKIE_BUCKET {
return true
}
}
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 cc5919a..7ff88fa 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
@@ -1178,59 +1178,59 @@
expectedError string
}{
{
- name: "num_cookie_buckets is set when COOKIE_BUCKET_ID is not set",
+ name: "num_cookie_buckets is set when COOKIE_BUCKET is not set",
allowed: true,
numCookieBuckets: 20,
expectError: true,
- expectedError: "Accepted report definition with cookie buckets enabled while COOKIE_BUCKET_ID system profile field is not set",
+ expectedError: "Accepted report definition with cookie buckets enabled while COOKIE_BUCKET system profile field is not set",
},
{
- name: "cookie_bucket_scope is set when COOKIE_BUCKET_ID is not set",
+ name: "cookie_bucket_scope is set when COOKIE_BUCKET is not set",
allowed: true,
cookieBucketScope: "scope",
expectError: true,
- expectedError: "Accepted report definition with cookie_bucket_scope set while COOKIE_BUCKET_ID system profile field is not set",
+ expectedError: "Accepted report definition with cookie_bucket_scope set while COOKIE_BUCKET system profile field is not set",
},
{
name: "Cookie buckets used when not allowed",
allowed: false,
- systemProfileField: []config.SystemProfileField{config.SystemProfileField_COOKIE_BUCKET_ID, config.SystemProfileField_EXPERIMENT_IDS},
+ systemProfileField: []config.SystemProfileField{config.SystemProfileField_COOKIE_BUCKET, config.SystemProfileField_EXPERIMENT_IDS},
numCookieBuckets: 20,
cookieBucketScope: "scope",
experimentID: []int64{1},
expectError: true,
- expectedError: "Accepted report definition with COOKIE_BUCKET_ID system profile field set while cookie buckets are not allowed",
+ expectedError: "Accepted report definition with COOKIE_BUCKET system profile field set while cookie buckets are not allowed",
},
{
name: "Cookie buckets used when EXPERIMENT_IDS is not set",
allowed: true,
- systemProfileField: []config.SystemProfileField{config.SystemProfileField_COOKIE_BUCKET_ID},
+ systemProfileField: []config.SystemProfileField{config.SystemProfileField_COOKIE_BUCKET},
numCookieBuckets: 20,
cookieBucketScope: "scope",
expectError: true,
- expectedError: "Accepted report definition with COOKIE_BUCKET_ID system profile field set while EXPERIMENT_IDS system profile field is not set",
+ expectedError: "Accepted report definition with COOKIE_BUCKET system profile field set while EXPERIMENT_IDS system profile field is not set",
},
{
name: "Cookie buckets used when experiment_ids is empty",
allowed: true,
- systemProfileField: []config.SystemProfileField{config.SystemProfileField_COOKIE_BUCKET_ID, config.SystemProfileField_EXPERIMENT_IDS},
+ systemProfileField: []config.SystemProfileField{config.SystemProfileField_COOKIE_BUCKET, config.SystemProfileField_EXPERIMENT_IDS},
numCookieBuckets: 20,
cookieBucketScope: "scope",
expectError: true,
expectedError: "Accepted non-experiment report with cookie buckets enabled",
},
{
- name: "num_cookie_buckets is not set when COOKIE_BUCKET_ID is set",
+ name: "num_cookie_buckets is not set when COOKIE_BUCKET is set",
allowed: true,
- systemProfileField: []config.SystemProfileField{config.SystemProfileField_COOKIE_BUCKET_ID, config.SystemProfileField_EXPERIMENT_IDS},
+ systemProfileField: []config.SystemProfileField{config.SystemProfileField_COOKIE_BUCKET, config.SystemProfileField_EXPERIMENT_IDS},
experimentID: []int64{1},
expectError: true,
- expectedError: "Accepted report definition with COOKIE_BUCKET_ID system profile field set while cookie buckets disabled",
+ expectedError: "Accepted report definition with COOKIE_BUCKET system profile field set while cookie buckets disabled",
},
{
name: "cookie_bucket_scope is empty when cookie buckets are enabled",
allowed: true,
- systemProfileField: []config.SystemProfileField{config.SystemProfileField_COOKIE_BUCKET_ID, config.SystemProfileField_EXPERIMENT_IDS},
+ systemProfileField: []config.SystemProfileField{config.SystemProfileField_COOKIE_BUCKET, config.SystemProfileField_EXPERIMENT_IDS},
numCookieBuckets: 20,
experimentID: []int64{1},
expectError: true,
@@ -1239,7 +1239,7 @@
{
name: "cookie_bucket_scope is whitespace when cookie buckets are enabled",
allowed: true,
- systemProfileField: []config.SystemProfileField{config.SystemProfileField_COOKIE_BUCKET_ID, config.SystemProfileField_EXPERIMENT_IDS},
+ systemProfileField: []config.SystemProfileField{config.SystemProfileField_COOKIE_BUCKET, config.SystemProfileField_EXPERIMENT_IDS},
numCookieBuckets: 20,
cookieBucketScope: " ",
experimentID: []int64{1},
@@ -1249,7 +1249,7 @@
{
name: "num_cookie_buckets is not 20 when cookie buckets are enabled",
allowed: true,
- systemProfileField: []config.SystemProfileField{config.SystemProfileField_COOKIE_BUCKET_ID, config.SystemProfileField_EXPERIMENT_IDS},
+ systemProfileField: []config.SystemProfileField{config.SystemProfileField_COOKIE_BUCKET, config.SystemProfileField_EXPERIMENT_IDS},
numCookieBuckets: 19,
cookieBucketScope: "scope",
experimentID: []int64{1},
@@ -1259,7 +1259,7 @@
{
name: "Cookie buckets are enabeld for private report",
allowed: true,
- systemProfileField: []config.SystemProfileField{config.SystemProfileField_COOKIE_BUCKET_ID, config.SystemProfileField_EXPERIMENT_IDS},
+ systemProfileField: []config.SystemProfileField{config.SystemProfileField_COOKIE_BUCKET, config.SystemProfileField_EXPERIMENT_IDS},
numCookieBuckets: 20,
cookieBucketScope: "scope",
experimentID: []int64{1},
@@ -1270,7 +1270,7 @@
{
name: "Valid experiment report with cookie buckets enabled",
allowed: true,
- systemProfileField: []config.SystemProfileField{config.SystemProfileField_COOKIE_BUCKET_ID, config.SystemProfileField_EXPERIMENT_IDS},
+ systemProfileField: []config.SystemProfileField{config.SystemProfileField_COOKIE_BUCKET, config.SystemProfileField_EXPERIMENT_IDS},
numCookieBuckets: 20,
cookieBucketScope: "scope",
experimentID: []int64{1},
diff --git a/src/registry/report_definition.proto b/src/registry/report_definition.proto
index 592ff2e..856be5a 100644
--- a/src/registry/report_definition.proto
+++ b/src/registry/report_definition.proto
@@ -838,9 +838,9 @@
CHANNEL = 5;
BUILD_TYPE = 7;
EXPERIMENT_IDS = 9;
- COOKIE_BUCKET_ID = 11;
- reserved 6, 8;
- reserved "REALM", "EXPERIMENT_TOKENS";
+ COOKIE_BUCKET = 12;
+ reserved 6, 8, 11;
+ reserved "REALM", "EXPERIMENT_TOKENS", "COOKIE_BUCKET_ID";
}
// Stages in the release cycle of a component. Each Cobalt customer determines