Skip to content

THREESCALE-12076: Upgrade Rails to 7.2#4232

Open
mayorova wants to merge 8 commits intomasterfrom
rails72
Open

THREESCALE-12076: Upgrade Rails to 7.2#4232
mayorova wants to merge 8 commits intomasterfrom
rails72

Conversation

@mayorova
Copy link
Contributor

@mayorova mayorova commented Feb 24, 2026

What this PR does / why we need it:

Upgrade Rails version to v7.2.

Which issue(s) this PR fixes

https://issues.redhat.com/browse/THREESCALE-12076

Verification steps

Special notes for your reviewer:

jlledom
jlledom previously approved these changes Feb 24, 2026
Copy link
Contributor

@jlledom jlledom left a comment

Choose a reason for hiding this comment

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

😺

config.active_record.dump_schema_after_migration = false

# Only use :id for inspections in production.
config.active_record.attributes_for_inspect = [ :id ]
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 is a new default config.

I am not sure about this one, we need to analyze the code to see if it may cause some issues.

For console usage it's not a problem, because there is #full_inspect method that ignores attributes_for_inspect.
However, if we rely on #inspect somewhere, we might need to comment this out.


# Specify the PID file. Defaults to tmp/pids/server.pid in development.
# In other environments, only set the PID file if requested.
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
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 is new, but I think it's harmless, and can actually be useful.

# Any libraries that use a connection pool or another resource pool should
# be configured to provide at least as many connections as the number of
# threads. This includes Active Record's `pool` parameter in `database.yml`.
threads_count = ENV.fetch("RAILS_MAX_THREADS", 5)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The new default is 3, see https://guides.rubyonrails.org/7_2_release_notes.html#set-a-new-default-for-the-puma-thread-count

Maybe we should change our default too? 🤔

Copy link
Contributor

@jlledom jlledom Feb 24, 2026

Choose a reason for hiding this comment

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

I did it on Zync


::Sidekiq::Testing.inline! do
provider.destroy!
# Prevent exception when deserializing ProviderDomainsChangedEvent with a non-existing (destroyed) provider
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this is a global issue, in fact, that happens in production. I opened a Jira for investigating and fixing this: https://issues.redhat.com/browse/THREESCALE-12414

I am not sure why it was not manifesting previously, but I guess it could be because of the following change in Rails 7.2:
https://guides.rubyonrails.org/7_2_release_notes.html#prevent-jobs-from-being-scheduled-within-transactions

Probably, because of the fact that now the jobs are deferred until after the transactions is committed, when the job is being processed, the provider object is no longer in the DB, while previously, I guess the job was executed immediately, while the object was still present.

@qltysh
Copy link

qltysh bot commented Feb 26, 2026

❌ 1 blocking issue (1 total)

Tool Category Rule Count
rubocop Lint Class has too many lines. [418/200] 1

CHARGE_PRECISION = 2

enum creation_type: {manual: 'manual', background: 'background'}
enum :creation_type, { manual: 'manual', background: 'background' }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

DEPRECATION WARNING: Defining enums with keyword arguments is deprecated and will be removed
in Rails 8.0. Positional arguments should be used instead:
enum :creation_type, {:manual=>"manual", :background=>"background"}
 (called from <class:Invoice> at /home/dmayorov/Projects/3scale/porta/app/models/invoice.rb:14)

include SystemName

enum account_type: {developer: 'developer', provider: 'provider'}
enum :account_type, { developer: 'developer', provider: 'provider' }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

DEPRECATION WARNING: Defining enums with keyword arguments is deprecated and will be removed
in Rails 8.0. Positional arguments should be used instead:
enum :account_type, {:developer=>"developer", :provider=>"provider"}
 (called from <class:AuthenticationProvider> at /home/dmayorov/Projects/3scale/porta/app/models/authentication_provider.rb:13)

buyer = FactoryBot.create(:simple_buyer)
buyer.update(nil)
assert_nothing_raised do
buyer.update(nil)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Test is missing assertions: `test_update_with_nil_as_param_should_not_raise_error` /home/dmayorov/Projects/3scale/porta/test/unit/account_test.rb:107

new_org_name = 'account is not readonly'
@named_scoped_provider.update(org_name: new_org_name)

assert_equal new_org_name, @named_scoped_provider.reload.org_name
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Test is missing assertions: `test_providers_named_scope_return_non-readonly_objects` /home/dmayorov/Projects/3scale/porta/test/unit/account_test.rb:153

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants