Skip to content

fix: Accept the documented options on the top-level factories - #583

Open
razor-x wants to merge 1 commit into
mainfrom
claude/ruby-sdk-audit-xbhaia-factory-options
Open

fix: Accept the documented options on the top-level factories#583
razor-x wants to merge 1 commit into
mainfrom
claude/ruby-sdk-audit-xbhaia-factory-options

Conversation

@razor-x

@razor-x razor-x commented Sep 1, 2026

Copy link
Copy Markdown
Member

Problem

SDK audit finding L2:

  • README "Advanced Usage" shows Seam.from_api_key("...", faraday_options: {}, faraday_retry_options: {}), but Seam.from_api_key, Seam.from_personal_access_token, and the Seam::Http counterparts forwarded only endpoint, wait_for_action_attempt, and timeout, so the documented call raised ArgumentError: unknown keywords.
  • The README's polling example constructed the client with a positional Seam.new("your-api-key"), which the keyword-only constructor rejects.
  • The README said a timed-out request raises Faraday::TimeoutError, while the spec named "raises Faraday::TimeoutError" asserted Faraday::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 raises Faraday::ConnectionFailed (Net::OpenTimeout is in its NET_HTTP_EXCEPTIONS), a response that does not arrive in time raises Faraday::TimeoutError.

Tests

New spec/seam_client/factory_options_spec.rb covers all four factories: faraday_options reaches the client's headers and request options, and faraday_retry_options: {max: 0} is honored (one request on a 503, counted with WebMock). timeout_spec.rb renames the mislabeled example and adds a read-timeout spec against a local socket that accepts but never responds, asserting Faraday::TimeoutError.

Revert-check against main: 8 ArgumentError failures from the factory specs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SQW83gyXeUG61RDrHEky97


Generated by Claude Code

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
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.

2 participants