Conversation
📝 WalkthroughWalkthroughReplaces separate PAT scoping fields with a structured Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
raystack/frontier/v1beta1/models.proto (1)
279-282: Consider adding validation forresource_typeallowed values.The comment indicates that
resource_typeshould be either"app/organization"or"app/project", but there's no validation rule enforcing this constraint. Adding aninrule would strengthen the API contract and provide clearer error messages for invalid inputs.♻️ Suggested validation rule
// Resource type: "app/organization" or "app/project" string resource_type = 2 [ - (google.api.field_behavior) = REQUIRED + (google.api.field_behavior) = REQUIRED, + (validate.rules).string = {in: ["app/organization", "app/project"]} ];🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@raystack/frontier/v1beta1/models.proto` around lines 279 - 282, Add a validation rule to the string field resource_type to restrict values to the allowed set ("app/organization", "app/project"); specifically, augment the resource_type field's protobuf options (e.g., using protoc-gen-validate string.in) so the generated validation enforces those two values and returns a clear error on other inputs—update the resource_type field definition in the same message to include the in rule referencing the two allowed strings.
🤖 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/models.proto`:
- Around line 279-282: Add a validation rule to the string field resource_type
to restrict values to the allowed set ("app/organization", "app/project");
specifically, augment the resource_type field's protobuf options (e.g., using
protoc-gen-validate string.in) so the generated validation enforces those two
values and returns a clear error on other inputs—update the resource_type field
definition in the same message to include the in rule referencing the two
allowed strings.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 33e282ea-0882-4b56-92e8-10b8245938fd
📒 Files selected for processing (2)
raystack/frontier/v1beta1/frontier.protoraystack/frontier/v1beta1/models.proto
|
@AmanGIT07, can you add a before-and-after body example to clarify this change? |
Updated the description with the same |
101320c to
3164387
Compare
There was a problem hiding this comment.
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/frontier/v1beta1/models.proto`:
- Around line 279-282: Add a proto-level validation rule to
PATScope.resource_type to restrict values to the documented closed set; update
the PATScope message by adding (validate.rules).string = {in:
["app/organization", "app/project"]} (so resource_type enforces only those two
values), ensuring this enforces the contract for scopes used by
CreateCurrentUserPATRequest and UpdateCurrentUserPATRequest rather than relying
on handler-side checks.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9a28d4da-0d16-4be9-bdd2-6e93d6810182
📒 Files selected for processing (2)
raystack/frontier/v1beta1/frontier.protoraystack/frontier/v1beta1/models.proto
Summary by CodeRabbit
Before and after payload example
CreateCurrentUserPATRequest
Before:
After:
UpdateCurrentUserPATRequest
Before:
After:
PAT (response model)
Before:
After:
Key change: Flat role_ids + project_ids arrays replaced with a structured scopes array where each scope explicitly ties a role to its resource type and optional resource IDs. This makes the role-to-resource relationship explicit rather than implicit.