Skip to content

Upgrade Ruby 3.4.9 -> 4.0.4#77

Merged
JuanVqz merged 2 commits into
mainfrom
feature/ruby-4.0
Jul 7, 2026
Merged

Upgrade Ruby 3.4.9 -> 4.0.4#77
JuanVqz merged 2 commits into
mainfrom
feature/ruby-4.0

Conversation

@JuanVqz

@JuanVqz JuanVqz commented Jul 7, 2026

Copy link
Copy Markdown
Member

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 the Dockerfile tag needed editing.

The one real change: ostruct

The pre-bump sweep on 3.4.9 flagged it:

ostruct ... will no longer be part of the default gems starting from Ruby 4.0.0

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 up ostruct 0.6.3.

Lockfiles

Relocked on 4.0.4: RUBY VERSION 4.0.4, PLATFORMS ruby only. BUNDLED WITH kept at 4.0.15 — a 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.

Verification (host, ruby 4.0.4, Postgres 16.13) — both boots

  • Deprecation sweep clean after the ostruct fix.
  • 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 — no unknown-version error) and reek both clean.

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 ostruct default-gem removal is the headline item) as a follow-up skill improvement.

JuanVqz added 2 commits July 7, 2026 16:11
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.
@JuanVqz JuanVqz merged commit 3d29058 into main Jul 7, 2026
2 checks passed
@JuanVqz JuanVqz deleted the feature/ruby-4.0 branch July 7, 2026 22:20
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.

1 participant