Upgrade Ruby 3.4.9 -> 4.0.4#77
Merged
Merged
Conversation
Major-version Ruby hop. There is no 3.5-3.9 line -- Ruby went 3.4 -> 4.0 directly -- so this is the immediate next sequential hop, done with the full ruby-upgrade methodology (latest-patch baseline, deprecation sweep, floor audit, boot smoke, suite as the gate). Rails stays 8.1.3 on both boots. Ran the whole thing on the host per usual. Version lives in one place now (.ruby-version); the Gemfile (`ruby file: ...`) and CI (`ruby-version-file:`) follow it, so only .ruby-version, .tool-versions, and the Dockerfile tag needed editing. The one real change the sweep surfaced: - ostruct leaves Ruby's default gems in 4.0 (it becomes a bundled gem). Under Bundler that means `require "ostruct"` is no longer implicitly satisfied -- and Rails' own boot path (zeitwerk) requires it, so the app would fail to boot on 4.0. Added `gem "ostruct"` to the Gemfile (harmless on 3.4, required on 4.0). Lock picks up ostruct 0.6.3. Locks relocked on 4.0.4: RUBY VERSION 4.0.4, PLATFORMS ruby only. BUNDLED WITH kept at 4.0.15 -- the plain relock briefly dropped it to 4.0.10 (the bundler ruby 4.0.4 ships), restored via `bundle update --bundler=4.0.15` to avoid regressing the #74 pin. Verified on the host (ruby 4.0.4), both boots: - Deprecation sweep clean after the ostruct fix (the pre-bump 3.4.9 sweep had flagged exactly that removal). - bundle lock: no gem required_ruby_version conflicts. - Dev + production boot clean, zero deprecation warnings. - Suite green (16 runs, 52 assertions, 0 failures), rubocop (42 files, and it recognizes the 4.0 target) and reek both clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Major-version Ruby hop: 3.4.9 → 4.0.4. There is no 3.5–3.9 line — Ruby went 3.4 → 4.0 directly — so this is the immediate next sequential hop. Done with the full ruby-upgrade methodology (latest-patch baseline, deprecation sweep, floor audit, boot smoke, suite as the gate). Rails stays 8.1.3 on both boots.
Thanks to the earlier DRY refactor, the version lives in one place (
.ruby-version); the Gemfile (ruby file: ...) and CI (ruby-version-file:) follow it — so only.ruby-version,.tool-versions, and theDockerfiletag needed editing.The one real change:
ostructThe pre-bump sweep on 3.4.9 flagged it:
ostruct(OpenStruct) becomes a bundled (non-default) gem in Ruby 4.0. Under Bundler,require "ostruct"is then no longer implicitly satisfied — and Rails' own boot path (zeitwerk) requires it, so the app would fail to boot on 4.0.Fix: added
gem "ostruct"to the Gemfile (harmless on 3.4, required on 4.0). Lock picks upostruct 0.6.3.Lockfiles
Relocked on 4.0.4:
RUBY VERSION 4.0.4,PLATFORMS rubyonly.BUNDLED WITHkept at 4.0.15 — a plain relock briefly dropped it to 4.0.10 (the bundler Ruby 4.0.4 ships), restored viabundle update --bundler=4.0.15to avoid regressing the #74 pin.Verification (host, ruby 4.0.4, Postgres 16.13) — both boots
ostructfix.bundle lock: no gemrequired_ruby_versionconflicts.Note
The ruby-upgrade skill's version guides stop at 3.3→3.4 (they predate 4.0), so there's no 3.4→4.0 guide yet — this hop leaned on the general methodology. Worth adding a 3.4→4.0 guide (the
ostructdefault-gem removal is the headline item) as a follow-up skill improvement.