Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test methodologies editor #640

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Test methodologies editor #640

wants to merge 7 commits into from

Conversation

tomrf1
Copy link
Member

@tomrf1 tomrf1 commented Oct 24, 2024

This PR updates the methodologies selector to enable use to compare them, e.g. AB test vs epsilon-greedy.
See also the associated SDC PR: guardian/support-dotcom-components#1251

If more than one methodology is configured then the the audience is split evenly between the methodologies. Each methodology is tracked separately with a different test name. This is done using the new testName field on the Methodology model.

I've also added the constraint that you cannot change the methodologies once a test is live. This is because it could change the test names, which would break tracking as well as the bandit calculations!

Single methodology:

Screenshot 2024-11-22 at 15 53 31

Two methodologies:

Screenshot 2024-11-22 at 15 53 44

@tomrf1 tomrf1 requested a review from a team as a code owner October 24, 2024 08:43
consentStatus: Option[ConsentStatus] = Some(ConsentStatus.All),
deploySchedule: Option[BannerTestDeploySchedule] = None,
methodologies: List[Methodology] = Nil
Copy link
Member Author

@tomrf1 tomrf1 Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

although the new methodologies field is mandatory, it's defaulted to Nil (an empty list), meaning validation does not fail when fetching existing data from dynamodb

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the field mandatory? Could we have it as an optional so we don't have to default it to a Nil

Copy link
Member Author

@tomrf1 tomrf1 Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I try to avoid Option[List[T]], because you have the following possible states:

  1. None
  2. empty list
  3. non-empty list

And 1 and 2 sort of mean the same thing!
If we make the field optional then the client has to handle that possibility as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahhh good point!

fontWeight: 500,
},
error: {
color: 'red',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't I've noticed we can use the actual colour name before!


const defaultEpsilonGreedyBandit: Methodology = {
name: 'EpsilonGreedyBandit',
epsilon: 0.1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need any documentation to help support setting the epsilon value? Or do marketing already have that knowledge?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 we can document it in the RRCP user guide

<div>
<TextField
type={'number'}
InputProps={{ inputProps: { min: 0, max: 1, step: 0.1 } }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of interest what would happen if you set it to 0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. It would pick the "best" variant 100% of the time, which is not useful! I'll set min to 0.1

))}
<Button
onClick={onAddClick}
disabled={isDisabled || methodologies.length >= 4}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 4 significant anywhere else? Seems like a sensible maximum though

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no it's fairly arbitrary!

Copy link
Contributor

@andrewHEguardian andrewHEguardian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants