Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade/rails 7.1 v2 #4736

Merged
merged 1 commit into from
Aug 11, 2024
Merged

Upgrade/rails 7.1 v2 #4736

merged 1 commit into from
Aug 11, 2024

Conversation

ChargrilledChook
Copy link
Member

@ChargrilledChook ChargrilledChook commented Aug 10, 2024

Partially closes #4735

Supersedes #4477 - easier to start fresh than fix merge conflicts

Will rebase / squash after review

@ChargrilledChook ChargrilledChook marked this pull request as draft August 10, 2024 04:05
@ChargrilledChook ChargrilledChook mentioned this pull request Aug 10, 2024
2 tasks
@ChargrilledChook ChargrilledChook linked an issue Aug 10, 2024 that may be closed by this pull request
5 tasks
@ChargrilledChook ChargrilledChook added the create-review-app Create a Heroku review app for pull request label Aug 10, 2024
@github-actions github-actions bot removed the create-review-app Create a Heroku review app for pull request label Aug 10, 2024
@KevinMulhern KevinMulhern temporarily deployed to odin-review-app-pr-4736 August 10, 2024 04:18 Inactive
@KevinMulhern KevinMulhern temporarily deployed to odin-review-app-pr-4736 August 10, 2024 05:03 Inactive
Copy link
Member Author

@ChargrilledChook ChargrilledChook left a comment

Choose a reason for hiding this comment

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

Successfuly deployed a review app on Heroku after some tweaking

This is probably a safe staging point before finishing all the config toggles - I've listed them all out in the issue.

Most will be trivial, but a few will need to be handled with care

# Please, add to the `ignore` list any other `lib` subdirectories that do
# not contain `.rb` files, or that should not be reloaded or eager loaded.
# Common ones are `templates`, `generators`, or `middleware`, for example.
config.autoload_lib(ignore: %w[assets tasks generators]) # TODO
Copy link
Member Author

@ChargrilledChook ChargrilledChook Aug 10, 2024

Choose a reason for hiding this comment

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

Related task in the upgrade file. Let me know if there's anything obvious that should go in here, but we'll need to come back to it to finish the upgrade.

Copy link
Member Author

Choose a reason for hiding this comment

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

Most of these are low risk, some are not.

Can be worked through incrementally without doing all in one go, I reckon

end

super
Copy link
Member Author

Choose a reason for hiding this comment

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

This doesn't look right, caused by Rubocop fixes. Will investigate

Actually works as expected as far as I can tell 👌

Copy link
Member

Choose a reason for hiding this comment

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

Looks good to me!

@@ -1,7 +1,7 @@
namespace :heroku do
desc 'Heroku release task - runs on every code push, runs before postdeploy task'
task release: :environment do
if ActiveRecord::SchemaMigration.table_exists?
if ActiveRecord::Base.connection.schema_migration.table_exists?
Copy link
Member Author

Choose a reason for hiding this comment

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

This was mildly annoying to debug. Caused heroku release phase to fail.

Caused by "Remove deprecated ActiveRecord::Base config accessors"

Context

@@ -27,7 +27,9 @@

fill_in 'Email', with: other_admin.email
fill_in 'Password', with: other_admin.password
click_button 'Sign in'
within 'form' do
Copy link
Member Author

Choose a reason for hiding this comment

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

Appeasing Rubocop caused these to be ambiguous. This was the easiest fix; using test-ids is probably better but I wanted to avoid touching templates for this pass

Copy link
Member

Choose a reason for hiding this comment

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

Strange they've added this rule when it can lead to issues like this. I think click_button and click_link communicates the intent way better and avoids these unambiguous matches. Standardrb may be in our future lol

Copy link
Member Author

Choose a reason for hiding this comment

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

On closer inspection this is a bit of a stitch up 😆 they've deprecrated this rule because of this exact reason.

Rule that was flagged

Replaced by

Unfortunately the change hasn't been released yet and the rule still screams.

I'll disable the rule, revert the changes and add a todo to remove it once the library gets updated

Copy link
Member

Choose a reason for hiding this comment

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

Nice find! stitch up indeed 😆
If its easier to keep those changes in, we can always change them back when the new release eventually appears.

Copy link
Member

@KevinMulhern KevinMulhern left a comment

Choose a reason for hiding this comment

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

All appears to be good on the review app for me. Nice work @ChargrilledChook!

end

super
Copy link
Member

Choose a reason for hiding this comment

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

Looks good to me!

@@ -27,7 +27,9 @@

fill_in 'Email', with: other_admin.email
fill_in 'Password', with: other_admin.password
click_button 'Sign in'
within 'form' do
Copy link
Member

Choose a reason for hiding this comment

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

Strange they've added this rule when it can lead to issues like this. I think click_button and click_link communicates the intent way better and avoids these unambiguous matches. Standardrb may be in our future lol

This commit:
* Run bundle update
* Run `app:update` task and resolve conflicts in config & env files
* Run safe autocorrect fixes for new Rubocop offences
* Add rubocop-rspec_rails to Rubcop config
* Manually fix new unsafe Rubcop offences
  * Requires fixing some specs as some elements became ambiguous due to
    preferring more generic `click_on` Capybara helper instead of `click_link`
* Add generators to new `autoload_lib` configuration
  * Because: CI breaks otherwise
* Access schema migration object via base connection in Heroku task
  * Because: This behaviour was removed in rails 7.1.
    See https://github.com/rails/rails/blob/7-1-stable/activerecord/CHANGELOG.md
* Toggle low risk framework defaults for Rails 7.1
@ChargrilledChook ChargrilledChook temporarily deployed to odin-review-app-pr-4736 August 11, 2024 00:01 Inactive
@ChargrilledChook ChargrilledChook merged commit 7778100 into main Aug 11, 2024
2 checks passed
@ChargrilledChook ChargrilledChook deleted the upgrade/rails-7.1_v2 branch August 11, 2024 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Chore: Upgrade to Rails 7.1
2 participants