Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ gem 'test-unit', '~> 3.2'

gem 'bundler'

gem "rails", "~> 7.2"
gem "rails-i18n"
gem "rails", "~> 8.0.0"
gem "rails-i18n", "~> 8.0", git: "https://github.com/marcus8448/rails-i18n", ref: "1d120cc3b2c02793e7cab4ff5951d3a9e0b316a4"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was some fun debugging. Pending PR.

gem "rack", "~> 2.2"
gem "sprockets", "< 4"

Expand Down Expand Up @@ -107,13 +107,13 @@ gem 'kgio', '2.10.0'
gem "marcel", "1.0.2"

# Library for helping run pt-online-schema-change commands:
gem "departure", "~> 6.8"
gem "departure", "~> 8.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't see anything of note in the changelog. Note that 8.0.1 seems to have not been published to rubygems (if it does get published I would like to pull it in).


gem "rack-timeout"
gem "puma_worker_killer"

group :test do
gem "rspec-rails", "~> 6.0"
gem "rspec-rails", "~> 8.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changelog, nothing stood out as well.

gem 'pickle'
gem 'shoulda'
gem "capybara"
Expand Down
145 changes: 76 additions & 69 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
GIT
remote: https://github.com/marcus8448/rails-i18n
revision: 1d120cc3b2c02793e7cab4ff5951d3a9e0b316a4
ref: 1d120cc3b2c02793e7cab4ff5951d3a9e0b316a4
specs:
rails-i18n (8.1.0)
i18n (>= 0.7, < 2)
railties (>= 8.0.0, < 9)

GIT
remote: https://github.com/rails/rails-observers
revision: 389b577322d8b17336730b2dc4e179060a23c8e7
Expand All @@ -15,70 +24,69 @@ GEM
remote: https://rubygems.org/
specs:
aaronh-chronic (0.3.9)
actioncable (7.2.2.2)
actionpack (= 7.2.2.2)
activesupport (= 7.2.2.2)
actioncable (8.0.4)
actionpack (= 8.0.4)
activesupport (= 8.0.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.2.2.2)
actionpack (= 7.2.2.2)
activejob (= 7.2.2.2)
activerecord (= 7.2.2.2)
activestorage (= 7.2.2.2)
activesupport (= 7.2.2.2)
actionmailbox (8.0.4)
actionpack (= 8.0.4)
activejob (= 8.0.4)
activerecord (= 8.0.4)
activestorage (= 8.0.4)
activesupport (= 8.0.4)
mail (>= 2.8.0)
actionmailer (7.2.2.2)
actionpack (= 7.2.2.2)
actionview (= 7.2.2.2)
activejob (= 7.2.2.2)
activesupport (= 7.2.2.2)
actionmailer (8.0.4)
actionpack (= 8.0.4)
actionview (= 8.0.4)
activejob (= 8.0.4)
activesupport (= 8.0.4)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (7.2.2.2)
actionview (= 7.2.2.2)
activesupport (= 7.2.2.2)
actionpack (8.0.4)
actionview (= 8.0.4)
activesupport (= 8.0.4)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4, < 3.2)
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
actionpack-page_caching (1.2.4)
actionpack (>= 4.0.0)
actiontext (7.2.2.2)
actionpack (= 7.2.2.2)
activerecord (= 7.2.2.2)
activestorage (= 7.2.2.2)
activesupport (= 7.2.2.2)
actiontext (8.0.4)
actionpack (= 8.0.4)
activerecord (= 8.0.4)
activestorage (= 8.0.4)
activesupport (= 8.0.4)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.2.2.2)
activesupport (= 7.2.2.2)
actionview (8.0.4)
activesupport (= 8.0.4)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
active_record_query_trace (1.8.3)
activerecord (>= 6.0.0)
activejob (7.2.2.2)
activesupport (= 7.2.2.2)
activejob (8.0.4)
activesupport (= 8.0.4)
globalid (>= 0.3.6)
activemodel (7.2.2.2)
activesupport (= 7.2.2.2)
activerecord (7.2.2.2)
activemodel (= 7.2.2.2)
activesupport (= 7.2.2.2)
activemodel (8.0.4)
activesupport (= 8.0.4)
activerecord (8.0.4)
activemodel (= 8.0.4)
activesupport (= 8.0.4)
timeout (>= 0.4.0)
activestorage (7.2.2.2)
actionpack (= 7.2.2.2)
activejob (= 7.2.2.2)
activerecord (= 7.2.2.2)
activesupport (= 7.2.2.2)
activestorage (8.0.4)
actionpack (= 8.0.4)
activejob (= 8.0.4)
activerecord (= 8.0.4)
activesupport (= 8.0.4)
marcel (~> 1.0)
activesupport (7.2.2.2)
activesupport (8.0.4)
base64
benchmark (>= 0.3)
bigdecimal
Expand All @@ -90,6 +98,7 @@ GEM
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
acts_as_list (0.9.19)
activerecord (>= 3.0)
addressable (2.8.7)
Expand Down Expand Up @@ -217,10 +226,10 @@ GEM
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
date (3.4.1)
departure (6.8.0)
activerecord (>= 6.0.0, < 7.3.0, != 7.0.0)
departure (8.0.0)
activerecord (>= 7.2.0)
mysql2 (>= 0.4.0, < 0.6.0)
railties (>= 6.0.0, < 7.3.0, != 7.0.0)
railties (>= 7.2.0)
devise (4.9.3)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
Expand Down Expand Up @@ -456,20 +465,20 @@ GEM
rackup (1.0.1)
rack (< 3)
webrick
rails (7.2.2.2)
actioncable (= 7.2.2.2)
actionmailbox (= 7.2.2.2)
actionmailer (= 7.2.2.2)
actionpack (= 7.2.2.2)
actiontext (= 7.2.2.2)
actionview (= 7.2.2.2)
activejob (= 7.2.2.2)
activemodel (= 7.2.2.2)
activerecord (= 7.2.2.2)
activestorage (= 7.2.2.2)
activesupport (= 7.2.2.2)
rails (8.0.4)
actioncable (= 8.0.4)
actionmailbox (= 8.0.4)
actionmailer (= 8.0.4)
actionpack (= 8.0.4)
actiontext (= 8.0.4)
actionview (= 8.0.4)
activejob (= 8.0.4)
activemodel (= 8.0.4)
activerecord (= 8.0.4)
activestorage (= 8.0.4)
activesupport (= 8.0.4)
bundler (>= 1.15.0)
railties (= 7.2.2.2)
railties (= 8.0.4)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -481,16 +490,14 @@ GEM
rails-html-sanitizer (1.6.2)
loofah (~> 2.21)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
rails-i18n (7.0.9)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (7.2.2.2)
actionpack (= 7.2.2.2)
activesupport (= 7.2.2.2)
railties (8.0.4)
actionpack (= 8.0.4)
activesupport (= 8.0.4)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
tsort (>= 0.2)
zeitwerk (~> 2.6)
rainbow (3.1.1)
raindrops (0.20.1)
Expand Down Expand Up @@ -535,10 +542,10 @@ GEM
rspec-mocks (3.13.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (6.1.5)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
rspec-rails (8.0.2)
actionpack (>= 7.2)
activesupport (>= 7.2)
railties (>= 7.2)
rspec-core (~> 3.13)
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
Expand Down Expand Up @@ -698,7 +705,7 @@ DEPENDENCIES
cucumber-timecop
dalli
database_cleaner
departure (~> 6.8)
departure (~> 8.0)
devise
devise-async
devise-pwned_password
Expand Down Expand Up @@ -740,17 +747,17 @@ DEPENDENCIES
rack-attack
rack-dev-mark (>= 0.7.8)
rack-timeout
rails (~> 7.2)
rails (~> 8.0.0)
rails-controller-testing
rails-i18n
rails-i18n (~> 8.0)!
rails-observers!
redis (< 5.0)
redis-namespace
resque (>= 1.14.0)
resque-scheduler
rest-client (~> 2.1.0)
rollout
rspec-rails (~> 6.0)
rspec-rails (~> 8.0)
rubocop (= 1.22.3)
rubocop-rails (= 2.12.4)
rubocop-rspec (= 2.6.0)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/errors_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class ErrorsController < ApplicationController
%w[403 404 422 500].each do |error_code|
%w[400 403 404 422 500].each do |error_code|
define_method error_code.to_sym do
render error_code, status: error_code.to_i, formats: :html
end
Expand Down
2 changes: 2 additions & 0 deletions app/jobs/application_job.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class ApplicationJob < ActiveJob::Base
self.enqueue_after_transaction_commit = true

include AfterCommitEverywhere
extend AfterCommitEverywhere

Expand Down
2 changes: 2 additions & 0 deletions app/jobs/application_mailer_job.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class ApplicationMailerJob < ActionMailer::MailDeliveryJob
self.enqueue_after_transaction_commit = true

# TODO: We have a mix of mailers that take ActiveRecords as arguments, and
# mailers that take IDs as arguments. If an item is unavailable when the
# notification is sent, it'll produce an ActiveJob::DeserializationError in
Expand Down
4 changes: 2 additions & 2 deletions app/models/tagset_models/tag_set.rb
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rails 8.0 now saves the parent model (tag set) before the child model (owned tag set), so we can't always touch it here (after_save). In that case the child model (owned tag set) is going to be saved after anyways, so it's fine to just skip touching.

This change looks to be a side effect of rails/rails#49847, but I think this ordering makes more sense so we were probably just depending on buggy behaviour.
Example, if that explanation doesn't make sense: https://gist.github.com/marcus8448/9459bcc0536f2baf0704cbea91fc9d0b

Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def remove_from_set(tags_to_remove)
return unless tags_to_remove.present?
self.set_taggings.where(tag_id: tags_to_remove.map(&:id)).delete_all
remove_tags_from_autocomplete(tags_to_remove)
owned_tag_set&.touch
owned_tag_set.touch if owned_tag_set&.persisted?
end

def add_to_set(tags_to_add)
Expand All @@ -127,7 +127,7 @@ def add_to_set(tags_to_add)
self.set_taggings.create(tag_id: tag.id)
end
add_tags_to_autocomplete(tags_to_add)
owned_tag_set&.touch
owned_tag_set.touch if owned_tag_set&.persisted?
end

# Tags must already exist unless they are being added to an owned tag set
Expand Down
3 changes: 3 additions & 0 deletions app/views/errors/400.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h2 class="heading">Error 400</h2>
<h3 class="heading">Bad Request</h3>
<p>The server cannot process the request due to a client error.</p>
2 changes: 2 additions & 0 deletions bin/dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env ruby
exec "./bin/rails", "server", *ARGV
13 changes: 5 additions & 8 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require "fileutils"

APP_ROOT = File.expand_path("..", __dir__)
APP_NAME = "otwarchive"

def system!(*args)
system(*args, exception: true)
Expand All @@ -14,7 +13,6 @@ FileUtils.chdir APP_ROOT do
# Add necessary setup steps to this file.

puts "== Installing dependencies =="
system! "gem install bundler --conservative"
system("bundle check") || system!("bundle install")

# puts "\n== Copying sample files =="
Expand All @@ -28,10 +26,9 @@ FileUtils.chdir APP_ROOT do
puts "\n== Removing old logs and tempfiles =="
system! "bin/rails log:clear tmp:clear"

puts "\n== Restarting application server =="
system! "bin/rails restart"

# puts "\n== Configuring puma-dev =="
# system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
unless ARGV.include?("--skip-server")
puts "\n== Starting development server =="
STDOUT.flush # flush the output before exec(2) so that it displays
exec "bin/dev"
end
end
5 changes: 1 addition & 4 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Application < Rails::Application
# These settings can be overridden in specific environments using the files
# in config/environments, which are processed later.

config.load_defaults 7.2
config.load_defaults 8.0

%w[
app/models/challenge_models
Expand Down Expand Up @@ -105,9 +105,6 @@ class Application < Rails::Application
# Use Resque to run ActiveJobs (including sending delayed mail):
config.active_job.queue_adapter = :resque

# TODO: Remove with Rails 8.0 where this option will be deprecated
config.active_job.enqueue_after_transaction_commit = :always
Copy link
Contributor Author

@marcus8448 marcus8448 Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've set enqueue_after_transaction_commit = true on our job classes since the option is deprecated.

An alternative would be to set ActiveJob::Base.enqueue_after_transaction_commit = true in an initializer to cover all job types. That's effectively what this option did (but manually set instead). Although the option is deprecated, the delayed queuing might be enabled by default in the future, so this might be a better fix.


config.active_model.i18n_customize_full_message = true

config.action_mailer.default_url_options = { host: ArchiveConfig.APP_HOST, protocol: "https" }
Expand Down
Loading
Loading