refactor: replace cloud longrunningpb with proto-only generated package#126
Closed
paultyng wants to merge 1 commit into
Closed
refactor: replace cloud longrunningpb with proto-only generated package#126paultyng wants to merge 1 commit into
paultyng wants to merge 1 commit into
Conversation
Replace cloud.google.com/go/longrunning/autogen/longrunningpb with a locally generated proto-only package at internal/longrunningpb/. The api-linter only uses OperationInfo message types and E_OperationInfo extension metadata, never gRPC clients/servers. This removes the entire gRPC dependency chain from the runtime binary, critical for WASM builds where binary size directly impacts memory usage in constrained sandboxes (e.g., buf's 512 MiB WASM limit). Includes: - Proto-only longrunningpb generated via buf generate (no gRPC stubs) - buf.gen.yaml with inputs config for reproducible generation - make generate / make checkgenerate targets - CI step to verify generated code is up-to-date - Pinned buf-action and protoc-gen-go versions in CI
Author
|
buf bumped their limit to 1gb, so I don't think this is as big of an issue any longer! bufbuild/buf#4503 |
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.
cloud.google.com/go/longrunning/autogen/longrunningpbincludes gRPC service stubs, pulling the entire gRPC dependency chain (~90 transitive packages) into any binary that imports the api-linter. The api-linter only usesOperationInfoandE_OperationInfofrom that package, never gRPC clients or servers.buf's WASM plugin runtime caps memory at 512 MiB with no user-facing override. When the api-linter is compiled to WASM as a buf check plugin, the gRPC init-time overhead can cause OOM during package initialization before any proto analysis begins in some runtime environments.
This replaces the import with a proto-only generated package at
internal/longrunningpb/(generated viabuf generatewith no gRPC plugin). Includesmake generate/make checkgeneratefor reproducible regeneration. The proto remains in its canonical location, so no worry of drift there.I have a PR with buf on this from the other side as well (increase the limit or allow us to override): bufbuild/buf#4504