Serve user-role relations as the RoleAssignmentV2 relation type
- Dominant language
- Python
- Stars
- 670
- Forks
- 183
- Avg merge
- 15h 13m
- Merged PRs (30d)
- 368
Description
Expose user_roles rows as RoleAssignmentV2, a relation type that is not a Node (no id field, no node(id) lookup, no data loader), per the Relations rules in src/ai/backend/manager/api/gql/AGENTS.md. Add RoleAssignmentV2 connections on both ends (Role and UserV2) and a root scoped query whose scope takes user and role lists OR'd together, reusing ScopedSearchRoleAssignmentsAction and RoleAssignmentSearcher. Filter and order are RoleAssignmentV2's own and nest user and role conditions; granted_by and granted_at are plain fields. Point the deprecated RoleAssignment surfaces (myRoles, Role.users, adminRoleAssignments) at the new fields in their deprecation notices.
## Success Criteria
- [ ] Role and UserV2 both expose a RoleAssignmentV2 connection carrying granted_by and granted_at
- [ ] the root scoped query ORs user and role scope items and refuses a scope the caller cannot read
- [ ] cursor pagination works without an id field
- [ ] deprecation notices on the RoleAssignment surfaces name the replacements
- [ ] schema dumps regenerated
- [ ] pants test passes for affected packages
JIRA Issue: BA-7888
Contributor guide
Research direction
Start with src/ai/backend/manager/api/gql/AGENTS.md and trace ScopedSearchRoleAssignmentsAction with RoleAssignmentSearcher. Inspect the Role and UserV2 relation entry points and the deprecated RoleAssignment surfaces, then verify the listed connection, scoped-query, pagination, deprecation, and schema-dump criteria with pants test for affected packages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, python
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100