Skip to content

refactor(proto): add shared api/base proto contracts (Change, Strategy)#261

Open
behinddwalls wants to merge 2 commits into
mainfrom
preetam/api-base-proto
Open

refactor(proto): add shared api/base proto contracts (Change, Strategy)#261
behinddwalls wants to merge 2 commits into
mainfrom
preetam/api-base-proto

Conversation

@behinddwalls

@behinddwalls behinddwalls commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

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 imports (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

Issues

Stack

  1. refactor(proto): move protos to top-level api/ tree by domain/service #258
  2. @ refactor(proto): add shared api/base proto contracts (Change, Strategy) #261
  3. feat(stovepipe): add Ingest RPC to gateway for trunk commit verification #262

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>
Base automatically changed from move-proto-to-api to main June 17, 2026 18:27
## 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>
@behinddwalls behinddwalls force-pushed the preetam/api-base-proto branch from edf2fe0 to cc1c653 Compare June 17, 2026 18:34
@behinddwalls behinddwalls marked this pull request as ready for review June 17, 2026 18:36
@behinddwalls behinddwalls requested review from a team and sbalabanov as code owners June 17, 2026 18:36
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