From feea276b2c28c402fe52a0555e26c4b8712117fe Mon Sep 17 00:00:00 2001 From: Matthew Bernhardt Date: Mon, 28 Aug 2023 15:13:20 -0400 Subject: [PATCH 1/5] Add Split gem with dashboard route --- Gemfile | 1 + Gemfile.lock | 201 +++++++++++++++++++++++++---------------------- config/routes.rb | 2 + 3 files changed, 110 insertions(+), 94 deletions(-) diff --git a/Gemfile b/Gemfile index bf666bfb..2331ab99 100644 --- a/Gemfile +++ b/Gemfile @@ -14,6 +14,7 @@ gem 'puma' gem 'rails', '~> 7.0' 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 bc49f0e0..fb7d1db9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,35 +10,35 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.1.3.2) - actionpack (= 7.1.3.2) - activesupport (= 7.1.3.2) + actioncable (7.1.3.3) + actionpack (= 7.1.3.3) + activesupport (= 7.1.3.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.3.2) - actionpack (= 7.1.3.2) - activejob (= 7.1.3.2) - activerecord (= 7.1.3.2) - activestorage (= 7.1.3.2) - activesupport (= 7.1.3.2) + actionmailbox (7.1.3.3) + actionpack (= 7.1.3.3) + activejob (= 7.1.3.3) + activerecord (= 7.1.3.3) + activestorage (= 7.1.3.3) + activesupport (= 7.1.3.3) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.1.3.2) - actionpack (= 7.1.3.2) - actionview (= 7.1.3.2) - activejob (= 7.1.3.2) - activesupport (= 7.1.3.2) + actionmailer (7.1.3.3) + actionpack (= 7.1.3.3) + actionview (= 7.1.3.3) + activejob (= 7.1.3.3) + activesupport (= 7.1.3.3) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.2) - actionpack (7.1.3.2) - actionview (= 7.1.3.2) - activesupport (= 7.1.3.2) + actionpack (7.1.3.3) + actionview (= 7.1.3.3) + activesupport (= 7.1.3.3) nokogiri (>= 1.8.5) racc rack (>= 2.2.4) @@ -46,35 +46,35 @@ GEM rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.3.2) - actionpack (= 7.1.3.2) - activerecord (= 7.1.3.2) - activestorage (= 7.1.3.2) - activesupport (= 7.1.3.2) + actiontext (7.1.3.3) + actionpack (= 7.1.3.3) + activerecord (= 7.1.3.3) + activestorage (= 7.1.3.3) + activesupport (= 7.1.3.3) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.3.2) - activesupport (= 7.1.3.2) + actionview (7.1.3.3) + activesupport (= 7.1.3.3) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.1.3.2) - activesupport (= 7.1.3.2) + activejob (7.1.3.3) + activesupport (= 7.1.3.3) globalid (>= 0.3.6) - activemodel (7.1.3.2) - activesupport (= 7.1.3.2) - activerecord (7.1.3.2) - activemodel (= 7.1.3.2) - activesupport (= 7.1.3.2) + activemodel (7.1.3.3) + activesupport (= 7.1.3.3) + activerecord (7.1.3.3) + activemodel (= 7.1.3.3) + activesupport (= 7.1.3.3) timeout (>= 0.4.0) - activestorage (7.1.3.2) - actionpack (= 7.1.3.2) - activejob (= 7.1.3.2) - activerecord (= 7.1.3.2) - activesupport (= 7.1.3.2) + activestorage (7.1.3.3) + actionpack (= 7.1.3.3) + activejob (= 7.1.3.3) + activerecord (= 7.1.3.3) + activesupport (= 7.1.3.3) marcel (~> 1.0) - activesupport (7.1.3.2) + activesupport (7.1.3.3) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -113,7 +113,7 @@ GEM regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) climate_control (1.2.0) - concurrent-ruby (1.2.3) + concurrent-ruby (1.3.1) connection_pool (2.4.1) crack (1.0.0) bigdecimal @@ -132,16 +132,16 @@ GEM railties (>= 6.1) drb (2.2.1) erubi (1.12.0) - ffi (1.16.3) - ffi-compiler (1.0.1) - ffi (>= 1.0.0) + ffi (1.17.0-arm64-darwin) + ffi-compiler (1.3.2) + ffi (>= 1.15.5) rake flipflop (2.7.1) activesupport (>= 4.0) terminal-table (>= 1.8) globalid (1.2.1) activesupport (>= 6.1) - graphql (2.3.2) + graphql (2.3.4) base64 graphql-client (0.22.0) activesupport (>= 3.0) @@ -153,7 +153,7 @@ GEM http-cookie (~> 1.0) http-form_data (~> 2.2) llhttp-ffi (~> 0.5.0) - http-cookie (1.0.5) + http-cookie (1.0.6) domain_name (~> 0.5) http-form_data (2.3.0) i18n (1.14.5) @@ -182,47 +182,48 @@ GEM net-imap net-pop net-smtp - marcel (1.0.2) + marcel (1.0.4) matrix (0.4.2) mini_mime (1.1.5) - minitest (5.22.3) + minitest (5.23.1) minitest-reporters (1.6.1) ansi builder minitest (>= 5.0) ruby-progressbar - mocha (2.2.0) + mocha (2.3.0) ruby2_keywords (>= 0.0.5) msgpack (1.7.2) + mustermann (3.0.0) + ruby2_keywords (~> 0.0.1) mutex_m (0.2.0) - net-imap (0.4.10) + net-imap (0.4.12) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.4.0.1) + net-smtp (0.5.0) net-protocol - nio4r (2.7.0) - nokogiri (1.16.4-arm64-darwin) - racc (~> 1.4) - nokogiri (1.16.4-x86_64-darwin) - racc (~> 1.4) - nokogiri (1.16.4-x86_64-linux) + nio4r (2.7.3) + nokogiri (1.16.5-arm64-darwin) racc (~> 1.4) parallel (1.24.0) - parser (3.3.1.0) + parser (3.3.2.0) ast (~> 2.4.1) racc pg (1.5.6) psych (5.1.2) stringio - public_suffix (5.0.4) + public_suffix (5.0.5) puma (6.4.2) nio4r (~> 2.0) - racc (1.7.3) - rack (3.0.10) + racc (1.8.0) + rack (3.0.11) + rack-protection (4.0.0) + base64 (>= 0.1.0) + rack (>= 3.0.0, < 4) rack-session (2.0.0) rack (>= 3.0.0) rack-test (2.1.0) @@ -230,20 +231,20 @@ GEM rackup (2.1.0) rack (>= 3) webrick (~> 1.8) - rails (7.1.3.2) - actioncable (= 7.1.3.2) - actionmailbox (= 7.1.3.2) - actionmailer (= 7.1.3.2) - actionpack (= 7.1.3.2) - actiontext (= 7.1.3.2) - actionview (= 7.1.3.2) - activejob (= 7.1.3.2) - activemodel (= 7.1.3.2) - activerecord (= 7.1.3.2) - activestorage (= 7.1.3.2) - activesupport (= 7.1.3.2) + rails (7.1.3.3) + actioncable (= 7.1.3.3) + actionmailbox (= 7.1.3.3) + actionmailer (= 7.1.3.3) + actionpack (= 7.1.3.3) + actiontext (= 7.1.3.3) + actionview (= 7.1.3.3) + activejob (= 7.1.3.3) + activemodel (= 7.1.3.3) + activerecord (= 7.1.3.3) + activestorage (= 7.1.3.3) + activesupport (= 7.1.3.3) bundler (>= 1.15.0) - railties (= 7.1.3.2) + railties (= 7.1.3.3) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -251,9 +252,9 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.1.3.2) - actionpack (= 7.1.3.2) - activesupport (= 7.1.3.2) + railties (7.1.3.3) + actionpack (= 7.1.3.3) + activesupport (= 7.1.3.3) irb rackup (>= 1.0.0) rake (>= 12.2) @@ -261,14 +262,19 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) - rdoc (6.6.3.1) + rdoc (6.7.0) psych (>= 4.0.0) - regexp_parser (2.9.0) - reline (0.5.6) + redis (5.2.0) + redis-client (>= 0.22.0) + redis-client (0.22.2) + connection_pool + regexp_parser (2.9.2) + reline (0.5.8) io-console (~> 0.5) - rexml (3.2.6) - rouge (4.2.0) - rubocop (1.63.5) + rexml (3.2.8) + strscan (>= 3.0.9) + rouge (4.2.1) + rubocop (1.64.1) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -281,13 +287,15 @@ GEM unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.31.3) parser (>= 3.3.1.0) - rubocop-rails (2.24.1) + rubocop-rails (2.25.0) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) + rubystats (0.4.1) + matrix rubyzip (2.3.2) sassc (2.4.0) ffi (~> 1.9) @@ -297,7 +305,7 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (4.20.1) + selenium-webdriver (4.21.1) base64 (~> 0.2) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) @@ -315,6 +323,17 @@ GEM simplecov-html (0.12.3) simplecov-lcov (0.8.0) simplecov_json_formatter (0.1.4) + sinatra (4.0.0) + mustermann (~> 3.0) + rack (>= 3.0.0, < 4) + rack-protection (= 4.0.0) + rack-session (>= 2.0.0, < 3) + tilt (~> 2.0) + split (4.0.4) + matrix + redis (>= 4.2) + rubystats (>= 0.3.0) + sinatra (>= 1.2.6) sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) @@ -322,12 +341,11 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - sqlite3 (1.7.3-arm64-darwin) - sqlite3 (1.7.3-x86_64-darwin) - sqlite3 (1.7.3-x86_64-linux) + sqlite3 (2.0.2-arm64-darwin) stimulus-rails (1.3.3) railties (>= 6.0.0) stringio (3.1.0) + strscan (3.1.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) thor (1.3.1) @@ -346,7 +364,7 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webmock (3.23.0) + webmock (3.23.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -357,16 +375,10 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.13) + zeitwerk (2.6.15) PLATFORMS arm64-darwin-22 - arm64-darwin-23 - x86_64-darwin-19 - x86_64-darwin-20 - x86_64-darwin-21 - x86_64-darwin-22 - x86_64-linux DEPENDENCIES annotate @@ -396,6 +408,7 @@ DEPENDENCIES sentry-ruby simplecov simplecov-lcov + split sprockets-rails sqlite3 stimulus-rails @@ -409,4 +422,4 @@ RUBY VERSION ruby 3.2.2p53 BUNDLED WITH - 2.3.7 + 2.4.10 diff --git a/config/routes.rb b/config/routes.rb index 03e5bb7d..aaf1ecbd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -15,4 +15,6 @@ get 'style-guide', to: 'static#style_guide' get 'boolpref', to: 'static#boolpref' + + mount Split::Dashboard, at: 'split' end From 9e9ae0e1d5f56c1e3843a646f32e312153691b4a Mon Sep 17 00:00:00 2001 From: Matthew Bernhardt Date: Mon, 28 Aug 2023 15:20:06 -0400 Subject: [PATCH 2/5] 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 a5253f0b..88f8e6ef 100644 --- a/app/assets/stylesheets/partials/_search.scss +++ b/app/assets/stylesheets/partials/_search.scss @@ -4,10 +4,17 @@ /* basic search bar */ .basic-search { - 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 9085b9e0..848309a2 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -12,6 +12,11 @@ class SearchController < ApplicationController end 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 f4ae9ff7..b9982fd8 100644 --- a/app/views/search/_form.html.erb +++ b/app/views/search/_form.html.erb @@ -25,7 +25,7 @@ if params[:geodistance] == "true" end %> -