From 80845a3b47f47b9315e310c3cf4593721d294ade Mon Sep 17 00:00:00 2001 From: Gregg P <117232882+GcioGregg@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:28:41 -0700 Subject: [PATCH] VFEP-1431b - upgrade GIBCT from Rails 7.0.8 to 7.1.3 (#1135) * api for Hcm * clean up code * api for eight_key * moved csv conversion method to bottom * update gemfile.lock to address blocking issue with recent Rexml upgrade * added comment * fixed eight_key IF structure * upgrade rails to 7.1.3 * removed 7.1.3 upgrade notes file --- Gemfile | 2 +- Gemfile.lock | 170 ++++++++++-------- config/application.rb | 10 +- config/environments/development.rb | 3 + config/environments/production.rb | 5 +- config/environments/test.rb | 9 +- .../initializers/filter_parameter_logging.rb | 4 +- spec/models/search_geocoder_spec.rb | 7 +- spec/rails_helper.rb | 3 + 9 files changed, 134 insertions(+), 79 deletions(-) mode change 100644 => 100755 config/application.rb mode change 100644 => 100755 config/environments/development.rb mode change 100644 => 100755 config/environments/production.rb mode change 100644 => 100755 config/environments/test.rb mode change 100644 => 100755 config/initializers/filter_parameter_logging.rb mode change 100644 => 100755 spec/models/search_geocoder_spec.rb mode change 100644 => 100755 spec/rails_helper.rb diff --git a/Gemfile b/Gemfile index 089737509..fad22a559 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' -gem 'rails', '~> 7.0.8.1' +gem 'rails', '~> 7.1.3' gem 'active_model_serializers', '~> 0.10.14' # JSON API gem 'activerecord-import' # Mass importing of CSV data diff --git a/Gemfile.lock b/Gemfile.lock index 8eae36d79..9ab10a3a7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,64 +18,69 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.0.8.1) - actionpack (= 7.0.8.1) - activesupport (= 7.0.8.1) + actioncable (7.1.3.3) + actionpack (= 7.1.3.3) + activesupport (= 7.1.3.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.8.1) - actionpack (= 7.0.8.1) - activejob (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + zeitwerk (~> 2.6) + 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.0.8.1) - actionpack (= 7.0.8.1) - actionview (= 7.0.8.1) - activejob (= 7.0.8.1) - activesupport (= 7.0.8.1) + 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.0) - actionpack (7.0.8.1) - actionview (= 7.0.8.1) - activesupport (= 7.0.8.1) - rack (~> 2.0, >= 2.2.4) + rails-dom-testing (~> 2.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) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.8.1) - actionpack (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + 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.0.8.1) - activesupport (= 7.0.8.1) + actionview (7.1.3.3) + activesupport (= 7.1.3.3) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) active_model_serializers (0.10.14) actionpack (>= 4.1) activemodel (>= 4.1) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) - activejob (7.0.8.1) - activesupport (= 7.0.8.1) + activejob (7.1.3.3) + activesupport (= 7.1.3.3) globalid (>= 0.3.6) - activemodel (7.0.8.1) - activesupport (= 7.0.8.1) - activerecord (7.0.8.1) - activemodel (= 7.0.8.1) - activesupport (= 7.0.8.1) + 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) activerecord-import (1.6.0) activerecord (>= 4.2) activerecord-session_store (2.1.0) @@ -85,17 +90,21 @@ GEM multi_json (~> 1.11, >= 1.11.2) rack (>= 2.0.8, < 4) railties (>= 6.1) - activestorage (7.0.8.1) - actionpack (= 7.0.8.1) - activejob (= 7.0.8.1) - activerecord (= 7.0.8.1) - activesupport (= 7.0.8.1) + 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) - mini_mime (>= 1.1.0) - activesupport (7.0.8.1) + activesupport (7.1.3.3) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) @@ -136,6 +145,7 @@ GEM concurrent-ruby (1.2.3) config (5.4.0) deep_merge (~> 1.2, >= 1.2.1) + connection_pool (2.4.1) crass (1.0.6) csv (3.3.0) database_cleaner (2.0.2) @@ -225,6 +235,10 @@ GEM i18n (1.14.5) concurrent-ruby (~> 1.0) ice_nine (0.11.2) + io-console (0.7.2) + irb (1.13.1) + rdoc (>= 4.0.0) + reline (>= 0.4.2) jquery-rails (4.6.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) @@ -259,13 +273,13 @@ GEM mini_mime (1.1.5) mini_racer (0.12.0) libv8-node (~> 21.7.2.0) - minitest (5.22.3) + minitest (5.23.1) msgpack (1.7.2) multi_json (1.15.0) multipart-post (2.4.0) mutex_m (0.2.0) nenv (0.3.0) - net-imap (0.4.10) + net-imap (0.4.11) date net-protocol net-pop (0.1.2) @@ -275,7 +289,7 @@ GEM net-smtp (0.5.0) net-protocol newrelic_rpm (9.9.0) - nio4r (2.7.1) + nio4r (2.7.3) nokogiri (1.16.5-aarch64-linux) racc (~> 1.4) nokogiri (1.16.5-arm64-darwin) @@ -300,29 +314,36 @@ GEM method_source (~> 1.0) pry-nav (1.0.0) pry (>= 0.9.10, < 0.15) + psych (5.1.2) + stringio public_suffix (5.0.4) puma (6.4.2) nio4r (~> 2.0) - racc (1.7.3) - rack (2.2.9) + racc (1.8.0) + rack (3.0.11) rack-cors (2.0.2) rack (>= 2.0.0) + rack-session (2.0.0) + rack (>= 3.0.0) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.8.1) - actioncable (= 7.0.8.1) - actionmailbox (= 7.0.8.1) - actionmailer (= 7.0.8.1) - actionpack (= 7.0.8.1) - actiontext (= 7.0.8.1) - actionview (= 7.0.8.1) - activejob (= 7.0.8.1) - activemodel (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + rackup (2.1.0) + rack (>= 3) + webrick (~> 1.8) + 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.0.8.1) + railties (= 7.1.3.3) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -334,19 +355,24 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.0.8.1) - actionpack (= 7.0.8.1) - activesupport (= 7.0.8.1) - method_source + railties (7.1.3.3) + actionpack (= 7.1.3.3) + activesupport (= 7.1.3.3) + irb + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) + rdoc (6.7.0) + psych (>= 4.0.0) regexp_parser (2.9.2) + reline (0.5.7) + io-console (~> 0.5) responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) @@ -462,6 +488,7 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) + stringio (3.1.0) strong_migrations (1.8.0) activerecord (>= 5.2) strscan (3.1.0) @@ -491,6 +518,7 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) + webrick (1.8.1) websocket (1.2.10) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) @@ -498,7 +526,7 @@ GEM will_paginate (4.0.0) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.13) + zeitwerk (2.6.15) PLATFORMS aarch64-linux @@ -548,7 +576,7 @@ DEPENDENCIES puma (~> 6.4.2) rack (>= 2.2.8.1) rack-cors - rails (~> 7.0.8.1) + rails (~> 7.1.3) rails-controller-testing rails-html-sanitizer (>= 1.4.4) rainbow diff --git a/config/application.rb b/config/application.rb old mode 100644 new mode 100755 index 392500873..7092bfd99 --- a/config/application.rb +++ b/config/application.rb @@ -1,4 +1,4 @@ -require File.expand_path('../boot', __FILE__) +require_relative 'boot' require 'rails/all' @@ -10,6 +10,11 @@ module GibctDataService class Application < Rails::Application config.load_defaults '7.0' # enables zeitwerk mode in CRuby + # Please, add to the `ignore` list any other `lib` subdirectories that do + # not contain `.rb` files, or that should not be reloaded or eager loaded. + # Common ones are `templates`, `generators`, or `middleware`, for example. + config.autoload_lib(ignore: %w(assets tasks)) + # Configuration for the application, engines, and railties goes here. # These settings can be overridden in specific environments using the files # in config/environments, which are processed later. @@ -42,6 +47,7 @@ class Application < Rails::Application # Rails 7 upgrade - turn off warnings # https://stackoverflow.com/questions/76347365/how-do-i-set-legacy-connection-handling-to-false-in-my-rails-application - config.active_record.legacy_connection_handling = false + # the legacy_connection_handling configuration option, which was deprecated in Rails 7.0 and removed in Rails 7.1 + # config.active_record.legacy_connection_handling = false end end diff --git a/config/environments/development.rb b/config/environments/development.rb old mode 100644 new mode 100755 index a751b93a3..59dfb9cac --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -82,4 +82,7 @@ # Uncomment if you wish to allow Action Cable access from any origin. # config.action_cable.disable_request_forgery_protection = true + + # Raise error when a before_action's only/except options reference missing actions + config.action_controller.raise_on_missing_callback_actions = true end diff --git a/config/environments/production.rb b/config/environments/production.rb old mode 100644 new mode 100755 index 7a881088e..0202f70cc --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -4,7 +4,8 @@ # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. - config.cache_classes = true + # this is the newer, best practice in Rails 7.1.3 + config.enable_reloading = false # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web servers @@ -77,6 +78,8 @@ # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "gibct_data_service_production" + config.action_mailer.perform_caching = false + # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false diff --git a/config/environments/test.rb b/config/environments/test.rb old mode 100644 new mode 100755 index f5510ab2a..d720f102e --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -12,6 +12,10 @@ # this probably isn't necessary. It's a good idea to do in a continuous integration # system, or in some way before deploying your code. config.eager_load = ENV["CI"].present? + + # only solution found to solve database_cleaner errors after upgrade to Rails 7.1.3 (from 7.0.8) + # per nblezer comment in https://github.com/rspec/rspec-rails/issues/2697 + config.active_job.queue_adapter = :test # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true @@ -55,5 +59,8 @@ # config.i18n.raise_on_missing_translations = true # Annotate rendered view with file names. - # config.action_view.annotate_rendered_view_with_filenames = trueend + # config.action_view.annotate_rendered_view_with_filenames = true + + # Raise error when a before_action's only/except options reference missing actions + config.action_controller.raise_on_missing_callback_actions = true end diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb old mode 100644 new mode 100755 index c0907a564..4b34a0366 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,4 +1,6 @@ # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += [:password, :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn] +Rails.application.config.filter_parameters += [ + :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn +] diff --git a/spec/models/search_geocoder_spec.rb b/spec/models/search_geocoder_spec.rb old mode 100644 new mode 100755 index 176df3486..04017f4d0 --- a/spec/models/search_geocoder_spec.rb +++ b/spec/models/search_geocoder_spec.rb @@ -200,8 +200,11 @@ build_and_create_institution :regular_address initial_progress_count = PreviewGenerationStatusInformation.count geo_search_results = described_class.new(version) - geo_search_results.process_geocoder_address - sleep(0.5) + + perform_enqueued_jobs do + geo_search_results.process_geocoder_address + end + expect(PreviewGenerationStatusInformation.count).to be > initial_progress_count end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb old mode 100644 new mode 100755 index e27480444..380163ba4 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -42,6 +42,9 @@ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures # config.fixture_path = "#{::Rails.root}/spec/fixtures" + # needed for perform_enqueued_jobs used in search_geocoder_spec + config.include ActiveJob::TestHelper + # Adding capybara DSL to rspec config.include Capybara::DSL config.include FixAll