Proof-of-Concept: Add persistence option for A/B tests#11202
Proof-of-Concept: Add persistence option for A/B tests#11202
Conversation
changelog: Internal, A/B Tests, Add persistence option for A/B tests
| session:, | ||
| user:, | ||
| user_session:, | ||
| persisted_read_only: false |
There was a problem hiding this comment.
Maybe clearer name?
| persisted_read_only: false | |
| assign_if_unpersisted: true |
There was a problem hiding this comment.
some more ideas
skip_assignment_for_unpersisted: false
skip_assignment_for_new: false
| persisted_value = AbTestAssignment.bucket(experiment:, discriminator:) if persist | ||
| return persisted_value if persisted_value || (persist && persisted_read_only) | ||
|
|
||
| return nil if no_percentages? |
There was a problem hiding this comment.
wouldn't we want to return @default_bucket here?
There was a problem hiding this comment.
Interesting question. This specific code existed previously, I had just rearranged it. But I'm not sure if nil is meant to be some meaningful value separate from @default_bucket. @matthinz Any thoughts here, since you recently worked on this?
|
I'm going to close this proof-of-concept for now, since we don't have a present need for this at the moment, and #11210 created incompatibilities with persisting the discriminator for reCAPTCHA at sign-in. I still think this'll have value with future A/B tests, but we can reopen once there's an actual need for it. |
🛠 Summary of changes
Adds support for an A/B test to persist its bucket assignment to the database, useful in scenarios where relevant metrics of a test may be logged at a different point in time than the enrollment itself.
Discussed in 2024-09-04 Engineering Huddle
General use-cases:
Specific examples:
📜 Testing Plan
Verify that bucket assignment for reCAPTCHA at sign-in sticks, even after the test is configured to not enroll new users.
config/application.ymlto effectively disable test:make watch_eventsin a separate terminal processab_tests.recaptcha_sign_in.bucketvalue (sign_in_recaptcha)