Skip to content

feat(ruby): add client-level max_retries constructor parameter#16144

Merged
iamnamananand996 merged 1 commit into
mainfrom
devin/fer-10182-ruby-client-level-retry-options
Jun 1, 2026
Merged

feat(ruby): add client-level max_retries constructor parameter#16144
iamnamananand996 merged 1 commit into
mainfrom
devin/fer-10182-ruby-client-level-retry-options

Conversation

@iamnamananand996
Copy link
Copy Markdown
Contributor

Description

Linear ticket: Closes FER-10182

Adds a max_retries: keyword argument to the root Client constructor 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-time maxRetries setting in generators.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).

# Before — consumer can't override retries at runtime
client = MyApi::Client.new(token: "...")

# After — consumer can override the default retry count
client = MyApi::Client.new(token: "...", max_retries: 5)

The constructor default still respects the configured customConfig.maxRetries (falling back to 2 when unset), so existing behavior is preserved for SDK authors who already pinned a value in generators.yml. The argument is threaded through to RawClient.new(...), whose retry logic was already in place.

Changes Made

  • generators/ruby-v2/sdk/src/root-client/RootClientGenerator.ts: add max_retries keyword parameter (typed Integer, default = customConfig.maxRetries ?? 2) and pass it through to RawClient.new(...) after the existing headers: argument.
  • generators/ruby-v2/sdk/changes/unreleased/add-client-level-max-retries.yml: feat changelog entry.
  • seed/ruby-sdk-v2/**/lib/**/client.rb: regenerated snapshots (132 fixtures) — all now expose max_retries: on the root Client.initialize and forward it to RawClient.
  • Updated README.md generator (if applicable) — N/A, the existing README snippet already documents this option.

Testing

  • Unit tests added/updated — existing ruby-v2 unit suites still pass (pnpm turbo run test --filter='@fern-api/ruby-*' → 104 ast + 33 dynamic-snippets + 6 sdk tests passed; existing maxRetries.test.ts config schema tests unchanged).
  • Manual testing completed — ran pnpm seed test --generator ruby-sdk-v2 --skip-scripts across 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) → forwards max_retries: max_retries to RawClient.new.
    • seed/ruby-sdk-v2/multi-url-environment/lib/seed/client.rb: parameter placed after environment:, still forwarded correctly with the multi-URL base_url: resolution.
    • seed/ruby-sdk-v2/basic-auth/wire-tests/lib/seed/client.rb: headers are built into a local variable then passed alongside max_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 so max_retries: follows on its own line. The internal auth_raw_client is intentionally left untouched (internal-only).

Link to Devin session: https://app.devin.ai/sessions/82a9f76b68ad40efbc9aaebca894e8fb
Requested by: @iamnamananand996

@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@iamnamananand996 iamnamananand996 marked this pull request as ready for review June 1, 2026 17:18
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

SDK Generation Benchmark Results

Comparing PR branch against median of 5 nightly run(s) on main (latest: 2026-06-01T05:35:53Z).

Full benchmark table (click to expand)
Generator Spec main (generator) main (E2E) PR (generator) Delta
ruby-sdk-v2 square 90s (n=5) 125s (n=5) 89s -1s (-1.1%)

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 fern generate). main (E2E): full customer-observable time including build/test scripts (nightly baseline, informational). Delta is computed against generator-only baseline.
⚠️ = generation exited with a non-zero exit code (timing may not reflect a successful run).
Baseline from nightly runs on main (latest: 2026-06-01T05:35:53Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-06-01 17:23 UTC

@iamnamananand996 iamnamananand996 merged commit 328d1be into main Jun 1, 2026
120 checks passed
@iamnamananand996 iamnamananand996 deleted the devin/fer-10182-ruby-client-level-retry-options branch June 1, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants