Skip to content

feat(FR-2209): scope admin serving by project for project admins#6652

Closed
yomybaby wants to merge 1 commit intographite-base/6652from
04-13-feat_fr-2209_scope_admin_serving_by_project_for_project_admins
Closed

feat(FR-2209): scope admin serving by project for project admins#6652
yomybaby wants to merge 1 commit intographite-base/6652from
04-13-feat_fr-2209_scope_admin_serving_by_project_for_project_admins

Conversation

@yomybaby
Copy link
Copy Markdown
Member

resolves #NNN (FR-MMM)

Checklist: (if applicable)

  • Documentation
  • Minium required manager version
  • Specific setting for review (eg., KB link, endpoint or how to setup)
  • Minimum requirements to check during review
  • Test case(s) to demonstrate the difference of before/after

Copilot AI review requested due to automatic review settings April 13, 2026 14:01
@github-actions github-actions Bot added the size:XL 500~ LoC label Apr 13, 2026
Copy link
Copy Markdown
Member Author

yomybaby commented Apr 13, 2026


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 Apr 13, 2026

Coverage report for ./react

St.
Category Percentage Covered / Total
🔴 Statements
9.02% (-0% 🔻)
1770/19631
🔴 Branches
8.14% (-0% 🔻)
1115/13697
🔴 Functions 5.36% 286/5335
🔴 Lines
8.71% (-0% 🔻)
1660/19062

Test suite run success

859 tests passing in 39 suites.

Report generated by 🧪jest coverage report action from 71ef875

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

Adds project-level scoping to the Admin Serving page’s endpoint listing so project admins can be restricted to the currently selected project (while keeping broader visibility for higher admin roles until backend domain-scope support lands).

Changes:

  • Derives an effective admin role and current project ID in ServingTabContent.
  • Passes an optional project variable into the endpoint_list GraphQL query to scope results for projectAdmin.
  • Updates memoized query variables/dependencies to include the project filter.

// Relay node. Leave unfiltered for domainAdmin until backend support lands.
// TODO(needs-backend): FR-2313 — domain-scope RBAC for endpoint_list
const projectFilter =
effectiveRole === 'projectAdmin' ? (currentProject.id ?? null) : null;
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

projectFilter uses null for the “no project filter” case, which means $project is always sent to GraphQL as an explicit null. Elsewhere in the codebase, endpoint_list optional project scoping is typically omitted by leaving the variable undefined (e.g., react/src/components/Chat/EndpointSelect.tsx:137-140 passes only {limit: 10}), which avoids any backend behavior differences between “arg omitted” vs “arg provided as null”. Consider changing the non-projectAdmin branch to undefined (and keeping the variable optional) so Relay omits $project entirely when unscoped.

Suggested change
effectiveRole === 'projectAdmin' ? (currentProject.id ?? null) : null;
effectiveRole === 'projectAdmin' ? (currentProject.id ?? undefined) : undefined;

Copilot uses AI. Check for mistakes.
Comment on lines +45 to +46
const projectFilter =
effectiveRole === 'projectAdmin' ? (currentProject.id ?? null) : null;
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

For effectiveRole === 'projectAdmin', projectFilter falls back to null when currentProject.id is missing. That would result in an unscoped endpoint_list query for a project admin, undermining the intended “scope by project” behavior. Consider blocking the query (or returning an empty state) until currentProject.id is available, or keep projectFilter as undefined/throw when it’s unexpectedly absent for project admins.

Copilot uses AI. Check for mistakes.
@yomybaby yomybaby force-pushed the 04-13-feat_fr-2209_scope_admin_serving_by_project_for_project_admins branch from 25f9613 to 71ef875 Compare April 13, 2026 14:46
@github-actions github-actions Bot added size:S 10~30 LoC and removed size:XL 500~ LoC labels Apr 13, 2026
@yomybaby yomybaby changed the base branch from 04-13-feat_fr-2209_add_usecurrentuserprojectroles_hook_with_myroles_rbac_query to graphite-base/6652 April 14, 2026 08:07
@yomybaby yomybaby closed this Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10~30 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants