From 863ca412bf4fc09c25b1a7f67458767dc8fbaf46 Mon Sep 17 00:00:00 2001 From: Jim Nanney Date: Wed, 2 Sep 2026 16:36:54 -0500 Subject: [PATCH] Upgrade to Ruby 4.0.6 Used OpenCode and Qwen3.8 to accomplish this upgrade. Bump the runtime/CI/dev/production Ruby version pins to 4.0.6. Add benchmark and readline to the Gemfile: both were removed from Ruby's default gems in 4.0 but delayed_job and pry-remote require them without declaring them as dependencies. faraday-retry transitively updates to 1.0.4. Verified under Ruby 4.0.6: full rspec suite (main models/services/controllers, requests, and system specs), rubocop + erb_lint, factory_bot:lint, and brakeman all pass. --- .cloud66/manifest.yml | 2 +- .devcontainer/Dockerfile | 4 ++-- .devcontainer/post-create.sh | 2 +- .ruby-version | 2 +- Gemfile | 8 ++++++++ Gemfile.lock | 7 ++++++- 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.cloud66/manifest.yml b/.cloud66/manifest.yml index 4e3c445ecf..741a7134f6 100644 --- a/.cloud66/manifest.yml +++ b/.cloud66/manifest.yml @@ -1,3 +1,3 @@ rails: configuration: - ruby_version: 3.4.3 + ruby_version: 4.0.6 diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 58a29b1c6b..05fd060a37 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,11 +1,11 @@ -# Installs Ruby 3.4. When human-essentials moves to a newer version of ruby, +# Installs Ruby 4.0. When human-essentials moves to a newer version of ruby, # it will be more efficient to change the image. # See https://github.com/devcontainers/images/blob/main/src/ruby/history/ # # See devcontainers/features#1431 for why we include the `-bookworm` # suffix. Once that issue is resolved, we can remove the suffix, which # will let us follow the debian upgrade to trixie. -FROM mcr.microsoft.com/devcontainers/ruby:dev-3.4-bookworm +FROM mcr.microsoft.com/devcontainers/ruby:dev-4.0-bookworm RUN export DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get -y install vim curl gpg postgresql postgresql-contrib # Headless browser for Cuprite/Capybara system specs. Google Chrome only ships diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index e57a3c0e06..48c4b64e76 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -15,7 +15,7 @@ rbenv init zsh & # gem install nokogiri -v 1.18.1 --platform=ruby -- --use-system-libraries # If the project's required ruby version (specified in .ruby-version) -# changes from 3.4.3, this command will download and compile the correct +# changes from 4.0.6, this command will download and compile the correct # version, but it will take a long time. echo "*** Installing rbenv-able Ruby ***" rbenv install --skip-existing & diff --git a/.ruby-version b/.ruby-version index 6cb9d3dd0d..d13e837c8e 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.4.3 +4.0.6 diff --git a/Gemfile b/Gemfile index 7a48096758..d322824fa4 100644 --- a/Gemfile +++ b/Gemfile @@ -114,6 +114,10 @@ gem "sprockets", "~> 4.2.2" gem "prawn", "~> 2.4.0" gem "matrix" # Used by prawn gem "ttfunk", "~>1.7.0" +# `benchmark` was removed from Ruby's default gems in Ruby 4.0. delayed_job +# requires it at load time but does not declare it as a dependency, so we pin +# it here to keep the app loadable under Ruby 4.0. +gem "benchmark" group :production, :staging do # Reduce the noise of logs and include custom fields to it for easier access @@ -146,6 +150,10 @@ group :development, :test do gem "pry-rails" # Connect to a remotely running command line instance. gem "pry-remote" + # `readline` was removed from Ruby's default gems in Ruby 4.0. pry-remote + # requires it without declaring it as a dependency, so we pin it in the + # dev/test group to keep the app loadable under Ruby 4.0. + gem "readline" # Add-on for command line to create a simple debugger. gem "pry-nav" # Debugger which supports rdbg and Shopify Ruby LSP VSCode extension diff --git a/Gemfile.lock b/Gemfile.lock index bac8c14367..4a96b5fd76 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -115,6 +115,7 @@ GEM nokogiri (~> 1, >= 1.10.8) base64 (0.3.0) bcrypt (3.1.22) + benchmark (0.5.0) better_errors (2.10.1) erubi (>= 1.0.0) rack (>= 0.9.0) @@ -271,7 +272,7 @@ GEM faraday-net_http_persistent (1.2.0) faraday-patron (1.0.0) faraday-rack (1.0.0) - faraday-retry (1.0.3) + faraday-retry (1.0.4) faraday_middleware (1.2.0) faraday (~> 1.0) ferrum (0.17.1) @@ -597,6 +598,8 @@ GEM erb psych (>= 4.0.0) tsort + readline (0.0.4) + reline recaptcha (5.21.2) regexp_parser (2.12.0) reline (0.6.3) @@ -779,6 +782,7 @@ DEPENDENCIES awesome_print aws-sdk-s3 azure-storage-blob + benchmark better_errors binding_of_caller bootsnap @@ -844,6 +848,7 @@ DEPENDENCIES rails (~> 8.1.0) rails-controller-testing rails-erd + readline recaptcha rolify (~> 6.0) rspec-rails (~> 8.0.2)