Support Ruby 4.0 (magnus 0.8), release 0.3.0 - #6
Merged
Merged
Conversation
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
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
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.
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'sargvbecame*mut VALUErb_sys::RTypedDatalost itstyped_flagfieldBoth are inside magnus, not this crate. Found while installing
spellkit-dictionarieson a clean GitHub runner, whereruby-version: rubyresolves to 4.0.x.Changes
ruby-versions: "3.1,3.2,3.3,3.4,4.0"in both workflows. The sharedrust-gem-releasedefault excludes 4.0 deliberately and its own docs name the exact failure above, so this is the documented opt-in.benchmarkas a dev dependency — it left the default gems in Ruby 4.0, soperformance_spec.rb'srequirefailed before any spec could run.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_URLand 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-releaselabel to run the full matrix before merging.