Skip to content

feat(frontier): migrate from PGV to buf protovalidate#463

Open
ravisuhag wants to merge 2 commits intomainfrom
feat/frontier-migrate-protovalidate
Open

feat(frontier): migrate from PGV to buf protovalidate#463
ravisuhag wants to merge 2 commits intomainfrom
feat/frontier-migrate-protovalidate

Conversation

@ravisuhag
Copy link
Copy Markdown
Member

Summary

  • Migrate frontier protos (admin, frontier, models) from envoyproxy/protoc-gen-validate to buf/validate (protovalidate)
  • Convert all (validate.rules) annotations to (buf.validate.field)
  • Replace PGV ignore_empty: true with protovalidate ignore: IGNORE_IF_ZERO_VALUE
  • Convert (validate.rules).message.required to (buf.validate.field).required
  • Remove buf.build/envoyproxy/protoc-gen-validate dependency from buf.yaml

Test plan

  • buf build passes
  • buf lint passes

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4d8c1443-12f6-4a6b-a0b4-61b39ec54168

📥 Commits

Reviewing files that changed from the base of the PR and between 2086944 and e18024f.

📒 Files selected for processing (1)
  • raystack/frontier/v1beta1/admin.proto
🚧 Files skipped from review as they are similar to previous changes (1)
  • raystack/frontier/v1beta1/admin.proto

📝 Walkthrough

Walkthrough

This pull request migrates protobuf validation annotations in multiple proto files from validate/validate.proto and (validate.rules) to Buf's buf/validate/validate.proto and (buf.validate.field). It updates import statements, converts field-level validation syntax, and replaces ignore_empty: true with ignore: IGNORE_IF_ZERO_VALUE where applicable. The buf.yaml deps list was updated to remove buf.build/envoyproxy/protoc-gen-validate. No service/method signatures or public message fields were changed.

Suggested reviewers

  • rohilsurana
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: migrating from PGV (envoyproxy/protoc-gen-validate) to buf protovalidate across frontier protos.
Description check ✅ Passed The description is directly related to the changeset, providing a clear summary of the migration objectives, specific changes made, and test verification performed.
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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 29, 2026

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed⏩ skipped✅ passed✅ passedMar 30, 2026, 6:47 AM

- Replace import "validate/validate.proto" with "buf/validate/validate.proto"
- Convert (validate.rules) annotations to (buf.validate.field)
- Convert PGV ignore_empty to protovalidate IGNORE_IF_ZERO_VALUE
- Convert (validate.rules).message.required to (buf.validate.field).required
- Remove envoyproxy/protoc-gen-validate dependency from buf.yaml
@ravisuhag ravisuhag force-pushed the feat/frontier-migrate-protovalidate branch from 98ee661 to 2086944 Compare March 29, 2026 19:50
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.

🧹 Nitpick comments (2)
raystack/frontier/v1beta1/frontier.proto (1)

1661-1664: Keep request-body name validators in sync with the model messages.

Organization.name, Project.name, Group.name, and MetaSchema.name in raystack/frontier/v1beta1/models.proto all require min_len: 2, but the corresponding request bodies here only validate the pattern. As written, create/update calls can accept one-character names that fall outside the public model contract.

♻️ Suggested change
 message OrganizationRequestBody {
   string name = 1 [
+    (buf.validate.field).string.min_len = 2,
     (buf.validate.field).string.pattern = "^[A-Za-z0-9-_]+$",
     (google.api.field_behavior) = REQUIRED
   ];
 message ProjectRequestBody {
   string name = 1 [
+    (buf.validate.field).string.min_len = 2,
     (buf.validate.field).string.pattern = "^[A-Za-z0-9-_]+$",
     (google.api.field_behavior) = REQUIRED
   ];
 message GroupRequestBody {
   string name = 1 [
+    (buf.validate.field).string.min_len = 2,
     (buf.validate.field).string.pattern = "^[A-Za-z0-9-_]+$",
     (google.api.field_behavior) = REQUIRED
   ];
 message MetaSchemaRequestBody {
   string name = 1 [
+    (buf.validate.field).string.min_len = 2,
     (buf.validate.field).string.pattern = "^[A-Za-z0-9-_]+$",
     (google.api.field_behavior) = REQUIRED
   ];

Also applies to: 1939-1942, 2202-2205, 2406-2409

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

In `@raystack/frontier/v1beta1/frontier.proto` around lines 1661 - 1664, The
request message string fields for names (e.g., the field `name` used in request
messages that correspond to the model messages Organization.name, Project.name,
Group.name, and MetaSchema.name) only enforce a pattern; update those field
options to also include a minimum length validator of 2 to match the model
contract (add `(buf.validate.field).string.min_len = 2` alongside the existing
pattern and field_behavior options) so create/update request bodies cannot
accept single-character names; apply the same change for the other analogous
`name` request fields referenced in the diff (the similar blocks at the other
locations).
raystack/frontier/v1beta1/admin.proto (1)

937-939: Align the admin org-name rule with Organization.name.

raystack/frontier/v1beta1/models.proto requires Organization.name to have min_len: 2, but this request body only checks the pattern. That drift lets admin create accept one-character names while the returned model type is stricter.

♻️ Suggested change
     string name = 1 [
+      (buf.validate.field).string.min_len = 2,
       (buf.validate.field).string.pattern = "^[A-Za-z0-9-_]+$",
       (google.api.field_behavior) = REQUIRED
     ];
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@raystack/frontier/v1beta1/admin.proto` around lines 937 - 939, The request
field "name" (string name = 1) currently only enforces a pattern but must match
the stricter Organization.name rules in models.proto; update the proto
validation on this field to include the same minimum length constraint (e.g. add
(buf.validate.field).string.min_len = 2) so the admin request cannot accept
single-character names and remains consistent with Organization.name validation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@raystack/frontier/v1beta1/admin.proto`:
- Around line 937-939: The request field "name" (string name = 1) currently only
enforces a pattern but must match the stricter Organization.name rules in
models.proto; update the proto validation on this field to include the same
minimum length constraint (e.g. add (buf.validate.field).string.min_len = 2) so
the admin request cannot accept single-character names and remains consistent
with Organization.name validation.

In `@raystack/frontier/v1beta1/frontier.proto`:
- Around line 1661-1664: The request message string fields for names (e.g., the
field `name` used in request messages that correspond to the model messages
Organization.name, Project.name, Group.name, and MetaSchema.name) only enforce a
pattern; update those field options to also include a minimum length validator
of 2 to match the model contract (add `(buf.validate.field).string.min_len = 2`
alongside the existing pattern and field_behavior options) so create/update
request bodies cannot accept single-character names; apply the same change for
the other analogous `name` request fields referenced in the diff (the similar
blocks at the other locations).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 42d38e6a-2200-4d2d-adf0-e748db0dd55b

📥 Commits

Reviewing files that changed from the base of the PR and between 8eb1ed1 and 2086944.

⛔ Files ignored due to path filters (1)
  • buf.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • buf.yaml
  • raystack/frontier/v1beta1/admin.proto
  • raystack/frontier/v1beta1/frontier.proto
  • raystack/frontier/v1beta1/models.proto
💤 Files with no reviewable changes (1)
  • buf.yaml

Comment on lines +617 to +618
(buf.validate.field).string = {min_len: 1},
(buf.validate.field).string.uuid = true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lets merge these into one?

Suggested change
(buf.validate.field).string = {min_len: 1},
(buf.validate.field).string.uuid = true
(buf.validate.field).string = {min_len: 1, uuid: true}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks cleaner

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.

2 participants