Repository navigation
fix(a2a-pb): generate the gRPC code into OUT_DIR - #409
Merged
Merged
Conversation
The build script wrote the prost/tonic output into the crate's own src/gen, so every dependent's build wrote into its copy of a2a-pb: from a read-only source (cargo vendor, the Nix store, a sandbox) the build script failed with PermissionDenied, and with the current tonic-prost-build the dependent's build rewrote the shipped sources. The code is now generated into OUT_DIR/grpc and included from there, like the protojson pass already is, and the checked-in copy is gone. A test asserts the build leaves no src/gen behind. Fixes: a2aproject#402 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: gulldan <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Merged
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.
Fixes #402.
Problem
a2a-pb/build.rswrote the prost/tonic output with.out_dir("src/gen"), into the crate's own sources, so every dependent's build wrote into its copy ofa2a-pb. From a read-only source —cargo vendoroutput, the Nix store, a sandboxed build — the build script failed withPermissionDenied. And because a dependent resolves the current tonic-prost-build (0.14.9, which adds#[allow(clippy::all)]) while this repository locks 0.14.6, a dependent's build also rewrote the shippedsrc/genit was about to compile.Fix
The gRPC pass now writes to
OUT_DIR/grpc, andprotoincludes it from there, asprotojsonalready includes the second pass fromOUT_DIR. The checked-insrc/gen(lf.a2a.v1.rs, andgoogle.api.rs, which nothing included) is removed. The public modules and types are unchanged.Tests
a2a-pb/tests/read_only_source.rs: asserts the build leaves nosrc/genin the crate. Onmainit fails (…/a2a-pb/src/gen exists); it also fails if a later change writes there again, since the build would recreate the directory.cargo package -p a2a-pbfrom this branch, unpacked into a read-only directory and used as a path dependency: builds, anda2a_pb::proto::a2a_service_server::A2aServiceServeranda2a_pb::protojson::Taskresolve. The same build from the published 0.3.2 fails as shown in [Bug]: a2a-pb: build script writes generated code into its own src/gen, so a read-only source fails to build #402.cargo metadata --locked,cargo hack check --all-targets --each-feature,cargo fmt --check,cargo hack clippy --all-targets --each-feature -- -D warnings,cargo test --workspace --exclude itk-rust-current-agent, copyright headers — all green.Notes
protoc-bin-vendored(eight per-platform protoc crates) and tonic stay build requirements.src/genfor A2A 1.1, and keep.out_dir("src/gen"), so on the stack this is the same smallbuild.rs/lib.rschange plus deleting the regenerated files. Happy to rebase once the stack lands.🤖 Generated with Claude Code