Skip to content

refactor: replace cloud longrunningpb with proto-only generated package#126

Closed
paultyng wants to merge 1 commit into
aep-dev:mainfrom
paultyng:pt-upstream-grpc-removal
Closed

refactor: replace cloud longrunningpb with proto-only generated package#126
paultyng wants to merge 1 commit into
aep-dev:mainfrom
paultyng:pt-upstream-grpc-removal

Conversation

@paultyng
Copy link
Copy Markdown

@paultyng paultyng commented Apr 24, 2026

cloud.google.com/go/longrunning/autogen/longrunningpb includes gRPC service stubs, pulling the entire gRPC dependency chain (~90 transitive packages) into any binary that imports the api-linter. The api-linter only uses OperationInfo and E_OperationInfo from 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 via buf generate with no gRPC plugin). Includes make generate / make checkgenerate for 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

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
@paultyng
Copy link
Copy Markdown
Author

buf bumped their limit to 1gb, so I don't think this is as big of an issue any longer! bufbuild/buf#4503

@paultyng paultyng closed this Apr 25, 2026
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.

1 participant