Skip to content

Support Ruby 4.0 (magnus 0.8), release 0.3.0 - #6

Merged
cpetersen merged 3 commits into
mainfrom
ruby-4.0-support
Sep 7, 2026
Merged

cpetersen merged 3 commits into
mainfrom
ruby-4.0-support

Conversation

@cpetersen

Copy link
Copy Markdown
Member

spellkit cannot be installed on Ruby 4.0 today. The precompiled platform gem carries one binary per ABI for 3.1–3.4 only, so RubyGems falls back to the source gem — and that fails to compile, because magnus 0.7 does not support Ruby 4.0's C API:

  • rb_fiber_raise's argv became *mut VALUE
  • rb_sys::RTypedData lost its typed_flag field

Both are inside magnus, not this crate. Found while installing spellkit-dictionaries on a clean GitHub runner, where ruby-version: ruby resolves to 4.0.x.

Changes

  • magnus 0.7 → 0.8, matching red-candle, which is already on 0.8.
  • ruby-versions: "3.1,3.2,3.3,3.4,4.0" in both workflows. The shared rust-gem-release default excludes 4.0 deliberately and its own docs name the exact failure above, so this is the documented opt-in.
  • benchmark as a dev dependency — it left the default gems in Ruby 4.0, so performance_spec.rb's require failed before any spec could run.
  • All magnus deprecations cleared (7 warnings → 0).
  • README platform list corrected; it claimed 3.1–3.3, stale even before this.

Verification

Compiled and ran the full suite locally on 3.3.0, 3.4.8, 4.0.1 and 4.0.6. All four compile; all four report the same 186 examples, 2 failures.

Those 2 failures are pre-existing and version-independent — both hit DEFAULT_DICTIONARY_URL and fail under WebMock without a warm cache, identically on 3.4.8. Not introduced here.

What still needs CI to confirm

The linux cross-compile legs for the new 4.0 ABI are the one thing I could not verify locally — that needs the rb-sys-dock image to carry Ruby 4.0. Add the dry-run-release label to run the full matrix before merging.

cpetersen and others added 2 commits September 7, 2026 15:04
spellkit could not be installed on Ruby 4.0 at all. The precompiled platform gem
carries one binary per ABI for 3.1-3.4 only, so RubyGems fell back to the source
gem, and that failed to compile: magnus 0.7 does not support Ruby 4.0's C API.
Two errors, both inside magnus rather than this crate - rb_fiber_raise's argv
became *mut VALUE, and rb_sys::RTypedData lost its typed_flag field. Found while
installing this gem on a clean GitHub runner, where ruby-version: ruby resolves
to 4.0.x.

magnus 0.8 fixes both, matching red-candle, which is already on 0.8. Verified by
compiling and running the full suite on 3.3.0, 3.4.8, 4.0.1 and 4.0.6: all four
compile, all four report the same 186 examples / 2 failures. Those 2 are
pre-existing and version-independent - both hit DEFAULT_DICTIONARY_URL and fail
under WebMock without a warm cache, identically on 3.4.8.

ruby-versions is set explicitly to "3.1,3.2,3.3,3.4,4.0" in both workflows. The
shared rust-gem-release default excludes 4.0 on purpose and its own docs name the
exact failure above, so adding it is the documented opt-in for a gem whose native
deps can handle it.

benchmark is now a development dependency: it left the default gems in Ruby 4.0,
so spec/performance_spec.rb's require failed there before any spec could run.

Also clears every magnus deprecation (define_module, class::object, RArray::new,
RHash::new -> their Ruby:: equivalents), taking the build from 7 warnings to 0.
init already received a &Ruby it was ignoring; stats now takes one the same way
suggestions and correct_tokens already did.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CiDy8MvBncxzGnnmvDJMtL
It claimed Ruby 3.1-3.3, which was already stale before this release: 3.4 has
shipped in the fat gem for some time, and 4.0 lands in 0.3.0. Also corrects the
platform list to what the release workflow actually builds (arm64 darwin;
x86_64 and aarch64 linux) rather than the macOS-x86_64/musl set it claimed, and
says plainly what happens outside that list - a source build needing Rust.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CiDy8MvBncxzGnnmvDJMtL
@cpetersen cpetersen added the dry-run-release Run the full precompiled release matrix as a publish=false dry-run on this PR label Sep 7, 2026
Every build run on this repo has been failing, on every branch and every Ruby -
dependabot, ci/version-box-dispatch and migrate-to-rust-gem-release are all red
for the same reason, so this predates the Ruby 4.0 work and blocks any clean
release.

Cause: dictionary_loading_spec.rb does `require "webmock/rspec"`, which disables
net connect for the WHOLE suite rather than that one file. The two examples tagged
:integration exist precisely to prove DEFAULT_DICTIONARY_URL really resolves and
loads, so WebMock blocked them and they failed with NetConnectNotAllowedError.
Collateral damage from a require in an unrelated file.

An around hook now lets a :integration-tagged example reach the network and
restores the block afterwards, so nothing else inherits it.

186 examples, 0 failures on 3.3.0, 3.4.8, 4.0.1 and 4.0.6 - recompiling between
runs, since rake compile overwrites the flat lib/spellkit/spellkit.bundle and a
stale one from another ABI fails ~170 examples in a way that looks alarming and
is not real.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CiDy8MvBncxzGnnmvDJMtL
@cpetersen
cpetersen merged commit 4bd0dd1 into main Sep 7, 2026
16 checks passed
@cpetersen
cpetersen deleted the ruby-4.0-support branch September 7, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dry-run-release Run the full precompiled release matrix as a publish=false dry-run on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant