Skip to content

Formalize the proto service/message file split - #70

Merged
abrown-RV merged 2 commits into
developfrom
proto-lint
Jul 28, 2026
Merged

Formalize the proto service/message file split#70
abrown-RV merged 2 commits into
developfrom
proto-lint

Conversation

@abrown-RV

Copy link
Copy Markdown
Collaborator

The .proto files 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:

  • check-proto-split.sh — a fast, dependency-free lint that fails if any .proto declares a service alongside a top-level message/enum.
  • proto-lint.yml — runs the check on every push and PR.
  • A comment in service.proto documenting the invariant and pointing to the check.

No proto files needed changes — the tree already satisfies the rule.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/enum declaration (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/enum declarations. 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.

Comment thread check-proto-split.sh
Comment thread interface/proto/service.proto
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@abrown-RV
abrown-RV merged commit a639eab into develop Jul 28, 2026
6 checks passed
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.

3 participants