Repository navigation
feat(internal/sidekick/rust): initialize bidi streaming RPCs eagerly - #7221
Conversation
Initialize bidirectional streaming RPCs eagerly on send instead of deferring transport dialing until the first message is written to the channel in a background task. Stream builders now support field setters and with_request to configure the initial request message, and send initiates the stream immediately, surfacing connection errors to the caller.
There was a problem hiding this comment.
Code Review
This pull request refactors the Rust template code for bidirectional streaming RPCs. It renames the builder's build method to send, which now accepts an initial request and returns a Result. The stub, tracing, and transport layers are updated to propagate this request and return a Result. In the transport layer, the connection setup is now awaited directly, allowing stream initiation errors to be returned immediately to the caller. I have no feedback to provide as there are no review comments.
coryan
left a comment
There was a problem hiding this comment.
In Swift we started writing unit tests to verify the mustache template output matches expectations.... For example:
librarian/internal/sidekick/swift/generate_enum_swift_test.go
Lines 90 to 103 in 5a7775a
I think these are less annoying than golden file tests, and will avoid somebody accidentally changing the template to return the wrong thing.
The downside is that they trigger errors if you change spaces or indentation in the mustache templates.
Consider starting a few such tests with this PR.
…tion Add table-driven unit tests for Rust bidirectional streaming code generation, verifying the mustache template output across builder, stub, dynamic stub, tracing, and transport files. For googleapis#6835
🤖 I have created a release *beep* *boop* --- ## [0.34.0](v0.33.0...v0.34.0) (2026-08-08) ### Features * **dart:** add a setup skill ([#7193](#7193)) ([d322aa0](d322aa0)) * **dart:** implement bump ([#6989](#6989)) ([5505997](5505997)) * **internal/librarian/php:** derive component name with config override in generate ([#7197](#7197)) ([557e664](557e664)), refs [#7025](#7025) * **internal/librarian/php:** derive lowercase hyphenated php library names from api path ([#7215](#7215)) ([4669112](4669112)) * **internal/librarian/php:** initialize new component before generation ([#7225](#7225)) ([b6c50b4](b6c50b4)) * **internal/librarian/ruby:** support deleting output paths after generation ([#7223](#7223)) ([609ffb7](609ffb7)), refs [#6633](#6633) * **internal/librarian/rust:** support external type conversions ([#7212](#7212)) ([5b72c52](5b72c52)), refs [#7144](#7144) * **internal/proto:** add package to gather proto files ([#7218](#7218)) ([9646f09](9646f09)), refs [#7217](#7217) * **internal/sidekick/rust:** initialize bidi streaming RPCs eagerly ([#7221](#7221)) ([cbfa368](cbfa368)), refs [#6835](#6835) * **internal/sidekick/rust:** support type-erased streaming handles ([#7229](#7229)) ([17f5a3d](17f5a3d)), refs [#6835](#6835) * **internal/sidekick/rust:** use builder pattern for bidi methods ([#7203](#7203)) ([bc90045](bc90045)), refs [#6835](#6835) * **internal/tool/composer:** use entrypoint configuration instead of package names ([#7156](#7156)) ([e33192f](e33192f)) * **sidekick/rust:** bigquery query creation metadata ([#7167](#7167)) ([d70f2a2](d70f2a2)) * **swift:** conversions support map fields ([#7222](#7222)) ([341f1e5](341f1e5)) * **swift:** protobuf conversions support oneofs ([#7205](#7205)) ([40c48df](40c48df)) * **swift:** support skipped_ids in configuration ([#7206](#7206)) ([95d3464](95d3464)) ### Bug Fixes * **internal/librarian/php:** remove version suffix from init namespace ([#7227](#7227)) ([7fb3b46](7fb3b46)) * **internal/librarian/ruby:** pass gem namespace option to generator ([#7210](#7210)) ([817146f](817146f)) * **internal/librarian/ruby:** pass service override option to generator ([#7208](#7208)) ([e9886bf](e9886bf)), refs [#6633](#6633) * **internal/librarian/ruby:** search proto recursively in API path ([#7220](#7220)) ([3d4a4a1](3d4a4a1)), refs [#7219](#7219) [#7217](#7217) * **internal/librarian/rust:** preserve parent messages of used types ([#7170](#7170)) ([e51520c](e51520c)), refs [#7143](#7143) * **internal/serviceconfig:** update config for compute ([#7200](#7200)) ([a08e565](a08e565)) * **internal/sidekick/rust:** use from for repeated enum conversions in convert-prost ([#7211](#7211)) ([ee4fb71](ee4fb71)) ### Performance Improvements * **java:** batch format all libraries using argument file ([#7186](#7186)) ([5a7775a](5a7775a)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
…oogleapis#7221) Initialize bidirectional streaming RPCs eagerly on send instead of deferring transport dialing until the first message is written to the channel in a background task. Stream builders now support field setters and with_request to configure the initial request message, and send initiates the stream immediately, surfacing connection errors to the caller. This change is intended to be the minimal change needed to move the initialization logic and does not address other TODOs remaining in the transport implementation. This includes configuration for the channel values, which may mean we will not use RequestBuilder directly in the final implementation. For googleapis#6835
Initialize bidirectional streaming RPCs eagerly on send instead of deferring transport dialing until the first message is written to the channel in a background task.
Stream builders now support field setters and with_request to configure the initial request message, and send initiates the stream immediately, surfacing connection errors to the caller.
This change is intended to be the minimal change needed to move the initialization logic and does not address other TODOs remaining in the transport implementation. This includes configuration for the channel values, which may mean we will not use RequestBuilder directly in the final implementation.
For #6835