Skip to content

Conversation

@kpumuk
Copy link
Contributor

@kpumuk kpumuk commented Nov 20, 2025

Fixnum type has been deprecated since Ruby 2.4 and removed in Ruby 3.0, which makes BaseProtocol incompatible with modern Ruby versions.

This change removes the Fixnum reference, as well as a monkey-patch that introduces Fixnum#ord() to Ruby versions below 1.8.7.

Important

This change essentially makes it officially required to use Ruby 2.4 or newer.

Currently, LANGUAGES.md mentions Ruby 2.3.1 as the minimum version, which had an EOL in March 2019. With a series of changes, I am trying to revive the continuous integration pipeline for Ruby, and have currently the test suite pass for up to 3.4.7. I propose to bump the minimum required Ruby version to 2.4.0,
and update the "tested up to" version to 3.4.7 once the pipeline is completely green and running on GitHub.

Fixes the following test failures:

  1) BaseProtocol Thrift::BaseProtocol should write out the different types (deprecated write_type signature)
     Failure/Error: if field_info.is_a? Fixnum

     NameError:
       uninitialized constant Thrift::BaseProtocol::Fixnum
     # ./lib/thrift/protocol/base_protocol.rb:256:in 'Thrift::BaseProtocol#write_type'
     # ./spec/base_protocol_spec.rb:65:in 'block (3 levels) in <top (required)>'

  2) BaseProtocol Thrift::BaseProtocol should write out the different types
     Failure/Error: if field_info.is_a? Fixnum

     NameError:
       uninitialized constant Thrift::BaseProtocol::Fixnum
     # ./lib/thrift/protocol/base_protocol.rb:256:in 'Thrift::BaseProtocol#write_type'
     # ./spec/base_protocol_spec.rb:90:in 'block (3 levels) in <top (required)>'

  3) BaseProtocol Thrift::BaseProtocol should read the different types (deprecated read_type signature)
     Failure/Error: if field_info.is_a? Fixnum

     NameError:
       uninitialized constant Thrift::BaseProtocol::Fixnum
     # ./lib/thrift/protocol/base_protocol.rb:296:in 'Thrift::BaseProtocol#read_type'
     # ./spec/base_protocol_spec.rb:113:in 'block (3 levels) in <top (required)>'

  4) BaseProtocol Thrift::BaseProtocol should read the different types
     Failure/Error: if field_info.is_a? Fixnum

     NameError:
       uninitialized constant Thrift::BaseProtocol::Fixnum
     # ./lib/thrift/protocol/base_protocol.rb:296:in 'Thrift::BaseProtocol#read_type'
     # ./spec/base_protocol_spec.rb:136:in 'block (3 levels) in <top (required)>'
  • Did you create an Apache Jira ticket? THRIFT-5906
  • If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
  • Did you squash your changes to a single commit? (not required, but preferred)
  • Did you do your best to avoid breaking changes? If one was needed, did you label the Jira ticket with "Breaking-Change"?
  • If your change does not involve any code, include [skip ci] anywhere in the commit message to free up build resources.

@kpumuk kpumuk changed the title Remove Fixnum references to support modern Ruby versions THRIFT-5906: Remove Fixnum references to support modern Ruby versions Nov 20, 2025
@Jens-G Jens-G added the ruby label Nov 21, 2025
@kpumuk
Copy link
Contributor Author

kpumuk commented Nov 21, 2025

@Jens-G I am working through the failing tests to get the Ruby build pipeline up and running on the GitHub workflows. One question is which Ruby versions to support.

In this MR I propose to bump the minimum version from 2.3 to 2.4 (as per LANGUAGES.md), but the number of support versions will affect the size of the test pipeline.

Currently supported versions are 3.2 and above https://endoflife.date/ruby, which might be too aggressive, maybe? I'm thinking about 2.7 and up (https://github.com/kpumuk/thrift/actions/runs/19521001691), but can of course lower it.

@kpumuk
Copy link
Contributor Author

kpumuk commented Nov 22, 2025

I am not quite sure why appveyor tests are failing and how to fix them. Does not seem to be related to the change

@kpumuk
Copy link
Contributor Author

kpumuk commented Dec 2, 2025

I am not quite sure why appveyor tests are failing and how to fix them. Does not seem to be related to the change

The tests are fixed now, and this PR is ready for review.

As per the discussion in the mailing list, we should be good with bumping minimum required version a little bit, as 2.4 it is still well below the currently supported Ruby versions.

Fixnum type has been deprecated since Ruby 2.4 and removed in Ruby 3.0,
which makes BaseProtocol incompatible with modern Ruby versions.

This change removes the Fixnum reference, as well as a monkey-patch that
introduces Fixnum#ord() to Ruby versions below 1.8.7.

**This change essentially makes it officially required to use Ruby 2.4 or newer.**

Fixes the following test failures:

  1) BaseProtocol Thrift::BaseProtocol should write out the different types (deprecated write_type signature)
     Failure/Error: if field_info.is_a? Fixnum

     NameError:
       uninitialized constant Thrift::BaseProtocol::Fixnum
     # ./lib/thrift/protocol/base_protocol.rb:256:in 'Thrift::BaseProtocol#write_type'
     # ./spec/base_protocol_spec.rb:65:in 'block (3 levels) in <top (required)>'

  2) BaseProtocol Thrift::BaseProtocol should write out the different types
     Failure/Error: if field_info.is_a? Fixnum

     NameError:
       uninitialized constant Thrift::BaseProtocol::Fixnum
     # ./lib/thrift/protocol/base_protocol.rb:256:in 'Thrift::BaseProtocol#write_type'
     # ./spec/base_protocol_spec.rb:90:in 'block (3 levels) in <top (required)>'

  3) BaseProtocol Thrift::BaseProtocol should read the different types (deprecated read_type signature)
     Failure/Error: if field_info.is_a? Fixnum

     NameError:
       uninitialized constant Thrift::BaseProtocol::Fixnum
     # ./lib/thrift/protocol/base_protocol.rb:296:in 'Thrift::BaseProtocol#read_type'
     # ./spec/base_protocol_spec.rb:113:in 'block (3 levels) in <top (required)>'

  4) BaseProtocol Thrift::BaseProtocol should read the different types
     Failure/Error: if field_info.is_a? Fixnum

     NameError:
       uninitialized constant Thrift::BaseProtocol::Fixnum
     # ./lib/thrift/protocol/base_protocol.rb:296:in 'Thrift::BaseProtocol#read_type'
     # ./spec/base_protocol_spec.rb:136:in 'block (3 levels) in <top (required)>'
@Jens-G Jens-G merged commit f06db1b into apache:master Dec 16, 2025
31 checks passed
@kpumuk kpumuk deleted the fixnum branch December 16, 2025 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants