From ce683e23691ad4fc1a745281921c7705dd3f8fe6 Mon Sep 17 00:00:00 2001 From: Matthew Bernhardt Date: Mon, 28 Aug 2023 15:13:20 -0400 Subject: [PATCH 1/4] Add Split gem with dashboard route --- Gemfile | 1 + Gemfile.lock | 238 ++++++++++++++++++++++++++++------------------- config/routes.rb | 2 + 3 files changed, 146 insertions(+), 95 deletions(-) diff --git a/Gemfile b/Gemfile index 317b3125..cad05156 100644 --- a/Gemfile +++ b/Gemfile @@ -16,6 +16,7 @@ gem 'rails', '~> 7.2.0' gem 'redis' gem 'sentry-rails' gem 'sentry-ruby' +gem 'split', require: 'split/dashboard' gem 'sprockets-rails' gem 'stimulus-rails' gem 'turbo-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 72625ff9..5b359f0f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,66 +10,68 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.2.2.2) - actionpack (= 7.2.2.2) - activesupport (= 7.2.2.2) + actioncable (7.2.3) + actionpack (= 7.2.3) + activesupport (= 7.2.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.2.2.2) - actionpack (= 7.2.2.2) - activejob (= 7.2.2.2) - activerecord (= 7.2.2.2) - activestorage (= 7.2.2.2) - activesupport (= 7.2.2.2) + actionmailbox (7.2.3) + actionpack (= 7.2.3) + activejob (= 7.2.3) + activerecord (= 7.2.3) + activestorage (= 7.2.3) + activesupport (= 7.2.3) mail (>= 2.8.0) - actionmailer (7.2.2.2) - actionpack (= 7.2.2.2) - actionview (= 7.2.2.2) - activejob (= 7.2.2.2) - activesupport (= 7.2.2.2) + actionmailer (7.2.3) + actionpack (= 7.2.3) + actionview (= 7.2.3) + activejob (= 7.2.3) + activesupport (= 7.2.3) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.2.2.2) - actionview (= 7.2.2.2) - activesupport (= 7.2.2.2) + actionpack (7.2.3) + actionview (= 7.2.3) + activesupport (= 7.2.3) + cgi nokogiri (>= 1.8.5) racc - rack (>= 2.2.4, < 3.2) + rack (>= 2.2.4, < 3.3) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (7.2.2.2) - actionpack (= 7.2.2.2) - activerecord (= 7.2.2.2) - activestorage (= 7.2.2.2) - activesupport (= 7.2.2.2) + actiontext (7.2.3) + actionpack (= 7.2.3) + activerecord (= 7.2.3) + activestorage (= 7.2.3) + activesupport (= 7.2.3) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.2.2.2) - activesupport (= 7.2.2.2) + actionview (7.2.3) + activesupport (= 7.2.3) builder (~> 3.1) + cgi erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.2.2.2) - activesupport (= 7.2.2.2) + activejob (7.2.3) + activesupport (= 7.2.3) globalid (>= 0.3.6) - activemodel (7.2.2.2) - activesupport (= 7.2.2.2) - activerecord (7.2.2.2) - activemodel (= 7.2.2.2) - activesupport (= 7.2.2.2) + activemodel (7.2.3) + activesupport (= 7.2.3) + activerecord (7.2.3) + activemodel (= 7.2.3) + activesupport (= 7.2.3) timeout (>= 0.4.0) - activestorage (7.2.2.2) - actionpack (= 7.2.2.2) - activejob (= 7.2.2.2) - activerecord (= 7.2.2.2) - activesupport (= 7.2.2.2) + activestorage (7.2.3) + actionpack (= 7.2.3) + activejob (= 7.2.3) + activerecord (= 7.2.3) + activesupport (= 7.2.3) marcel (~> 1.0) - activesupport (7.2.2.2) + activesupport (7.2.3) base64 benchmark (>= 0.3) bigdecimal @@ -89,7 +91,7 @@ GEM ansi (1.5.0) ast (2.4.3) base64 (0.3.0) - benchmark (0.4.1) + benchmark (0.5.0) better_errors (2.10.1) erubi (>= 1.0.0) rack (>= 0.9.0) @@ -110,14 +112,15 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) + cgi (0.5.0) climate_control (1.2.0) concurrent-ruby (1.3.5) connection_pool (2.5.4) - crack (1.0.0) + crack (1.0.1) bigdecimal rexml crass (1.0.6) - date (3.4.1) + date (3.5.0) debug (1.11.0) irb (~> 1.10) reline (>= 0.3.8) @@ -129,12 +132,16 @@ GEM dotenv (= 3.1.8) railties (>= 6.1) drb (2.2.3) - erb (5.0.3) + erb (5.1.3) erubi (1.13.1) ffi (1.17.2-aarch64-linux-gnu) + ffi (1.17.2-aarch64-linux-musl) + ffi (1.17.2-arm-linux-gnu) + ffi (1.17.2-arm-linux-musl) ffi (1.17.2-arm64-darwin) ffi (1.17.2-x86_64-darwin) ffi (1.17.2-x86_64-linux-gnu) + ffi (1.17.2-x86_64-linux-musl) ffi-compiler (1.3.2) ffi (>= 1.15.5) rake @@ -148,13 +155,13 @@ GEM graphql-client (0.26.0) activesupport (>= 3.0) graphql (>= 1.13.0) - hashdiff (1.1.2) + hashdiff (1.2.1) http (5.3.1) addressable (~> 2.8) http-cookie (~> 1.0) http-form_data (~> 2.2) llhttp-ffi (~> 0.5.0) - http-cookie (1.0.8) + http-cookie (1.1.0) domain_name (~> 0.5) http-form_data (2.3.0) i18n (1.14.7) @@ -171,7 +178,7 @@ GEM jbuilder (2.14.1) actionview (>= 7.0.0) activesupport (>= 7.0.0) - json (2.13.2) + json (2.15.2) language_server-protocol (3.17.0.5) lint_roller (1.1.0) llhttp-ffi (0.5.1) @@ -181,13 +188,14 @@ GEM loofah (2.24.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) - mail (2.8.1) + mail (2.9.0) + logger mini_mime (>= 0.1.1) net-imap net-pop net-smtp marcel (1.1.0) - matrix (0.4.2) + matrix (0.4.3) mini_mime (1.1.5) minitest (5.26.0) minitest-reporters (1.7.1) @@ -198,6 +206,8 @@ GEM mocha (2.7.1) ruby2_keywords (>= 0.0.5) msgpack (1.8.0) + mustermann (3.0.4) + ruby2_keywords (~> 0.0.1) net-imap (0.5.12) date net-protocol @@ -207,37 +217,52 @@ GEM timeout net-smtp (0.5.1) net-protocol - nio4r (2.7.4) + nio4r (2.7.5) nokogiri (1.18.10-aarch64-linux-gnu) racc (~> 1.4) + nokogiri (1.18.10-aarch64-linux-musl) + racc (~> 1.4) + nokogiri (1.18.10-arm-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.10-arm-linux-musl) + racc (~> 1.4) nokogiri (1.18.10-arm64-darwin) racc (~> 1.4) nokogiri (1.18.10-x86_64-darwin) racc (~> 1.4) nokogiri (1.18.10-x86_64-linux-gnu) racc (~> 1.4) + nokogiri (1.18.10-x86_64-linux-musl) + racc (~> 1.4) parallel (1.27.0) - parser (3.3.9.0) + parser (3.3.10.0) ast (~> 2.4.1) racc + pg (1.6.2) pg (1.6.2-aarch64-linux) + pg (1.6.2-aarch64-linux-musl) pg (1.6.2-arm64-darwin) pg (1.6.2-x86_64-darwin) pg (1.6.2-x86_64-linux) + pg (1.6.2-x86_64-linux-musl) pp (0.6.3) prettyprint prettyprint (0.2.0) - prism (1.4.0) + prism (1.6.0) psych (5.2.6) date stringio public_suffix (6.0.2) - puma (7.0.4) + puma (7.1.0) nio4r (~> 2.0) racc (1.8.1) - rack (3.1.18) - rack-attack (6.7.0) + rack (3.2.3) + rack-attack (6.8.0) rack (>= 1.0, < 4) + rack-protection (4.2.1) + base64 (>= 0.1.0) + logger (>= 1.6.0) + rack (>= 3.0.0, < 4) rack-session (2.1.1) base64 (>= 0.1.0) rack (>= 3.0.0) @@ -245,20 +270,20 @@ GEM rack (>= 1.3) rackup (2.2.1) rack (>= 3) - rails (7.2.2.2) - actioncable (= 7.2.2.2) - actionmailbox (= 7.2.2.2) - actionmailer (= 7.2.2.2) - actionpack (= 7.2.2.2) - actiontext (= 7.2.2.2) - actionview (= 7.2.2.2) - activejob (= 7.2.2.2) - activemodel (= 7.2.2.2) - activerecord (= 7.2.2.2) - activestorage (= 7.2.2.2) - activesupport (= 7.2.2.2) + rails (7.2.3) + actioncable (= 7.2.3) + actionmailbox (= 7.2.3) + actionmailer (= 7.2.3) + actionpack (= 7.2.3) + actiontext (= 7.2.3) + actionview (= 7.2.3) + activejob (= 7.2.3) + activemodel (= 7.2.3) + activerecord (= 7.2.3) + activestorage (= 7.2.3) + activesupport (= 7.2.3) bundler (>= 1.15.0) - railties (= 7.2.2.2) + railties (= 7.2.3) rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest @@ -266,30 +291,32 @@ GEM rails-html-sanitizer (1.6.2) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) - railties (7.2.2.2) - actionpack (= 7.2.2.2) - activesupport (= 7.2.2.2) + railties (7.2.3) + actionpack (= 7.2.3) + activesupport (= 7.2.3) + cgi irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) + tsort (>= 0.2) zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.3.0) + rake (13.3.1) rdoc (6.15.0) erb psych (>= 4.0.0) tsort redis (5.4.1) redis-client (>= 0.22.0) - redis-client (0.24.0) + redis-client (0.26.1) connection_pool regexp_parser (2.11.3) reline (0.6.2) io-console (~> 0.5) rexml (3.4.4) - rouge (4.5.1) - rubocop (1.81.1) + rouge (4.6.1) + rubocop (1.81.7) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -311,7 +338,9 @@ GEM rubocop-ast (>= 1.44.0, < 2.0) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) - rubyzip (2.4.1) + rubystats (0.4.1) + matrix + rubyzip (3.2.1) sassc (2.4.0) ffi (~> 1.9) sassc-rails (2.1.2) @@ -321,46 +350,63 @@ GEM sprockets-rails tilt securerandom (0.4.1) - selenium-webdriver (4.36.0) + selenium-webdriver (4.38.0) base64 (~> 0.2) - json (<= 2.13.2) logger (~> 1.4) - prism (~> 1.0, < 1.5) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 4.0) websocket (~> 1.0) - sentry-rails (5.28.0) - railties (>= 5.0) - sentry-ruby (~> 5.28.0) - sentry-ruby (5.28.0) + sentry-rails (6.0.0) + railties (>= 5.2.0) + sentry-ruby (~> 6.0.0) + sentry-ruby (6.0.0) bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.13.1) + simplecov-html (0.13.2) simplecov-lcov (0.9.0) simplecov_json_formatter (0.1.4) - sprockets (4.2.1) + sinatra (4.2.1) + logger (>= 1.6.0) + mustermann (~> 3.0) + rack (>= 3.0.0, < 4) + rack-protection (= 4.2.1) + rack-session (>= 2.0.0, < 3) + tilt (~> 2.0) + split (4.0.5) + bigdecimal + cgi + matrix + redis (>= 4.2) + rubystats (>= 0.3.0) + sinatra (>= 1.2.6) + sprockets (4.2.2) concurrent-ruby (~> 1.0) + logger rack (>= 2.2.4, < 4) sprockets-rails (3.5.2) actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) sqlite3 (2.7.4-aarch64-linux-gnu) + sqlite3 (2.7.4-aarch64-linux-musl) + sqlite3 (2.7.4-arm-linux-gnu) + sqlite3 (2.7.4-arm-linux-musl) sqlite3 (2.7.4-arm64-darwin) sqlite3 (2.7.4-x86_64-darwin) sqlite3 (2.7.4-x86_64-linux-gnu) + sqlite3 (2.7.4-x86_64-linux-musl) stimulus-rails (1.3.4) railties (>= 6.0.0) stringio (3.1.7) thor (1.4.0) - tilt (2.6.0) - timeout (0.4.3) + tilt (2.6.1) + timeout (0.4.4) tsort (0.2.0) - turbo-rails (2.0.17) + turbo-rails (2.0.20) actionpack (>= 7.1.0) railties (>= 7.1.0) tzinfo (2.0.6) @@ -376,7 +422,7 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webmock (3.25.1) + webmock (3.26.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -392,14 +438,15 @@ GEM PLATFORMS aarch64-linux - arm64-darwin-22 - arm64-darwin-23 - arm64-darwin-24 - x86_64-darwin-19 - x86_64-darwin-20 - x86_64-darwin-21 - x86_64-darwin-22 + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-gnu + arm-linux-musl + arm64-darwin + x86_64-darwin x86_64-linux + x86_64-linux-gnu + x86_64-linux-musl DEPENDENCIES annotate @@ -430,6 +477,7 @@ DEPENDENCIES sentry-ruby simplecov simplecov-lcov + split sprockets-rails sqlite3 stimulus-rails @@ -444,4 +492,4 @@ RUBY VERSION ruby 3.4.7p58 BUNDLED WITH - 2.4.19 + 2.6.9 diff --git a/config/routes.rb b/config/routes.rb index 82746036..0e673f66 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -11,4 +11,6 @@ get 'style-guide', to: 'static#style_guide' get 'boolpref', to: 'static#boolpref' + + mount Split::Dashboard, at: 'split' end From 7aa3d8bae22cdd8de2edfd3e823c54db774ea9bb Mon Sep 17 00:00:00 2001 From: Matthew Bernhardt Date: Mon, 28 Aug 2023 15:20:06 -0400 Subject: [PATCH 2/4] Implement a first experiment This sets up a simple UI experiment, defining an alternative set of styles for the search form. The search form starts in the _form.html.erb partial, with most users getting a "standard" class - the experimental group would get the "alt" class, which is rendered differently. The experiment ends when a user reaches a search results page (i.e, they submitted the form and thus got results). Curious folks can force themselves into one or the other pool by using a querystring such as ?ab_test[ui_colors]=alt or ?ab_test[ui_colors]=standard --- app/assets/stylesheets/partials/_search.scss | 9 ++++++++- app/controllers/search_controller.rb | 5 +++++ app/views/search/_form.html.erb | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/partials/_search.scss b/app/assets/stylesheets/partials/_search.scss index 4b9ca1cb..c9ae376c 100644 --- a/app/assets/stylesheets/partials/_search.scss +++ b/app/assets/stylesheets/partials/_search.scss @@ -59,10 +59,17 @@ /* basic search bar */ .search-form { - background-color: #989898; margin-bottom: 0rem; padding: 2.4rem 2rem 1.6rem 2rem; + &.standard { + background-color: #989898; + } + + &.alt { + background-color: #ffd700; + } + details { &:first-of-type { margin-top: 1rem; diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index f8fb3edd..894e937b 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -10,6 +10,11 @@ class SearchController < ApplicationController before_action :validate_geodistance_units!, only: %i[results] def results + # if we are loading results, the user submitted the form - so this experiment is finished + ab_finished(:ui_colors) + + # ab_test(:result_format) + # inject session preference for boolean type if it is present params[:booleanType] = cookies[:boolean_type] || 'AND' diff --git a/app/views/search/_form.html.erb b/app/views/search/_form.html.erb index 0caac289..0eac7929 100644 --- a/app/views/search/_form.html.erb +++ b/app/views/search/_form.html.erb @@ -1,4 +1,4 @@ -