Upgrade to Rails 7.2 - #655
Open
tungleduyxyz wants to merge 10 commits into
Open
Conversation
- Bump rails to ~> 7.2 in Gemfile/kaui.gemspec, bump required_ruby_version to >= 3.1.0 (Rails 7.2's new minimum) - Bump activerecord-jdbc-adapter to ~> 72.0 for Rails 7.2 compatibility - Bump CI JRuby version to 9.4.15.0, update README dependencies accordingly - Fix Rails 7.2 removal of TestFixtures.fixture_path/= (use fixture_paths) - Add sorbet-runtime workaround for js-routes crash under JRuby 10 - Regenerate test/dummy/db/schema.rb for Rails 7.2 schema format
- Add explicit driver: org.mariadb.jdbc.Driver hint for the mysql2 adapter under JRuby (Rails 7.2 instantiates the adapter class directly, so arjdbc's old mariadb_connection helper that used to auto-set the driver is no longer invoked) - Allow adapter: mysql2 in the JRuby test block (arjdbc 72.x dropped the mariadb adapter name) - Align local dev default DB password with the docker MariaDB container
arjdbc 72.x dropped the 'mariadb' adapter name, so CI now uses 'mysql2' with an explicit driver: org.mariadb.jdbc.Driver override. But nothing was actually loading the driver jar onto the JRuby classpath, causing: Java::JavaLang::ClassNotFoundException: org.mariadb.jdbc.Driver Explicitly require 'jdbc/mariadb' and call Jdbc::MariaDB.load_driver(:require) before establishing the connection. Note :require must be passed explicitly - the gem's default :load method does not register the jar with the classloader.
…g backtrace - app/helpers/kaui/exception_helper.rb: Rails/EnvLocal offense, use Rails.env.local? - test/functional/kaui/accounts_controller_test.rb: Rails 7.2's redirect_to no longer populates a fallback HTML body (previously '<html><body>You are being <a href=...>redirected</a>.</body></html>'), so parsing @response.body for the account id no longer works. Use the Location header instead. - test/functional/kaui/admin_tenants_controller_test.rb: ActionController::TestCase recycles the request env between successive calls in the same test but does not clear a stale multipart Content-Type header (see scrub_env! in Rails' test_case.rb), so Rack 3.x now raises Rack::Multipart::EmptyContentError on the subsequent GET. Explicitly clear the header first. - lib/kaui/error_handler.rb: TEMPORARY - append exception backtrace to the flash error message to diagnose the remaining 2 failures (AdminAllowedUsersControllerTest#test_should_get_create/test_should_get_edit) via CI output. Will revert once root cause is found.
… env Diagnostic only - does not change behavior/flow, just logs to help find the root cause of the humanize NoMethodError affecting admin_allowed_users edit action tests. Will revert once fixed.
Found via CI fail-fast + random test order surfacing more instances of the same two Rails 7.2 regressions already fixed once: - accounts_controller_test.rb#test_should_trigger_invoice: same redirect-body-is-now-empty issue as test_should_validate_external_key_if_found. Use @response.location directly instead of regex-matching the body. - admin_allowed_users_controller_test.rb#extract_allowed_id: same issue, fall back to parsing response_path (Location header) instead of the body. - functional_test_helper_nosetup.rb: fix the stale multipart Content-Type bug (Rack::Multipart::EmptyContentError) once for all tests instead of per-test-file, by clearing CONTENT_TYPE before every #process call. This also fixes test_should_get_new_plan_currency which hit the same issue. - Removed the now-redundant manual fix from admin_tenants_controller_test.rb#test_should_download_a_catalog.
Root cause found via the temporary backtrace diagnostic:
app/views/kaui/admin_allowed_users/_form.html.erb passed a blank string
(' ') as the attribute name to f.label, purely for layout spacing. Under
Rails 7.2, ActiveModel::Translation#human_attribute_name has:
translation = attribute.present? ? attribute.humanize : namespace.humanize
For a blank attribute that doesn't contain a '.', the 'namespace' local
variable is never assigned (it's only set in the dotted-attribute branch),
so this evaluates nil.humanize - a Rails core edge case bug when passing a
blank/whitespace label method name.
Fixed by using label_tag instead of f.label, since this label isn't actually
associated with any model attribute and doesn't need i18n attribute name
translation.
Also reverts the temporary warn-based backtrace diagnostic in
lib/kaui/error_handler.rb added earlier purely for CI debugging - no longer
needed now that the root cause is fixed.
Rails 7.2 quotes String id values in ActiveRecord::RecordNotFound's message (e.g. 'id'="60" instead of 'id'=60). Update the expected flash message accordingly in test_should_delete_allowed_user.
tungleduyxyz
force-pushed
the
upgrade_rails_7.2
branch
from
August 16, 2026 13:01
acc3599 to
c096562
Compare
This was referenced Aug 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrade kaui from Rails 7.0 to Rails 7.2.
Changes
railsto~> 7.2andrequired_ruby_versionto>= 3.1.0(Rails 7.2's new minimum Ruby version)activerecord-jdbc-adapterto~> 72.0— the 70.x line only supports Rails ~> 7.0 and doesn't implement Rails 7.2's new adapter-loading API (ActiveRecord::ConnectionAdapters.register).github/workflows/ci.yml): bump JRuby from 9.4.2.0 to 9.4.15.0 (latest 9.4.x patch, Ruby 3.1 compat); switch the JRuby MySQL matrix jobs fromdatabase-adapter: mariadbtomysql2(arjdbc 72.x dropped themariadbadapter name)driver: org.mariadb.jdbc.Driverhint for the mysql2 adapter under JRuby — Rails 7.2 instantiates the adapter class directly (adapter_class.new(config)), so arjdbc's oldmariadb_connectionhelper that used to auto-set the driver is no longer invoked, and without the hint arjdbc defaults to the (unbundled)com.mysql.jdbc.DriverT::Configuration.default_checked_level = :neverunder JRuby) for a js-routes crash under JRuby 10TestFixtures.fixture_path/=API — use pluralfixture_paths(Array) infunctional_test_helper_nosetup.rbandadmin_tenants_controller_test.rbVerification
bundle exec rake test:units→ 47 runs, 191 assertions, 0 failures under Rails 7.2.3.2 (CRuby 3.2.2, and JRuby 9.4.15.0 against the MariaDB container)Notes
rails/railties >= 7.0.