feat(mapper): add entity-proto mappers#224
Merged
Merged
Conversation
1 task
yushan8
force-pushed
the
yushan/streaming-split
branch
from
July 20, 2026 19:31
2f87a76 to
eacdca8
Compare
yushan8
marked this pull request as ready for review
July 20, 2026 19:40
yushan8
added a commit
that referenced
this pull request
Jul 20, 2026
## Summary - Adds entity-proto mappers for target graph and changed targets responses - `ResultToTargetGraph` — converts `targethasher.Result` into ID-mapped entity types - `GetTargetGraphResponseToProto` / `ChangedTargetsResponseToProto` — entity→proto conversions for gRPC streaming - `ProtoToGetTargetGraphRequest` — proto→entity request conversion This PR is addresses this comment to split up the Result -> Optimized target entity conversion, and OptimizedTarget -> `GetTargetGraphResponseToProto` #206. These mappers are used to avoid leaking proto definitions into internals such as storage and orchestrator. ## Stack 1. #224 (streaming split utilities) 2. **This PR** (entity-proto mappers) 3. #222 (storage JSON rewrite) 4. #212 (callsite migration) ## Test plan - [x] `make build && make test && make gazelle` --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
xytan0056
reviewed
Jul 21, 2026
| @@ -0,0 +1,97 @@ | |||
| package mapper | |||
Contributor
There was a problem hiding this comment.
for #222 (comment)
I meant the naming, we have 2 mapper pakage? internal/mapper and mapper
Contributor
Author
There was a problem hiding this comment.
Internally we're importing ResultToTargetGraph so we need the API to be visible. There could be custom orchestrator implementations that's running bazel query -> targethasher -> ResultToTargetGraph -> upload to storage.
1 task
xytan0056
approved these changes
Jul 21, 2026
yushan8
marked this pull request as draft
July 21, 2026 20:56
yushan8
added a commit
that referenced
this pull request
Jul 21, 2026
#226) ## Summary Adds `internal/streaming` package for splitting gRPC stream messages by wire size to stay under the per-message size limit. Also adds `Size()` to `entity.OptimizedTarget` for 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 single `stream.Send()`. Without splitting, large monorepos would exceed the gRPC message size limit. ## Stack 1. **This PR** (streaming utilities) 2. #224 (entity-proto mappers, retargeted) 3. #222 (storage JSON + entity migration) ## Test plan - [x] `make build && make test && make gazelle` --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
yushan8
added a commit
that referenced
this pull request
Jul 21, 2026
## Summary - Adds entity-proto mappers for target graph and changed targets responses - `ResultToTargetGraph` — converts `targethasher.Result` into ID-mapped entity types - `GetTargetGraphResponseToProto` / `ChangedTargetsResponseToProto` — entity→proto conversions for gRPC streaming - `ProtoToGetTargetGraphRequest` — proto→entity request conversion This PR is addresses this comment to split up the Result -> Optimized target entity conversion, and OptimizedTarget -> `GetTargetGraphResponseToProto` #206. These mappers are used to avoid leaking proto definitions into internals such as storage and orchestrator. ## Stack 1. #224 (streaming split utilities) 2. **This PR** (entity-proto mappers) 3. #222 (storage JSON rewrite) 4. #212 (callsite migration) ## Test plan - [x] `make build && make test && make gazelle` --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
yushan8
force-pushed
the
yushan/streaming-split
branch
from
July 21, 2026 22:29
60f3ec2 to
f988cfc
Compare
yushan8
marked this pull request as ready for review
July 21, 2026 22:39
## Summary - Adds entity-proto mappers for target graph and changed targets responses - `ResultToTargetGraph` — converts `targethasher.Result` into ID-mapped entity types - `GetTargetGraphResponseToProto` / `ChangedTargetsResponseToProto` — entity→proto conversions for gRPC streaming - `ProtoToGetTargetGraphRequest` — proto→entity request conversion This PR is addresses this comment to split up the Result -> Optimized target entity conversion, and OptimizedTarget -> `GetTargetGraphResponseToProto` #206. These mappers are used to avoid leaking proto definitions into internals such as storage and orchestrator. ## Stack 1. #224 (streaming split utilities) 2. **This PR** (entity-proto mappers) 3. #222 (storage JSON rewrite) 4. #212 (callsite migration) ## Test plan - [x] `make build && make test && make gazelle` --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
yushan8
force-pushed
the
yushan/streaming-split
branch
from
July 21, 2026 22:40
f988cfc to
a1ca3d7
Compare
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 entity-proto mapping functions for the controller and orchestrator layers:
internal/mapper/— proto↔entity converters (GetTargetGraphResponseToProto,ChangedTargetsResponseToProto,ProtoToGetTargetGraphRequest,ProtoToBuildDescription,ToProtoError)mapper/— top-levelResultToTargetGraphfor convertingtargethasher.Resultinto ID-mapped entity types (importable by external consumers)Stack
Test plan
make build && make test && make gazelle