Add Ruby 4.0 to CI and fix stdlib dependency issues#129
Open
David Elner (delner) wants to merge 8 commits intomainfrom
Open
Add Ruby 4.0 to CI and fix stdlib dependency issues#129David Elner (delner) wants to merge 8 commits intomainfrom
David Elner (delner) wants to merge 8 commits intomainfrom
Conversation
3ef23bd to
7a4c0e8
Compare
ace7325 to
5c03895
Compare
5c03895 to
0df38cf
Compare
Luca Forstner (lforst)
approved these changes
Mar 23, 2026
Stephen Belanger (Qard)
approved these changes
Mar 23, 2026
Matt Perpick (clutchski)
approved these changes
Mar 23, 2026
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.
Ruby 4.0 was officially released Dec 2025. This PR adds it to our CI matrix and fixes dependency issues caused by gems being extracted from the standard library in Ruby 3.4+ and 4.0.
No SDK code changes required — the SDK itself is already Ruby 4.0 compatible.
Changes
CI (
ci.yml)'4.0'to the Ruby version matrixruby/setup-rubyfrom v1.270.0 to v1.295.0 (adds Ruby 4.0.2 support; the old version only had 4.0.0-preview2)bundler: 'latest'— Ruby 4.0-preview2 shipped with a broken bundler 2.4.19; using latest avoids thisDependencies
braintrust.gemspec: Move development dependencies toGemfile(gemspec now only has runtime deps)Gemfile: Add all development dependencies here instead of gemspecGemfile.lock: BumpBUNDLED WITHfrom 2.4.19 to 4.0.8 (prevents bundler from auto-downgrading to the broken version)base64andcgias supplemental deps foropenaiandanthropicgems — these upstream gems usebase64/cgiwithout declaring them, which breaks on Ruby 3.4+ (wherebase64was removed from default gems) and Ruby 4.0+ (wherecgiwas removed)Appraisals refactor
GEM_DEPENDENCIESintoOPTIONAL_GEMS— each version entry is now a hash withconstraintanddepskeys, so supplemental dependencies can be scoped per-version instead of applied to all versions of a gemOther
base64stdlib warning inencoding_test.rb(the test already handlesLoadErrorgracefully; the warning was just noise)Context
Ruby 3.4+ and 4.0 have been progressively extracting gems from the standard library:
base64: Warning in Ruby 3.4, removed in later 3.4.x patchescgi: Removed in Ruby 4.0logger: Removed in Ruby 4.0 (already declared as a runtime dep in our gemspec)Several upstream gems (
openai,anthropic) use these without declaring them, so we add them as supplemental deps in our appraisal configurations.