Allow setting groupId on rollout strategies

The feature flag form hardcoded groupId: 'default' on the Percent rollout (flexibleRollout) and Percent of users (gradualRolloutUserId) strategies. Users couldn't give a flag its own rollout bucket, and editing the percentage or stickiness silently reset a groupId set through the API.

Both strategies now show an editable Group ID field, validated client-side with the backend rule (/^[a-z]{1,32}$/, see app/models/operations/feature_flags/strategy.rb). New strategies still default to default, and an existing groupId is kept when other parameters change. There are no backend changes. A per-flag default is discussed in #635497, and a feature spec for the reset bug is tracked in #635496.

Where to look: flexible_rollout.vue and percent_rollout.vue, GROUP_ID_REGEX in constants.js, three new FeatureFlags| strings in gitlab.pot (added by hand), and a paragraph in each strategy section of doc/operations/feature_flags.md.

Verified locally on a GitLab CE nightly instance with the branch assets (screenshots below), and jest spec/frontend/feature_flags under Vue 2 and VUE_VERSION=3 (30 suites, 303 tests each), eslint/prettier on the touched files.

Screenshots

Before is stock GitLab, After is this branch, with the same data reset before each run. All mobile steps first, then desktop.

View description Before After
A1, mobile (390 × 844): Edit existing flag checkout-redesign (both strategies use group ID payments), step 1: arrive on the edit page. Notice: Group ID field shows the stored payments on both strategies. A1 before, mobile: no Group ID field A1 after, mobile: Group ID field shows the stored payments on both strategies
A2, mobile (390 × 844): step 2: set Percent of users to 50. Notice: percentage changed, Group ID still payments. A2 before, mobile: percentage changed A2 after, mobile: percentage changed, Group ID still payments
A3, mobile (390 × 844): step 3: type Bad-ID in Group ID. Notice: validation error, strategy width unchanged. N/A (new view/step) A3 after, mobile: validation error, strategy width unchanged
A4, mobile (390 × 844): step 4: type pricing in Group ID. Notice: error cleared, pricing accepted. N/A (new view/step) A4 after, mobile: error cleared, pricing accepted
A5, mobile (390 × 844): step 5: Save changes. Notice: list shows Percent of users 50% (API stores groupId: pricing). A5 before, mobile: list shows Percent of users 50% (API now stores groupId: default) A5 after, mobile: list shows Percent of users 50% (API stores groupId: pricing)
A6, mobile (390 × 844): step 6: reopen the edit page. Notice: pricing and 50% persisted. A6 before, mobile: 50% saved, no way to see the group ID was reset A6 after, mobile: pricing and 50% persisted
B1, mobile (390 × 844): New strategy on flag checkout, step 1: arrive on the edit page. Notice: no strategies. B1 before, mobile: no strategies B1 after, mobile: no strategies
B2, mobile (390 × 844): step 2: click Add strategy. Notice: All users strategy added. B2 before, mobile: All users strategy added B2 after, mobile: All users strategy added
B3, mobile (390 × 844): step 3: select Percent of users. Notice: Group ID field shows the unchanged default default. B3 before, mobile: no Group ID field B3 after, mobile: Group ID field shows the unchanged default default
B4, mobile (390 × 844): step 4: type 25. Notice: percentage 25, Group ID still default. B4 before, mobile: percentage 25 B4 after, mobile: percentage 25, Group ID still default
B5, mobile (390 × 844): step 5: Save changes. Notice: saved (API stores groupId: default, same as before). B5 before, mobile: saved (API stores groupId: default) B5 after, mobile: saved (API stores groupId: default, same as before)
A1, desktop (1440 × 900): Edit existing flag checkout-redesign (both strategies use group ID payments), step 1: arrive on the edit page. Notice: Group ID field shows the stored payments on both strategies. A1 before, desktop: no Group ID field A1 after, desktop: Group ID field shows the stored payments on both strategies
A2, desktop (1440 × 900): step 2: set Percent of users to 50. Notice: percentage changed, Group ID still payments. A2 before, desktop: percentage changed A2 after, desktop: percentage changed, Group ID still payments
A3, desktop (1440 × 900): step 3: type Bad-ID in Group ID. Notice: validation error, strategy width unchanged. N/A (new view/step) A3 after, desktop: validation error, strategy width unchanged
A4, desktop (1440 × 900): step 4: type pricing in Group ID. Notice: error cleared, pricing accepted. N/A (new view/step) A4 after, desktop: error cleared, pricing accepted
A5, desktop (1440 × 900): step 5: Save changes. Notice: list shows Percent of users 50% (API stores groupId: pricing). A5 before, desktop: list shows Percent of users 50% (API now stores groupId: default) A5 after, desktop: list shows Percent of users 50% (API stores groupId: pricing)
A6, desktop (1440 × 900): step 6: reopen the edit page. Notice: pricing and 50% persisted. A6 before, desktop: 50% saved, no way to see the group ID was reset A6 after, desktop: pricing and 50% persisted
B1, desktop (1440 × 900): New strategy on flag checkout, step 1: arrive on the edit page. Notice: no strategies. B1 before, desktop: no strategies B1 after, desktop: no strategies
B2, desktop (1440 × 900): step 2: click Add strategy. Notice: All users strategy added. B2 before, desktop: All users strategy added B2 after, desktop: All users strategy added
B3, desktop (1440 × 900): step 3: select Percent of users. Notice: Group ID field shows the unchanged default default. B3 before, desktop: no Group ID field B3 after, desktop: Group ID field shows the unchanged default default
B4, desktop (1440 × 900): step 4: type 25. Notice: percentage 25, Group ID still default. B4 before, desktop: percentage 25 B4 after, desktop: percentage 25, Group ID still default
B5, desktop (1440 × 900): step 5: Save changes. Notice: saved (API stores groupId: default, same as before). B5 before, desktop: saved (API stores groupId: default) B5 after, desktop: saved (API stores groupId: default, same as before)

Please keep Changelog: added in the squash commit.

Closes #635223 (closed)

Edited by Mehdi Youb

Merge request reports

Loading
Loading