Skip to content

feat(stencil): migrate proto to connectRPC with buf.validate#481

Merged
ravisuhag merged 2 commits intomainfrom
feat/stencil-connectrpc
Apr 21, 2026
Merged

feat(stencil): migrate proto to connectRPC with buf.validate#481
ravisuhag merged 2 commits intomainfrom
feat/stencil-connectrpc

Conversation

@ravisuhag
Copy link
Copy Markdown
Member

Summary

  • Remove gRPC-gateway HTTP annotations (google.api.http) and OpenAPI (openapiv2) options from all StencilService RPCs
  • Replace google.api.field_behavior with buf.validate constraints for automatic request validation via connectrpc.com/validate
  • Add Java options (java_multiple_files, java_package, java_outer_classname) for multi-language support
  • Clean up service definitions to plain RPC declarations (matching Compass pattern)

Validation rules added

  • string.min_len = 1 on all ID/name fields (namespace_id, schema_id, query)
  • bytes.min_len = 1 on schema data fields
  • int32.gt = 0 on version_id fields
  • enum.defined_only + not_in: [0] on format and compatibility enums (rejects UNSPECIFIED)

Context

Part of the connectRPC migration for Stencil, following the same pattern established by Compass. The companion Stencil codebase PR will consume these updated protos.

Test plan

  • buf lint passes
  • buf generate produces valid Go + connectRPC code
  • Stencil server builds and runs with the new protos

Remove gRPC-gateway HTTP annotations and OpenAPI options from
StencilService proto in preparation for connectRPC migration.
Replace google.api.field_behavior with buf.validate constraints
for automatic request validation. Add Java options for multi-language
support.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 21, 2026

The latest Buf updates on your PR. Results from workflow Validate / validate (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed⏩ skipped✅ passed✅ passedApr 21, 2026, 2:15 AM

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

Warning

Rate limit exceeded

@ravisuhag has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 56 minutes and 31 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 56 minutes and 31 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e5bcbe05-0b4c-4d1c-8518-4dc890e0f05b

📥 Commits

Reviewing files that changed from the base of the PR and between 521c804 and 94b7a6f.

📒 Files selected for processing (1)
  • raystack/stencil/v1beta1/stencil.proto
📝 Walkthrough

Walkthrough

The protobuf file updates validation annotations by replacing Google API field-behavior directives with Buf validation constraints. HTTP routing definitions for RPC methods are removed. String identifier fields now require minimum length constraints, numeric version fields require positive values, and enum fields restrict values to exclude unspecified/zero states. These changes maintain the same RPC signatures and message structures while modifying how field validation is specified.

Suggested reviewers

  • rohilsurana
  • whoAbhishekSah
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: migrating the Stencil proto from gRPC-gateway/OpenAPI annotations to connectRPC with buf.validate constraints.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, covering the removal of HTTP annotations, replacement with buf.validate, Java options addition, and validation rules.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@raystack/stencil/v1beta1/stencil.proto`:
- Around line 124-129: Add validation to reject unspecified enum values and zero
version IDs: for CreateSchemaRequest.format and
CreateSchemaRequest.compatibility, add a buf.validate rule to exclude the
*_UNSPECIFIED enum (e.g., (buf.validate.field).enum.not_in =
[Schema.Format.FORMAT_UNSPECIFIED] and similarly for Schema.Compatibility);
apply the same enum.not_in rule to CheckCompatibilityRequest.compatibility and
UpdateSchemaMetadataRequest.compatibility; for SearchRequest.version_id (the
oneof branch that selects version_id) add a numeric gt rule to require > 0
(e.g., (buf.validate.field).uint64.gt = 0) so selecting the version_id branch
cannot be zero.
🪄 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: d9204ef4-db1f-4bdc-b349-f6698d33e75d

📥 Commits

Reviewing files that changed from the base of the PR and between f9e588c and 521c804.

📒 Files selected for processing (1)
  • raystack/stencil/v1beta1/stencil.proto

Comment on lines 124 to 129
message CreateSchemaRequest {
string namespace_id = 1;
string schema_id = 2;
bytes data = 3 [(google.api.field_behavior) = REQUIRED];
string namespace_id = 1 [(buf.validate.field).string.min_len = 1];
string schema_id = 2 [(buf.validate.field).string.min_len = 1];
bytes data = 3 [(buf.validate.field).bytes.min_len = 1];
Schema.Format format = 4;
Schema.Compatibility compatibility = 5;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Complete validation coverage for the remaining enum and version fields.

CreateSchemaRequest.format, CreateSchemaRequest.compatibility, CheckCompatibilityRequest.compatibility, and UpdateSchemaMetadataRequest.compatibility still accept *_UNSPECIFIED; SearchRequest.version_id still accepts 0 when that oneof branch is selected. This leaves gaps in the validation contract added elsewhere in this proto.

🛡️ Proposed validation additions
 message CreateSchemaRequest {
   string namespace_id = 1 [(buf.validate.field).string.min_len = 1];
   string schema_id = 2 [(buf.validate.field).string.min_len = 1];
   bytes data = 3 [(buf.validate.field).bytes.min_len = 1];
-  Schema.Format format = 4;
-  Schema.Compatibility compatibility = 5;
+  Schema.Format format = 4 [(buf.validate.field).enum = {defined_only: true, not_in: [0]}];
+  Schema.Compatibility compatibility = 5 [(buf.validate.field).enum = {defined_only: true, not_in: [0]}];
 }
 
 message CheckCompatibilityRequest {
   string namespace_id = 1 [(buf.validate.field).string.min_len = 1];
   string schema_id = 2 [(buf.validate.field).string.min_len = 1];
   bytes data = 3 [(buf.validate.field).bytes.min_len = 1];
-  Schema.Compatibility compatibility = 4;
+  Schema.Compatibility compatibility = 4 [(buf.validate.field).enum = {defined_only: true, not_in: [0]}];
 }
 
 message UpdateSchemaMetadataRequest {
   string namespace_id = 1 [(buf.validate.field).string.min_len = 1];
   string schema_id = 2 [(buf.validate.field).string.min_len = 1];
-  Schema.Compatibility compatibility = 3;
+  Schema.Compatibility compatibility = 3 [(buf.validate.field).enum = {defined_only: true, not_in: [0]}];
 }
 
 message SearchRequest {
   string namespace_id = 1;
   string schema_id = 2;
   string query = 3 [(buf.validate.field).string.min_len = 1];
 
   oneof version {
     bool history = 4;
-    int32 version_id = 5;
+    int32 version_id = 5 [(buf.validate.field).int32 = {gt: 0}];
   }
 }

Also applies to: 138-143, 161-165, 211-219

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@raystack/stencil/v1beta1/stencil.proto` around lines 124 - 129, Add
validation to reject unspecified enum values and zero version IDs: for
CreateSchemaRequest.format and CreateSchemaRequest.compatibility, add a
buf.validate rule to exclude the *_UNSPECIFIED enum (e.g.,
(buf.validate.field).enum.not_in = [Schema.Format.FORMAT_UNSPECIFIED] and
similarly for Schema.Compatibility); apply the same enum.not_in rule to
CheckCompatibilityRequest.compatibility and
UpdateSchemaMetadataRequest.compatibility; for SearchRequest.version_id (the
oneof branch that selects version_id) add a numeric gt rule to require > 0
(e.g., (buf.validate.field).uint64.gt = 0) so selecting the version_id branch
cannot be zero.

@ravisuhag ravisuhag merged commit 8ef3e30 into main Apr 21, 2026
3 checks passed
@ravisuhag ravisuhag deleted the feat/stencil-connectrpc branch April 21, 2026 02:16
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