Page MenuHomePhabricator

xLab: Simplify groups and feature values
Closed, ResolvedPublic5 Estimated Story Points

Assigned To
Authored By
Sfaci
Mar 26 2025, 10:17 AM
Referenced Files
F59933304: Screenshot 2025-05-13 at 13.10.43.png
May 13 2025, 11:13 AM
F59267152: Screenshot 2025-04-16 at 16.55.54.png
Apr 16 2025, 2:56 PM
F59267066: Screenshot 2025-04-16 at 16.34.43.png
Apr 16 2025, 2:56 PM
F59266502: Screenshot 2025-04-16 at 15.21.27.png
Apr 16 2025, 2:56 PM
F59266266: Screenshot 2025-04-16 at 14.47.24.png
Apr 16 2025, 2:56 PM
F59024285: image.png
Apr 9 2025, 11:16 AM
F58967022: image.png
Apr 2 2025, 5:48 PM
F58967028: image.png
Apr 2 2025, 5:48 PM

Description

Description

Recently we have been working in a new approach to deal with experiment configuration. So far we are dealing with feature variants (every feature has a name and some allowed values) but we want to explore a new approach based on treatment groups (a control group and a variable number of treatment ones that the user can configure). According to this new way to configure experiments, experiment owners will assign only groups to a specific experiment in such a way the feature code only will need to know which is the assigned group for every user enrolled in that experiment. According to the assigned group, the feature code will run some specific experience that they relate to that group. There will be a fixed control group to represent the existing experience and several treatment ones to represent the new experiences that the Product team wants to explore.

xLab UI
Default state: Users find the control group predefined in the variations module. The ‘+ Add a variation’ button is available for them to insert a variation.Variation added: Adding a variation results in a split of the enrollment percentage between groups. Users can input the name, machine-readable name and description of their variations. In the first iteration, the ‘+ Add a variation’ button becomes disabled after use.Deletion confirmation: If users try to delete a Variation which fields are populated with data, a confirmation modal is thrown to avoid involuntary loss of information/progress.Test activation confirmation: Users won't be able to edit their treatment group's details once their experiment has been activated. We'll mention this in the activation confirmation dialog as indicated in the screenshot.
image.png (2,110×1,168 px, 164 KB)
image.png (2,110×1,168 px, 178 KB)
image.png (2,110×1,168 px, 258 KB)
image.png (2,374×1,152 px, 306 KB)

Find flow and behavior annotations in the design specifications ➡ Figma | Miro

The new "Variations" module will be included right after the "Project and sample size" field in the A/B test form.
Note that, for now, only the required control group and one additional treatment work are allowed per experiment, all that according to the following rules:

  • The Variation name field is a human-friendly name that instrument owners can edit freely
  • The Machine-readable name field can be also edited freely by instrument owners, but the system will apply some rules that won't allow some special characters and spaces. The idea is to apply same restrictions that we are applying to generate the machine-readable name for the experiment. This works this way because this value will be the one that Product developers will use in the feature code to identify the assigned group for the current user. We'll cover these validation rules in a future task.
  • Both the Variation name and the Machine readable name fields are required, and should be validated on submit like other required fields. (Improved validation will be implemented when we address this at a global form level. See T384707)
  • The Description field can be edited freely. It will contain the group description
  • There will be always a control group that will represent the existing change as it's right now (it's a required group). The instrument owner will be able to add any other treatment group they consider to test different features via the feature code
  • The percentage assigned to every group will be equitable (50% each group if there are two groups, 25% each group if there are four, . . .)
  • Once the experiment is activated, changes to related groups fields (friendly and machine-readable names and description) won't be allowed
  • xLab will throw a dialog in the case the user tries to remove a group which fields contain any value (the copy for this dialog is still pending)
xLab API

We will have to update also the response for the /api/v1/experiments to reflect these changes. We will have to remove the features field from the response and add a new one called groups that will be an array that will contain only the machine-readable name for each group.

We will take also the opportunity to remove some unneeded data we are including currently in the /api/v1/experiments endpoint response. We are including there all the fields that belong to any specific experiment but the Experiment Manager don't need all of them to be able to enroll an user in some experiment. We could also update the endpoint to serve only experiments that have been activated (status === 1)

The following would be how an experiment would look from the API perspective with these changes:

{
    "slug": "test_text_experiment",
    "utc_start_dt": "2025-03-08T10:08:53.000Z",
    "utc_end_dt": "2025-03-18T10:08:53.000Z",
    "sample_rate": {
      "default": 1
    },
    "groups": [
      "control",
      "bold_text",
      "italic_text"
    ]
  }
xLab data model

The data model will be updated to store all the information related to groups (Group name, machine-readatable name and description) and the features field will be removed.

Acceptance criteria

  • xLab UI: Experiment configuration is based on variations (instead of features)
    • The "Variants" section in the A/B test configuration form is removed
    • Following the design specifications, a required control is configured automatically, and experiment owners can add one more treatment
    • The confirmation dialog that is shown when an experiment is activated will be updated to say "Variations" instead of "feature variants" when explaining which fields will no longer be editable
    • A confirmation dialog is shown when the user tries to delete a group which fields contain any values
  • The xLab data model allows to store groups (and the three related fields) and features field has been removed
  • The /api/v1/experiments endpoint response has been update to include groups as a new field. It will be only an array with the machine-readable group names. Group name and Description won't be included as a part of the response
  • Right now, we are limiting the UI to showing two groups: control and treatment (but the API and data model should allow more)
  • The /api/v1/experiments response has been updated to remove all the non-necessary fields there: id, name, description, creator, owner, purpose, created_at, updated_at, task, compliance_requirements, sample_unit, environments, security_legal_review, was_activated and email_address)
  • The /api/v1/experiments response has been updated to serve only the experiments that have been activated (status === 1) and the status field has been removed from the response
  • Response format proposal reviewed and incorporated

Details

Related Changes in Gerrit:
Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
Address Design Review feedbackrepos/data-engineering/test-kitchen!167phuedxwork/phuedx/groups-design-review-1main
Migrate from features to variationsrepos/data-engineering/test-kitchen!164phuedxwork/phuedx/groupsmain
Customize query in GitLab

Event Timeline

Sfaci renamed this task from xLab: Simplify features and feature values to xLab: Simplify groups and feature values.Mar 26 2025, 10:25 AM
Sfaci updated the task description. (Show Details)
Sfaci removed Sfaci as the assignee of this task.Mar 26 2025, 5:46 PM

@Sarai-WMF: A question that came up when I was working on the initial implementation: How should groups be displayed in the Read view? In order to get the app into a working state, I used an ordered list, i.e.

Screenshot 2025-03-28 at 17.09.31.png (360×326 px, 23 KB)

@Sarai-WMF: A question that came up when I was working on the initial implementation: How should groups be displayed in the Read view? In order to get the app into a working state, I used an ordered list, i.e.

Screenshot 2025-03-28 at 17.09.31.png (360×326 px, 23 KB)

Thanks for the heads-up, @phuedx! I didn't remember to update read view to reflect any of the new/adjusted fields 😓 I think that an ordered list makes sense! Should we display the machine-readable name and description too? In that case, those could be displayed as a ul nested under each group/variation:

Screenshot 2025-03-31 at 16.56.26.png (370×158 px, 16 KB)

More importantly: the designs that had been attached to this task were outdated, and the new version is not finalized. My apologies for not updating the description earlier. For some reason, I assumed that this task wasn't ready to be picked up. I'll wrap things up and add the final designs asap to avoid blocking you any further. My apologies again!

@phuedx and @Sfaci I just added an overview of the designs and a link to the Figma specs. Please let me know (through your channel of choice) in case any clarifications/corrections are needed. Thank you! 🙏🏻

Milimetric set the point value for this task to 5.

The module looks and works great, @phuedx! 🎉 Sharing some change suggestions after design verification:

  1. For some reason, I can't make the tooltip that clarifies the meaning of the "Split" indicators to be displayed. Would it be possible to trigger it when the split span is hovered?
    Screenshot 2025-04-16 at 14.47.24.png (1,730×794 px, 135 KB)
  1. [Control] The suggested copy for the Control group's description was: "The control group represents users who receive the existing experience. It serves as the benchmark for measuring the impact of the changes being tested.". Does this proposal sound good?
  1. Variation module: To avoid redundancy, the "Machine-readable name" and "Description" sections don't need to be included in the Variantion module. The corresponding fields will already display this information.
    Screenshot 2025-04-16 at 15.21.27.png (665×233 px, 17 KB)
  1. Variation module: Thanks for incorporating the clever machine-readable placeholder suggestion! It works amazing. I would just recommend that we also only display the "e.g.," bit when users enter a value in the "Variation name" field. I think this would avoid any potential temporary confusion. Does that sound good?
  1. Variation module validation: If the "variation name" or "machine-readable name" fields are empty or contain wrongly-formed values when the form is submitted, validation is correctly triggered, but 1) the messages displayed are not very orientating, we could replace "variants[1].name" and "variants[1].slug" by the field names (i.e., "variation name" and "variation machine-readable name"); 2) Even if the issue is with the fields being empty, the validation message still says "Invalid value" 3) Also, for some reason the machine-readable error is displayed twice.
    Screenshot 2025-04-16 at 16.34.43.png (322×421 px, 34 KB)
  1. Variation name validation: If users need to input a name that should follow specific rules, we might want to indicate this to them using the text input's helper text. This is what we had planned for the Instrument/Experiment name field. Would that make sense?
    Screenshot 2025-04-16 at 16.55.54.png (700×384 px, 43 KB)
    This could be addressed as part of T372952: (stretch) xLab: Add better validation to forms

Couple of small UI fixes:

  1. (Potentially out of scope?) The field-group elements included in xLab don't display the right border and padding. It'd be great if we could finally tackle this known issue (see T383983) as part of a task that reuses this class. Particularly, the border should display a lighter color: border-color-muted (that's #DADDE3/#404244 for light and dark mode respectively), and a 2px border radius (border-radius-base). The padding of the field-groups should be of 12px instead of 10.
  1. The elements inside the control and variation field groups should have a vertical spacing of 16px between them. This applies to all elements in all other groups, which also need fixing. I'm not sure whether there's an easy way to apply that new consistent spacing to all field groups without altering anything else. We could also tackle this individually, as all groups will be adjusted in some way as part of 2.4.13.
  1. Since they are purely decorative (unlike the ones included in interactive elements), would it be possible to apply a lighter color (color-subtle) to the user-avatar icons?

I'd say that's all. Thank you again for all the changes!

Below I respond to those points that I could not address fully and give my reasons for not having done so. If you don't see a point below, then you should assume that the latest MR address it.

  1. For some reason, I can't make the tooltip that clarifies the meaning of the "Split" indicators to be displayed. Would it be possible to trigger it when the split span is hovered?
    Screenshot 2025-04-16 at 14.47.24.png (1,730×794 px, 135 KB)
  1. Variation module validation: If the "variation name" or "machine-readable name" fields are empty or contain wrongly-formed values when the form is submitted, validation is correctly triggered, but 1) the messages displayed are not very orientating, we could replace "variants[1].name" and "variants[1].slug" by the field names (i.e., "variation name" and "variation machine-readable name"); 2) Even if the issue is with the fields being empty, the validation message still says "Invalid value" 3) Also, for some reason the machine-readable error is displayed twice.
    Screenshot 2025-04-16 at 16.34.43.png (322×421 px, 34 KB)

I've addressed (2) and (3). (1), however, is pretty tricky and would require special-casing this particular group of fields. I would prefer that it should be addressed as part of T372952: (stretch) xLab: Add better validation to forms.

  1. Variation name validation: If users need to input a name that should follow specific rules, we might want to indicate this to them using the text input's helper text. This is what we had planned for the Instrument/Experiment name field. Would that make sense?
    Screenshot 2025-04-16 at 16.55.54.png (700×384 px, 43 KB)
    This could be addressed as part of T372952: (stretch) xLab: Add better validation to forms

There are other fields that need similar explanation. I would prefer that they are all addressed as part of T372952: (stretch) xLab: Add better validation to forms.

Couple of small UI fixes:

  1. (Potentially out of scope?) The field-group elements included in xLab don't display the right border and padding. It'd be great if we could finally tackle this known issue (see T383983) as part of a task that reuses this class. Particularly, the border should display a lighter color: border-color-muted (that's #DADDE3/#404244 for light and dark mode respectively), and a 2px border radius (border-radius-base). The padding of the field-groups should be of 12px instead of 10.

I'd note that note all fields are correctly marked up as fieldsets (and some fieldsets should be expanded in scope). I would prefer to do that in the context of T383983: xLab: Correct form modules' style (and probably increase it's size accordingly).

  1. The elements inside the control and variation field groups should have a vertical spacing of 16px between them. This applies to all elements in all other groups, which also need fixing. I'm not sure whether there's an easy way to apply that new consistent spacing to all field groups without altering anything else. We could also tackle this individually, as all groups will be adjusted in some way as part of 2.4.13.

Maybe there's a missing task here? In my response to (7) above, I noted that some of the markup needs to be updated. Perhaps we should create a task to review the vertical rhythm as a subtask of T383983: xLab: Correct form modules' style or expand its scope slightly (again)?

Thanks for all the new changes, @phuedx! Regarding the pending points:

(1) Missing "Split" indicators' tooltip: If this cannot be addressed as part of this task, then I believe it'd make sense to create a separate ticket, since the informative tooltip is not really related to validation 🤔
(5) Variation module & (6) Variation name validation: Makes sense to address these as part of T372952: (stretch) xLab: Add better validation to forms 👍🏻
(7) Incorrect border and padding of field-sets & (8) Vertical spacing: Sure! Let's address these field-group issues through T383983: xLab: Correct form modules' style, sounds sensible. Edit: The task was just updated

Thanks again!

(1) Missing "Split" indicators' tooltip: If this cannot be addressed as part of this task, then I believe it'd make sense to create a separate ticket, since the informative tooltip is not really related to validation 🤔

I'm not quite sure why I couldn't get this working previously but I've managed to do so now 🎉

(1) Missing "Split" indicators' tooltip: If this cannot be addressed as part of this task, then I believe it'd make sense to create a separate ticket, since the informative tooltip is not really related to validation 🤔

I'm not quite sure why I couldn't get this working previously but I've managed to do so now 🎉

Yay!! Awesome, thanks! 🎉 🎉 🎉

Change #1141970 had a related patch set uploaded (by Clare Ming; author: Clare Ming):

[operations/deployment-charts@master] Experimentation Lab: Deploying to staging

https://gerrit.wikimedia.org/r/1141970

Change #1141970 merged by jenkins-bot:

[operations/deployment-charts@master] Experimentation Lab: Deploying to staging

https://gerrit.wikimedia.org/r/1141970

This looks/ works great. Thank you! 💯

To summarize what's pending and will be covered in separate tasks:

  1. Client-side validation will be added as part of T372952: (stretch) xLab: Add better validation to forms: Right now, users can input invalid Variation names and Machine-readable names and only find out that something is wrong on submit. As part of the validation task, we'll need to decide if the placeholder suggestion displayed by the "Machine-readable name" should be removed if the Variation name value is malformed.
    Screenshot 2025-05-13 at 13.10.43.png (651×134 px, 15 KB)
  1. UI fixes for the border, padding and vertical spacing of field-sets will be applied as part of T383983: xLab: Correct form modules' style.

Change #1145328 had a related patch set uploaded (by Santiago Faci; author: Santiago Faci):

[operations/deployment-charts@master] Experimentation Lab: Deploying to production

https://gerrit.wikimedia.org/r/1145328

Change #1145328 merged by jenkins-bot:

[operations/deployment-charts@master] Experimentation Lab: Deploying to production

https://gerrit.wikimedia.org/r/1145328