-
Notifications
You must be signed in to change notification settings - Fork 4
Add support for role scope trait. #643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds RoleScopeTrait, RoleScopeConditions, and ResourceDoesNotExist protobuf messages; registers TRAIT_ROLE_SCOPE in ResourceType.Trait; generates Go validation scaffolding for the new messages; and adds resource helper options and a NewRoleScopeResource constructor to manage RoleScopeTrait on resources. Changes
Sequence Diagram(s)(omitted — changes are additive protobufs, generated validators, and local helper functions without a multi-component sequential flow that warrants a diagram) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
2467dd6 to
9cc0466
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@pkg/types/resource/resource.go`:
- Around line 331-332: The doc comment for NewRoleScopeResource incorrectly
claims "configured with the provided profile" (copied from NewRoleResource);
update the comment to accurately describe that the returned resource includes a
RoleScopeTrait configured with role_id and scope_resource_id (reference
RoleScopeTrait and NewRoleScopeResource) instead of mentioning a profile, and
remove any leftover wording specific to RoleResource to avoid confusion.
In `@pkg/types/resource/role_scope_trait.go`:
- Around line 26-27: Update the doc comment above the GetRoleScopeTrait function
so the first word matches the function name (replace "GetRoleTrait" with
"GetRoleScopeTrait"); ensure the comment still describes that it attempts to
return the RoleScopeTrait instance on a resource and references
v2.RoleScopeTrait and the resource parameter consistently.
🧹 Nitpick comments (1)
proto/c1/connector/v2/annotation_trait.proto (1)
85-89: Consider adding validation rules for required fields.The message definition looks correct and follows existing trait patterns. However, neither
role_idnorscope_resource_idhas validation rules. If both fields are semantically required for a validRoleScopeTrait, consider adding[(validate.rules).message = {required: true}]to enforce this at the proto level.
26f25a7 to
033f8c5
Compare
680fc10 to
e0d9b5c
Compare
|
|
||
| // RoleScopeTrait is used to scope a role to a resource or set of resources. | ||
| // The scope may be static (determined at crawl time) or dynamic (determined based on conditions). | ||
| message RoleScopeTrait { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change the name to something more general? We are just binding two other resources here.
Summary by CodeRabbit
New Features
New Validation
✏️ Tip: You can customize this high-level summary in your review settings.