fix(rust): only clear config.environment in wire tests when multiple base URLs exist, fix pagination error tests#15856
Conversation
…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>
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.
config.environment in wire tests when multiple base URLs exist, fix pagination error tests
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
Fixes two issues in the Rust SDK generator that broke generated wire tests and pagination unit tests:
config.environment = None;for the WireMock test setup. Single-URL SDKs do not expose anenvironmentfield onClientConfig, 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).ApiError::Serialization, which is not a valid variant in the currentApiErrorenum, so the test file failed to compile. Switched the test fixtures toApiError::Configuration, which is the appropriate variant for synthesizing a configuration-style error from the paginator callback.Seed snapshots for
rust-sdkfixtures (multi-url-environment,pagination,single-url-environment-default/{basic,custom-environment,full-custom}) were regenerated to reflect the above. The single-URLfull-customwire test no longer carries the unusedconfig.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 theconfig.environment = None;emission onthis.context.hasMultipleBaseUrls().generators/rust/base/src/asIs/pagination.rs: switch the synchronous-paginator error tests fromApiError::SerializationtoApiError::Configuration.seed/rust-sdk/**snapshots for the affected fixtures (pagination.rs,tests/dummy_test.rs,.fern/metadata.json).Testing
Link to Devin session: https://app.devin.ai/sessions/2e4e587dd160400390839880a5434932
Requested by: @iamnamananand996