Formalize the proto service/message file split - #70
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR formalizes and enforces the repository’s Proto convention that RPC service definitions live in dedicated .proto files separate from message/enum type definitions, to keep generated stubs (and gRPC runtime dependencies) isolated from plain data-type bindings.
Changes:
- Added a CI lint script (
check-proto-split.sh) to detect mixed service + message/enum declarations in a single.proto. - Added a GitHub Actions workflow (
proto-lint.yml) to run the lint on pushes and pull requests. - Documented the invariant directly in
interface/proto/service.proto.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| interface/proto/service.proto | Adds an in-file comment documenting the service/message split invariant and pointing to CI enforcement. |
| check-proto-split.sh | Introduces a dependency-free Bash lint that fails when a .proto mixes service with message/enum declarations. |
| .github/workflows/proto-lint.yml | Adds a workflow that runs the proto split check on every push and PR. |
Comments suppressed due to low confidence (2)
check-proto-split.sh:18
- The lint claims it's strict about "top-level" message/enum declarations, but the implementation flags any
message/enumdeclaration (nested included). Align this description with the actual enforcement level.
# This is a fast, dependency-free lint. It is intentionally strict: a service
# file must contain no top-level message/enum declarations at all.
check-proto-split.sh:45
- This comment says the grep matches only "top-level" declarations, but the regex intentionally allows indentation, so it will also match nested
message/enumdeclarations. Updating the wording here will prevent readers from assuming this is a true top-level-only check.
# Match top-level keyword declarations only (a keyword at the start of a line,
# ignoring leading whitespace). Field types reference a message by name and
# never repeat the `message`/`enum`/`service` keyword, so this does not
# false-positive on usages. Commented-out lines (`// service ...`) are skipped
# because the leading `//` prevents the anchor from matching.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
NR-RV
approved these changes
Jul 28, 2026
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.
The
.protofiles follow a convention: service.proto holds the service definition and no messages, and files that define messages/enums do not define a service. This keeps a clean boundary so language bindings can isolate the generated RPC/stub code (which pulls in a gRPC runtime) from the plain data types. Consumers that only need the messages aren't forced to link the gRPC runtime. Downstream projects may already rely on this split.Until now the rule was informal. This PR enforces it:
.protodeclares aservicealongside a top-levelmessage/enum.No proto files needed changes — the tree already satisfies the rule.