feat(streaming): add streaming split utilities for gRPC message sizing#226
Merged
Conversation
Add internal/streaming package with: - SplitBySize: generic function to split items into groups by wire size - SplitMetadata: splits metadata maps into multiple messages - SplitTargetGraph: splits targets and metadata into wire-safe response chunks Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Add Size() method directly on entity.OptimizedTarget using packed protobuf wire size calculation, so SplitTargetGraph works with plain entity types throughout without converting to proto intermediaries. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Inline the size-based grouping directly over the targets slice instead of allocating a parallel []*OptimizedTarget pointer slice to satisfy the Sizer generic constraint. For large monorepos with hundreds of thousands of targets, this eliminates a needless pointer-per-target allocation. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 task
xytan0056
approved these changes
Jul 21, 2026
yushan8
marked this pull request as draft
July 21, 2026 20:56
Move varintSize to an exported wire.VarintSize in a shared package so both entity and internal/streaming import it instead of each maintaining a copy. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
yushan8
marked this pull request as ready for review
July 21, 2026 22:10
yushan8
added a commit
that referenced
this pull request
Jul 22, 2026
## Summary Adds entity-proto mapping functions for the controller and orchestrator layers: - `internal/mapper/` — proto↔entity converters (`GetTargetGraphResponseToProto`, `ChangedTargetsResponseToProto`, `ProtoToGetTargetGraphRequest`, `ProtoToBuildDescription`, `ToProtoError`) - `mapper/` — top-level `ResultToTargetGraph` for converting `targethasher.Result` into ID-mapped entity types (importable by external consumers) ## Stack 1. #226 (streaming utilities) 2. **This PR** (entity-proto mappers) 3. #222 (storage JSON + entity migration) ## Test plan - [x] `make build && make test && make gazelle` Co-authored-by: Claude Sonnet 5 <noreply@anthropic.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.
Summary
Adds
internal/streamingpackage for splitting gRPC stream messages by wire size to stay under the per-message size limit. Also addsSize()toentity.OptimizedTargetfor proto wire size estimation without importing protobuf.Target graphs are split into bounded chunks before writing to storage. When the controller reads back, each
Read()returns one pre-split chunk that fits in a singlestream.Send(). Without splitting, large monorepos would exceed the gRPC message size limit.Stack
Test plan
make build && make test && make gazelle