Files
Charis 1d0398db4b feat(studio): gate connect sheet and project connection popover on api-keys grants (#52964)
Part 4 of 6 in a stack for
[FE-4731](https://linear.app/supabase/issue/FE-4731/grants-rollout-api-keys-consumers-that-only-need-publishable-keys).
Based on #52963.

## Stack
1. #52961 Docs and project API docs consumers
2. #52962 Edge functions and vector bucket examples
3. #52963 Integrations landing data
4. 👉 #52964 Connect sheet and project connection popover; remove the
transitional api-keys hooks
5. #52965 `reveal` refinement for single api-key reads; API key pill
6. #52966 API key create and delete

## Changes
Moves the last publishable-key consumers onto the plain `GET
/v1/projects/{ref}/api-keys` grant:
- `ConnectSheet`: shows `ApiKeysAccessNote` under the mode selector
(except the warehouse and server modes; the server panel has its own
note)
- `useConnectServerEnv`: `canReadAPIKeys` and its loading state come
from the grant, and the hook returns the grant. The on-demand secret
reveal is unchanged here (part 5 moves it).
- Server env content: shows the note next to the disabled copy buttons
- `ProjectConnectionPopover`: only fetches while open. The nested
ternary for the key display is replaced with a flat helper covering
loading, denied, error, and the key.

With no callers left, the deprecated transitional `useAPIKeys` /
`useAPIKeysQuery` hooks are removed from
`data/api-keys/api-keys-query.ts`.

The old guards matched the annotation.

## Testing
- `ProjectConnectionPopover.platform.test.tsx` and
`content/server/env/content.platform.test.tsx`: granted, denied (no
request), and permission-check error.
- `useConnectServerEnv.test.ts` updated for the grant.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-11-05 12:40:49 -05:00
..