From 9d75c8b7ebb62d99004f864842439e934ac9d5ef Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Mon, 5 Oct 2026 04:46:38 -0400 Subject: [PATCH] Update Rails to main Rails main (e3d5c569) moves Campfire's pin forward ten months. Because Campfire loads the 8.2 framework defaults, the ones added since then take effect too, among them header-only forgery protection, Herb as the HTML template engine, strict Accept headers and immediate blob analysis. Changes it needed: - Minitest 6 has no minitest/unit; the test helper no longer requires it. - Rack::Sendfile is no longer in the middleware stack; DebugLocks goes before ActionDispatch::Executor, as the Rails guide now says. - Time::DATE_FORMATS is deprecated; :epoch is registered through ActiveSupport::TimeFormats. - Channel test subscriptions expose stream_names; streams is private. - sentry-rails declares its Action Cable handle_open and handle_close wrappers private, which Rails 8.2 calls from outside the connection, so no /cable connection succeeded. An initializer makes them public until getsentry/sentry-ruby#2972 ships (issue #2975). - Lexxy renders editor content through Rails' editor adapter when Rails has one, which asks a mention for its editor partial. It is the same users/mention partial the mention prompt already inserts. - redis-client moves to 0.30.1: Rails main's Redis cache store, which production uses, requires 0.28.0 or later, and assets:precompile (the Docker build) aborted on 0.25.2. Co-Authored-By: Claude Opus 5.5 (cherry picked from commit b4d3880a3d88059dd5b0b884f1f5f1a6f82aa95c) --- Gemfile.lock | 64 +++++++++++++--------- app/models/user/mentionable.rb | 5 ++ config/environments/development.rb | 2 +- config/initializers/sentry.rb | 8 +++ config/initializers/time_formats.rb | 2 +- test/channels/unread_rooms_channel_test.rb | 4 +- test/test_helper.rb | 1 - 7 files changed, 56 insertions(+), 30 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3d02eff..65641b8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -32,7 +32,7 @@ GIT GIT remote: https://github.com/rails/rails.git - revision: 1a02651ac37fb64b4de2a2b73461d86acf9c98fb + revision: e3d5c569d217c56c022b04acb127a8c24dbe9685 branch: main specs: actioncable (8.2.0.alpha) @@ -63,10 +63,10 @@ GIT rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) - rails-html-sanitizer (~> 1.6) + rails-html-sanitizer (~> 1.7) useragent (~> 0.16) actiontext (8.2.0.alpha) - action_text-trix (~> 2.1.15) + action_text-trix (~> 2.1.16) actionpack (= 8.2.0.alpha) activerecord (= 8.2.0.alpha) activestorage (= 8.2.0.alpha) @@ -77,11 +77,12 @@ GIT activesupport (= 8.2.0.alpha) builder (~> 3.1) erubi (~> 1.11) + herb (>= 0.10) rails-dom-testing (~> 2.2) - rails-html-sanitizer (~> 1.6) + rails-html-sanitizer (~> 1.7) activejob (8.2.0.alpha) activesupport (= 8.2.0.alpha) - globalid (>= 0.3.6) + globalid (>= 1.4.0) activemodel (8.2.0.alpha) activesupport (= 8.2.0.alpha) activerecord (8.2.0.alpha) @@ -93,7 +94,7 @@ GIT activejob (= 8.2.0.alpha) activerecord (= 8.2.0.alpha) activesupport (= 8.2.0.alpha) - marcel (~> 1.0) + marcel (~> 2.0) activesupport (8.2.0.alpha) base64 bigdecimal @@ -104,6 +105,8 @@ GIT json logger (>= 1.4.2) minitest (>= 5.1) + psych (>= 4) + ractor-dispatch (>= 0.3.0) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) uri (>= 0.13.1) @@ -170,7 +173,7 @@ GEM irb (~> 1.10) reline (>= 0.3.8) drb (2.2.3) - erb (6.0.4) + erb (6.0.7) erubi (1.13.1) faker (3.8.0) i18n (>= 1.8.11, < 2) @@ -182,17 +185,22 @@ GEM geared_pagination (1.2.0) activesupport (>= 5.0) addressable (>= 2.5.0) - globalid (1.3.0) + globalid (1.4.0) activesupport (>= 6.1) hashdiff (1.2.0) + herb (0.11.0-aarch64-linux-gnu) + herb (0.11.0-arm64-darwin) + herb (0.11.0-x86_64-darwin) + herb (0.11.0-x86_64-linux-gnu) i18n (1.15.2) concurrent-ruby (~> 1.0) image_processing (1.14.0) mini_magick (>= 4.9.5, < 6) ruby-vips (>= 2.0.17, < 3) - io-console (0.8.1) - irb (1.15.3) + io-console (0.9.4) + irb (1.18.0) pp (>= 0.6.0) + prism (>= 1.3.0) rdoc (>= 4.0.0) reline (>= 0.4.2) jbuilder (2.14.1) @@ -219,7 +227,7 @@ GEM net-imap net-pop net-smtp - marcel (1.1.0) + marcel (2.1.0) matrix (0.4.3) mini_magick (5.3.1) logger @@ -235,14 +243,14 @@ GEM ruby2_keywords (~> 0.0.1) net-http-persistent (4.0.6) connection_pool (~> 2.2, >= 2.2.4) - net-imap (0.6.4.1) + net-imap (0.6.7) date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.2.2) + net-protocol (0.4.0) timeout - net-smtp (0.5.1) + net-smtp (0.5.2) net-protocol nio4r (2.7.5) nokogiri (1.19.4-aarch64-linux-gnu) @@ -262,11 +270,11 @@ GEM platform_agent (1.0.1) activesupport (>= 5.2.0) useragent (~> 0.16.3) - pp (0.6.3) + pp (0.6.4) prettyprint prettyprint (0.2.0) prism (1.9.0) - psych (5.2.6) + psych (5.5.0) date stringio public_suffix (6.0.2) @@ -283,8 +291,9 @@ GEM rack (>= 3.0.0) rack-test (2.2.0) rack (>= 1.3) - rackup (2.2.1) + rackup (2.3.1) rack (>= 3) + ractor-dispatch (0.3.0) rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest @@ -297,19 +306,24 @@ GEM activesupport (> 3.1) railties (> 3.1) rainbow (3.1.1) - rake (13.3.1) - rdoc (6.16.1) + rake (13.4.2) + rbs (4.2.0) + logger + prism (>= 1.6.0) + tsort + rdoc (8.1.0) erb - psych (>= 4.0.0) + prism (>= 1.6.0) + rbs (>= 4.0.0) tsort redis (5.4.1) redis-client (>= 0.22.0) - redis-client (0.25.2) + redis-client (0.30.1) connection_pool redis-namespace (1.11.0) redis (>= 4) regexp_parser (2.11.2) - reline (0.6.3) + reline (0.7.0) io-console (~> 0.5) resque (2.7.0) mono_logger (~> 1) @@ -384,8 +398,8 @@ GEM sqlite3 (2.9.6-x86_64-linux-gnu) stimulus-rails (1.3.4) railties (>= 6.0.0) - stringio (3.1.8) - thor (1.4.0) + stringio (3.2.0) + thor (1.5.0) thruster (0.1.23-aarch64-linux) thruster (0.1.23-arm64-darwin) thruster (0.1.23-x86_64-darwin) @@ -414,7 +428,7 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.7.3) + zeitwerk (2.8.3) PLATFORMS aarch64-linux diff --git a/app/models/user/mentionable.rb b/app/models/user/mentionable.rb index b028284..a48df75 100644 --- a/app/models/user/mentionable.rb +++ b/app/models/user/mentionable.rb @@ -11,6 +11,11 @@ module User::Mentionable "users/mention" end + # How a mention appears inside the editor, matching the prompt's editor template. + def to_editor_content_attachment_partial_path + "users/mention" + end + def attachable_plain_text_representation(caption) "@#{name}" end diff --git a/config/environments/development.rb b/config/environments/development.rb index 7994eb0..a25cb62 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -80,5 +80,5 @@ Rails.application.configure do config.action_controller.raise_on_missing_callback_actions = true # Visit /rails/locks to see the locks - config.middleware.insert_before Rack::Sendfile, ActionDispatch::DebugLocks + config.middleware.insert_before ActionDispatch::Executor, ActionDispatch::DebugLocks end diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb index 2706bc1..2d32885 100644 --- a/config/initializers/sentry.rb +++ b/config/initializers/sentry.rb @@ -6,3 +6,11 @@ if Rails.env.production? && ENV["SKIP_TELEMETRY"].blank? config.release = ENV["GIT_REVISION"] end end + +# sentry-rails declares its Action Cable handle_open and handle_close wrappers private, +# but Rails 8.2 calls them from outside the connection, so every /cable connection fails. +# Remove once sentry-rails ships getsentry/sentry-ruby#2972 (issue #2975). +ActiveSupport.on_load(:action_cable_connection) do + require "sentry/rails/action_cable" + Sentry::Rails::ActionCableExtensions::Connection.send(:public, :handle_open, :handle_close) +end diff --git a/config/initializers/time_formats.rb b/config/initializers/time_formats.rb index 07e300e..9360926 100644 --- a/config/initializers/time_formats.rb +++ b/config/initializers/time_formats.rb @@ -1,2 +1,2 @@ # Used to match JavaScripts (new Date).getTime() for sorting -Time::DATE_FORMATS[:epoch] = ->(time) { (time.to_f * 1000).to_i } +ActiveSupport::TimeFormats.register(:epoch, ->(time) { (time.to_f * 1000).to_i }) diff --git a/test/channels/unread_rooms_channel_test.rb b/test/channels/unread_rooms_channel_test.rb index 4444eb1..98cd236 100644 --- a/test/channels/unread_rooms_channel_test.rb +++ b/test/channels/unread_rooms_channel_test.rb @@ -8,7 +8,7 @@ class UnreadRoomsChannelTest < ActionCable::Channel::TestCase assert subscription.confirmed? assert_has_stream "user_#{users(:jz).id}_unreads" - assert_not_includes subscription.streams, "unread_rooms" + assert_not_includes subscription.stream_names, "unread_rooms" end test "an outsider is not told about activity in a room they can't see" do @@ -37,7 +37,7 @@ class UnreadRoomsChannelTest < ActionCable::Channel::TestCase stub_connection(current_user: user) subscribe - stream = subscription.streams.sole + stream = subscription.stream_names.sole before = ActionCable.server.pubsub.broadcasts(stream).size yield diff --git a/test/test_helper.rb b/test/test_helper.rb index 5c4ac31..5a998e9 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -2,7 +2,6 @@ ENV["RAILS_ENV"] ||= "test" require_relative "../config/environment" require "rails/test_help" -require "minitest/unit" require "mocha/minitest" require "webmock/minitest" require "turbo/broadcastable/test_helper"