Add anthropics/connect-rust plugin v0.4.2#2334
Conversation
61b03f3 to
eca199a
Compare
eca199a to
f42cc7a
Compare
f42cc7a to
92259e7
Compare
|
changed to crate ref instead of github ref 👍 |
92259e7 to
314f1da
Compare
314f1da to
b60cff4
Compare
| # The plugin accepts `extern_path=.=<rust_path>` (or the shorthand | ||
| # `buffa_module=<rust_path>`) to tell it where the buffa-generated message | ||
| # types live. BSR should inject this based on the buffa dep's SDK crate | ||
| # name, same as tonic receives extern_path for its prost dep. Leaving | ||
| # opts empty here; please advise if an explicit entry is needed. | ||
| opts: [] |
There was a problem hiding this comment.
should be fine to leave this empty, and the BSR will figure out extern_path settings using the prost syntax 👍.
| # https://github.com/anthropics/connect-rust/blob/v0.3.2/connectrpc/Cargo.toml | ||
| - name: "connectrpc" | ||
| req: "0.3.2" | ||
| default_features: true |
There was a problem hiding this comment.
silly non-expert-in-rust question: I see the default features; those don't include the tls feature, but is that just something that is "enabled" by having the various "deps" in the sub-features installed? (Mostly trying to confirm that someone consuming this generated SDK could still use the TLS features.)
There was a problem hiding this comment.
[claude code] Yes — Cargo features are additive and unified per-crate across the dependency graph. The generated SDK crate only needs connectrpc's default features for the generated code to compile, so that's all it declares. A consumer who wants TLS adds their own direct dependency in their application's Cargo.toml:
connectrpc = { version = "0.4", features = ["tls"] }Cargo then compiles connectrpc once with the union of features requested by both the SDK crate and the application, so tls (and client-tls / server-tls / any other optional feature) is fully available. Same model the tonic SDK crates use — the SDK doesn't gate runtime features.
b60cff4 to
114550b
Compare
|
[claude code] Updated to I haven't been able to check in |
Adds the
protoc-gen-connect-rustplugin for ConnectRPC Rust service bindings, under the new top-levelanthropicsorg as requested in earlier review.About connect-rust
connect-rust is a Tower-based Rust implementation of the ConnectRPC protocol:
request.nameis a&strborrow into the decoded bufferCrates on crates.io:
connectrpc,connectrpc-codegen,connectrpc-build.Plugin layering
The plugin emits service stubs only - server traits, typed clients, monomorphic dispatchers. Message types come from
buf.build/anthropics/buffa(declared indeps:). Generated stubs reference message types via absolute Rust paths configured withextern_path.With
file_per_package(set inopts), the plugin emits one<dotted.package>.rsfile per proto package, mirroring theanthropics/buffaplugin'sfile_per_package=trueopt. Matches the prost/tonic filename convention the BSR Rust SDKlib.rssynthesis already understands.Dockerfile note: the
protoc-gen-connect-rustbinary is a[[bin]]target inside theconnectrpc-codegencrate, socargo install connectrpc-codegenis what produces it.Open question: extern_path injection —
plugin.sumnot yet checked inThe plugin needs to know where the buffa-generated message types live so it can emit absolute paths. It accepts either
extern_path=.=<rust_path>(same format as tonic/prost) or the shorthandbuffa_module=<rust_path>. Without one of these, generation fails:The
tests/harness runs the plugin standalone with only theoptsfrombuf.plugin.yaml, somake test PLUGINS=anthropics/connect-rustfails at this step and I haven't checked inplugin.sumfiles yet.I'd like to understand how the BSR Rust SDK pipeline handles the
deps:relationship so I can set the right opt:buffa_module=crateor similar — but then the<dotted.pkg>.rsfilenames from the two plugins would collide and one would need a distinguishing suffix (the way tonic emits<pkg>.tonic.rs). Happy to add that toprotoc-gen-connect-rustif so.buffa_module=::<buffa_sdk_crate_name>— but the crate name is dynamic per BSR module, so the BSR would need to inject it.Can you confirm which model the BSR uses, and what — if anything — it injects into a dependent plugin's opts at SDK build time? Once I know I'll set the opt (or add a
testOverrideOptionsentry like prost-crate'sno_features), regenerate, and check inplugin.sum.Dependencies
Depends on the buffa plugin landing first: #2333