feat(ruby): add client-level max_retries constructor parameter#16144
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
SDK Generation Benchmark ResultsComparing PR branch against median of 5 nightly run(s) on Full benchmark table (click to expand)
main (generator): generator-only time via --skip-scripts (includes Docker image build, container startup, IR parsing, and code generation — this is the same Docker-based flow customers use via |
Description
Linear ticket: Closes FER-10182
Adds a
max_retries:keyword argument to the rootClientconstructor generated by the Ruby-v2 SDK generator. Consumers can now configure the default retry count once at client construction (e.g.Client.new(max_retries: 5)) instead of relying on the generation-timemaxRetriessetting ingenerators.yml(which only the SDK author can change).Mirrors the existing Python implementation (FER-10180, commit b7d4e67) and matches the README snippet that already documents this option (
generators/ruby-v2/sdk/src/readme/ReadmeSnippetBuilder.ts).The constructor default still respects the configured
customConfig.maxRetries(falling back to2when unset), so existing behavior is preserved for SDK authors who already pinned a value ingenerators.yml. The argument is threaded through toRawClient.new(...), whose retry logic was already in place.Changes Made
generators/ruby-v2/sdk/src/root-client/RootClientGenerator.ts: addmax_retrieskeyword parameter (typedInteger, default =customConfig.maxRetries ?? 2) and pass it through toRawClient.new(...)after the existingheaders:argument.generators/ruby-v2/sdk/changes/unreleased/add-client-level-max-retries.yml:featchangelog entry.seed/ruby-sdk-v2/**/lib/**/client.rb: regenerated snapshots (132 fixtures) — all now exposemax_retries:on the rootClient.initializeand forward it toRawClient.Testing
pnpm turbo run test --filter='@fern-api/ruby-*'→ 104 ast + 33 dynamic-snippets + 6 sdk tests passed; existingmaxRetries.test.tsconfig schema tests unchanged).pnpm seed test --generator ruby-sdk-v2 --skip-scriptsacross all 132 fixtures, all green. Spot-checked generated output for several fixture shapes:seed/ruby-sdk-v2/no-environment/lib/seed/client.rb:def initialize(token:, base_url: nil, max_retries: 2)→ forwardsmax_retries: max_retriestoRawClient.new.seed/ruby-sdk-v2/multi-url-environment/lib/seed/client.rb: parameter placed afterenvironment:, still forwarded correctly with the multi-URLbase_url:resolution.seed/ruby-sdk-v2/basic-auth/wire-tests/lib/seed/client.rb:headersare built into a local variable then passed alongsidemax_retries: max_retries.seed/ruby-sdk-v2/inferred-auth-explicit/lib/seed/client.rb:@raw_client = ...new(... .merge(@auth_provider.auth_headers), max_retries: max_retries)—.merge(...)line gets the trailing comma somax_retries:follows on its own line. The internalauth_raw_clientis intentionally left untouched (internal-only).Link to Devin session: https://app.devin.ai/sessions/82a9f76b68ad40efbc9aaebca894e8fb
Requested by: @iamnamananand996