fix: Accept the documented options on the top-level factories - #583
Open
razor-x wants to merge 1 commit into
Open
fix: Accept the documented options on the top-level factories#583razor-x wants to merge 1 commit into
razor-x wants to merge 1 commit into
Conversation
The README shows Seam.from_api_key taking faraday_options and
faraday_retry_options, but Seam.from_api_key, Seam.from_personal_access_token,
and their Seam::Http counterparts forwarded only endpoint,
wait_for_action_attempt, and timeout, so the documented call raised
ArgumentError. The README also constructed a client with a positional
Seam.new("your-api-key"), which the keyword-only constructor rejects, and
claimed every timeout raises Faraday::TimeoutError while the spec named
for that assertion checked Faraday::ConnectionFailed.
Forward both options through every factory, fix the README example, and
document what actually happens: a connection that cannot be opened in
time raises Faraday::ConnectionFailed and a response that does not arrive
in time raises Faraday::TimeoutError, each now covered by a spec.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SQW83gyXeUG61RDrHEky97
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.
Problem
SDK audit finding L2:
Seam.from_api_key("...", faraday_options: {}, faraday_retry_options: {}), butSeam.from_api_key,Seam.from_personal_access_token, and theSeam::Httpcounterparts forwarded onlyendpoint,wait_for_action_attempt, andtimeout, so the documented call raisedArgumentError: unknown keywords.Seam.new("your-api-key"), which the keyword-only constructor rejects.Faraday::TimeoutError, while the spec named "raises Faraday::TimeoutError" assertedFaraday::ConnectionFailed.Fix
Forward both options through every factory. Fix the README example to
Seam.new(api_key: "your-api-key"). Document the timeout behavior as it actually is (verified against faraday-net_http's source): a connection that cannot be opened in time raisesFaraday::ConnectionFailed(Net::OpenTimeoutis in itsNET_HTTP_EXCEPTIONS), a response that does not arrive in time raisesFaraday::TimeoutError.Tests
New
spec/seam_client/factory_options_spec.rbcovers all four factories:faraday_optionsreaches the client's headers and request options, andfaraday_retry_options: {max: 0}is honored (one request on a 503, counted with WebMock).timeout_spec.rbrenames the mislabeled example and adds a read-timeout spec against a local socket that accepts but never responds, assertingFaraday::TimeoutError.Revert-check against
main: 8ArgumentErrorfailures from the factory specs.🤖 Generated with Claude Code
https://claude.ai/code/session_01SQW83gyXeUG61RDrHEky97
Generated by Claude Code