refactor(proto): add shared api/base proto contracts (Change, Strategy)#261
Open
behinddwalls wants to merge 2 commits into
Open
refactor(proto): add shared api/base proto contracts (Change, Strategy)#261behinddwalls wants to merge 2 commits into
behinddwalls wants to merge 2 commits into
Conversation
This was referenced Jun 17, 2026
84bbb33 to
d6ecbf8
Compare
behinddwalls
added a commit
that referenced
this pull request
Jun 17, 2026
…#258) ## Summary Stacked on top of `refactor` (#257). Moves all proto wire contracts into a single top-level `api/` tree organized by `domain/service`, and lays the groundwork for upcoming messagequeue payload contracts. - Relocate each service's `proto/` and `protopb/` dirs to `api/{domain}/{service}/` (history-preserving renames). New importpath: `github.com/uber/submitqueue/api/{domain}/{service}/protopb`. - Update `go_package`, all Bazel importpaths, root `gazelle:resolve` hints, consumer `deps`, and all Go imports. - Generalize the `tool/proto` codegen rule (`srcs` list) and the `make proto` copy loop to support **multiple `.proto` files per service package**, so messagequeue contracts can later live alongside each service's RPC contract under the same `api/{domain}/{service}/proto/` dir. - Update docs (`CLAUDE.md` project layout / import paths / proto-gen workflow, `example/README.md`). The proto `package` declarations are intentionally left unchanged (only `go_package` moved) to avoid churning wire-level type names. ## Test plan - [x] `make build` - [x] `make test` (54/54 pass) - [x] `make check-gazelle` - [x] `make lint` - [x] `make check-tidy` - [x] `make proto` produces zero drift vs committed stubs Made with [Cursor](https://cursor.com) ## Stack 1. @ #258 1. #261 1. #262 Co-authored-by: Cursor <cursoragent@cursor.com>
## Summary
### Why?
Each service's gateway proto redefines its own `Change` message (and SubmitQueue its own `Strategy` enum), duplicating wire contracts that are meant to stay identical across domains. This is the proto-level gap mirroring what `platform/base/{change,mergestrategy}` already solved for the Go entities, and Stovepipe's upcoming gateway API would otherwise add a third copy of `Change`.
### What?
Introduces an `api/base/` proto tree as the shared-wire-contract analog of `platform/base/`:
- Adds `api/base/change` (`uber.base.change.Change`) and `api/base/mergestrategy` (`uber.base.mergestrategy.Strategy`), each a message-only contract that domains import instead of redefining.
- Teaches the hermetic codegen rule (`tool/proto/proto_codegen.bzl`) to resolve cross-package proto `import`s (exec-root proto_path + imported sources as action inputs) and to skip the gRPC/YARPC generators for service-less contracts via a new `gen_services` attribute.
- Migrates the SubmitQueue gateway proto to import the shared `Change`/`Strategy` and drops its local definitions; updates Go consumers (land controller + unit/integration/e2e tests) to the shared `protopb` packages.
- Makefile now creates the `protopb/` output dir and marks copied stubs writable, so net-new proto packages generate cleanly.
Known cosmetic gazelle warning: resolving the new cross-proto import prints "multiple rules may be imported" for the `# keep` rules_go go_proto_library alias. It does not change generated BUILD files, the build, or the committed-files path that consumers resolve via the root `# gazelle:resolve go` directives.
## Test Plan
- ✅ `make proto` (regenerates stubs, including the message-only base protos)
- ✅ `./tool/bazel build //...` (213 targets)
- ✅ `make test` (54 unit tests pass)
- ✅ `make fmt`
Co-authored-by: Cursor <cursoragent@cursor.com>
edf2fe0 to
cc1c653
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
Why?
Each service's gateway proto redefines its own
Changemessage (and SubmitQueue its ownStrategyenum), duplicating wire contracts that are meant to stay identical across domains. This is the proto-level gap mirroring whatplatform/base/{change,mergestrategy}already solved for the Go entities, and Stovepipe's upcoming gateway API would otherwise add a third copy ofChange.What?
Introduces an
api/base/proto tree as the shared-wire-contract analog ofplatform/base/:api/base/change(uber.base.change.Change) andapi/base/mergestrategy(uber.base.mergestrategy.Strategy), each a message-only contract that domains import instead of redefining.tool/proto/proto_codegen.bzl) to resolve cross-package protoimports (exec-root proto_path + imported sources as action inputs) and to skip the gRPC/YARPC generators for service-less contracts via a newgen_servicesattribute.Change/Strategyand drops its local definitions; updates Go consumers (land controller + unit/integration/e2e tests) to the sharedprotopbpackages.protopb/output dir and marks copied stubs writable, so net-new proto packages generate cleanly.Known cosmetic gazelle warning: resolving the new cross-proto import prints "multiple rules may be imported" for the
# keeprules_go go_proto_library alias. It does not change generated BUILD files, the build, or the committed-files path that consumers resolve via the root# gazelle:resolve godirectives.Test Plan
make proto(regenerates stubs, including the message-only base protos)./tool/bazel build //...(213 targets)make test(54 unit tests pass)make fmtIssues
Stack