Skip to content

Upgrade to Rails 8.1#2559

Open
A-Wheeto wants to merge 30 commits into
mainfrom
eng-1743-bump-rails-to-80
Open

Upgrade to Rails 8.1#2559
A-Wheeto wants to merge 30 commits into
mainfrom
eng-1743-bump-rails-to-80

Conversation

@A-Wheeto

@A-Wheeto A-Wheeto commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Upgrades Rails from 7.1 to 8.1.3 and resolves all breaking changes introduced by the upgrade.

Gem changes

  • rails bumped from ~> 7.1.0 to ~> 8.0 (resolved: 8.1.3)
  • view_component upgraded from 3.x to 4.12.0 (required by Rails 8; 3.x had a < 8.0 constraint)\
  • administrate unpinned from ~> 0.20.0 to current (1.0.0; now supports Rails 8)
  • cloudflare-rails upgraded to 7.0.0 (6.x had a < 8.1.0 constraint)
  • administrate-field-nested_has_many removed (incompatible with Administrate 1.0)
  • rspec-rails bumped to 8.0.4
  • ostruct added explicitly (extracted from stdlib in Ruby 3.5+)

Breaking changes fixed

  • Enum syntax (app/models/badge.rb) - Rails 8 removed the old hash-rocket enum form. Updated to positional syntax
  • Time arithmetic (_csa-test.html.erb, _exam.html.erb) - can_take_test_at returns an integer (seconds). Rails 8 tightened implicit integer coercion in ActiveSupport, so .seconds is now explicit
  • Routes (config/routes.rb) - perform_sync/perform_reset were incorrectly listed in only. Moved to explicit get routes inside the resources block
  • ViewComponent 4 - super → super() in ModalComponent and RelatedLinksComponent; preview config keys renamed (previews.paths, previews.route, previews.enabled); image_pack_tag delegation added to initializer for Webpacker compatibility until Phase 3
  • ViewComponent generator namespace (lib/generators/strapi/component_generator.rb). ViewComponent 4 renamed the generator from "component" to "view_component:component". Rails 8.1's Generators.invoke now calls exit 1 on a missing generator (7.1 just warned), which was raising SystemExit inRSpec before-hooks and killing the test suite mid-run with variable test counts

Notes

  • config.load_defaults remains at 7.1 - adopting Rails 8.0 defaults is deferred to a follow-on phase (same strategy used for the 7.1 defaults in the preceding branch)
  • Phase 3 (replacing Webpacker with importmap + dartsass) will be completed in ENG-1744

@tc-deploybot tc-deploybot temporarily deployed to teachcomputing-pr-2559 June 12, 2026 12:52 Inactive
@A-Wheeto A-Wheeto temporarily deployed to teachcomputing-pr-2559 June 12, 2026 12:59 Inactive
@A-Wheeto A-Wheeto temporarily deployed to teachcomputing-pr-2559 June 12, 2026 14:13 Inactive
A-Wheeto added 24 commits June 16, 2026 15:58
Rails 8 rejects non-standard action names in :only. Remove :perform_sync and :perform_reset from users resources and add them as standalone named routes.

Add explicit ViewComponent preview routes before the CMS wildcard.

ENG-1743
Initialize no longer accepts arguments, replace super with super() in components that define their own initialize

Add initializer to delegate image_pack_tag to helpers, which ViewComponent 4 no longer does automatically.

ENG-1743
Remove config.sass, update mailer preview_path to preview_paths and update ViewComponent preview config to the 4 API

ENG-1743
Rails 8.1 no longer allows adding a plain integer to a TimeWithZone. Add .seconds to convert before adding

ENG-1743
Webpacker compile block now captures the result properly

ENG-1743
ENG-1743
@A-Wheeto A-Wheeto force-pushed the eng-1743-bump-rails-to-80 branch from 7142424 to 1c148ba Compare June 16, 2026 14:58
@tc-deploybot tc-deploybot temporarily deployed to teachcomputing-pr-2559 June 16, 2026 15:19 Inactive
@A-Wheeto A-Wheeto changed the title Upgrade to Rails 8 Upgrade to Rails 8.1 Jun 17, 2026
The rescue isn't needed anymore. The SystemExit was only being raised because "component" wasn't found - now that the namespace is correctly "view_component:component", the generator will be found and exit 1 won't be called

ENG-1743
@A-Wheeto A-Wheeto temporarily deployed to teachcomputing-pr-2559 June 17, 2026 08:19 Inactive
Comment thread config/routes.rb
resources :sent_emails, only: %i[index show]
resources :support_audits, only: %i[index show update edit]
resources :users, only: %i[index create show edit perform_sync perform_reset update] do
resources :users, only: %i[index create show edit update] do

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Are we certain that /perform_sync and /perform_reset are never called without the user_id param?

@A-Wheeto A-Wheeto Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, Matt. That's a really good spot. Although these actions are performed from within administrate and would have no front end effect, they need addressing. I'll put a fix together.

@A-Wheeto A-Wheeto temporarily deployed to teachcomputing-pr-2559 June 17, 2026 13:40 Inactive
@A-Wheeto A-Wheeto temporarily deployed to teachcomputing-pr-2559 June 17, 2026 13:48 Inactive
@A-Wheeto A-Wheeto temporarily deployed to teachcomputing-pr-2559 June 17, 2026 14:02 Inactive
@A-Wheeto A-Wheeto temporarily deployed to teachcomputing-pr-2559 June 18, 2026 09:09 Inactive
end

def perform_reset
def perform_reset_tests

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What was the reason for renaming this method?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The original code had a mismatch. The route was named perform_reset but the controller action was perform_reset_tests. I made it more consistent, but then decided to rename back to perform_reset_tests because that's what it actually does (calls reset_tests), and now both the route and action are in line.

Sidekiq 7.3.9 calls ConnectionPool::TimedStack#pop with a positional argument. connection_pool 3.0 changed this to keyword-only, breaking the Sidekiq scheduler thread on startup

ENG-1743
@A-Wheeto A-Wheeto temporarily deployed to teachcomputing-pr-2559 June 19, 2026 10:02 Inactive
@sonarqubecloud

Copy link
Copy Markdown

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.

3 participants