Skip to content

Conversation

@kpumuk
Copy link
Contributor

@kpumuk kpumuk commented Dec 17, 2025

When binary extensions are compiled and loaded, they replace Ruby implementation for some of of the core classes (structs, unions, and interestingly, compact protocol). This code is never tested when the binary extensions are present.

For example, #3269 provides a fix for one such discrepancy between native code and Ruby.

CleanShot 2025-12-17 at 17 30 30@2x

This PR introduces one special "no extensions" build to test pure Ruby code.

  • Did you create an Apache Jira ticket? THRIFT-5909
  • 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
Copy link
Contributor Author

kpumuk commented Dec 19, 2025

The build no no-extension job failed due to #3269

…mplementation

When binary extension is not available (for example, in JRuby), Thrift::Union
throws an unexpected NoMethodError instead of the intended error:

  1) Union Thrift::Union should raise for wrong set field when hash initialized and type checking is off
     Failure/Error: expect { Thrift::Serializer.new.serialize(union) }.to raise_error(RuntimeError, "set_field is not valid for this union!")

       expected RuntimeError with "set_field is not valid for this union!", got #<NoMethodError: undefined method '[]' for nil> with backtrace:
         # ./lib/thrift/union.rb:78:in 'write'
         # ./lib/thrift/serializer/serializer.rb:29:in 'serialize'
         # ./spec/union_spec.rb:54:in 'block in <main>'
         # ./spec/union_spec.rb:54:in 'block in <main>'
     # ./spec/union_spec.rb:54:in 'block in <main>'
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