Skip to content

fix(rust): only clear config.environment in wire tests when multiple base URLs exist, fix pagination error tests#15856

Merged
iamnamananand996 merged 2 commits into
mainfrom
fix/rust-sdk-wire-test-environment-pagination
May 12, 2026
Merged

fix(rust): only clear config.environment in wire tests when multiple base URLs exist, fix pagination error tests#15856
iamnamananand996 merged 2 commits into
mainfrom
fix/rust-sdk-wire-test-environment-pagination

Conversation

@iamnamananand996
Copy link
Copy Markdown
Contributor

@iamnamananand996 iamnamananand996 commented May 12, 2026

Description

Linear ticket: Closes

Fixes two issues in the Rust SDK generator that broke generated wire tests and pagination unit tests:

  1. Wire test generator unconditionally emitted config.environment = None; for the WireMock test setup. Single-URL SDKs do not expose an environment field on ClientConfig, so the generated test failed to compile. The line is now only emitted when the SDK was generated against multiple base URLs (i.e. context.hasMultipleBaseUrls() is true).
  2. Pagination error-propagation tests in the Rust base template referenced ApiError::Serialization, which is not a valid variant in the current ApiError enum, so the test file failed to compile. Switched the test fixtures to ApiError::Configuration, which is the appropriate variant for synthesizing a configuration-style error from the paginator callback.

Seed snapshots for rust-sdk fixtures (multi-url-environment, pagination, single-url-environment-default/{basic,custom-environment,full-custom}) were regenerated to reflect the above. The single-URL full-custom wire test no longer carries the unused config.environment = None; line.

Note: this branch is stacked on top of #15854 (the ruby-v2 empty-comment RuboCop fix), so that commit appears in the diff. It will drop out once #15854 lands.

Changes Made

  • generators/rust/sdk/src/wire-tests/WireTestGenerator.ts: gate the config.environment = None; emission on this.context.hasMultipleBaseUrls().
  • generators/rust/base/src/asIs/pagination.rs: switch the synchronous-paginator error tests from ApiError::Serialization to ApiError::Configuration.
  • Regenerate seed/rust-sdk/** snapshots for the affected fixtures (pagination.rs, tests/dummy_test.rs, .fern/metadata.json).
  • Updated README.md generator (if applicable)

Testing

  • Unit tests added/updated
  • Manual testing completed (seed snapshots regenerated; the previously failing rust-sdk wire test and pagination unit tests now compile and run).

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

fern-support and others added 2 commits May 13, 2026 00:24
…fense

Types with no description were emitting a bare `#` line above the class
definition, triggering `Layout/EmptyComment`. Guard the Comment AST node
write path with `.trim()` so whitespace-only or empty docs produce no output.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix WireTestGenerator to only emit `config.environment = None` when
  the API has multiple base URLs; single-URL APIs don't have this field
  on ClientConfig, causing a compile error
- Fix pagination tests to use ApiError::Configuration (accepts String)
  instead of ApiError::Serialization (accepts serde_json::Error)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

@devin-ai-integration devin-ai-integration Bot changed the title Fix/rust sdk wire test environment pagination fix(rust): only clear config.environment in wire tests when multiple base URLs exist, fix pagination error tests May 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

SDK Generation Benchmark Results

Comparing PR branch against median of 5 nightly run(s) on main (latest: 2026-05-12T05:12:12Z).

Full benchmark table (click to expand)
Generator Spec main (generator) main (E2E) PR (generator) Delta
rust-sdk square 153s (n=5) 156s (n=5) 154s +1s (+0.7%)

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-05-12T05:12:12Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-05-12 19:35 UTC

@iamnamananand996 iamnamananand996 merged commit ff62457 into main May 12, 2026
72 of 73 checks passed
@iamnamananand996 iamnamananand996 deleted the fix/rust-sdk-wire-test-environment-pagination branch May 12, 2026 19:35
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