Skip to content

feat(internal/sidekick/rust): support used_if streaming package deps - #7345

Merged
suzmue merged 2 commits into
googleapis:mainfrom
suzmue:streaming-deps
Aug 20, 2026
Merged

feat(internal/sidekick/rust): support used_if streaming package deps#7345
suzmue merged 2 commits into
googleapis:mainfrom
suzmue:streaming-deps

Conversation

@suzmue

@suzmue suzmue commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Add support for resolving package dependencies marked with used-if=streaming when bidirectional streaming is enabled and present in the service model.

Previously, gRPC and streaming dependencies were hardcoded directly in Cargo.toml.mustache behind HasBidiStreaming. With this change, these dependencies can be dynamically specified in librarian.yaml via package_dependencies and conditionally included only when streaming methods are generated.

For #6835

@suzmue
suzmue requested a review from a team as a code owner August 19, 2026 23:00
@suzmue

suzmue commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

googleapis/google-cloud-rust#6476 shows the google-cloud-rust changes

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors Rust package dependency resolution to dynamically include streaming-related dependencies (such as prost and futures) based on whether bidirectional streaming is enabled, rather than hardcoding them in Cargo.toml. The reviewer feedback correctly points out that this logic should be extended to support unidirectional streaming as well. To achieve this, the reviewer suggests replacing the hasBidiStreaming check with a more comprehensive hasStreaming helper that covers both bidirectional and unidirectional streaming methods, and updating all dependent calls and tests accordingly. Additionally, the reviewer recommends removing a conditional guard in the tests to ensure strict validation of required packages.

Comment thread internal/sidekick/rust/used_by_test.go
Comment thread internal/sidekick/rust/used_by_test.go
Comment thread internal/sidekick/rust/codec.go
Comment thread internal/sidekick/rust/annotate_model.go
Comment thread internal/sidekick/rust/used_by_test.go
Comment thread internal/sidekick/rust/used_by_test.go
Comment thread internal/sidekick/rust/used_by_test.go
Comment thread internal/sidekick/rust/used_by_test.go
Comment thread internal/sidekick/rust/used_by_test.go
Comment thread internal/sidekick/rust/annotate_model_test.go Outdated
…dencies

Add support for resolving package dependencies marked with used-if=streaming
when bidirectional streaming is enabled and present in the service model.

Previously, gRPC and streaming dependencies were hardcoded directly in
Cargo.toml.mustache behind HasBidiStreaming. With this change, these
dependencies can be dynamically specified in librarian.yaml via
package_dependencies and conditionally included only when streaming methods
are generated.
…notations test

Remove the len guard and use cmpopts.EquateEmpty to strictly validate
RequiredPackages in TestModelAnnotationsHasBidiStreaming. Also standardize
the error message format for mismatch diffs.
@suzmue
suzmue merged commit 084470b into googleapis:main Aug 20, 2026
40 checks passed
@suzmue
suzmue deleted the streaming-deps branch August 20, 2026 17:14
codyoss pushed a commit that referenced this pull request Aug 25, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.39.0](v0.38.0...v0.39.0)
(2026-08-25)


### Features

* **dart:** exclude all generate files
([#7367](#7367))
([7d03e50](7d03e50))
* **go:** add control for the protobuf code generation level
([#7351](#7351))
([1476dd0](1476dd0))
* **internal/librarian/php:** allow skipping GAPIC client generation
([#7332](#7332))
([8702675](8702675))
* **internal/librarian/php:** allow skipping sample generation
([#7348](#7348))
([8ac4c94](8ac4c94))
* **internal/librarian/php:** explicitly set copyright years during
post-processing
([#7328](#7328))
([5df5834](5df5834))
* **internal/librarian/php:** initialize default library version on add
([#7381](#7381))
([1baf7d9](1baf7d9)),
refs [#7382](#7382)
* **internal/librarian/php:** support excluding protos from generation
([#7335](#7335))
([f3a328b](f3a328b))
* **internal/librarian/ruby:** forward ruby cloud title option and add
beyondcorp titles
([#7364](#7364))
([14f8e33](14f8e33))
* **internal/sidekick/rust:** refactor bidi streaming templates
([#7312](#7312))
([1119b7a](1119b7a)),
refs [#6835](#6835)
* **internal/sidekick/rust:** support server-side streaming in gapics
([#7372](#7372))
([7e1065d](7e1065d)),
refs [#7373](#7373)
* **internal/sidekick/rust:** support used_if streaming package deps
([#7345](#7345))
([084470b](084470b)),
refs [#6835](#6835)
* **sidekick/rust:** bigquery generated types will move to model_ext
([#7365](#7365))
([4eaeba5](4eaeba5))
* **sidekick/swift:** clients are `Sendable`
([#7390](#7390))
([605505f](605505f))
* **sidekick/swift:** generate doc landing page
([#7353](#7353))
([50fae5d](50fae5d))
* **sidekick/swift:** generate smaller LROs
([#7334](#7334))
([f945e9d](f945e9d))
* **sidekick/swift:** use `_QueryParameterEncoder`
([#7356](#7356))
([bed3922](bed3922))
* **sidekick/swift:** use `@_spi` for some imports
([#7318](#7318))
([9d4a5b3](9d4a5b3))
* **sidekick/swift:** use `@_spi` in retry stub
([#7357](#7357))
([c5c8aed](c5c8aed))
* **swift:** support gRPC routing parameter extraction
([#7346](#7346))
([2aa5ef5](2aa5ef5))
* **swift:** support service name overrides for doc link resolution
([#7319](#7319))
([7637cf6](7637cf6))


### Bug Fixes

* **dart:** use `[@doc](https://github.com/doc)Import` for service
exceptions
([#7322](#7322))
([f72812a](f72812a))
* **internal/librarian/ruby:** forward all ruby cloud opts to generator
([#7360](#7360))
([ba46b05](ba46b05))
* **internal/sidekick/rust:** use anyhow::Result in bidi streaming
samples ([#7347](#7347))
([2c61bae](2c61bae))
* **librarian/swift:** support showcase generation
([#7338](#7338))
([50aa62e](50aa62e))
* **sidekick/rust:** redundant body fields
([#7378](#7378))
([65ff2ca](65ff2ca))
* **tool/cmd/migrate/php:** parse and extract gapic_yaml from
BUILD.bazel
([#7355](#7355))
([1a47f13](1a47f13))

---
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants