drop [patch.crates-io] now that buffa 0.4.0 is published#71
Draft
drop [patch.crates-io] now that buffa 0.4.0 is published#71
Conversation
The git-rev pin at 4d2023d was a placeholder until buffa 0.4.0 hit crates.io; it has, and the workspace deps are already at version = "0.4", so the patch block is no longer needed (and would block cargo publish).
iainmcgin
added a commit
to siketyan/connect-rust
that referenced
this pull request
Apr 30, 2026
) * adapt to buffa 0.4: __buffa:: sentinel paths + ViewEncode buffa#62 split codegen output into 5 content files + a per-package `.mod.rs` stitcher and moved view/oneof types under a `__buffa::` sentinel module. buffa#55 added `ViewEncode` for borrowed-field serialization (additive, no integration changes needed here yet). - connectrpc-codegen: service stubs now set `package`/`kind` on `GeneratedFile`; in unified mode they merge into buffa's `<stem>.rs` (Owned) file as before, in split mode they emit their own `<pkg>.mod.rs` stitcher. `rust_view_type()` rewritten to insert `__buffa::view::` at the package boundary via `rust_type_relative_split()` (handles same-/cross-package and extern-path cases). - connectrpc-build: write all 6 files/proto, wire only `PackageMod` entries into the include tree (the stitcher pulls the rest via `include!`). - examples/conformance/tests: adopt `__buffa::view::` / `__buffa::oneof::` paths; `Any.value` is now `bytes::Bytes`. - Regenerated checked-in code under conformance/ and examples/multiservice/. `[patch.crates-io]` pins buffa at git rev 3f80d56 until 0.4.0 is published; at release, swap `version = "0.3"` → `"0.4"` and drop the patch block. * benches: add echo_bloat codec-layer bench for ViewEncode Measures the four {owned,view}×{decode,encode} combinations on a 2.2KB string-heavy echo payload (8 strings, 9 tags, 11-entry map, 6 nested headers) to quantify ViewEncode's impact at the codec layer. Result on this branch: view→view 1.79× over the move-based owned baseline; the half-paths (view→owned, owned→view) are 0.80×/0.87× because they pay container-rebuild cost the move baseline doesn't. ViewEncode is what flips view-decode from a regression to a win for echo-shaped handlers. Also fixes `__buffa::view::` import paths in the existing bench server bins (collateral from buffa#62). * benches: echo_bloat shape sweep — 5 payload shapes × move/clone baselines Extends the codec-layer ViewEncode bench to map out when view→view wins big (map_dominated 3.4×, many_small_strings 2.0×) vs barely (deep_nested 1.15× — MessageFieldView boxing; scalar_heavy 1.19×), and when half-paths matter (only against a clone-baseline: 1.5–1.8×; against move-baseline they're a wash). Multiplier scales with string-alloc count + HashMap insert overhead + decode-side bytes copied, and is suppressed by nesting depth. * review feedback: dedupe extern-coverage checks, doc fixes - Extract `check_extern_coverage` / `fallback_unresolved` helpers so `resolve_path` and `rust_view_type` share one error-message source instead of copy-pasting the bail! text. - Update `generate_files` doc for the 6-files-per-proto stitcher model. - Note that echo_bloat benches the codec layer ahead of the view-response handler API it motivates. - Comment the `{:?}` Debug-format trick in the stitcher emitter. * cargo fmt * benches: replace JWT-shaped placeholder to avoid secret-scanner false positive * cargo +nightly fmt (CI uses nightly rustfmt) * benches: fanout sweep + prosecutor-honesty fixes Adds a fanout benchmark (decode once → N×{build+encode} for N∈{1,4,16,64}) modeling a 1-source-to-N-readers service. At N≥16 both owned/view and view/view converge on ~3.5× — ViewEncode alone delivers nearly the full win since decode amortizes to nothing. Honesty fixes after adversarial review: - Added `identity` reference (decode→encode, no rebuild). Confirms move-based owned/owned is within ~1% of true identity, so the field-by-field rebuild was not inflating the baseline. - Dropped the `bench_shape_clone!` variants — they decoded then cloned, which mislabeled the `Arc<AppState>` scenario (state isn't decoded). The fanout bench is the honest model for that case; for build-from-resident-state without decode, see buffa's `build_encode` benches. - Doc rewrite reflecting the above. * benches: maintainability pass — README, add-a-shape guide, fanout macro - README.md for benches/rpc with run/filter instructions and a pointer to the add-a-shape guide. - echo_bloat.rs: "Adding a new shape" comment block; bench_fanout fn → macro so any shape with clone_from/borrow_from/reborrow_from helpers can be fanout-swept; identity-row explainer. - lib.rs: drop 11 echo_bloat-only view types from the public re-export — the bench file imports them directly now. Confirmed rpc-bench has zero production-code cost: publish=false, no workspace crate depends on it, no cfg-gates in connectrpc*. Declined a field-mapping macro for the four path fns — it'd cut ~250 lines but hide the per-path alloc story the explicit struct construction documents. * regenerate eliza for buffa#62 layout; mark benches/rpc generated in .gitattributes eliza was the only checked-in generated dir not regenerated in 99ce5c9 — its old single-file output happened to compile (PR anthropics#62/anthropics#55 are runtime-API-compatible) but was inconsistent with the rest. Regenerated and adopted the `__buffa::view::` import in client.rs/main.rs. Also adds `benches/rpc/src/generated/**` to .gitattributes (linguist-generated=true) so GitHub collapses its diff like the other three generated dirs. * bump buffa pin to release/v0.4.0 HEAD; regenerate for SizeCache + Option Advances the buffa patch from 3f80d56 to 4d2023d (release/v0.4.0 tip) and bumps workspace deps 0.3 -> 0.4. The four post-3f80d56 commits (buffa#67 fully-qualified Option, anthropics#70/anthropics#71 safe DefaultInstance, anthropics#22 externalized SizeCache) are all regenerate-only for connectrpc. - Regenerated all checked-in code (conformance, eliza, multiservice, benches/rpc): structs lose __buffa_cached_size, impls gain &mut SizeCache params, Option becomes ::core::option::Option. - benches: compute_size() -> encoded_len() (the provided method; compute_size now needs a SizeCache). - buffa:link: add buffa-descriptor to the path-override template and cargo-update list, matching the workspace patch set. - CHANGELOG: note SizeCache externalization and the encoded_len() migration for direct compute_size callers. * docs: add __buffa::view::* import to guide.md quick-start The buffa#62 stitcher layout moved view types under <pkg>::__buffa::view::, so the glob import on the package module no longer brings GreetRequestView into scope. Add the second glob to match what tests/streaming and examples/streaming-tour already do. * review: nested-view-path test, plugin output doc, Bytes idiom - codegen: add nested_message_view_type_mirrors_owned_module_nesting test verifying rust_view_type() inserts __buffa::view:: at the package boundary (not the type boundary) for Outer.Inner. - codegen: document that the plugin now also emits <pkg>.mod.rs stitchers and that they intentionally share filenames with protoc-gen-buffa's, requiring a separate output dir + protoc-gen-buffa-packaging to wire both. - codegen: drop intra-doc-link brackets on rust_type_relative_split (foreign-type method, doesn't resolve). - conformance/client: &m.value[..] -> m.value.as_ref() for Bytes. --------- Co-authored-by: Iain McGinniss <309153+iainmcgin@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
buffa 0.4.0 is on crates.io; the git-rev pin (added in #62) is no longer needed and would block
cargo publish. Workspace deps are already atversion = "0.4".