Repository navigation
Check Faraday::Connection#ssl with to_hash in the client spec - #799
Merged
Merged
Conversation
Faraday 2.16 builds SSLOptions on a new BaseOptions class instead of Struct, and drops most of the Struct API, `empty?` included. The spec "leaves Faraday::Connection#ssl unset" calls `empty?` on the options, so it fails on Faraday main. `to_hash` leaves out members that are nil, on every Faraday version from 0.17.3 to 2.16. So `ssl.to_hash` is empty when no SSL option is set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 tasks done
iMacTia
pushed a commit
to lostisland/faraday
that referenced
this pull request
Nov 26, 2026
These methods are back only for code written against the legacy Options Structs. elastic-transport, oauth2 and ruby_llm are moving off them (elastic/elastic-transport-ruby#134, ruby-oauth/oauth2#799, crmne/ruby_llm#1857), but their released versions still call them. So they stay for the whole 2.x series, like StructCompat. The docs now say they go away in 3.0 and name the replacement. There is no runtime warning yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
iMacTia
added a commit
to lostisland/faraday
that referenced
this pull request
Nov 26, 2026
* fix: restore the members class method on the options classes Converting the options classes to BaseOptions removed the class method `members` that the legacy Struct provided. elastic-transport 8.6.0 calls `Faraday::SSLOptions.members` to check for `verify_hostname`, so every client set up with `ca_fingerprint:` fails on its first request with NoMethodError. BaseOptions.members now returns a copy of MEMBERS. Every class converted from a Struct (Env, ConnectionOptions, RequestOptions, SSLOptions and ProxyOptions) answers it as before, and a caller that changes the result does not change the class. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: restore empty? on the options classes Converting the options classes to BaseOptions removed `empty?`, which the legacy Options Structs answered with "no member is set". oauth2 2.1.0 checks a new connection with `expect(subject.connection.ssl).to be_empty`. On Faraday main that spec fails, because SSLOptions no longer responds to `empty?`. BaseOptions#empty? is true when every member is nil, as before. A member set to false counts as set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: restore to_h on the options classes Converting the options classes to BaseOptions removed `to_h`, which the legacy Options Structs answered with every member, nil included. ruby_llm 2.2.3 calls `to_h` on Faraday::Env and SSLOptions in three transport specs, and they fail on Faraday main with NoMethodError. BaseOptions#to_h returns every member and its value, like Struct#to_h, and maps the pairs when given a block. Nested options stay objects, and Env leaves out its custom members, as before. to_hash still leaves out nil values and converts nested options. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: deprecate members, empty? and to_h on the options classes These methods are back only for code written against the legacy Options Structs. elastic-transport, oauth2 and ruby_llm are moving off them (elastic/elastic-transport-ruby#134, ruby-oauth/oauth2#799, crmne/ruby_llm#1857), but their released versions still call them. So they stay for the whole 2.x series, like StructCompat. The docs now say they go away in 3.0 and name the replacement. There is no runtime warning yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
7 tasks done
Member
|
This is a great find. Thanks! |
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.
Faraday 2.16 builds its options classes,
Faraday::SSLOptionsincluded, on a newFaraday::BaseOptionsclass instead ofStruct, and drops most of theStructAPI. An ecosystem test of the 2.16 beta found that one spec here callsempty?onconnection.ssl, so it fails on Faraday main:This PR checks
connection.ssl.to_hashinstead. On every Faraday version from 0.17.3 to 2.16,to_hashleaves out members that arenil. So the spec still checks that no SSL option is set. The library code does not callempty?, so oauth2 itself works on Faraday 2.16.Faraday adds
empty?back for compatibility in lostisland/faraday#1746, so released versions of oauth2 keep passing. With this change, the spec no longer depends on it.Tests
The full suite, on Ruby 4.0.9:
8160a12) with themembersfix of lostisland/faraday#1746, withoutempty?🤖 Generated with Claude Code