From fd7bc8d29eb60273c41dd3868a62fcf5e9ae3f34 Mon Sep 17 00:00:00 2001 From: Mitchell Henke Date: Wed, 22 Jan 2025 16:08:39 -0600 Subject: [PATCH 1/3] Upgrade to Rails 8 changelog: Internal, Maintenance, Upgrade to Rails 8 --- Gemfile | 4 +- Gemfile.lock | 145 +++++++++--------- db/schema.rb | 4 +- db/worker_jobs_schema.rb | 4 +- lib/asset_sources.rb | 2 +- spec/services/deleted_accounts_report_spec.rb | 2 +- 6 files changed, 81 insertions(+), 80 deletions(-) diff --git a/Gemfile b/Gemfile index 75507ed7336..1029e6b7c88 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" } ruby "~> #{File.read(File.join(__dir__, '.ruby-version')).strip}" -gem 'rails', '~> 7.2.1' +gem 'rails', '~> 8.0.0' gem 'ahoy_matey', '~> 3.0' # pod identity requires 3.188.0 @@ -102,7 +102,7 @@ end group :development, :test do gem 'brakeman', require: false - gem 'bullet', '~> 7.0' + gem 'bullet', '~> 8.0' gem 'capybara-webmock', git: 'https://github.com/hashrocket/capybara-webmock.git', ref: 'd3f3b7c' gem 'erb_lint', '~> 0.7.0', require: false gem 'i18n-tasks', '~> 1.0' diff --git a/Gemfile.lock b/Gemfile.lock index aa5b10f1a52..42f43201677 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -80,66 +80,65 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.2.2.1) - actionpack (= 7.2.2.1) - activesupport (= 7.2.2.1) + actioncable (8.0.1) + actionpack (= 8.0.1) + activesupport (= 8.0.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.2.2.1) - actionpack (= 7.2.2.1) - activejob (= 7.2.2.1) - activerecord (= 7.2.2.1) - activestorage (= 7.2.2.1) - activesupport (= 7.2.2.1) + actionmailbox (8.0.1) + actionpack (= 8.0.1) + activejob (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) mail (>= 2.8.0) - actionmailer (7.2.2.1) - actionpack (= 7.2.2.1) - actionview (= 7.2.2.1) - activejob (= 7.2.2.1) - activesupport (= 7.2.2.1) + actionmailer (8.0.1) + actionpack (= 8.0.1) + actionview (= 8.0.1) + activejob (= 8.0.1) + activesupport (= 8.0.1) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.2.2.1) - actionview (= 7.2.2.1) - activesupport (= 7.2.2.1) + actionpack (8.0.1) + actionview (= 8.0.1) + activesupport (= 8.0.1) nokogiri (>= 1.8.5) - racc - rack (>= 2.2.4, < 3.2) + rack (>= 2.2.4) 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.1) - actionpack (= 7.2.2.1) - activerecord (= 7.2.2.1) - activestorage (= 7.2.2.1) - activesupport (= 7.2.2.1) + actiontext (8.0.1) + actionpack (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.2.2.1) - activesupport (= 7.2.2.1) + actionview (8.0.1) + activesupport (= 8.0.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.2.2.1) - activesupport (= 7.2.2.1) + activejob (8.0.1) + activesupport (= 8.0.1) globalid (>= 0.3.6) - activemodel (7.2.2.1) - activesupport (= 7.2.2.1) - activerecord (7.2.2.1) - activemodel (= 7.2.2.1) - activesupport (= 7.2.2.1) + activemodel (8.0.1) + activesupport (= 8.0.1) + activerecord (8.0.1) + activemodel (= 8.0.1) + activesupport (= 8.0.1) timeout (>= 0.4.0) - activestorage (7.2.2.1) - actionpack (= 7.2.2.1) - activejob (= 7.2.2.1) - activerecord (= 7.2.2.1) - activesupport (= 7.2.2.1) + activestorage (8.0.1) + actionpack (= 8.0.1) + activejob (= 8.0.1) + activerecord (= 8.0.1) + activesupport (= 8.0.1) marcel (~> 1.0) - activesupport (7.2.2.1) + activesupport (8.0.1) base64 benchmark (>= 0.3) bigdecimal @@ -151,6 +150,7 @@ GEM minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) ahoy_matey (3.3.0) @@ -228,7 +228,7 @@ GEM erubi (~> 1.4) parser (>= 2.4) smart_properties - bigdecimal (3.1.8) + bigdecimal (3.1.9) bindata (2.4.15) bootsnap (1.18.3) msgpack (~> 1.2) @@ -236,7 +236,7 @@ GEM racc browser (6.0.0) builder (3.3.0) - bullet (7.2.0) + bullet (8.0.0) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) bundler-audit (0.9.2) @@ -264,8 +264,8 @@ GEM coderay (1.1.3) coercible (1.0.0) descendants_tracker (~> 0.0.1) - concurrent-ruby (1.3.4) - connection_pool (2.4.1) + concurrent-ruby (1.3.5) + connection_pool (2.5.0) cose (1.3.0) cbor (~> 0.5.9) openssl-signature_algorithm (~> 1.0) @@ -369,7 +369,7 @@ GEM htmlbeautifier (1.4.3) htmlentities (4.3.4) http_accept_language (2.1.1) - i18n (1.14.6) + i18n (1.14.7) concurrent-ruby (~> 1.0) i18n-tasks (1.0.12) activesupport (>= 4.0.2) @@ -404,7 +404,7 @@ GEM listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.6.2) + logger (1.6.5) lograge (0.11.2) actionpack (>= 4) activesupport (>= 4) @@ -533,20 +533,20 @@ GEM rackup (2.1.0) rack (>= 3) webrick (~> 1.8) - rails (7.2.2.1) - actioncable (= 7.2.2.1) - actionmailbox (= 7.2.2.1) - actionmailer (= 7.2.2.1) - actionpack (= 7.2.2.1) - actiontext (= 7.2.2.1) - actionview (= 7.2.2.1) - activejob (= 7.2.2.1) - activemodel (= 7.2.2.1) - activerecord (= 7.2.2.1) - activestorage (= 7.2.2.1) - activesupport (= 7.2.2.1) + rails (8.0.1) + actioncable (= 8.0.1) + actionmailbox (= 8.0.1) + actionmailer (= 8.0.1) + actionpack (= 8.0.1) + actiontext (= 8.0.1) + actionview (= 8.0.1) + activejob (= 8.0.1) + activemodel (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) bundler (>= 1.15.0) - railties (= 7.2.2.1) + railties (= 8.0.1) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -558,12 +558,12 @@ GEM rails-html-sanitizer (1.6.1) 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) - rails-i18n (7.0.6) + rails-i18n (8.0.1) i18n (>= 0.7, < 2) - railties (>= 6.0.0, < 8) - railties (7.2.2.1) - actionpack (= 7.2.2.1) - activesupport (= 7.2.2.1) + railties (>= 8.0.0, < 9) + railties (8.0.1) + actionpack (= 8.0.1) + activesupport (= 8.0.1) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) @@ -662,7 +662,7 @@ GEM scrypt (3.0.8) ffi-compiler (>= 1.0, < 2.0) rake (>= 9, < 14) - securerandom (0.4.0) + securerandom (0.4.1) selenium-webdriver (4.27.0) base64 (~> 0.2) logger (~> 1.4) @@ -692,14 +692,14 @@ GEM mini_portile2 (~> 2.8.0) stringex (2.8.5) stringio (3.1.2) - strong_migrations (2.0.0) + strong_migrations (2.1.0) activerecord (>= 6.1) tableparser (1.0.1) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) thor (1.3.2) thread_safe (0.3.6) - timeout (0.4.2) + timeout (0.4.3) tpm-key_attestation (0.11.0) bindata (~> 2.4) openssl (> 2.0, < 3.1) @@ -708,10 +708,10 @@ GEM concurrent-ruby (~> 1.0) unicode-display_width (2.6.0) uniform_notifier (1.16.0) - uri (0.13.0) + uri (1.0.2) useragent (0.16.11) - view_component (3.9.0) - activesupport (>= 5.2.0, < 8.0) + view_component (3.21.0) + activesupport (>= 5.2.0, < 8.1) concurrent-ruby (~> 1.0) method_source (~> 1.0) virtus (2.0.0) @@ -735,7 +735,8 @@ GEM hashdiff (>= 0.4.0, < 2.0.0) webrick (1.9.1) websocket (1.2.11) - websocket-driver (0.7.6) + websocket-driver (0.7.7) + base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xmldsig (0.6.6) @@ -777,7 +778,7 @@ DEPENDENCIES bootsnap (~> 1.0) brakeman browser - bullet (~> 7.0) + bullet (~> 8.0) bundler-audit capybara-webmock! caxlsx @@ -841,7 +842,7 @@ DEPENDENCIES rack-test (>= 1.1.0) rack-timeout rack_session_access (>= 0.2.0) - rails (~> 7.2.1) + rails (~> 8.0.0) rails-controller-testing (>= 1.0.4) redacted_struct redis (>= 3.2.0) diff --git a/db/schema.rb b/db/schema.rb index 376cc842b52..3433618343e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,11 +10,11 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2025_01_06_232958) do +ActiveRecord::Schema[8.0].define(version: 2025_01_06_232958) do # These are extensions that must be enabled in order to support this database enable_extension "citext" + enable_extension "pg_catalog.plpgsql" enable_extension "pg_stat_statements" - enable_extension "plpgsql" create_table "account_reset_requests", force: :cascade do |t| t.integer "user_id", null: false, comment: "sensitive=false" diff --git a/db/worker_jobs_schema.rb b/db/worker_jobs_schema.rb index 2ce7f8fc09c..2db9037026e 100644 --- a/db/worker_jobs_schema.rb +++ b/db/worker_jobs_schema.rb @@ -10,10 +10,10 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_10_22_162624) do +ActiveRecord::Schema[8.0].define(version: 2024_10_22_162624) do # These are extensions that must be enabled in order to support this database + enable_extension "pg_catalog.plpgsql" enable_extension "pgcrypto" - enable_extension "plpgsql" create_table "good_job_batches", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.datetime "created_at", null: false diff --git a/lib/asset_sources.rb b/lib/asset_sources.rb index 676473a544c..3bbd8913812 100644 --- a/lib/asset_sources.rb +++ b/lib/asset_sources.rb @@ -23,7 +23,7 @@ def get_sources(*names) locale_sources, sources = names.flat_map do |name| manifest&.dig('entrypoints', name, 'assets', 'js').presence || begin - [name] if name.match?(URI::DEFAULT_PARSER.regexp[:ABS_URI]) + [name] if name.match?(URI::ABS_URI) end end.uniq.compact.partition { |source| @regexp_locale_suffix.match?(source) } diff --git a/spec/services/deleted_accounts_report_spec.rb b/spec/services/deleted_accounts_report_spec.rb index a82663287aa..da29181fde4 100644 --- a/spec/services/deleted_accounts_report_spec.rb +++ b/spec/services/deleted_accounts_report_spec.rb @@ -47,7 +47,7 @@ :service_provider_identity, service_provider: service_provider, user: user, - last_authenticated_at: days_ago + 1, + last_authenticated_at: (days_ago + 1).days.ago, ) user.destroy! rows = DeletedAccountsReport.call(service_provider, days_ago) From 03a3a7c5d6f1f6a6cd245f7728bef6fd36c594ac Mon Sep 17 00:00:00 2001 From: Mitchell Henke Date: Thu, 23 Jan 2025 12:27:42 -0600 Subject: [PATCH 2/3] load 8.0 defaults --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 64f212ce46f..7311db07e49 100644 --- a/config/application.rb +++ b/config/application.rb @@ -59,7 +59,7 @@ class Application < Rails::Application end end - config.load_defaults '7.2' + config.load_defaults '8.0' config.active_record.belongs_to_required_by_default = false config.active_job.queue_adapter = :good_job From 49f3459113c20bb9d6a07fb264b8694d639a155b Mon Sep 17 00:00:00 2001 From: Mitchell Henke Date: Thu, 23 Jan 2025 13:33:46 -0600 Subject: [PATCH 3/3] update rubocop target --- .rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 0d369481f1b..745afde2679 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -30,7 +30,7 @@ AllCops: - 'vendor/**/*' - 'public/**/*' TargetRubyVersion: 3.3.0 - TargetRailsVersion: 7.2 + TargetRailsVersion: 8.0 UseCache: true DisabledByDefault: true SuggestExtensions: false