feat(nats): define micro proto contract#50
Conversation
yordis
commented
May 11, 2026
- Prevent generator implementations from inventing incompatible NATS service annotations.
- Avoid ambiguity between service discovery identity and endpoint request subjects.
PR SummaryMedium Risk Overview Updates the extension-number registry docs to reserve Reviewed by Cursor Bugbot for commit 2976537. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
WalkthroughThis PR introduces a new protobuf schema for NATS micro service configuration options and comprehensive documentation on using these annotations to document microservice contracts. The schema defines ChangesNATS Micro Service Options Schema and Documentation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).
|
e158488 to
199b63a
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
docs/how-to/document-nats-micro-services.md (1)
3-113: ⚡ Quick winDocument
service.skipandservice.payload_encodingin this how-to.The new contract includes both fields, but this guide doesn’t describe intended semantics. Adding them here would better prevent generator interpretation drift.
📝 Suggested addition
+## Skip Generation + +Set `service.skip: true` when a protobuf service should be excluded from NATS micro code generation. + +## Select Payload Encoding + +Use `service.payload_encoding` to declare the default payload format for generated clients/handlers: + +- `PAYLOAD_ENCODING_PROTOBUF` +- `PAYLOAD_ENCODING_JSON` + +If unset, generators use their configured default (typically protobuf).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/how-to/document-nats-micro-services.md` around lines 3 - 113, Add documentation for the new service fields: explain (trogon.nats.micro.v1alpha1.service).skip as a boolean that tells generators to omit service discovery registration and subject generation for that service (i.e., endpoints may still exist but are not advertised), and document (trogon.nats.micro.v1alpha1.service).payload_encoding as the service-level default encoding (e.g., "proto", "json", "jsonpb", or "binary") that generators should apply to request/response payloads unless a method-level override exists (method.payload_encoding), how it interacts with transport metadata and error payloads, and that it is purely a descriptor hint (no runtime enforcement) so generators must emit metadata/serialization code accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/explanation/protobuf-extension-naming.md`:
- Line 117: The ServiceOptions example in the docs is missing fields and should
match the actual proto schema; update the ServiceOptions entry (the line showing
"ServiceOptions { endpoint_prefix, name, version, metadata } → service") so its
field list exactly mirrors the fields defined in
proto/trogon/nats/micro/v1alpha1/options.proto (use the same field names and
order), and ensure the example maps to "service" consistently with the proto
definition.
---
Nitpick comments:
In `@docs/how-to/document-nats-micro-services.md`:
- Around line 3-113: Add documentation for the new service fields: explain
(trogon.nats.micro.v1alpha1.service).skip as a boolean that tells generators to
omit service discovery registration and subject generation for that service
(i.e., endpoints may still exist but are not advertised), and document
(trogon.nats.micro.v1alpha1.service).payload_encoding as the service-level
default encoding (e.g., "proto", "json", "jsonpb", or "binary") that generators
should apply to request/response payloads unless a method-level override exists
(method.payload_encoding), how it interacts with transport metadata and error
payloads, and that it is purely a descriptor hint (no runtime enforcement) so
generators must emit metadata/serialization code accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 31be75b3-14c9-41d9-ab70-a4be875f25d6
📒 Files selected for processing (4)
docs/README.mddocs/explanation/protobuf-extension-naming.mddocs/how-to/document-nats-micro-services.mdproto/trogon/nats/micro/v1alpha1/options.proto
0bf92a5 to
36780de
Compare
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
36780de to
2976537
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2976537. Configure here.
