Skip to content

chore(FR-2828): adopt new filter input types for RBAC permission/entity queries#7276

Merged
graphite-app[bot] merged 1 commit into
mainfrom
05-07-chore_fr-2828_adopt_new_filter_input_types_for_rbac_permission_entity_queries
May 7, 2026
Merged

chore(FR-2828): adopt new filter input types for RBAC permission/entity queries#7276
graphite-app[bot] merged 1 commit into
mainfrom
05-07-chore_fr-2828_adopt_new_filter_input_types_for_rbac_permission_entity_queries

Conversation

@ironAiken2
Copy link
Copy Markdown
Contributor

@ironAiken2 ironAiken2 commented May 7, 2026

Resolves #7275(FR-2828)

Summary

The backend wrapped scalar fields on RBAC filter input types into operator objects:

  • PermissionFilter.roleId: UUIDUUIDFilter
  • PermissionFilter.scopeType / entityType: RBACElementTypeRBACElementTypeFilter
  • PermissionFilter.scopeId: new StringFilter field
  • PermissionNestedFilter.scopeId: StringStringFilter
  • PermissionNestedFilter.scopeType / entityType: RBACElementTypeRBACElementTypeFilter
  • PermissionNestedFilter.operation: OperationTypeOperationTypeFilter
  • EntityFilter.entityType: RBACElementTypeRBACElementTypeFilter

This PR updates the frontend call sites to emit the new wrapped shape so existing queries no longer fail with GRAPHQL_VALIDATION_FAILED.

Changes

  • RoleDetailDrawer: permissionFilter.roleId now { equals: localRoleId }.
  • RolePermissionTab: roleId now { equals: roleId }; dropped valueMode: 'scalar' on the scopeType / entityType BAIGraphQLPropertyFilter properties so the default operator mode emits { equals: VALUE }, matching RBACElementTypeFilter.
  • RoleScopeTab: dropped valueMode: 'scalar' on the entityType filter property for the same reason.
  • useCurrentUserProjectRoles: nested entityType under { equals: PROJECT_ADMIN_PAGE } in the myRoles permission filter.
  • data/schema.graphql: pulled the new filter input types (UUIDFilter-style wrappers, OperationTypeFilter, RBACElementTypeFilter, StringFilter on permission/entity filters).

Verification

bash scripts/verify.sh:

  • Relay: PASS
  • Lint: PASS
  • Format: PASS
  • TypeScript: only pre-existing failures (packages/backend.ai-client/src/client.ts, DeleteForeverVFolderModalV2.tsx, VFolderDeployModal.tsx) remain — no new errors introduced by this change.

Test plan

  • Open Role detail drawer for any role: scope / permission / assignment tabs load without GRAPHQL_VALIDATION_FAILED.
  • In RolePermissionTab, apply scopeType / entityType filters and confirm rows are correctly filtered.
  • In RoleScopeTab, apply scopeType filter and confirm rows are correctly filtered.
  • Log in as a project admin (non-superadmin) and confirm useCurrentUserProjectRoles resolves project admin scopes (admin-only menus appear).

Copilot AI review requested due to automatic review settings May 7, 2026 04:08
@github-actions github-actions Bot added the size:M 30~100 LoC label May 7, 2026
Copy link
Copy Markdown
Contributor Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Coverage Report for react-coverage (./react)

Status Category Percentage Covered / Total
🔵 Lines 6.52% 1783 / 27318
🔵 Statements 5.4% 1978 / 36622
🔵 Functions 5.2% 296 / 5689
🔵 Branches 3.79% 1293 / 34075
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
react/src/components/RoleDetailDrawer.tsx 0% 0% 0% 0% 26-150
react/src/components/RolePermissionTab.tsx 0% 0% 0% 0% 44-169
react/src/components/RoleScopeTab.tsx 0% 0% 0% 0% 29-221
react/src/hooks/useCurrentUserProjectRoles.ts 0% 0% 0% 0% 36-126
Generated in workflow #405 for commit 731574c by the Vitest Coverage Report Action

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the RBAC-related GraphQL filters in the WebUI to match newly introduced “filter input” types in the schema (e.g., RBACElementTypeFilter, OperationTypeFilter, UUIDFilter), replacing previous scalar enum/UUID filter usage.

Changes:

  • Migrated RBAC permission/entity filters from scalar values to { equals: ... } style operator objects in Relay queries/refetches.
  • Updated BAIGraphQLPropertyFilter configurations by removing valueMode: 'scalar' so enum filters emit operator objects compatible with the new schema inputs.
  • Extended/adjusted GraphQL schema inputs for RBAC filtering (entity/permission/nested permission).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
react/src/hooks/useCurrentUserProjectRoles.ts Updates myRoles permission filter to use entityType: { equals: ... }.
react/src/components/RoleScopeTab.tsx Removes scalar filter emission for enum filter to align with EntityFilter.entityType now being a filter input.
react/src/components/RolePermissionTab.tsx Updates roleId filter to UUIDFilter shape and removes scalar enum filter emission for scope/entity types.
react/src/components/RoleDetailDrawer.tsx Updates initial permissionFilter.roleId to UUIDFilter shape.
data/schema.graphql Changes RBAC filter fields from scalars to filter-input types and adds new enum filter input definitions.

Comment thread react/src/components/RoleScopeTab.tsx
Comment thread react/src/components/RolePermissionTab.tsx
Comment thread data/schema.graphql
Comment thread data/schema.graphql
Copy link
Copy Markdown
Member

@yomybaby yomybaby left a comment

Choose a reason for hiding this comment

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

LGTM

@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented May 7, 2026

Merge activity

…ty queries (#7276)

Resolves #7275(FR-2828)

## Summary

The backend wrapped scalar fields on RBAC filter input types into operator objects:

- `PermissionFilter.roleId`: `UUID` → `UUIDFilter`
- `PermissionFilter.scopeType` / `entityType`: `RBACElementType` → `RBACElementTypeFilter`
- `PermissionFilter.scopeId`: new `StringFilter` field
- `PermissionNestedFilter.scopeId`: `String` → `StringFilter`
- `PermissionNestedFilter.scopeType` / `entityType`: `RBACElementType` → `RBACElementTypeFilter`
- `PermissionNestedFilter.operation`: `OperationType` → `OperationTypeFilter`
- `EntityFilter.entityType`: `RBACElementType` → `RBACElementTypeFilter`

This PR updates the frontend call sites to emit the new wrapped shape so existing queries no longer fail with `GRAPHQL_VALIDATION_FAILED`.

## Changes

- `RoleDetailDrawer`: `permissionFilter.roleId` now `{ equals: localRoleId }`.
- `RolePermissionTab`: `roleId` now `{ equals: roleId }`; dropped `valueMode: 'scalar'` on the `scopeType` / `entityType` `BAIGraphQLPropertyFilter` properties so the default operator mode emits `{ equals: VALUE }`, matching `RBACElementTypeFilter`.
- `RoleScopeTab`: dropped `valueMode: 'scalar'` on the `entityType` filter property for the same reason.
- `useCurrentUserProjectRoles`: nested `entityType` under `{ equals: PROJECT_ADMIN_PAGE }` in the `myRoles` permission filter.
- `data/schema.graphql`: pulled the new filter input types (`UUIDFilter`-style wrappers, `OperationTypeFilter`, `RBACElementTypeFilter`, `StringFilter` on permission/entity filters).

## Verification

`bash scripts/verify.sh`:

- Relay: PASS
- Lint: PASS
- Format: PASS
- TypeScript: only pre-existing failures (`packages/backend.ai-client/src/client.ts`, `DeleteForeverVFolderModalV2.tsx`, `VFolderDeployModal.tsx`) remain — no new errors introduced by this change.

## Test plan

- [ ] Open Role detail drawer for any role: scope / permission / assignment tabs load without `GRAPHQL_VALIDATION_FAILED`.
- [ ] In RolePermissionTab, apply scopeType / entityType filters and confirm rows are correctly filtered.
- [ ] In RoleScopeTab, apply scopeType filter and confirm rows are correctly filtered.
- [ ] Log in as a project admin (non-superadmin) and confirm `useCurrentUserProjectRoles` resolves project admin scopes (admin-only menus appear).
@graphite-app graphite-app Bot force-pushed the 05-07-chore_fr-2828_adopt_new_filter_input_types_for_rbac_permission_entity_queries branch from 5459292 to 731574c Compare May 7, 2026 05:50
@graphite-app graphite-app Bot merged commit 731574c into main May 7, 2026
12 checks passed
@graphite-app graphite-app Bot deleted the 05-07-chore_fr-2828_adopt_new_filter_input_types_for_rbac_permission_entity_queries branch May 7, 2026 05:52
@github-pages github-pages Bot temporarily deployed to github-pages May 7, 2026 05:52 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30~100 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GraphQL validation error: RBACElementType enum sent where RBACElementTypeFilter is expected

3 participants