Commit Graph
5244 Commits
Author SHA1 Message Date
Saxon Fletcher d7f2b501b5 feat(studio): add the issue detail page (#52991)
Add issue details, affected resources, and copy actions with coverage for secondary checks and clipboard outcomes.
2026-11-09 16:35:02 +01:00
Saxon Fletcher e04c556bd5 feat(studio): add the issues list (#52990)
Add the Issues list, URL filters, and overview counts with complete advisor refresh handling.
2026-11-09 16:24:11 +01:00
Charis c0e92057a6 feat(studio): split SQL errors into user and Studio SQL (#53059)
Part of FE-4772.

## Why

Errors from the pg-meta query endpoint didn't say who wrote the SQL, so
a Sentry issue like SUPABASE-APP-KXE couldn't tell a user's query from
one Studio composed. That event came from the assistant's `execute_sql`
tool and was captured by the Vercel AI integration on the server, so it
skipped `reportStudioError` and had no fault tags. The Postgres message
also went to Sentry as-is, and it can contain user SQL and data.

## What

- **`sqlOrigin` is required on `executeSql`.** `'user'` covers SQL the
user or an AI agent wrote, in whole or in part: SQL editor, editor
panel, Explorer, AI `execute_sql` and `run_notebook`, report blocks,
Query Insights EXPLAIN, the policy, function, and cron editors, and
running a stored cron job. Everything else is `'studio'`. The policy,
function, and cron mutation hooks and `useDbQuery` take `sqlOrigin` too.
- **`classifySqlResponseError`** turns a 400 from the query endpoint
into `UserSqlError` (`user`, `user_sql`) or `StudioSqlError` (`studio`,
`studio_sql`). Pattern rules (connection timeouts) and other statuses
keep their classes.
- **`UserSqlError` never reaches Sentry.** Its routing is
`SAMPLE_NEVER`, `alwaysCapture` doesn't override it, and `beforeSend`
drops it.
- **`StudioSqlError` is redacted.** Error classes can set
`sentryMessage`; for `StudioSqlError` it is the SQLSTATE and the query's
`queryName`, a static name that `executeSql` requires for Studio SQL.
The query key is never reported, since its segments can hold IDs,
schemas, and search terms. `applyStudioErrorPolicy` applies it from
`beforeSend` on the client and the server, so it holds however the error
was captured. The server config gets a `beforeSend` for this. Events get
`query_name` and `sql_state` tags and are grouped by both, since every
SQL error shares the `executeSql` stack.
- **A custom `handleError` gets the classified error**, matching its
declared type. The SQL editor, editor panel, and policy editor rethrow
it, so their errors are now `UserSqlError` instead of being reported as
`UnexpectedError`. The error keeps Postgres's `position` for the
editor's line highlight.

The error message, `formattedError`, and `position` stay on the error
for the UI. The query-performance Sentry context no longer carries the
raw error message, which bypassed redaction.

## Known gaps

- Index advisor queries run users' query text from `pg_stat_statements`
but are marked `'studio'`. Redaction keeps the text out of Sentry, but
their failures count as Studio faults.
- 5xx responses for user SQL are still `PlatformError` and keep their
message.
- The self-hosted MCP `executeSql` calls `executeQuery` directly and
isn't covered.

## Testing

- Unit tests for `classifySqlResponseError`, `applyStudioErrorPolicy`,
and the client `beforeSend`.
- Full Studio vitest suite passes except `useReportDateRange.test.ts`
(169 vs 168 hourly buckets across the DST change), which this PR doesn't
touch.
2026-11-09 09:47:35 -05:00
011b7cd4ac feat(studio): derive issues from advisor lints (#52989)
Part 1 of 6: #52989 → #52990 → #52991 → #52992 → #52993 → #53138

Advisors becomes Issues. This PR maps lints to issues on the client: one
issue per check, each lint an affected resource, plus one issue for
banned IPs. There's no Issues API yet, so issues exist only while their
check fails. Nothing renders them until #52990.

## How to test

- Read `data/issues/lint-to-issue.ts`; the rest follows from it.
- `pnpm --filter studio exec vitest run data/issues
components/interfaces/Issues`

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-11-09 14:38:13 +01:00
Drew McLellan 4c68610167 feat(studio): copy large values when duplicating a row (#53091)
## What

Follow-up to #52952. The grid truncates large columns (over 10 KB) in
the database query, so \"Duplicate row\" used to leave those fields
blank. It now fetches their full values and fills them into the Insert
Row panel.

## Behavior

- Truncated columns are fetched by primary key after the panel opens.
Each one is disabled with \"Loading full value...\" until it arrives,
and Save is disabled until every value has settled. Submitting the form
another way (e.g. pressing Enter) is blocked too.
- Only the truncated fields are filled in, so anything the user has
edited is never overwritten.
- If a value can't be copied, the field stays empty with a note saying
why:
- the value is over 1 MB (it isn't sent, so a single row can't pull an
unbounded amount of data into the browser)
  - the table has no primary key
  - the fetch failed (also shows a toast)
- The fetch honors \"View as role\", like the existing \"Load full\"
buttons.

## How

- New `useRowLargeValuesQuery` in `data/table-rows/` selects the
truncated columns of one row in a single query. Each column is returned
as `NULL` when it exceeds `MAX_ROW_LARGE_VALUE_BYTES`. The SQL is built
with `ident()`, `literal()` and the Query builder.
- A new `useCopiedLargeValues` hook owns the fetch and per-field status,
to keep `RowEditor` from growing further. Pure helpers
(`getTruncatedFieldNames`, `getPrimaryKeyMatch`, `mergeLargeValues`) are
in `RowEditor.utils.ts`.
- `InputField` takes an optional `status` and renders the note.

## Also changes

`isValueTruncated` now compares byte length instead of character length.
The query truncates when a value exceeds the limit in bytes but cuts by
characters, so a value of multibyte characters could be truncated and
still be shorter than the limit in characters, and wasn't detected.
Comparing bytes still never flags a genuine value, because an
untruncated value is at most the limit in bytes. Edit row's \"Load
full\" buttons benefit from the same fix.

## Notes

- A fetched value over 10 KB that genuinely ends in `...` still looks
truncated to the existing check, so the form disables that field, as it
already does when editing such a row.
- A column that changed to `NULL` after the grid loaded also shows the
\"too large\" note.

## Testing

- Unit tests for the SQL builder (including identifier and literal
escaping), the byte-aware detection, and the new helpers.
- Component tests for `RowEditor`: the full value is fetched and
included in the insert; field and Save are disabled while loading
(including form submit); too large, fetch failure, and no primary key
leave the field empty with a note; nothing is fetched when no value was
truncated. I confirmed the loading test fails when the Save guard is
removed.

Resolves FE-4927
2026-11-09 12:53:25 +00:00
Danny White 5cf3cf1032 feat(studio): make security the home for sign-in and recovery setup (#52358)
## Problem

- Sign-in methods are in Preferences, separate from MFA and recovery
settings.
- The risk of a single sign-in method (e.g. GitHub, and getting locked
out of that account) isn’t clearly communicated.

## Solution

- Bring sign-in methods, MFA and recovery codes together on the Security
page. If Security is disabled, sign-in methods remain accessible in
Preferences.
- Highlight the most important next step with a primary button. For
example, when MFA is off, “Set up MFA” takes priority over adding a
password.
- Explain the risk of relying on a single sign-in provider, and make it
clear which email address a new password will apply to.
- After connecting a sign-in provider, return users to the settings page
they can access. Links to password setup open the password dialog
directly.

| After |
| --- |
| <img width="1460" height="1426" alt="CleanShot 2026-11-06 at 14 54
23@2x"
src="https://github.com/user-attachments/assets/afb82601-1b6f-43be-9e98-a0edb8d529c8"
/> |
| _The “Sign-in methods” section moved to Account → Security. Note also
the new Admonition regarding the risk of a single (GitHub) sign-in
method._ |

## Review instructions

1. Open
[Security](https://studio-staging-git-dnywh-recovery-security-home-supabase.vercel.app/dashboard/account/security#sign-in-methods).
Check sign-in methods appear above MFA and recovery codes. With MFA off,
“Set up MFA” should be primary.
2. Open Preferences. Sign-in methods should be absent unless Security is
disabled.
3. On a test account, check password setup, email editing and provider
linking. [Open password setup
directly](https://studio-staging-git-dnywh-recovery-security-home-supabase.vercel.app/dashboard/account/security?securityAction=set-password#sign-in-methods),
then cancel and confirm it stays closed.
2026-11-09 17:42:43 +11:00
Danny White b83ad78d77 feat(studio): show recovery code health in account security (#52355)
## Problem

Users can run out of recovery codes without a clear warning that they
have lost a backup way to sign in.

## Solution

Show a warning when codes are running low or used up, with Regenerate
beside the code count. When MFA is enabled but codes are missing,
explain how to generate them. Keep recovery codes hidden until MFA is
enabled.

Remove standalone code deletion. Users can regenerate codes while MFA is
enabled.

| Before | After |
| --- | --- |
| <img width="1024" height="682" alt="Security Account Supabase"
src="https://github.com/user-attachments/assets/1c7a4c52-00c9-4c31-8b3a-ef0599555a1a"
/> | <img width="1024" height="682" alt="81082"
src="https://github.com/user-attachments/assets/ae662802-4fab-4c93-a5cb-52ed39d16f87"
/> |
| _3/10 codes left._ | _3/10 codes left._ |
| <img width="1024" height="682" alt="21450"
src="https://github.com/user-attachments/assets/82049f44-2fca-4477-84bf-23ab009868be"
/> | <img width="1024" height="682" alt="Security Account Supabase"
src="https://github.com/user-attachments/assets/e2185026-af6a-42a5-bc10-b587e3d2d4ab"
/> |
| _0/10 codes left._ | _0/10 codes left._ |

## Review instructions

1. Open [Recovery
codes](https://studio-staging-git-dnywh-recovery-code-health-supabase.vercel.app/dashboard/account/security#recovery-codes)
with one authenticator and generated codes.
2. In DevTools, override GET `/factors/recovery-codes`: keep the other
fields, set `remaining` to `0`, save and reload. Check the warning.
Repeat with `3`, then restore the response.
3. With MFA off, check that the Recovery codes section is hidden.
Disable overrides before using Regenerate.
2026-11-09 17:34:51 +11:00
Danny White 52cc917752 feat(studio): clarify authenticator setup and backup status (#52354)
## Problem

MFA setup and backup status are difficult to scan, and unverified
factors can appear as configured authenticators.

## Solution

- Show only verified authenticators (non-abandoned setup), with a clear
setup state when none are configured.
- Show backup guidance from the shared recovery checks and emphasise the
most relevant MFA action once those checks succeed.
- Align authenticator rows with the existing controls, use removal icons
with tooltips, and prevent removal when recovery-code status cannot be
confirmed.

| Before | After |
| --- | --- |
| <img width="1024" height="759" alt="7693"
src="https://github.com/user-attachments/assets/1deb07ef-91ce-481b-87f6-4baa7b023f94"
/> | <img width="1024" height="759" alt="18215"
src="https://github.com/user-attachments/assets/f17248a2-2001-4d95-ba28-3f16b75af0fb"
/> |
| <img width="1024" height="759" alt="Security Account Supabase"
src="https://github.com/user-attachments/assets/ede61c84-0baa-4139-9773-0953a05cbd94"
/> | <img width="1024" height="759" alt="14038"
src="https://github.com/user-attachments/assets/58ab1a70-0392-4706-8df3-2ba078c5a8ba"
/> |


## Review instructions

1. Open [MFA
settings](https://studio-staging-git-dnywh-recovery-mfa-status-supabase.vercel.app/dashboard/account/security#mfa)
without a verified authenticator. Confirm the setup empty state offers
“Set up MFA”.
2. Use an account with one authenticator and healthy codes. Check the
backup warning, aligned icon row, and remove tooltip.


## Validation

14 focused tests passed, including Auth SDK network responses and failed
recovery-status reads keeping removal unavailable. Formatting passed.
Focused ESLint passed with the locally incompatible TanStack
exhaustive-deps rule disabled; standard lint is blocked by the installed
plugin rejecting the current rule options. Full local typecheck still
reports errors in untouched panel and MCP files; none remain in this
PR's changed files.
2026-11-09 17:34:51 +11:00
Danny WhiteandJoshen Lim c7b49e2b1b feat(studio): resume account actions after recovery-code verification (#52747)
## Problem

Recovery-code verification uses a separate sign-in layout and returns
users to Security without resuming the selected action.

## Solution

Visually align with other security checks: use InterstitialLayout and
return to the selected authenticator’s removal confirmation. Cancel
returns to Security without signing out. Verification never removes the
authenticator automatically.

| Before | After |
| --- | --- |
| <img width="1280" height="1323" alt="Supabase"
src="https://github.com/user-attachments/assets/404e7b6d-6fe6-492a-b853-dc3b13b8f767"
/> | <img width="1280" height="1323" alt="47214"
src="https://github.com/user-attachments/assets/0100cf2f-3252-4f5c-a3a6-17bb0d81dfa5"
/> |

| After |
| --- |
| <img width="1280" height="1323" alt="45032"
src="https://github.com/user-attachments/assets/584254e2-0772-4dae-a0e5-9be6a8f99239"
/> |
| _Loading state._ |
| <img width="1280" height="1323" alt="8565"
src="https://github.com/user-attachments/assets/6d14459d-f172-4338-a021-fb5721649fda"
/> |
| _Standard unfilled state._ |
| <img width="1280" height="1323" alt="47304"
src="https://github.com/user-attachments/assets/83eca080-0fb6-4b3e-a52b-0110c6f8714a"
/> |
| _Error state. I’ve removed `font-mono` since this screenshot._ |

This PR also includes the _Use recovery code instead_ option into the
prior PR’s _Verify your identity_ interstitial:

| After |
| --- |
| <img width="1280" height="763" alt="6526"
src="https://github.com/user-attachments/assets/a05e3bc5-061d-4297-9fd0-e456dba44d4a"
/> |
| _Addition of the _Use recovery code instead_ button._ |


## Review instructions

Use a disposable MFA account with saved recovery codes. Successful
verification consumes one code.

1. Open [Security on this
preview](https://studio-staging-git-dnywh-recovery-code-verification-supabase.vercel.app/dashboard/account/security).
Follow [#52352’s breakpoint
steps](https://github.com/supabase/supabase/pull/52352#review-instructions)
on this preview to show Verify your identity. Remove the breakpoint
before continuing.
2. Choose Use a recovery code instead. Check the code visibility control
and an invalid-code error, then enter a valid saved code. The selected
authenticator’s removal confirmation should open. Nothing is deleted
until you click Remove.
3. Repeat and Cancel on the recovery-code screen. Return to Security and
remain signed in.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-11-09 16:35:32 +11:00
Danny WhiteandJoshen Lim 1052d414ad fix(studio): verify identity before removing authenticators (#52352)
## Problem

Authenticator removal can fail when the session has not completed MFA.

This is difficult to test (see below) but shows an awkward toast with
unclear “AAL1” and ”AAL2” copy, which is unhelpful to the user.

## Solution

Checks the session before removal confirmation. If needed, shows _Verify
your identity_ first.

Depends on #52351. Badge presentation: #52748. Recovery-code
verification: #52747.

| After |
| --- |
| <img width="814" height="725" alt="Security Account Supabase"
src="https://github.com/user-attachments/assets/8d0dc002-3777-4ba5-a4bc-9d98a059c2c4"
/> |
| _Unfilled state._ |
| <img width="814" height="725" alt="63727"
src="https://github.com/user-attachments/assets/5472de19-99b6-4403-aaca-f92e319445cb"
/> |
| _Errored state._ |
| <img width="814" height="725" alt="27157"
src="https://github.com/user-attachments/assets/f8480f0b-5cc4-432f-b38f-79cd311274cf"
/> |
| _What the above (success state) unlocks: being able to remove
authenticator._ |

## Review instructions

Use a disposable MFA account and sign in normally.

1. Open [Security locally](http://localhost:8082/account/security) (so
the breakpoint feature can be used). Click Delete beside an
authenticator. Since you already entered an MFA code at sign-in, removal
confirmation should open directly. Cancel keeps the authenticator. Click
Cancel.
2. To show verification, open DevTools → Sources → ⌘P. Find
`mfa-authenticator-assurance-level-query.ts`. Inside
`getMfaAuthenticatorAssuranceLevel`, click the line number beside
**`return data`** to add a breakpoint, then (back in the Studio
interface) click Delete.
3. When Paused in debugger appears, press Esc for the Console drawer (in
DevTools) and run `data.currentLevel = 'aal1'`. Remove the breakpoint by
clicking its line number again, then press F8 or Resume ▶ (at the top of
Studio in the yellow strip).
4. Try an invalid authenticator code, then a valid one. Verification
must lead to a separate removal confirmation. Cancel must keep the
authenticator.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-11-09 16:35:31 +11:00
Danny White ed03223f5a fix(studio): preserve authenticator removal progress on failure (#52351)
## Problem

Failed authenticator removal shows a toast and can repeat completed
steps on retry. A failed recovery-code status check can also allow
removal before Studio knows whether codes exist.

## Solution

Show errors below the dialog content, preserve removal progress on
retry, and block removal until recovery-code status is known. Add Retry
for failed status checks.

| After |
| --- |
| <img width="1450" height="458" alt="CleanShot 2026-11-04 at 15 34
41@2x"
src="https://github.com/user-attachments/assets/98989ad0-9b43-4203-95e4-1767346f2a8e"
/> |
| _Retry action._ |
| <img width="1514" height="246" alt="CleanShot 2026-11-04 at 15 16
37@2x"
src="https://github.com/user-attachments/assets/969b6525-c380-4a8a-9826-58bfe04887f8"
/> |
| _Blocked `recovery-codes` means user cannot delete MFA._ |
| <img width="1088" height="1040" alt="CleanShot 2026-11-04 at 15 18
08@2x"
src="https://github.com/user-attachments/assets/08e6631f-e90e-4719-bd0b-6360d5871d48"
/> |
| _If `recovery-codes` becomes unavailable after dialog is open, show
the error inline (not as a toast)._ |

## Review instructions

Use a disposable MFA account with recovery codes. Successful removal
deletes the authenticator and, if it was the last, its codes.

1. Open
[Security](https://studio-staging-git-dnywh-recovery-removal-errors-supabase.vercel.app/dashboard/account/security).
In DevTools Network, right-click GET `/factors/recovery-codes` → Block
request, then reload. Confirm removal is disabled. Unblock and click
Retry to enable it.
2. Open the removal dialog, then block the same request without
reloading. Click Remove: the error should appear below the content.
Unblock and retry: removal should succeed.
2026-11-09 16:35:31 +11:00
Danny White 156738417b fix(studio): centre the account recovery interstitial (#53073)
## Problem

The account recovery interstitial sits too high on tall screens because
it overrides the shared layout with fixed top padding.

## Solution

Use the shared interstitial layout's vertical centring for the reminder,
loading and unavailable states.

| Before | After |
| --- | --- |
| <img width="1451" height="957" alt="69167"
src="https://github.com/user-attachments/assets/b473a983-93a9-4c57-866c-5ce6dd02dddf"
/> | <img width="1280" height="1323" alt="Organizations Supabase"
src="https://github.com/user-attachments/assets/fe0af974-36fb-4edf-adfd-abfa75c22038"
/> |

## Review instructions

1. Use this PR's
**[studio-staging](https://studio-staging-git-dnywh-fixrecovery-interstiti-efb132-supabase.vercel.app/)**
preview with `enableAccountRecoveryInterstitial` and
`enableAuthRecoveryCodes` enabled. Sign in with a non-SSO test account
that has MFA but no recovery codes, and complete MFA verification.
2. If the account has previously skipped the reminder, remove its
`account-recovery-reminder:<user-id>` entry from local storage on this
preview origin, then reload.
3. Open `/dashboard/organizations` The reminder appears over the
dashboard after its background checks finish. Confirm the card is
vertically centred on a tall desktop viewport.
4. Use a narrow viewport, a short viewport and 200% browser zoom.
Confirm all content and **Skip for now** remain reachable by scrolling
when needed. Skip rather than generating codes if you do not want to
change the test account.
2026-11-09 10:23:06 +11:00
Ayush Gade 9f351563a9 fix(studio): prevent column comment data loss from sensitivity marker (#53051)
## What

Studio stores a column's "sensitive data" flag in-band by adding
`[SENSITIVE]` to the column's comment. The encode/decode helpers matched
the marker **anywhere** in the string, which caused two problems:

* A comment that merely *contains* `[SENSITIVE]` (e.g. `Fields marked
[SENSITIVE] are PII`) was wrongly treated as sensitive.
* The marker was stripped from the **middle** of the user's text on save
- even when the sensitivity toggle was off - silently corrupting
user-authored content.

Discussion: https://github.com/orgs/supabase/discussions/52699

## Changes

Following the direction in the discussion:

1. **One shared helper** - the marker logic was duplicated in three
places (`ColumnEditor.utils.ts`, `state/table-editor-table.tsx`, and the
toggle in `TableEditor/Column.tsx`), each slightly different. These are
consolidated into a single `lib/sensitive-column-comment.ts` with
`isSensitiveComment` / `encodeSensitiveComment` /
`decodeSensitiveComment`.
2. **Prefix-anchored detection and removal** - the marker is only
matched and stripped when it's an exact leading prefix (plus at most one
following space), so a mid-string `[SENSITIVE]` is preserved verbatim.
3. **Standardized the marker position** - `Column.tsx`'s toggle
previously appended the marker to the *end* of the comment, while the
column editor prepended it. The toggle now writes the canonical prefix,
so detection is consistent across all paths.
4. **Backward compatibility** - to avoid losing the flag on columns that
were saved with a *trailing* marker (the old toggle behavior),
`decodeSensitiveComment` also recognizes and strips an existing trailing
marker. Re-saving such a column migrates it to the prefix form.

## Example

```ts
// Before
encodeSensitiveComment('a [SENSITIVE] b', false) // -> 'a  b'  (data loss)

// After
encodeSensitiveComment('a [SENSITIVE] b', false) // -> 'a [SENSITIVE] b'  (preserved)
```

Tests

Added lib/sensitive-column-comment.test.ts covering the encode/decode
round trip, the mid-string case, the bare-marker case, and legacy
trailing-marker migration (16 cases).

Note for reviewers

Point 4 (decoding a legacy trailing marker) is the one behavior I'd like
a sanity check on.... it's there so columns already flagged via the old
grid toggle don't silently lose their flag after this change. Happy to
drop it if you'd prefer to keep decode strictly prefix-only.
2026-11-06 19:24:48 +00:00
Connor Davis c920e07d9c feat(studio): review a pending network restrictions change (#52984)
## Problem

A network restrictions change that was never applied can now wait for
the customer's review ([API
Docs](https://api.supabase.com/api/v1#tag/projects/POST/v1/projects/{ref}/network-restrictions/review),
[CTRL-1934](https://linear.app/supabase/issue/CTRL-1934)). Studio
doesn't show it. Lists with an entry that isn't a valid IP range also
fail to save without saying which entry is wrong.

## Solution

- A change in review shows one callout with **Apply change** and
**Discard change**, and both lists together: added entries in green,
removed ones in red. Editing is disabled until it's resolved, and
discarding asks for confirmation. Only the change on screen is resolved
(`pending_requested_at`).
- A list the worker is still applying shows as applying and is polled,
instead of showing the "not applied correctly" error.
- Entries that aren't valid ranges are marked Invalid with a suggested
correction, and can be saved corrected. The add dialog rejects
IPv4-mapped IPv6 addresses and finds duplicates spelled differently.

There's no way to create a review yet: a change only ends up in review
when the backend fails to apply a list. I tested the review state
locally by editing the database directly.

Stacked on #53046, which syncs the API types with production, including
the review endpoint. This PR will be retargeted to `master` once that
merges.

## Screenshots

<img width="712" height="473" alt="Screenshot 2026-11-04 at 5 10 19 PM"
src="https://github.com/user-attachments/assets/c72cc38d-f7b4-4269-a787-f27dfe382086"
/>

### If pressing `apply`

<img width="704" height="150" alt="Screenshot 2026-11-04 at 5 19 27 PM"
src="https://github.com/user-attachments/assets/92dce8e5-8d58-48b8-8899-ed01c9f242c2"
/>

### If pressing `discard`

<img width="712" height="473" alt="Screenshot 2026-11-04 at 5 10 38 PM"
src="https://github.com/user-attachments/assets/85656004-d510-4cef-89c1-80d9f95ebb83"
/>

### Invalid

<img width="754" height="596" alt="Image"
src="https://github.com/user-attachments/assets/4ba480f6-af4c-4253-9693-2c545fb77ab1"
/>

### Invalid repair

<img width="704" height="680" alt="Screenshot 2026-11-04 at 6 03 20 PM"
src="https://github.com/user-attachments/assets/ed4e3dcf-8d9b-4588-afc0-938248c78712"
/>

### Invalid and Pending

<img width="704" height="593" alt="Image"
src="https://github.com/user-attachments/assets/7ad76b50-0d08-4505-89ad-b6afff6865af"
/>

### Invalid and Pending repair

<img width="704" height="585" alt="Screenshot 2026-11-04 at 6 05 04 PM"
src="https://github.com/user-attachments/assets/b123453f-0f30-452d-b84c-a556c52458a0"
/>

## Review instructions

1. Locally, put a project's network restrictions into review by editing
the database directly. There's no API that creates one.
2. Open Database Settings > Network restrictions and check the callout
and the added and removed entries.
3. Apply or discard the change.

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [x] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
2026-11-06 13:15:46 -05:00
Charis 597d1ce56e fix(studio): pass caller options to grant-gated query factories (#53088)
## Context

Grant-gated query factories returned `queryFn: skipToken` when the
caller had no grant. TanStack Query keeps one options object per cache
entry, overwritten by whichever observer rendered last. When that was a
grant-less observer, invalidation refetched with `skipToken` and failed
with `Missing queryFn`, breaking the query for every other observer on
the key. #53075 patched two call sites; this fixes the factories.

## Changes

- New `grantedQueryOptions` helper (`data/granted-query-options.ts`).
Without a grant, the factory sets `queryFn: undefined` instead of
`skipToken`, so TanStack borrows the query function from a subscribed
observer that has one. The caller's `enabled` applies only when the
factory has a query function.
- `apiKeysQueryOptions`, `revealedApiKeysQueryOptions`,
`branchesQueryOptions`, `branchQueryOptions` and
`branchDiffQueryOptions` take caller options as a second argument. Call
sites change from `useQuery({ ...f(vars), enabled })` to
`useQuery(f(vars, { enabled }))`, so callers can't override the grant
gate.
- New type-aware `fga/no-spread-granted-query-options` lint rule
(error). `grantedQueryOptions` returns a type-only brand, and the rule
flags any spread or `Object.assign` of a branded value, however it was
built or named.
- Restores typed linting as a separate pass
(`eslint.type-checks.config.cjs`, run by `pnpm lint` via
`lint:type-checks`), as #44678 did. Enabling type info in the main
config changes what other plugins report, so it stays separate.
- `studio-queries` skill documents the pattern.

Callers still pass their own grant, so the UI gates on the same grant
the request carries.

## Testing

- `data/api-keys/api-keys-query.test.tsx`: a granted and a grant-less
component share the key, with the grant-less one rendering last;
invalidation via the delete mutation refetches successfully. Fails on
master with `Missing queryFn`.
- `data/granted-query-options.test.ts`: `enabled` gating, factory fields
win over caller fields, `select` type inference.
- Lint rule cases in `scripts/__tests__/fga-eslint-rules.test.ts`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-11-06 11:04:00 -05:00
Ivan VasilovandClaude Sonnet 5.5 fe7b3ad6af chore: bump @graphql-codegen and its deps (#52785)
## Problem

`@graphql-codegen/cli` and related packages in `apps/studio` and
`apps/docs` were pinned to old major versions (`cli` 5.0.5, `typescript`
4.1.6, `typescript-resolvers` 4.5.0).

## Solution

- Bump `@graphql-codegen/cli` to `^7.0.0` and
`@graphql-codegen/typescript-resolvers` to `^6.0.0`. Drop the explicit
`@graphql-codegen/typescript` dependency from `apps/docs`.
- Regenerate the Studio GraphQL output in `apps/studio/data/graphql/`
with the new codegen. The generated files now include an `index.ts`
export change, and `graphql.ts` is much smaller.
- Refresh `apps/studio/scripts/schema.graphql`, which picks up the new
`ManagementApiReference` search result type.
- Update `.prettierignore` (ignore `apps/studio/.output`,
`apps/studio/dist`, and all of `apps/ui-library/public`) and run
Prettier on the regenerated files.

## Review instructions

1. Check the dependency bumps in `apps/studio/package.json` and
`apps/docs/package.json`.
2. Re-run the Studio codegen and confirm it produces no diff in
`apps/studio/data/graphql/`.
3. Run `pnpm typecheck` and confirm the GraphQL consumers in Studio
still compile.

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-06 14:01:38 +00:00
supabase-vercel-tedd[bot] b1cc9cf436 fix(studio): show an error toast when deleting a JWT signing key fails (#53087)
## What kind of change does this PR introduce?

Bug fix

## What is the current behavior?

On the JWT Keys settings page, the delete mutation for a signing key is
called with a custom `onError` that only closes the dialog. A custom
`onError` replaces the hook's default error toast, so when the API
rejects the delete (for example a 422 for a revoked key that cannot be
deleted yet), the dialog closes and nothing tells the user why.

## What is the new behavior?

The custom `onError` still closes the dialog, and now also shows `Failed
to delete JWT signing key: <API error message>` as an error toast.

## How to verify

1. Open Project Settings > JWT Keys on a project with a revoked signing
key that the API refuses to delete.
2. Click Delete on the revoked key and confirm.
3. An error toast appears with the API's error message, and the dialog
closes.
4. Deleting a revoked key that the API accepts still shows "Successfully
deleted key" and removes it from the list.

## Checks run

- `pnpm turbo run lint --filter='[origin/master]'`
- Studio typecheck (`tsc --noEmit` in `apps/studio`; the turbo run ran
out of memory, the direct run passed)
- Prettier check on the changed file


[FE-4943](https://linear.app/supabase/issue/FE-4943/no-error-message-shown-when-deleting-revoked-jwt-key-fails)

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
2026-11-06 07:56:18 -06:00
Pedro Rodrigues e8a82b4db2 docs(mcp): document notebook tools for MCP v0.16.0 (#53045)
## Problem

[MCP
0.16.0](https://github.com/supabase/mcp/releases/tag/mcp-server-supabase-v0.16.0)
enables the notebook tools (`create_notebook`, `run_notebook`,
`delete_notebook`) alongside `list_notebooks` and `get_notebook`, in the
`notebooks` feature group, and
[0.16.1](https://github.com/supabase/mcp/releases/tag/mcp-server-supabase-v0.16.1)
enables that group by default. The MCP docs page doesn't mention them or
their confirmations, and the configuration panel has no way to select
the group or skip its confirmations.

## Solution

Document the Notebooks group on the MCP page in the same format as the
other groups: hosted only, not available in local or self-hosted Studio.
Add a Notebook confirmations section covering `run_notebook` and
`delete_notebook` elicitation and read-only behavior. Add `run_notebook`
and `delete_notebook` to `skip_elicitations`, and add a Notebooks
recommendation covering the per-run limits (50 query cells, about 1 MB
of rows).

In the configuration panel and Studio Connect sheet, add Notebooks as a
default group for hosted connections only. A `defaultDisabled` flag on
each group replaces the hardcoded Storage exclusion, and the notebook
skip options appear only while Notebooks is enabled.

No docs change needed for the other 0.16.0 and 0.16.1 fixes (feedback
`project_id`, project ref hint, `partition_of`, check expressions,
EXPLAIN confirmation, edge function paths, notebook URLs in tool
outputs).

## Before merge

-
[supabase/platform#38799](https://github.com/supabase/platform/pull/38799)
must ship. Until then, hosted only serves `list_notebooks` and
`get_notebook`.
- The scoped token permissions table is generated from the platform
`mcp-tools-permissions` endpoint, which doesn't list `create_notebook`,
`run_notebook`, or `delete_notebook` yet.

## Verification

<img width="838" height="367" alt="image"
src="https://github.com/user-attachments/assets/29d1bd4e-5046-4986-9dbb-ed077bdf3a56"
/>

MCP Docs preview
[page](https://docs-git-rodriguespn-ai-1409-mcp-docs-v0-16-0-supabase.vercel.app/docs/guides/ai-tools/mcp)

Closes AI-1409
2026-11-06 12:49:39 +00:00
Joshen Lim 06d43f6881 Joshenlim/fe 4721 cmd k support searching for triggers (#52755)
## Context

Building off from
[here](https://github.com/supabase/supabase/pull/52751) to make Cmd+K
resource-aware so finding and inspecting anything in a project doesn't
depend on knowing where it lives in the dashboard.

Specifically looking into database entities for now - end state would be
that you could search for a table name for example, and Cmd K will pull
up everything related to that table for you to skim (e.g Policies,
Functions, Triggers, etc). Changes in this PR sets up searching for
**database triggers**, and will probably be the last database entity
that we'll add into context aware cmd K for now given that we'll have
tables, policies, functions and triggers which are the primary building
blocks for a project.

<img width="500" alt="image"
src="https://github.com/user-attachments/assets/242ec517-88cd-4f3d-96ce-741edaa8560d"
/>

Triggers will also match if it's function matches the search input, and
its description will tweak slightly as well
<img width="500" alt="image"
src="https://github.com/user-attachments/assets/65f515df-b875-4b92-95b7-00389d8a070b"
/>

## Performance

Had Claude do some benchmarking against `getSearchEntitiesSql` (`EXPLAIN
ANALYZE`, median of 5 runs, local Postgres, warm cache) on one synthetic
catalog:
- 12,000 tables (36,651 `pg_class`), 6,001 policies, 27,261 `pg_proc`
(12,000 user + 12,000 extension-owned functions), 56,304 `pg_trigger`
- 3,500 user triggers, 500 of which run one shared function; the rest
are internal FK triggers
  - 297,921 `pg_depend`.

Compared against master (tables + policies) and the functions PR (before
triggers).

| Search | What it exercises | master | functions PR | this PR | Δ this
PR |
|---|---|---|---|---|---|
| `t_1` | broad table match | 12ms | 26ms | 30ms | +4ms |
| `p_1` | broad policy-name match | 15ms | 27ms | 35ms | +8ms |
| `fn_1` | broad function match | 10ms | 26ms | 33ms | +7ms |
| `trg_1` | broad trigger-name match | 9ms | 23ms | 32ms | +9ms |
| `trg_` | every user trigger matches by name | 10ms | 25ms | 40ms |
+15ms |
| `audit_row_fn` | function match; its 500 triggers match only through
the function | 9ms | 24ms | 31ms | +7ms |
| `ri_constraint` | only internal FK triggers match | 9ms | 24ms | 30ms
| +6ms |
| `stress.fn_1` | schema-qualified | 12ms | 33ms | 40ms | +7ms |
| `zzz` | no match | 9ms | 22ms | 27ms | +5ms |

- Triggers add +4 to +15ms over the functions PR. The worst case is a
search matching every user trigger, at 40ms in total.
- Matching triggers through their function shares the single
`pg_trigger` pass the name search already does, with no extra scan. A
separate pass measured about 30ms more on every search.

## To test
- [ ] Search a table name: Tables first, then policies, and functions,
and triggers
- [ ] Search a trigger name: it appears under triggers and opens the
editor panel in database/triggers
- [ ] Search a function name: trigger results should appear if the
trigger uses that function
- [ ] Trigger outside public: schema filter switches and the trigger
opens
2026-11-06 17:04:39 +08:00
Joshen Lim 7a9f019825 Fix api keys query cache entry (#53075)
## Context

Creating a secret API key on Project Settings -> API Keys showed "Failed
to load secret API keys" with `Missing queryFn:
'["projects","<ref>","api-keys"]'`.
<img width="1148" height="212" alt="image"
src="https://github.com/user-attachments/assets/72d5daf7-b894-401c-9e8d-8d180c3d6ecd"
/>

This was happening as two components on the page (the API docs panel and
the connection popover) fetched the same API keys data but turned
fetching off by removing the fetch function. After you created a key,
the refetch used their missing fetch function instead of the real one
and failed. So the fix here is just to pass the real grant and gate
fetching with `enabled` instead

## To test

- Open `/project/[ref]/settings/api-keys`.
- Click **New secret key** and create a key.
- The key list refreshes with the new key and there is no "Failed to
load secret API keys" error.
2026-11-06 16:00:23 +08:00
CharisandJoshen Lim 1fcd420530 feat(studio): suggest enabling Explorer preview on notebook pages (#53060)
## Problem

Direct notebook links open even when the Explorer feature preview is
off, while the navigation item stays hidden. Users who land on a
notebook this way get no hint that the Explorer preview exists or how to
turn it on.

Resolves FE-4939:
https://linear.app/supabase/issue/FE-4939/suggest-enabling-explorer-preview-when-opening-notebook-links

## Solution

- Add `ExplorerPreviewSuggestion`, an admonition titled "Explorer is a
feature preview" with the text "Enable the Explorer preview to find
notebooks from the navigation bar." and an "Enable Explorer" button. The
button opens the feature preview modal on the Explorer entry.
- Render it below the notebook toolbar in `ExplorerNotebookTab`, only in
the loaded notebook state.
- Show it only on platform, when the `explorer` flag is on and the user
has not opted in to the preview. It is not dismissible and disappears
once the preview is enabled.

## Testing

- Existing Explorer component tests pass.
- Lint ratchet passes.
- Manual check: with the `explorer` flag on and the preview off, open a
notebook URL directly, confirm the notice appears, and confirm the
button opens the feature preview modal.

## Review instructions

1. Enable the `explorer` flag and make sure the Explorer feature preview
is off.
2. Open a notebook URL directly.
3. Confirm the "Explorer is a feature preview" notice appears below the
notebook toolbar.
4. Click "Enable Explorer" and confirm the feature preview modal opens
on the Explorer entry.
5. Enable the preview and confirm the notice disappears.

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-11-06 12:34:28 +08:00
Charis 757040ffc7 feat(studio): add reveal refinement for single api-key reads (#52965)
Part 5 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 #52964.

## 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
- Adds a `reveal` refinement for `GET /v1/projects/{ref}/api-keys/{id}`,
mirroring the list endpoint: the `reveal` variant adds
`api_gateway_keys_secret_read`, and the wrapper owns the `reveal` query
param.
- `getAPIKeysById` takes a plain or reveal grant instead of
`unguarded.migrating` and a manual `reveal` flag.
- `useRevealedSecret` mints the reveal grant, returns it, and doesn't
request unless it's granted.
- `ApiKeyPill` uses the reveal grant instead of its V2 check. Reveal and
copy are disabled while the check loads, when denied, or when it fails.
Publishable keys aren't gated.
- `useConnectServerEnv`: the secret can only be revealed once the reveal
grant is granted.

**Guard drift:** `ApiKeyPill` checked only
`api_gateway_keys_secret_read`, but the endpoint needs
`api_gateway_keys_read` and `api_gateway_keys_secret_read`. Users with
only the secret permission saw an enabled button and got a 403; they now
see it as restricted.

## Testing
- `data/guarded-fetch.test.ts`: type tests for the by-id endpoint (plain
and reveal grants match the raw client, `reveal` rejected as a caller
param, a list-endpoint reveal grant rejected), and a runtime test that
`reveal` is set from the grant. The "variant the endpoint doesn't have"
negative now uses the branches endpoint.
- `ApiKeyPill.platform.test.tsx` (renamed from `ApiKeyPill.test.tsx`,
now on real grants through MSW): reveal and copy when granted, denied
(no request), permission-check error, publishable keys not gated.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-11-05 15:21:32 -05:00
Charis e05ef0e50c fix(studio): use API collation warning for read replica eligibility (#53049)
## What

Read replica eligibility now uses the `collation_reindex_required`
warning returned by the upgrade eligibility endpoint
(`/v1/projects/{ref}/upgrade/eligibility`) to decide whether to block
replica creation, instead of reimplementing the collation lineage
boundary check in Studio.

- Removes `CollationLineage.utils.ts` and its tests.
- `useCheckEligibilityDeployReplica` sets `isCollationLineageCrossed`
when the response includes a `collation_reindex_required` warning.

## API types

Regenerated `packages/api-types` from the production specs so the new
warning type is available. The regen also picks up other recent API
changes, which Studio now handles so typecheck passes:

- `PROMOTING` project status: added labels in `BranchStatusBadge` and
the dev toolbar's `ProjectStatusTab`.
- `table_using_reg_type` upgrade validation error (tables with columns
using `reg*` types that `pg_upgrade` can't carry over): added a title,
description, and Manage link to the table in `UpgradeWarnings`.

## Testing

- Studio typecheck passes (the one remaining error, in `ui-patterns`
McpUrlBuilder, is also on `master`).
- Read replica and infrastructure settings unit tests pass.
2026-11-05 15:20:51 -05:00
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
c5cdb59c47 feat(studio): prerender signed-out auth pages in the TanStack build (#52690)
## Problem

The TanStack Start build serves every document from the prerendered SPA
shell (`_shell.html`). For signed-out pages such as `/sign-in` and
`/sign-up`, the first HTML response holds only the loading fallback and
the generic `<title>Supabase</title>`. The page content and route
`head()` tags only appear after the JS bundle hydrates.

## Solution

On platform builds, prerender `/sign-in`, `/sign-up`, `/sign-in-sso` and
`/forgot-password` to static HTML next to the shell.

- `lib/prerendered-routes.ts`: the list of prerendered paths, shared by
the build config, the Vercel routes and the root route.
- `vite.config.ts`: passes the paths to `tanstackStart({ pages })` with
link crawling off, so only these pages are prerendered. Self-hosted
builds prerender nothing (self-hosted sign-in redirects straight to the
default project).
- `scripts/vercel-spa-routes.ts`: serves `<path>/index.html` for each
prerendered path (with and without the base path, optional trailing
slash, case-sensitive), ahead of the shell catch-all.
- `routes/__root.tsx`: renders `<Outlet />` once hydrated, or before
hydration when the path is prerendered; otherwise `<ShellFallback />`.
The Outlet stays at the same position in the tree, so navigating away
from a prerendered page doesn't remount it.

One prerendered file serves every visitor and every query string, so the
first render of these pages can't depend on per-visitor state:

- Search-param reads that affect render return empty until
`useHydrated()`, then update. `useInboundBranding` checks this directly,
and the "Sign up", "Sign in" and "Continue with SSO" link hrefs read
from `useHydratedQuery`.
- The "Sign in" links on `/sign-up` and `/forgot-password` now carry the
query params. The `/sign-up` link drops `returnTo=/new`, the default the
"Sign up" link sets, so existing users don't land in the new-org flow.
- Form controls sit in a `DisabledUntilHydrated` fieldset, so input
typed before hydration isn't lost and Enter can't natively POST the
form.
- The sign-in/forgot-password logo switches light/dark via CSS (`dark:`
classes) instead of `resolvedTheme` after mount, so dark-theme users
don't see the light logo first.
- `SignInLayout`'s session redirect effect skips the redirect after
unmount.

Also adds page titles for `/sign-in-sso` and `/forgot-password`.

## Review instructions

1. View source (not the inspector) of `/dashboard/sign-in`,
`/dashboard/sign-up`, `/dashboard/sign-in-sso` and
`/dashboard/forgot-password` on the preview: the HTML holds the form and
the page title, not the loading fallback. `/dashboard/organizations`
still returns the shell.
2. Load `/dashboard/sign-in?returnTo=%2Fproject%2F<ref>`: no hydration
errors in the console, and the "Sign up" link (hover / open in new tab)
carries the same `returnTo`. The "Sign in" links on `/dashboard/sign-up`
and `/dashboard/forgot-password` carry the query params too.
3. Sign in from that URL: you land on the project, with no second
redirect to `/organizations`.
4. Load `/dashboard/sign-in?destination=cli`: the CLI-branded heading
renders without a hydration error.
5. Links between the four pages navigate client-side, and dark mode
shows the dark logo straight away.

## Checks

- Platform `vite build` (`NEXT_PUBLIC_IS_PLATFORM=true
NEXT_PUBLIC_BASE_PATH=/dashboard`): prerenders the four pages plus the
shell; each file has its title, inputs and a disabled fieldset.
Self-hosted build prerenders only the shell.
- Served the build locally with Vercel-equivalent routing and checked in
a browser: no hydration errors for plain, `?returnTo=…`,
`?destination=cli` (with and without `method`),
`/sign-up?destination=cli` and `/Sign-In`; hrefs carry `returnTo` after
hydration; navigating from `/sign-in` to other routes doesn't remount
the sign-in form or flash the shell loader; with JS blocked, inputs and
submit are disabled.
- Unit tests for `isPrerenderedRoute` and the prerendered Vercel routes;
`tsc --noEmit`, ESLint on changed files, Prettier, knip and the lint
ratchet pass.
- Not covered locally: the signed-in `returnTo` redirect end to end
(review step 3).

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)

---------

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
Co-authored-by: Kody Jackson <kody.jackson@supabase.io>
Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-05 10:31:28 -06:00
Anthony Lio 1fb63b7d85 fix(ui): lift tooltip from the page and use a ring edge (#52631)
## Problem

- tooltips blend into the page in dark mode, for example the timestamp
tooltip in the logs table
- the tooltip background is `bg-alternative`, which is the same color as
the page background

## Solution

- changes the tooltip background in dark mode, so the tooltip is one
elevation step above the page
- replaces the border and the drop shadow with a 1px ring from the
`foreground` token, so the edge is thinner and uses theme tokens
- changes the row highlight in the timestamp tooltip
- fixes the "Copied!" state in the timestamp tooltip, so the copied
value does not show behind the text and the row keeps its width

| before | after |
| -------|------|
| <img width="357" height="162" alt="image"
src="https://github.com/user-attachments/assets/07435a9e-74eb-4007-aa5e-d350a979f8bb"
/> | <img width="357" height="162" alt="image"
src="https://github.com/user-attachments/assets/df274062-318e-4ed0-841a-2bf57c98ec4c"
/> |
| <img width="357" height="162" alt="image"
src="https://github.com/user-attachments/assets/1cfc18fa-196e-41e2-9aae-2458cd98418b"
/> | <img width="357" height="162" alt="image"
src="https://github.com/user-attachments/assets/c116329c-233c-4216-9a71-4a1950ec710a"
/> |

<!--
## Preview links

If relevant, include links to changed pages for easy review access.

Copy the preview base URL from the Vercel bot comment on this PR. Use
the following table as an example template.

| Site | Live | Preview | Search for |
| -------------- |
-------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
| ----------------------------- |
| WWW | [/blog/your-post](https://supabase.com/blog/your-post) |
[/blog/your-post](https://zone-www-dot-com-git-branch-name-supabase.vercel.app/blog/your-post)
| unique phrase from the change |
| Docs |
[/docs/guides/your-page](https://supabase.com/docs/guides/your-page) |
[/docs/guides/your-page](https://docs-git-branch-name-supabase.vercel.app/docs/guides/your-page)
| unique phrase from the change |
| Studio | [/dashboard](https://supabase.com/dashboard) |
[/dashboard](https://studio-git-branch-name-supabase.vercel.app/dashboard)
| unique phrase from the change |
| Design system | [/design-system](https://supabase.com/design-system) |
[/design-system](https://design-system-git-branch-name-supabase.vercel.app/design-system)
| unique phrase from the change |
| UI library | [/library](https://supabase.com/library) |
[/library](https://ui-library-git-branch-name-supabase.vercel.app/library)
| unique phrase from the change |
| Knowledge base |
[/kb/guides/your-page](https://supabase.com/kb/guides/your-page) |
[/kb/guides/your-page](https://kb-git-branch-name-supabase.vercel.app/kb/guides/your-page)
| unique phrase from the change |
-->

<!-- ## Additional context

Optionally add any other context or screenshots.

-->

## Review instructions


1. open
[/design-system/docs/components/tooltip](https://design-system-git-antlio-tooltip-contrast-supabase.vercel.app/design-system/docs/components/tooltip)
and set the theme to dark
2. hover the "Hover" button, and make sure that the tooltip is lighter
than the page and has a thin ring edge
3. set the theme to light, and make sure that the tooltip has a thin
ring edge and no drop shadow
4. open
[/dashboard/project/_/logs/edge-logs](https://studio-git-antlio-tooltip-contrast-supabase.vercel.app/dashboard/project/_/logs/edge-logs)
in dark mode and select a project
5. hover a date in the logs table, and make sure that the tooltip is
lighter than the table
6. hover each row in the tooltip, and make sure that the row highlight
shows
7. click a row, and make sure that "Copied!" shows with no value text
behind it and the tooltip width does not change

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
2026-11-05 17:59:15 +02:00
Joshen Lim 6d08d66b7d Add eslint rule for google translate dynamic spans + address all issues (#52949)
## Context

We've been seeing many `NotFoundError: Failed to execute 'removeChild'
on 'Node'` and `NotFoundError: Failed to execute 'insertBefore' on
'Node'` events on Sentry which are historically known to be caused by
Google Translate in the browser.

There's technically no _right way_ to address this unfortunately, but
one of the solutions which should address most of these issues is to
wrap any dynamic text within a span - we've considered that quite a
while back tbh but never took the time to do this until today with the
help of Claude. Although just a heads up that it might not necessarily
completely eradicate those issues.

Also added an eslint rule which should prevent future occurences of this
<img width="1264" height="192" alt="image"
src="https://github.com/user-attachments/assets/b2c32ea0-45a2-4ccd-82fe-1a859905fc29"
/>
2026-11-05 23:28:46 +08:00
Jordi Enric 40bb24353d fix(studio): keep service health windows within DST limits FE-4928 (#53027)
## Problem

The home dashboard's 7-day charts can fail after daylight saving time
ends. Subtracting seven local calendar days produces a 169-hour request,
exceeding the service-health endpoint's 168-hour limit. The same
calculation also changes the 24-hour window across DST transitions.

## Fix

Calculate the shared service-health windows using 24 and 168 elapsed
hours. Add regression coverage for both daylight saving transitions in
America/New_York.

Fixes
[FE-4928](https://linear.app/supabase/issue/FE-4928/re-dashboard-is-not-showing-correct-data).

## How to test

- Run `pnpm --dir apps/studio exec vitest run --retry=0
components/interfaces/Observability/useServiceHealthMetrics.utils.test.ts`.
- In a browser using America/New_York around the November 1 DST
transition, open a project's home dashboard and select the 7-day view.
- Expected result: the service-health request spans exactly 168 hours
and the charts load. The 24-hour view spans exactly 24 hours across
either DST transition.

Local verification: Studio typecheck, focused ESLint, Prettier, and 41
affected tests pass. All four DST regressions fail against the original
helper and pass with the fix; shuffled tests also pass with seed 4928
and TZ=UTC.
2026-11-05 15:51:39 +01:00
supabase-vercel-tedd[bot] 04f3c6c41c fix(studio): return to the buckets list after deleting a bucket from its page (#53028)
## Problem

Deleting a bucket from its own page
(`/storage/files/buckets/[bucketId]`) could leave Studio on the deleted
bucket's route. The page kept loading and then showed "Failed to fetch
buckets" / "Bucket not found".

On success, `DeleteBucketModal` called `onClose()` and then
`router.push` to the buckets list. On the bucket page, `onClose` clears
the `?delete` query param through nuqs, which queues its own shallow
push to the current bucket URL. That push could race with the navigation
to the list and land back on the deleted bucket. The page then
re-rendered with the bucket query already removed from the cache,
refetched the missing bucket, and got a 404.

## Solution

- On the bucket's own page, the success handler now awaits `router.push`
to the buckets list and does not call `onClose`. The modal closes when
the page unmounts. When there is no `bucketId` in the route, it still
calls `onClose` as before.
- Added a component test for deleting from the bucket page. It checks
that Studio ends up on `/project/<ref>/storage/files` and that `onClose`
is not called. The test opts out of the global `useParams` stub so the
modal reads `bucketId` from the mocked route. It fails without the fix.

## How to verify

1. Open a project, go to Storage > Files, and open any bucket.
2. Choose Edit bucket > Delete bucket, type the bucket name, and
confirm.
3. Studio shows the success toast and lands on the buckets list
(`/project/<ref>/storage/files`). The deleted bucket no longer appears
there.
4. Studio never shows the deleted bucket's page with a spinner that
keeps loading, "Failed to fetch buckets" or "Bucket not found".

## Checks run

- `pnpm --filter studio exec vitest run
components/interfaces/Storage/FilesBuckets/DeleteBucketModal.test.tsx`
(2 passed)
- `pnpm turbo run typecheck --filter='...[origin/master]'`
- `pnpm turbo run lint --filter='[origin/master]'`
- Prettier check on the changed files


[FE-4926](https://linear.app/supabase/issue/FE-4926/deleting-a-bucket-leaves-its-page-loading-until-an-error)

---------

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
2026-11-05 08:15:41 -06:00
Monica Khoury 12440e62a9 feat(studio): add Test badge to webhook deliveries for test events (#52510)
## Problem

Test deliveries in the webhook deliveries table look the same as real
ones. Test events are sent with `is_test: true` in the event payload,
but the UI doesn't surface it, so there's no way to tell them apart at a
glance.

Closes FE-4710.

## Solution

- Added an `isTestDelivery` helper that checks `eventPayload.is_test ===
true`. It uses a strict comparison, so values like the string `"true"`
don't count.
- Show a green "Test" badge next to the event name in the deliveries
table.
- Show the same badge in the header of the delivery details sheet, next
to the status badge.
- Added unit tests for the helper and component tests for the table and
the sheet, each covering a test delivery and a real one.

## Review instructions

1. Open a project's webhooks page and select an endpoint.
2. Click the button to send a test event and wait for its delivery to
appear in the Deliveries table.
3. Check that the new row has a green "Test" badge next to its event
name, and that existing rows without it have no badge.
4. Click the test row and check that the delivery details sheet shows
the "Test" badge next to the status badge in the header.
5. Click a non-test row and check that its sheet has no "Test" badge.
2026-11-05 15:58:56 +02:00
Drew McLellan 097e7a11ad feat(studio): duplicate row and keep values with Create more in Table Editor (#52952)
## What

Two additions to the Table Editor's Insert Row flow:

- **Duplicate row**: new item in the row context menu. Opens the Insert
Row panel as a new record, pre-filled from the selected row.
- **Keep values**: a gear button next to \"Create more\" (visible only
while \"Create more\" is on) opens a \"Row creation options\" popover
with a \"Keep values for the next row\" checkbox. When checked, the form
keeps its values after each insert instead of clearing. Off by default,
so existing behavior is unchanged.

## How

- Both use a shared helper, `generateReusedRowFields`, that clears
primary key, identity, function-defaulted (e.g. `gen_random_uuid()`,
`nextval(...)`, `now()`, `CURRENT_TIMESTAMP`), and truncated values.
Cleared columns fall back to their blank state so the database fills
them in. A boolean with a function default is left unset so the database
evaluates it.
- Duplicate adds a `duplicateFrom` field to the `row` side panel state
rather than reusing `row`, so the panel stays in insert mode and can't
turn into an update.
- The popover lives in a new co-located `RowCreationOptions` component.
Its notch is a rotated square drawn inside the popover content,
positioned over the trigger by Radix.

<img width="165" height="220" alt="Screenshot 2026-11-04 at 15 22 20"
src="https://github.com/user-attachments/assets/145e3aeb-9f6f-4826-a789-a0e462d3d1d5"
/>

<img width="678" height="202" alt="Screenshot 2026-11-05 at 11 41 35"
src="https://github.com/user-attachments/assets/07cc5251-e2fc-417c-90bd-6b6268a2c0c7"
/>


## Notes

- Columns with unique constraints other than the primary key are still
copied, so saving a duplicate can fail with the normal error toast.
- Large values (over 10 KB) are truncated by the grid query, so
duplicate clears them rather than copying a corrupted value. Copying
them is tracked in FE-4927.

## Testing

- Unit tests for the helper (clearing rules, literal defaults, keyword
and boolean function defaults, truncated values).
- Component tests for `RowEditor`: duplicate opens in insert mode with
the identity key cleared and inserts without it; \"Create more\" clears
by default and keeps values via the options popover; the gear only shows
while \"Create more\" is on.
- Checked manually in the app.

Resolves FE-4516
2026-11-05 13:19:42 +00:00
Monica Khoury dfe1e330a4 chore(studio): encourage shorter, clearer support requests (#52492)
## What

Updates the Message field on the support form to encourage shorter,
clearer requests.

- Replaces the "Please be as detailed and specific as possible"
placeholder with three plain questions: "What are you trying to do? What
happened instead? What have you tried?"
- Adds one line of guidance under the field, with a link to the KB
article on formatting support requests
- Replaces the static "5000 character limit" label with a live `count /
2,500` counter, and lowers the limit to 2,500

## Why

The old wording encouraged very long requests. Closes FE-4716:

https://linear.app/supabase/issue/FE-4716/review-support-form-wording-to-encourage-shorter-clearer-requests

Copy follows design feedback in the Slack thread. Layout changes to the
wider support form are out of scope and tracked separately.

The 2,500 limit comes from the proposed mockup on the ticket, which was
marked as a proposal rather than an agreed change. Flagging it here so
it gets confirmed in review.

A prepopulated template is not included. A placeholder gives the same
guidance without text users have to delete, and avoids conflicting with
flows that prefill the message.

## How to test

1. Run `pnpm dev:studio` and open the support form
2. Check the placeholder shows the three questions, and disappears when
you type
3. Check the line under the field links to the KB article via "Learn
more"
4. Type in the field and check the counter goes up (`0 / 2,500` to `N /
2,500`)
5. Paste text longer than 2,500 characters and check it is cut off at
the limit
6. Type `ipv4` in the message and check the IPv4 alert appears below the
guidance, then delete it and check the alert disappears
2026-11-05 14:55:44 +02:00
Jordi Enric 8bebf8206e fix(logs): retain loaded history on refresh DEBUG-233 (#51598)
Preserve loaded log history during refresh, bound refresh requests, and stop automatic polling when Live is paused.
2026-11-05 13:35:17 +01:00
Charis 57a5087579 feat(studio): gate integrations landing api-keys query on grants (#52963)
Part 3 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)..

## 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
`useProjectOAuthIntegrationData`
(`Integrations/Landing/Landing.utils.ts`) read api-keys through the
transitional hook with no guard. It now takes a plain `GET
/v1/projects/{ref}/api-keys` grant.

A query skipped by `skipToken` stays pending forever, so a small helper
folds the grant into the api-keys query state:
- loading grant: pending
- denied: settles with no keys and no error, matching how a 403 was
treated before (no request is sent)
- permission-check error: surfaced as the hook's error

## Testing
- `Landing.utils.platform.test.tsx`: granted, denied (settles, no
request, no error), and permission-check error.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-11-05 06:48:49 -05:00
kemal.earth fa7e8b636a feat(studio): update flags for interstitals and apps list (#52955)
## Problem

The single `OauthAppScopedGrants` flag gates three independent areas of
scoped OAuth apps, so they can't be rolled out or rolled back
separately.

Resolves FE-4919

## Solution

Replace `OauthAppScopedGrants` with three flags, one per concern, and
remove the old one. Gating is a straight swap with no behavior changes.

| Flag | Files |
| --- | --- |
| `enableScopedOAuthConsent` | `pages/authorize.tsx` |
| `enableScopedOAuthPublish` | `PublishAppSidePanel/index.tsx` |
| `enableScopedOAuthManage` | `OAuthApps.tsx`, `pages/account/apps.tsx`,
`AccountLayout.tsx` |

The `authorize` page test now mocks only the consent flag.

Note: `PublishableApps` (the org apps list) isn't gated today, so Manage
covers only the authorized-apps table and the account page. I left that
as is to keep this a pure flag swap.

## Review instructions

Each flag can be toggled on its own.

1. Consent only: `/authorize?mock_scenario=default` shows the new
consent screen. The app form and list pages are unchanged.
2. Publish only: `/org/[slug]/apps`, then publish or edit an app. The
extra controls appear and nothing else changes.
3. Manage only: `/org/[slug]/apps` shows the new authorized-apps table,
and `/account/apps` renders. `/authorize` uses the legacy screen.
4. All off: behavior matches `master`.

Before merging, the three new flags must exist in ConfigCat with the
same targeting that `OauthAppScopedGrants` has today.
2026-11-05 11:34:43 +00:00
Anthony Lio 9659778769 feat(ui): scrollbar track (#52493)
## Problem

- proposal to lift scroll bar ui accross the apps
- fix shared `ScrollBar` in `ui` showing only a thin `bg-border` thumb
with no track, so the scroll position is hard to see

## Solution

- replaces the native scrollbars in the docs left nav and in the guide
right column with the shared scroll area
- replaces the native scrollbar in the docs search v2 results with the
shared scroll area, and keeps the animated list height and the bottom
fade
- changes the command menu list to the shared scroll area, with the bar
2px from the edge so it does not touch the hover highlight
- changes the studio connect sheet body and its framework combobox to
the shared scroll area, so long code lines still scroll inside their own
code blocks

| state | preview |
| -------|------|
| before | <img width="473" height="260" alt="image"
src="https://github.com/user-attachments/assets/ef22e643-b92a-4a23-9c77-6b10851e1445"
/> |
| after | <img width="473" height="260" alt="image"
src="https://github.com/user-attachments/assets/46fe95e9-0574-4eef-afbd-20d591baa859"
/> |

<!--
## Preview links

If relevant, include links to changed pages for easy review access.

Copy the preview base URL from the Vercel bot comment on this PR. Use
the following table as an example template.

| Site | Live | Preview | Search for |
| -------------- |
-------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
| ----------------------------- |
| WWW | [/blog/your-post](https://supabase.com/blog/your-post) |
[/blog/your-post](https://zone-www-dot-com-git-branch-name-supabase.vercel.app/blog/your-post)
| unique phrase from the change |
| Docs |
[/docs/guides/your-page](https://supabase.com/docs/guides/your-page) |
[/docs/guides/your-page](https://docs-git-branch-name-supabase.vercel.app/docs/guides/your-page)
| unique phrase from the change |
| Studio | [/dashboard](https://supabase.com/dashboard) |
[/dashboard](https://studio-git-branch-name-supabase.vercel.app/dashboard)
| unique phrase from the change |
| Design system | [/design-system](https://supabase.com/design-system) |
[/design-system](https://design-system-git-branch-name-supabase.vercel.app/design-system)
| unique phrase from the change |
| UI library | [/library](https://supabase.com/library) |
[/library](https://ui-library-git-branch-name-supabase.vercel.app/library)
| unique phrase from the change |
| Knowledge base |
[/kb/guides/your-page](https://supabase.com/kb/guides/your-page) |
[/kb/guides/your-page](https://kb-git-branch-name-supabase.vercel.app/kb/guides/your-page)
| unique phrase from the change |
-->

<!-- ## Additional context

Optionally add any other context or screenshots.

-->

## Review instructions

1. open
[/design-system/docs/components/scroll-area](https://design-system-git-antlio-feat-ui-scrollbar-track-supabase.vercel.app/design-system/docs/components/scroll-area),
scroll the vertical and horizontal demos, and make sure that the thumb
moves on a visible track and gets lighter on hover
2. open
[/docs/guides/database/postgres/row-level-security](https://docs-git-antlio-feat-ui-scrollbar-track-supabase.vercel.app/docs/guides/database/postgres/row-level-security),
scroll the left nav and the right column, and make sure that each shows
the new scrollbar
3. resize the page to mobile width, open the menu, and make sure that it
scrolls above the footer
4. make sure that the results scroll with the trackpad and with the
arrow keys, and that the bottom fade shows
5. open
[/dashboard](https://studio-git-antlio-feat-ui-scrollbar-track-supabase.vercel.app/dashboard),
press `⌘K`, scroll the command menu, and make sure that the thumb does
not touch the hover highlight of an item
6. open
[/dashboard/project/_?showConnect=true](https://studio-git-antlio-feat-ui-scrollbar-track-supabase.vercel.app/dashboard/project/_?showConnect=true),
scroll the connect sheet, and make sure that long code lines scroll
inside their code blocks and do not widen the sheet

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
2026-11-05 09:16:06 +02:00
Joshen Lim ebe8849f8b Skip resource aware search in cmd k while in a sub page (#52773)
## Context

Related to the resource aware CMD K changes, this just skips the request
for the resource aware search when searching in the CMD K field input if
the user is on any sub page, as the search will no longer be relevant.
2026-11-05 13:03:34 +08:00
Joshen Lim 5152899fac Joshenlim/fe 4720 cmd k support searching for functions (#52751)
## Context

Building off from
[here](https://github.com/supabase/supabase/pull/52678) to make Cmd+K
resource-aware so finding and inspecting anything in a project doesn't
depend on knowing where it lives in the dashboard.

Specifically looking into database entities for now - end state would be
that you could search for a table name for example, and Cmd K will pull
up everything related to that table for you to skim (e.g Policies,
Functions, Triggers, etc). Changes in this PR sets up searching for
**database functions**.

<img width="607" height="531" alt="image"
src="https://github.com/user-attachments/assets/b4a2cd15-9874-4e80-80d4-d343d8c70fc3"
/>

## Performance

Ran a Claude session to benchmark `getSearchEntitiesSql` against the
version on master (tables and policies only), on the same synthetic
catalog:
- 12,000 tables (36,651 `pg_class`), 6,001 policies, 27,258 `pg_proc`
(12,000 user + 12,000 extension-owned functions), 290,915 `pg_depend`.
- Median of 5 runs, `EXPLAIN ANALYZE`, local Postgres (warm cache).

| Search | Matches | master | this PR |
|---|---|---|---|
| `t_1` | ~1/9 of tables | 12ms | 23ms |
| `p_1` | broad policy-name match | 13ms | 25ms |
| `fn_1` | user + extension functions | 8ms | 23ms |
| `fn_` | every function | 8ms | 29ms |
| `stress.fn_1` | schema-qualified | 10ms | 30ms |
| `zzz` | nothing | 9ms | 22ms |

- Adding functions costs +11 to +21ms at this scale
- Most of it is fixed (+13ms even for a query that matches nothing): one
pass over `pg_proc`, plus building the set of extension-owned functions.
It doesn't grow with the number of matches.

## To test
- [ ] Search a table name: Tables first, then policies, and functions
- [ ] Search a function name: it appears under Functions and opens the
editor panel in database/functions
- [ ] Function outside public: schema filter switches and the function
opens
2026-11-05 13:02:44 +08:00
LennyandAlexis Aguilar ab54becc60 docs(storage): move url signing keys to dedicated page (#52954)
## Problem

Details about URL signing keys are embedded in the downloads page, but
it is a broader security related topic that applies to both uploads and
downloads.

There is no signed URL guidance in the Standard Upload section

## Solution

- Move details about URL signing keys to a dedicated page under the
storage>security tab (content mostly the same)
- Replace URL signing key details in downloads page with a brief blurb
and a link (keep header in case it has been hot linked)
- Add link to URL signing key details to resumable upload > signed url
section
- Add signed URL details to standard upload page, and similarly link to
url signing key page
- Update link in URL signing key page of dashboard to point to new
dedicated URL Signing key page

## Additional context

Follow up to: https://github.com/supabase/supabase/pull/52522

---------

Co-authored-by: Alexis Aguilar <98043211+alexisintech@users.noreply.github.com>
2026-11-05 11:08:12 +08:00
Charis 1decd82fcc feat(studio): gate edge functions and vector bucket api-keys consumers on grants (#52962)
Part 2 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 #52961.

## 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 more publishable-key consumers onto the plain `GET
/v1/projects/{ref}/api-keys` grant:
- `Functions/TerminalInstructions`
- `Functions/EdgeFunctionDetails`: only the `api_gateway_keys_read`
check; the `edge_functions_write` check belongs to the edge functions
rollout
- `Storage/VectorBuckets/.../VectorBucketTableExamplesSheet`: still uses
non-revealed keys. When keys can't be read, the note tells the user to
substitute their own secret key.

Each shows `ApiKeysAccessNote` when denied or errored. The old guards
matched the annotation.

## Testing
- `TerminalInstructions.platform.test.tsx`,
`EdgeFunctionDetails.platform.test.tsx`,
`VectorBucketTableExamplesSheet.platform.test.tsx`: granted, denied (no
api-keys request), and permission-check error.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-11-04 20:56:56 +00:00
Charis bde5e81f3a feat(studio): gate docs and project API docs api-keys consumers on grants (#52961)
Part 1 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).

## 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 api-keys consumers that only need publishable keys from the V2
`API_GATEWAY_KEYS_READ` check and the transitional `useAPIKeys` /
`useAPIKeysQuery` hooks onto a plain `GET /v1/projects/{ref}/api-keys`
grant with `apiKeysQueryOptions`:
- Docs: `Authentication` and `LangSelector`
- Project API docs: `ProjectAPIDocs` (still only fetches while the panel
is open) and `Content/Introduction`

Without access, the docs keep their placeholder keys:
- On the Data API docs page, the key picker in `LangSelector` is hidden
and `Authentication` keeps the placeholder. There's no inline note.
- In the API docs slideover, "Show keys" is disabled, with a tooltip
saying the user needs additional permissions (or that the permission
check failed).

The old guards matched the endpoint annotation
(`api_gateway_keys_read`).

## Testing
- `Docs/ApiKeysGrants.platform.test.tsx`: `LangSelector` offers keys
when granted, and hides the picker without requesting keys when denied
or when the permission check fails. `Authentication` prefills the key
when granted and keeps the placeholder otherwise.
- `ProjectAPIDocs/ProjectAPIDocs.platform.test.tsx`: "Show keys" reveals
the client key when granted; when denied or errored it's disabled with
the matching tooltip, and no keys are requested.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-11-04 15:45:46 -05:00
Charis b3dd6612d7 feat(studio): classify errors with fault, reason, and per-tag Sentry sampling (#52730)
Follows #52707 (rename `ResponseError` to `StudioError`).

Resolves FE-4772.

## What

Introduces the error core for Studio error classification.

- **Tagged errors.** `lib/errors/studio-errors.ts` defines
`Data.TaggedError` classes (`RequestAborted`, `NetworkUnreachable`,
`MalformedResponse`, `PlatformError`, `UnclassifiedApiError`,
`DbConnectionTimeout`, `UnexpectedError`). Each carries `fault`,
`reason`, `classifiedBy` (`rule` or `default`), `retryable`, and
`service`. `StudioError` is the union type; use `isStudioError` instead
of `instanceof`.
- **Two classifiers** in `data/error-classification.ts`:
- `classifyResponseError` is only for errors from an API response: known
message patterns first, then defaults by status (5xx `PlatformError`,
4xx `UnclassifiedApiError`, no status `UnexpectedError`).
- `classifyError` is for everything else: aborts, browser fetch failures
(matched by message, so ordinary `TypeError` bugs stay
`UnexpectedError`), and unexpected errors.
- `handleError` picks between them, reports, and rethrows the same
instance so React Query receives the classified error.
- **Routing and sampling.** `lib/errors/error-routing.ts` maps every tag
to a Sentry sample rate (`SAMPLE_NEVER`, `SAMPLE_OTHER`, `SAMPLE_OWNED`,
`SAMPLE_ALWAYS`). `reportStudioError` tags events with `sample_rate`,
and `beforeSend` applies it. `alwaysCapture` reports at rate 1. The
global Sentry error `sampleRate` stays unset so the rates don't
multiply.
- **Network failures.** A fetch failure is a `user` fault with reason
`offline` when the browser reports being offline, and a `platform` fault
otherwise.
- **Hand-built errors.** Call sites that wrapped caught exceptions or
made up status codes now use `classifyError` or a specific class instead
of `classifyResponseError`.

## Behavior changes

- Errors that previously went unreported, including unexpected errors
with a message, are now reported to Sentry at their routed sample rate.
- `handleError` no longer logs the stack with `console.error`.
- `MalformedResponse` is defined but not produced yet; a follow-up adds
the empty-body check.

## Testing

- Unit tests for classification, routing, reporting, and the
`beforeSend` sampling helper.
- `pnpm vitest run data lib components/interfaces/ErrorHandling`,
typecheck, lint ratchet, and knip pass locally.
2026-11-04 13:19:01 -05:00
CharisandClaude bef73a722c feat(studio): gate storage, cron, and realtime key consumers on grants (#52728)
Part 4 of 4 in a stack for
[FE-4694](https://linear.app/supabase/issue/FE-4694/pilot-split-api-keys-queries-and-add-first-refinement-reveal-variant).
Based on #52727.

## Stack
1. #52723 Reveal refinement and split api-keys queries
2. #52724 API keys settings UI and command menu
3. #52727 Database and edge functions consumers that reveal secret keys
4. 👉 Storage, cron, and Realtime consumers; remove the transitional
reveal path

## Changes
Moves the remaining consumers that need secret keys onto the `reveal`
grant with `revealedApiKeysQueryOptions`, replacing their V2 permission
checks:
- Analytics bucket configuration details and the update catalog token
dialog
- The Iceberg wrapper create mutation. Its V2 check only covered
`api_gateway_keys_secret_read`, which didn't match the endpoint's
requirement. Without keys it used to save a placeholder as the vault
token; it now throws unless the grant is granted, and returns the grant
so callers can explain why. The bucket create form disables Create and
the missing-wrapper callout disables "Install wrapper", both showing
`ApiKeysAccessNote`. The `storage_config_write` check is unchanged.
- Cron job HTTP headers (edge function variant)

`RealtimeTokensPopover` only reads the anon and publishable keys, so it
moves to the plain grant and `apiKeysQueryOptions` instead of requesting
revealed keys.

With no `reveal: true` callers left, the transitional `useAPIKeysQuery`
/ `useAPIKeys` hooks drop their reveal path and only mint a plain grant.
They remain for the publishable-only consumers until FE-4731.

## Testing
- `iceberg-wrapper-create-mutation.platform.test.tsx`: `mutateAsync`
throws without the reveal grant and makes no credentials request; the
granted case exposes the grant.
- `BucketCallouts.platform.test.tsx`: "Install wrapper" is enabled when
granted, and disabled with the note when denied or with an error when
the permission check fails.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-04 11:36:17 -05:00
CharisandClaude 82671cbb65 feat(studio): gate database and functions reveal consumers on grants (#52727)
Part 3 of 4 in a stack for
[FE-4694](https://linear.app/supabase/issue/FE-4694/pilot-split-api-keys-queries-and-add-first-refinement-reveal-variant).
Based on #52724.

## Stack
1. #52723 Reveal refinement and split api-keys queries
2. #52724 API keys settings UI and command menu
3. 👉 Database and edge functions consumers that reveal secret keys
4. #52728 Storage, cron, and Realtime consumers; remove the transitional
reveal path

## Changes
Moves the database and edge functions consumers that need secret keys
off the V2 permission checks and onto `useGrant('GET
/v1/projects/{ref}/api-keys', scope, { variant: 'reveal' })` with
`revealedApiKeysQueryOptions`:
- Database webhooks (`Database/Hooks/HTTPHeaders`, `FormContents`)
- Replication destination form (Analytics Bucket catalog token prefill)
- Edge function tester sheet

Adds `components/ui/ApiKeysAccessNote`, a small inline note shown when
the reveal grant is denied, and an `AlertError` when the permission
check fails. It doesn't block the rest of the form: users without
secret-key access can still fill in headers or the catalog token
manually, where before the keys were silently missing.

## Testing
- Adds `HTTPHeaders.platform.test.tsx` covering granted (requests keys
with `reveal=true`, no note), denied (note shown, form still usable, no
request), and permission-check error.
- Removes the partial V2 permissions mock from the DestinationForm test,
which no longer needs it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-04 10:54:45 -05:00
CharisandClaude 7bc32a82fd feat(studio): gate api keys settings UI on api-keys grants (#52724)
Part 2 of 4 in a stack for
[FE-4694](https://linear.app/supabase/issue/FE-4694/pilot-split-api-keys-queries-and-add-first-refinement-reveal-variant).
Based on #52723.

## Stack
1. #52723 Reveal refinement and split api-keys queries
2. 👉 #52724 API keys settings UI and command menu
3. #52727 Database and edge functions consumers that reveal secret keys
4. #52728 Storage, cron, and Realtime consumers; remove the transitional
reveal path

## Changes
Moves the API keys settings UI off the V2 permission checks and onto
`useGrant('GET /v1/projects/{ref}/api-keys')` with the new query
options:
- `PublishableAPIKeys`, `SecretAPIKeys`, `Project/APIKeys`, and the
api-keys settings page use a plain grant. They never requested revealed
keys; individual secrets still come from the per-key endpoint.
- The command menu's API keys commands use the `reveal` grant, since
they copy secret key values.
- Each consumer renders loading, denied (`NoPermission`),
permission-check error (`AlertError`), and the existing data states.
`Project/APIKeys` now shows `NoPermission` when denied instead of a
skeleton that never resolved.

## Testing
- Migrates `PublishableAPIKeys.test.tsx`,
`CommandMenu/ApiKeys.test.tsx`, and the api-keys settings page test to
MSW and `customRender`, without mocking the data module or the V2
permissions hook.
- Adds `PublishableAPIKeys.platform.test.tsx` and
`CommandMenu/ApiKeys.platform.test.tsx` for granted, denied, and error
states. The denied test waits for the denied grant before asserting that
no api-keys request was made.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-04 10:35:39 -05:00
CharisandClaude d727bb0081 feat(studio): add reveal refinement for api-keys and split queries (#52723)
Part 1 of 4 in a stack for
[FE-4694](https://linear.app/supabase/issue/FE-4694/pilot-split-api-keys-queries-and-add-first-refinement-reveal-variant).
Later PRs migrate the api-keys consumers onto grants.

## Stack
1. 👉 Reveal refinement and split api-keys queries
2. #52724 API keys settings UI and command menu
3. #52727 Database and edge functions consumers that reveal secret keys
4. #52728 Storage, cron, and Realtime consumers; remove the transitional
reveal path

## Changes
- Adds a `reveal` variant for `GET /v1/projects/{ref}/api-keys` in
`lib/fga-refinements.ts`. It requires `api_gateway_keys_secret_read` on
top of the base annotation, and owns the `reveal` query param: the fetch
wrapper sets it to `'true'` for a reveal grant and `'false'` otherwise
(including `unguarded`), so passing `reveal` by hand is a type error.
- Splits the query into `apiKeysQueryOptions` (plain grant) and
`revealedApiKeysQueryOptions` (reveal grant). Both use `skipToken`
without a grant, and the grant stays out of the query key.
- `useAPIKeysQuery` and `useAPIKeys` stay as deprecated transitional
hooks that mint the matching grant with `useGrant`. They can't use
`unguarded.migrating`: with `reveal` owned by the wrapper, that would
silently return unrevealed keys to consumers that need secrets.
- Marks the variant type parameter `const` in `getGrant`, `useGrant`,
`ensureGrant`, and `testGrant`. Adding a second refinement with variants
widened inference of the branch variants to a union.
- Adds `tests/lib/project-grant-mocks.ts` for component tests that need
`useGrant` to resolve, and updates tests that partially mocked the V2
permissions hook.

## Testing
Adds the type and runtime tests deferred from FE-4689 to
`data/guarded-fetch.test.ts`: type equality with the raw client for
plain and reveal grants, `reveal` rejected as a caller-supplied param, a
reveal grant rejected on an endpoint without that variant, brand
invariance, `guardMethod` setting `reveal` from the grant, and
`assertGrant` throwing on an unknown variant.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-04 10:12:22 -05:00
Drew McLellan 706dba62f9 fix(studio): attribute storage policies to every bucket they reference (#52692)
## Problem

Studio's storage policy parser (\`extractBucketNameFromDefinition\`)
returned only the first quoted string near \`bucket_id\` and ignored the
operator. As a result:

- Policies covering several buckets (\`bucket_id in ('a', 'b')\`) were
listed and counted under the first bucket only.
- Negated policies (\`bucket_id <> 'a'\`) were attributed to the
excluded bucket.
- \`DeleteBucketModal\` could delete a negated or shared policy that
still protects other buckets.

Fixes FE-3993, supabase/supabase#48164.

Before:

<img width="884" height="444" alt="Screenshot 2026-11-03 at 10 46 08"
src="https://github.com/user-attachments/assets/fc6e4842-b07f-40be-8057-b94f4034e4eb"
/>

After (same data):

<img width="891" height="515" alt="Screenshot 2026-11-03 at 10 46 21"
src="https://github.com/user-attachments/assets/47248b30-a309-4774-8349-05260ad02111"
/>


## Solution

- Replace the parser with \`extractBucketNamesFromDefinition\`, which
returns every bucket referenced via \`=\`, \`= ANY (ARRAY[...])\` and
\`OR\`, and returns none for negated conditions (those fall into
Ungrouped).
- Add \`getPolicyBucketNames\`, which combines \`definition\` and
\`check\`, and use it in the Policies page grouping,
\`useBucketPolicyCount\`, and \`DeleteBucketModal\` so they agree.
- A policy is now listed under each bucket it covers.
- Bucket deletion only removes policies whose sole target is the deleted
bucket. Shared and negated policies are left in place. This is the
conservative choice: an unparsed policy is left behind, never deleted.
- Added unit tests for the parser shapes, negation, \`check\`-only
policies, and grouping.
2026-11-04 11:36:11 +00:00
Alaister YoungandAlaister Young b5d9f22f14 fix(studio): handle unknown upgrade warning types (#52775)
Fixes a page crash on Project Settings > General. The upgrade
eligibility API now returns a warning type
(`collation_reindex_required`) that Studio doesn't handle, so
`getWarningLink` returned `undefined` and `<Link href={undefined}>`
threw in `resolveHref`, taking the page down via the global error
boundary.

**Changed:**
- Added `default` cases to the warning title, description, and link
helpers in `UpgradeWarnings.tsx`. Unknown warning types now show generic
copy and link to the specific upgrade notes section of the docs, rather
than being hidden or crashing.

**Added:**
- `UpgradeWarnings.test.tsx`, covering a known warning type and an
unknown one. The unknown case failed with `href` undefined before this
change.

**Not in this PR:**
- Dedicated copy for `collation_reindex_required`. That needs
regenerated `api-types` and an upgrade guide section, which doesn't
exist yet.
- Open tabs on old bundles keep crashing until they reload, since this
fix only reaches new bundles.

## To test

- Open Project Settings > General on a project whose
`/upgrade/eligibility` response includes `collation_reindex_required`.
The page should load and show "Review the upgrade notes before
upgrading".
- Check that "Read upgrade notes" goes to the specific upgrade notes
section of the upgrading guide.
- Check that a known warning type, such as `ltree_reindex_required`,
still shows its own copy and link.

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-04 18:35:03 +08:00
Joshen Lim 2b55f7db9a Joshenlim/fe 4719 cmd k support searching for policies (#52678)
## Context

Continue to build off from
[here](https://github.com/supabase/supabase/pull/52205) to make Cmd+K
resource-aware so finding and inspecting anything in a project doesn't
depend on knowing where it lives in the dashboard.

Specifically looking into database entities for now - end state would be
that you could search for a table name for example, and Cmd K will pull
up everything related to that table for you to skim (e.g Policies,
Functions, Triggers, etc). Changes in this PR sets up searching for RLS
policies.

<img width="609" height="525" alt="image"
src="https://github.com/user-attachments/assets/212a430a-314d-48c4-a27c-2f9bb06e8457"
/>

Policies are matched on, in priority, its name and the target table.

## Performance checking

Just ran a check with Claude just to make sure that the added SQL
doesn't cause any performance degradation on the database. Plan guard
passes at 12,000 tables, under its 500ms budget. Also benchmarked
locally with a 3-character query matching every policy, results look
good so should be alright:

| Catalog | Worst-case search | No-match baseline |
|---|---|---|
| 36k policies | ~52–64ms | ~16ms |
| 120k policies | ~118–134ms | ~63ms |

## To test

- [x] Search a table name: Tables first, then its policies, under
Policies
- [x] Search a policy name: it appears under Policies and opens the
editor panel in database/policies
- [x] Policy outside `public`: schema filter switches and the policy
opens
2026-11-04 14:26:37 +08:00
Joshen Lim 0b9e8bdea4 Joshenlim/fe 4882 make the new integrations UI the default (#52683)
## Context

Makes the one-click integrations feature preview the new default +
cleans up all the old integrations code that's no longer used with this
change

## To test
- [ ] Verify that the project integrations page is using the new UI
2026-11-04 14:26:01 +08:00