mirror of
https://github.com/postalserver/postal.git
synced 2026-10-18 18:26:06 +00:00
Upgrades Rails from 7.1.6 to 7.2.3.2, Ruby from 3.4.6 to 3.4.10, and brings the rest of the bundle up to date. Two things were broken by Rails 7.2 and are fixed here: * MigrationWaiter called `ActiveRecord::Base.connection.migration_context`, which moved to the connection pool in 7.2. This raised NoMethodError on boot for any deployment with `migration_waiter.enabled` set, and had no test covering it. * `config.action_dispatch.show_exceptions = false` was deprecated in 7.1 and removed in 7.2. Now `:none`. `json` is pinned to < 3. Active Support 7.2 passes `quirks_mode:` to both `JSON.generate` and `JSON.parse`, and json 3.0 removed that option, so an unpinned json resolves to 3.x and makes every `to_json` raise - webhook payloads included. Nothing else in the bundle constrains it. The pin can go when we reach Rails 8.1, which no longer passes the option. `dynamic_form` is dropped. It is unmaintained and from 1.3.1 requires Ruby < 3.4, so it could never be updated again. Ten views used it, so `error_messages_for` now lives in ErrorMessagesHelper and `f.error_messages` in a form builder extension. The rendered markup is unchanged apart from a heading and description the stylesheet had always hidden; the rules that hid them are removed too. `execjs` is unpinned. The `< 2.8` constraint dated from the Rails 6.0 upgrade and asset output is byte-identical without it. Notable gem majors: puma 8, haml 7, secure_headers 7, sentry 7, jwt 3, prometheus-client 5, highline 3, omniauth-rails_csrf_protection 2, rspec-rails 8, shoulda-matchers 8, rubocop 1.91. secure_headers 7 changes X-XSS-Protection from "1; mode=block" to "0", which is the correct modern default and matches Rails' own. `config.load_defaults` deliberately stays at 7.0. The pending 7.1 and 7.2 options are listed, commented out, in new_framework_defaults_7_1.rb and _7_2.rb so they can be adopted in stages - several change the signed cookie and cache formats and need a staged deploy. The vestigial new_framework_defaults_7_0.rb is removed, as `load_defaults 7.0` already applies all of it. Adds tests for the areas this touched, which were mostly uncovered: MigrationWaiter, the serialized columns that gate a defaults bump, JSON encoding, HAML template compilation for all 103 templates, page rendering, form error rendering and security headers. The assets Gemfile group now includes :test so the view layer can be exercised at all.
73 lines
3.1 KiB
Ruby
73 lines
3.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
# Be sure to restart your server when you modify this file.
|
|
#
|
|
# This file eases your Rails 7.2 framework defaults upgrade.
|
|
#
|
|
# Uncomment each configuration one by one to switch to the new default.
|
|
# Once your application is ready to run with all new defaults, you can remove
|
|
# this file and set the `config.load_defaults` to `7.2`.
|
|
#
|
|
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
|
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
|
|
|
|
###
|
|
# Controls whether Active Job's `#perform_later` and similar methods automatically defer
|
|
# the job queuing to after the current Active Record transaction is committed.
|
|
#
|
|
# Example:
|
|
# Topic.transaction do
|
|
# topic = Topic.create(...)
|
|
# NewTopicNotificationJob.perform_later(topic)
|
|
# end
|
|
#
|
|
# In this example, if the configuration is set to `:never`, the job will
|
|
# be enqueued immediately, even though the `Topic` hasn't been committed yet.
|
|
# Because of this, if the job is picked up almost immediately, or if the
|
|
# transaction doesn't succeed for some reason, the job will fail to find this
|
|
# topic in the database.
|
|
#
|
|
# If `enqueue_after_transaction_commit` is set to `:default`, the queue adapter
|
|
# will define the behaviour.
|
|
#
|
|
# Note: Active Job backends can disable this feature. This is generally done by
|
|
# backends that use the same database as Active Record as a queue, hence they
|
|
# don't need this feature.
|
|
#++
|
|
# Rails.application.config.active_job.enqueue_after_transaction_commit = :default
|
|
|
|
###
|
|
# Adds image/webp to the list of content types Active Storage considers as an image
|
|
# Prevents automatic conversion to a fallback PNG, and assumes clients support WebP, as they support gif, jpeg, and png.
|
|
# This is possible due to broad browser support for WebP, but older browsers and email clients may still not support
|
|
# WebP. Requires imagemagick/libvips built with WebP support.
|
|
#++
|
|
# Rails.application.config.active_storage.web_image_content_types = %w[image/png image/jpeg image/gif image/webp]
|
|
|
|
###
|
|
# Enable validation of migration timestamps. When set, an ActiveRecord::InvalidMigrationTimestampError
|
|
# will be raised if the timestamp prefix for a migration is more than a day ahead of the timestamp
|
|
# associated with the current time. This is done to prevent forward-dating of migration files, which can
|
|
# impact migration generation and other migration commands.
|
|
#
|
|
# Applications with existing timestamped migrations that do not adhere to the
|
|
# expected format can disable validation by setting this config to `false`.
|
|
#++
|
|
# Rails.application.config.active_record.validate_migration_timestamps = true
|
|
|
|
###
|
|
# Controls whether the PostgresqlAdapter should decode dates automatically with manual queries.
|
|
#
|
|
# Example:
|
|
# ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.select_value("select '2024-01-01'::date") #=> Date
|
|
#
|
|
# This query used to return a `String`.
|
|
#++
|
|
# Rails.application.config.active_record.postgresql_adapter_decode_dates = true
|
|
|
|
###
|
|
# Enables YJIT as of Ruby 3.3, to bring sizeable performance improvements. If you are
|
|
# deploying to a memory constrained environment you may want to set this to `false`.
|
|
#++
|
|
# Rails.application.config.yjit = true
|