-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A/B testing infrastructure updates (#11026)
* Rename AbTestBucket to AbTest AbTests have multiple `buckets`, so this commit renames the class to be a little clearer. * Refactor ab_test_spec.rb - Move tests into #bucket method block - Set up a `let` for bucket configs * Move discriminator calculation into AbTest Provide a proc that can be used to determine a discriminator from user/user_session/service_provider/request. changelog: Internal, A/B testing, Rework A/B testing system * Automatically log AB tests with analytics events. Augment analytics events with a top-level `ab_tests` property that lists each active test and which bucket the event is in. (This will likely break a lot of tests) * Add AbTestingConcern - Add new method, ab_test_bucket, for controllers to figure out what bucket the user is in * Update ACUANT_SDK AB test to use new system * Update DOC_AUTH_VENDOR A/B test to use new system * Allow more control over what events log A/B tests should_log can be a Proc, RegExp, etc. and is matched against the event name. * Limit existing A/B tests to IdV events * Improve use of document_capture_session_uuid as a discriminator - Handle case where UUID is present in session (hybrid flow) - Handle case where UUID is in Idv::Session * Limit should_log to RegExp only Right now all we're doing with this is checking to see if it's an idv-related event, which we can do with a Regexp. * Pass acuant_sdk_upgrade_ab_test_bucket into ApiImageUploadForm - Tell the form what bucket it's in so that it can log properly - Add test coverage for form submission when Acuant A/B test is enabled * Remove stray method accidentally added to Idv::Session * Fix lint issues in api_image_upload_form_spec.rb * Remove stray _test_ for method accidentally committed Earlier I was playing with having Idv::Session own discriminator calculation, but I didn't like it. I previously removed a method I accidentally committed--this removes a test for that removed method. * Add test coverage for A/B test initializers Run intialize tests under different conditions and actually verify they can return buckets
- Loading branch information
Showing
33 changed files
with
916 additions
and
363 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module AbTestingConcern | ||
# @param [Symbol] test Name of the test, which should correspond to an A/B test defined in | ||
# # config/initializer/ab_tests.rb. | ||
# @return [Symbol,nil] Bucket to use for the given test, or nil if the test is not active. | ||
def ab_test_bucket(test_name) | ||
test = AbTests.all[test_name] | ||
raise "Unknown A/B test: #{test_name}" unless test | ||
|
||
test.bucket( | ||
request:, | ||
service_provider: current_sp&.issuer, | ||
session:, | ||
user: current_user, | ||
user_session:, | ||
) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
module Idv | ||
module DocAuthVendorConcern | ||
include AbTestingConcern | ||
|
||
# @returns[String] String identifying the vendor to use for doc auth. | ||
def doc_auth_vendor | ||
bucket = ab_test_bucket(:DOC_AUTH_VENDOR) | ||
DocAuthRouter.doc_auth_vendor_for_bucket(bucket) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.