Commit Graph
783 Commits
Author SHA1 Message Date
Joshen Lim 6abbb5700d Joshenlim/fe 5274 re database tables reshuffles the (#54521)
## Context

On Database > Tables, schemas with more than 50 relations reshuffle as
you scroll.
- Tables were paged by `oid`, then the merged list was re-sorted by name
on the client
- Views, materialized views and foreign tables came from three separate
unpaginated queries and were merged into the same sorted list, so the
list was never stable across pages

## Changes involved

Am hence opting to use the same query that we fetch entities in the
Table Editor for the Database > Tables page with a few tweaks
- `TableList` now uses `getEntityTypesSQL` instead of 4 separate queries
to fetch tables, views, materialised views and partition tables
- `getEntityTypesSQL` gets a new `enrich` prop which fetches additional
data that the Database > Tables page requires (e.g column count, row
count, size, etc
- Selecting "Edit" or "Duplicate" actions in the Database > Tables page
will fetch the table's details on demand
- Also fixed searching via `getEntityTypesSQL` to escape `%` and `_` in
`search` with `escapeIlikeLiteral`, otherwise searching `my_table` also
matched `myXtable`

## Performance

As with every change to SQL queries in the dashboard, we benchmark the
performance to ensure that the dashboard never runs a heavy query
against the project's DB. This just benchmarks `enrich` off vs on with
`EXPLAIN ANALYZE` on synthetic schemas of 500, 2,000 and 8,000 tables.
Execution time, median of 5 warm runs:

| Schema tables | limit 50 | limit 200 |
|---|---|---|
| 500 | +7.6 ms | +35.2 ms |
| 2,000 | +8.6 ms | +34.9 ms |
| 8,000 | +8.0 ms | +36.0 ms |

The extra cost is about 0.16 ms per row, the same at every schema size,
and the same on deep pages. It follows the page size, not the schema
size.

## To test

Create more than 50 relations in a schema (tables, views, materialized
views, a partitioned table), then on Database > Tables:

- [ ] Scroll through the list. New rows append at the bottom in
alphabetical order, with views mixed in.
- [ ] Untick and tick entity types. The list filters correctly, and
unticking all shows the empty state.
- [ ] Search `alph_` returns nothing when no name contains `alph_`, and
`zz_alpha` finds the matching rows.
- [ ] Create, edit, duplicate and delete a table. The list refreshes.
- [ ] Table Editor sidebar still lists and searches as before.
2026-12-04 14:49:17 +07:00
Alaister YoungandAlaister Young 217b9ca3f3 [FE-5024] feat(studio): track Table Editor sidebar and side panels (#53960)
Adds PostHog telemetry events across the Table Editor sidebar, new-tab
page, and column/table/row/cell side panels so we can measure schema
usage, entity-list search/filtering, entity menu actions, and panel
saves without logging schema, table, column, or search names.

**Added:**

- Event definitions in `packages/common/telemetry-constants.ts` (added
to `TelemetryEvent`):
- `table_editor_schema_selector_updated` (`schemaType: 'public' |
'protected' | 'custom'`) when switching schemas in `TableEditorMenu`. It
uses the same `schemaType` property and derivation as the existing
`database_schema_selector_updated` (now shared through
`getDatabaseSchemaType`), so the two selectors can be compared in one
insight
- `table_editor_new_item_clicked` (`itemType: 'schema'` or `itemType:
'table'` with `trigger: 'sidebar' | 'new_tab_card'`) from the sidebar
and `NewTab` card
- `table_editor_table_search_submitted` (debounced 500ms, cancelled on
clear, schema switch via selector or URL/tab change, and unmount)
- `table_editor_entity_filter_updated` (`visibleTypeCount`) on
entity-type checkbox toggle, "Select only", and filter reset
- `table_editor_entity_action_clicked` (`action`, `entityType`) across
dropdown and context menus in `useEntityActionHandlers` (excluding the
`View policies` link, which is covered by pageviews)
- `table_column_created` / `table_column_updated` (`hasForeignKey`,
`isArray`) on column side-panel saves via `SidePanelEditor.utils.tsx`,
with `hasForeignKey` scoped to the saved column and no-op saves skipped
- `table_updated` (`columnCountChanged`) on existing table edits in
`SidePanelEditor.tsx` once table, column, primary key, foreign key,
Realtime, and Data API updates succeed and at least one change was
persisted; no-op saves and saves where any step fails are skipped
- `table_editor_row_updated` (`editMethod: 'side_panel'`) when an
existing row edit from the row side panel is persisted. Saves from the
expanded cell editors and the foreign row selector don't count, and
neither do edits queued with queue operations enabled. The grid ticket
(FE-5023) can add more `editMethod` values when it tracks inline edits
- `table_editor_cell_editor_opened` (`editorType: 'json' | 'text'`) when
expanding JSON or text cell editors from the grid cell editors
(`JsonEditor` / `TextEditor`) or `RowEditor`
- Column, table and row save events are attributed to the project the
save ran against (third `track()` argument), and fire only after the
save succeeds
- Focused MSW-backed tests for non-obvious telemetry edge cases (search
debounce + cancellation on clear and selector/external schema switches,
schema switch single-fire + PII checks, column-scoped FK/array
derivation and no-op gating in `createColumn`/`updateColumn`,
change/error reporting in `updateTable` without double-firing column
events)

## To test

Watch `POST /platform/telemetry/event` in DevTools (and confirm arrival
in staging PostHog):

- Switch schemas (`public` -> `auth` -> custom schema -> `public`):
fires `table_editor_schema_selector_updated` with `schemaType`
`protected` -> `custom` -> `public` and no schema name; re-selecting the
active schema fires nothing
- On the Database > Schemas visualizer, switching schemas still fires
`database_schema_selector_updated` with the same `schemaType` values as
before
- Click **Create a new schema** and **New table** in the sidebar, plus
**Create a table** on `/project/[ref]/editor/new`: fires
`table_editor_new_item_clicked` with the expected `itemType` and
`trigger`
- Type in **Search tables...** and pause >500ms: fires one
`table_editor_table_search_submitted` with no query text; clearing or
switching schemas (via the selector or clicking a tab in another schema)
before 500ms fires nothing
- Toggle entity-type checkboxes, click **Select only**, or reset
filters: fires `table_editor_entity_filter_updated` with the new
`visibleTypeCount`
- Trigger actions from a table/view menu (both ⋮ and right-click): fires
`table_editor_entity_action_clicked` with `action` and `entityType`
(**View policies** does not fire it)
- Create and edit a column via the column panel: fires
`table_column_created` / `table_column_updated` with `hasForeignKey`
(scoped to that column) and `isArray`; clicking **Save** with no changes
fires nothing
- Edit an existing table (with and without adding/removing a column, or
toggling Realtime alone): fires `table_updated` with
`columnCountChanged`, without firing `table_column_*`; clicking **Save**
with no changes fires nothing
- Edit an existing row in the row side panel: fires
`table_editor_row_updated` with `editMethod: 'side_panel'`. Inserting a
new row, saving from an expanded JSON/text cell editor, picking a
foreign row, or saving with queue operations enabled does not fire it
- Edit an existing table so that adding a column (or updating
Realtime/Data API) fails: `table_updated` does not fire
- Expand JSON and text cell editors from both the grid and inside the
row panel: fires `table_editor_cell_editor_opened` with `editorType:
'json' | 'text'`

Notes for review:

- No `data-attr`s were added. Autocapture is off, so each tracked
interaction gets an explicit `track()` call instead.
- `table_editor_cell_editor_opened` counts the expand buttons in both
the grid cell editors and the row side panel fields. It's the same click
on both surfaces.
- `table_editor_row_updated` only has `editMethod: 'side_panel'` for
now. The grid toolbar ticket (FE-5023) can add values when it tracks
inline edits.

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-02 18:54:08 +08:00
Alaister YoungandAlaister Young e0635f2f38 [FE-5108] (part 3) refactor(studio): migrate database, editors & storage off next/link (#54306)
Part 3 of a 6-PR stack migrating all `next/link` imports in
`apps/studio` onto TanStack Router's `Link` (or plain `<a>` for known
external URLs) and removing `compat/next/link.tsx`.

| Part | PR | Scope |
| --- | --- | --- |
| 1 | #54304 | `data/prefetchers/PrefetchableLink.tsx` and
`components/ui/**` |
| 2 | #54305 | `components/layouts/**` and top-level shell components |
| **3** | **#54306 ← this PR** | **Database, TableGridEditor, Storage,
SQLEditor, BranchManagement, Branching, Functions, Realtime** |
| 4 | #54307 | Integrations, Settings, Observability, LogDrains, Issues,
Linter, Reports, QueryPerformance, QuerySources, ConfigDrift,
DiskManagement, Compute |
| 5 | #54308 | Remaining `components/interfaces/**` (Org, Billing, Auth,
Support, Home, SignIn, ConnectSheet, etc.) |
| 6 | #54309 | Remove `compat/next/link.tsx` shim, Vite alias, and
update basePath tests/docs |

Migrates
`components/interfaces/{Database,TableGridEditor,Storage,SQLEditor,BranchManagement,Branching,Functions,Realtime}/`
off `next/link`.

**Changed:**

- Replaced `next/link` across all 60 importing files in Database,
TableGridEditor, Storage, SQLEditor, BranchManagement, Branching,
Functions, and Realtime interfaces
- Updated legacy permanent-redirect hrefs (`/reports` →
`/observability`, `/database/schema` → `/database/schemas`) to their
canonical TanStack routes
- Dropped legacy `passHref` in `GridHeaderActions.tsx`, removed
duplicate `RouterLink` alias in `ChooseFunctionForm.tsx`, and removed
`vi.mock('next/link', ...)` in `ReplicationPipelineLayout.test.tsx`

Addresses
[FE-5108](https://linear.app/supabase/issue/FE-5108/replace-the-nextlink-shim-with-tanstack-link)

## To test

- [ ] Check Table Editor, SQL Editor, Database (tables, policies,
functions, triggers, replication, backups), Storage
(files/analytics/vector buckets), Edge Functions, Branching, and
Realtime links
- [ ] Verify SQL Editor and Table Editor links with query parameters
(`schema`, `content`, `search`) do not double-encode values

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-01 16:43:56 +08:00
Alaister YoungandAlaister Young 0a4cec0464 [FE-5108] (part 1) refactor(studio): migrate core UI & prefetchers off next/link (#54304)
Part 1 of a 6-PR stack migrating all `next/link` imports in
`apps/studio` onto TanStack Router's `Link` (or plain `<a>` for known
external URLs) and removing `compat/next/link.tsx`.

| Part | PR | Scope |
| --- | --- | --- |
| **1** | **#54304 ← this PR** |
**`data/prefetchers/PrefetchableLink.tsx` and `components/ui/**`** |
| 2 | #54305 | `components/layouts/**` and top-level shell components |
| 3 | #54306 | Database, TableGridEditor, Storage, SQLEditor,
BranchManagement, Branching, Functions, Realtime |
| 4 | #54307 | Integrations, Settings, Observability, LogDrains, Issues,
Linter, Reports, QueryPerformance, QuerySources, ConfigDrift,
DiskManagement, Compute |
| 5 | #54308 | Remaining `components/interfaces/**` (Org, Billing, Auth,
Support, Home, SignIn, ConnectSheet, etc.) |
| 6 | #54309 | Remove `compat/next/link.tsx` shim, Vite alias, and
update basePath tests/docs |

Migrates `data/prefetchers/PrefetchableLink.tsx` and all shared
`components/ui/**` components off `next/link`.

**Added:**

- `apps/studio/components/ui/DynamicLink.tsx` (with unit tests) — shared
`forwardRef` link wrapper for dynamic URL strings that runs
`splitInternalUrl` and renders a plain `<a>` for external URLs (or
same-origin URLs outside the app's `basePath`) vs TanStack `<Link>` for
internal paths

**Changed:**

- Replaced `next/link` in
`apps/studio/data/prefetchers/PrefetchableLink.tsx` and all 30 importing
components under `apps/studio/components/ui/**` (`InlineLink`,
`CardButton`, `CommandItemLink`, `ObservabilityLink`, `ProductMenuItem`,
`ResourceItem`, `UpgradePlanButton`, `ToggleSpendCapButton`, banners, AI
assistant panel links, etc.)
- Used typed `<Link to="..." params={...} search={...} hash="..." />`
for known internal routes, `<DynamicLink href={...} />` for
dynamic/untyped URL strings (whether internal with query/hash or
external), and plain `<a>` for known external links
- Updated `apps/studio/routes/index.tsx` `validateSearch` return type to
`{ next?: string }` so `<Link to="/">` compiles without requiring
`search={{ next: undefined }}`
- Updated
`hooks/misc/__tests__/useTableEditorFiltersSort.navigation.test.tsx`,
`PolicyTableRow.utils.test.ts`, `SupportAssistantSuccessCard.test.tsx`,
and `useOrganizationRestrictions.test.tsx` to render inside a TanStack
Router context (`customRender` / `RouterContextProvider`)

Addresses
[FE-5108](https://linear.app/supabase/issue/FE-5108/replace-the-nextlink-shim-with-tanstack-link)

## To test

- [ ] Click internal and external `InlineLink`, `CardButton`,
`ProductMenuItem`, and `PrefetchableLink` targets and verify client-side
navigation vs external anchors
- [ ] Verify banner links (upgrade, resource exhaustion, queue
operations) preserve query params and hashes
- [ ] Confirm Studio typecheck, lint, and unit tests pass

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-01 16:23:48 +08:00
Alaister YoungandAlaister Young 477e2c136f [FE-5109] (part 6) chore(studio): remove next/router shims, aliases, and test mocks (#54058)
Part 6 (final) of a 6-PR stack migrating all `next/router` and
`next/compat/router` imports in `apps/studio` onto TanStack Router hooks
and removing the router shims.

| Part | PR | Scope |
| --- | --- | --- |
| 1 | #54053 | Core navigation helpers, `hooks/**`, `lib/**`,
`data/prefetchers/**` |
| 2 | #54054 | `components/ui/**` |
| 3 | #54055 | `components/layouts/**` and `state/tabs.tsx` |
| 4 | #54056 | Database, Branching, Compute, Edge Functions, Explorer,
SQL Editor, Storage, Table Editor |
| 5 | #54057 | Remaining `components/interfaces/**` and
`QueryInsightsTable` router events |
| **6** | **#54058 ← this PR** | **Remove `next/router` &
`next/compat/router` shims, `_router-events.ts`, Vite aliases, and test
mocks** |

Now that no files in `apps/studio` (or `packages/**`) import
`next/router` or `next/compat/router`, deletes the router shims,
`_router-events.ts`, their Vite aliases, and the obsolete router test
mocks. `RouteValidationWrapper` is intentionally left for FE-3107.

**Removed:**

- `apps/studio/compat/next/router.ts`,
`apps/studio/compat/next/compat/router.ts`, and
`apps/studio/compat/next/_router-events.ts`
- `'next/router'` and `'next/compat/router'` entries from `nextShims` in
`apps/studio/vite.config.ts`
- Global `vi.mock('next/router', ...)` and
`vi.mock('next/compat/router', ...)` in
`apps/studio/tests/vitestSetup.ts`, `mockNextRouter` in
`apps/studio/tests/lib/route-aware-hooks.ts`, and the unused
`vi.mock('next/router')` in `tests/features/logs/LogTable.test.tsx`
- Obsolete shim tests and test helpers: `compat/next/router.test.ts`,
`compat/next/router-navigation.test.tsx`, `tests/config/router.tsx`, and
`tests/config/router.test.tsx`

**Changed:**

- Simplified `createNavigationHandler` in
`apps/studio/lib/navigation.ts` (and `navigation.test.ts`) to accept
TanStack's `UseNavigateResult<string>` only, dropping the `NextRouter`
union branch
- Updated `compat/next/link-basepath-navigation.test.tsx` (renamed from
`router-basepath-navigation.test.tsx`), `lib/router-url-shape.test.tsx`,
and `tests/lib/route-render.test.tsx` to exercise TanStack Router hooks
directly instead of the removed router shim
- Cleaned up stale `next/router` comments in `compat/next/link.tsx`,
`lib/internal-url.ts`, `router.tsx`, and `tests/lib/route-mock.ts`

**Simplified:**

- Removed `routerMock` setup from about 19 tests that no longer read it.
`next-router-mock` stays for now, because the test `FrameworkProvider`
still feeds `useParams` from it.
- `AGENTS.md` and the `vite.config.ts` error text now say only
`next/link` and `next/script` are shimmed
- Renamed `compat/next/router-basepath-navigation.test.tsx` to
`link-basepath-navigation.test.tsx`, and removed stale router-shim
references from comments

Addresses
[FE-5109](https://linear.app/supabase/issue/FE-5109/replace-the-nextrouter-shims-with-tanstack-router-hooks)

## To test

- [ ] Confirm `git grep -E "next/(compat/)?router|_router-events"
apps/studio` returns no code or config imports (only the prose guideline
in `apps/studio/AGENTS.md`)
- [ ] Confirm `pnpm --filter studio run typecheck`, `pnpm --filter
studio run lint`, `pnpm --filter studio run build`, Knip, and the full
Studio Vitest suite pass
- [ ] Spot-check basePath navigation (`next/link` + `navigateToUrl`) and
multi-line query param URLs in Studio

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-01 15:04:27 +08:00
Alaister YoungandAlaister Young d8568215ad [FE-5109] (part 4) refactor(studio): migrate database, editor, storage, and functions interfaces off next/router (#54056)
Part 4 of a 6-PR stack migrating all `next/router` and
`next/compat/router` imports in `apps/studio` onto TanStack Router hooks
and removing the router shims.

| Part | PR | Scope |
| --- | --- | --- |
| 1 | #54053 | Core navigation helpers, `hooks/**`, `lib/**`,
`data/prefetchers/**` |
| 2 | #54054 | `components/ui/**` |
| 3 | #54055 | `components/layouts/**` and `state/tabs.tsx` |
| **4** | **#54056 ← this PR** | **Database, Branching, Compute, Edge
Functions, Explorer, SQL Editor, Storage, Table Editor** |
| 5 | #54057 | Remaining `components/interfaces/**` and
`QueryInsightsTable` router events |
| 6 | #54058 | Remove `next/router` & `next/compat/router` shims,
`_router-events.ts`, Vite aliases, and test mocks |

Migrates the database, branching, compute, functions, explorer, SQL
editor, storage, and table editor interfaces off `next/router` and
`next/compat/router`.

**Changed:**

- Migrated the sole `next/compat/router` consumer
(`components/interfaces/Database/Replication/Destinations.tsx`) to
`useNavigate`
- Replaced `useRouter` across `BranchManagement`, `Branching`,
`Compute`, `Database` (`Backups`, `Functions`, `Replication`, `Schemas`,
`Tables`, `Triggers`), `EdgeFunctions`, `Explorer`, `Functions`,
`SQLEditor`, `Storage` (`AnalyticsBuckets`, `FilesBuckets`,
`VectorBuckets`, `StorageMenuV2`, `Storage.utils`), and
`TableGridEditor` with TanStack Router hooks (`useNavigate`,
`useLocation`, `useRoutePattern`) and `useParams` from `common`
- Updated unit and component tests across `Database/Replication`,
`Explorer`, `Functions`, and
`Storage/FilesBuckets/DeleteBucketModal.test.tsx` to use TanStack Router

**Simplified:**

- `useSnippetEditor` and `useRedirectLegacyReadReplicaDestination` read
search values from `useParams` instead of casting `location.search`
- `resolveSourceSwitch` returns `replace: boolean` instead of a
`push`/`replace` method name
- `ExplorerQueryTab` and `EdgeFunctionDetails` guard on a defined ref
instead of navigating with `ref ?? ''`
- `useFunctionsDetailShortcuts` and `StorageMenuV2` use a local `goTo`
helper for their navigation shortcuts
- Tests use the shared `createTestRouter` and `customRender` router, use
`toMatchObject` for search assertions, and drop duplicate assertions

Addresses
[FE-5109](https://linear.app/supabase/issue/FE-5109/replace-the-nextrouter-shims-with-tanstack-router-hooks)

## To test

- [ ] SQL Editor: creating, renaming, moving, opening
templates/examples, and keyboard shortcuts navigate between snippets
cleanly
- [ ] Table Editor & Database: opening tables, schema table nodes,
triggers, functions, backups/PITR, and replication destination flows
navigate as expected
- [ ] Storage: switching between Files, Analytics, and Vector buckets
and deleting a bucket navigates cleanly
- [ ] Edge Functions & Explorer: opening function details/logs, explorer
chat/query tabs, and branch management actions navigate properly

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-01 14:44:59 +08:00
39b359a70e chore: keep db partner roles out of picker (#54019)
## Problem

Newly added trusted partner roles appear as user selectable /
manageable. Resolves DEPR-735.

## Solution

Trusted partner roles should not be selectable in temporary access. And
should not appear as modifiable in the database roles tab.

| Before | After |
| --- | --- |
| <img width="553" height="398" alt="CleanShot 2026-11-27 at 12 24 43"
src="https://github.com/user-attachments/assets/14affc16-2f00-496f-a124-d918acd93bf0"
/> | <img width="553" height="363" alt="CleanShot 2026-11-27 at 12 25
00"
src="https://github.com/user-attachments/assets/de06002f-d063-453e-a9da-00eee8e0616d"
/> |
| _This partner role `this_is_a_test` shouldn’t be here._ | _Partner
role `this_is_a_test` is no longer in the list of options._ |
| <img width="940" height="305" alt="CleanShot 2026-11-30 at 10 34 52"
src="https://github.com/user-attachments/assets/bdface9f-b3f4-4620-b567-cba8d829205e"
/> | <img width="935" height="299" alt="CleanShot 2026-11-30 at 10 37
40"
src="https://github.com/user-attachments/assets/da1abaa3-5a98-4837-9e8f-35be84b6be4c"
/> |
| _Previous definition._ | _Broadened definition to better encompass
roles we generally manage
([context](https://github.com/supabase/supabase/pull/54019#discussion_r4716757425))._
|

## How to test

1. Open the [Studio staging
preview](https://studio-staging-git-chore-depr-735-supabase.vercel.app)
and select a staging test project. If **Temporary access** is off in
**Feature previews**, enable it there. Then go to **Database → Settings
→ Temporary access** and make sure it is enabled for the test project.
2. Go to **Database → Roles**. Open Chrome DevTools, select **Network**,
and reload. Filter for `key=database-roles`. Right-click the matching
request and select **Override content**.
3. Append this test role to the roles array. Save the override and
reload.

```json
{
  "id": 99999,
  "name": "this_is_a_test",
  "isSuperuser": false,
  "canCreateDb": false,
  "canCreateRole": false,
  "inheritRole": true,
  "canLogin": true,
  "isReplicationRole": false,
  "canBypassRls": false,
  "activeConnections": 0,
  "connectionLimit": 90,
  "validUntil": null,
  "comment": "{\"_supabase\":{\"oauth_app_id\":\"app\"}}",
  "config": {}
}
```

4. In **Database → Roles**, make sure that `this_is_a_test` appears
under **Supabase managed roles** without edit or delete controls.
5. Go to **Database → Settings → Temporary access**, select **Add
rule**, and open the role picker. The test role should be absent.
6. Set the test role's `comment` to `null` in the override and reload.
Open **Add rule** again and make sure that the role is now selectable.
Close the form without saving and remove the override.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Danny White <3104761+dnywh@users.noreply.github.com>
2026-11-30 15:35:30 +01:00
Alaister YoungandAlaister Young 87b9d0562e [FE-5111] refactor(studio): replace next/image shims with plain img (#54011)
Replaces all remaining `next/image` and `next/legacy/image` imports in
`apps/studio` with plain `<img>` elements and deletes both compat shims
and their Vite aliases (following #53906, which removed the last
`next/image` import from `packages/ui-patterns`).

**Changed:**

- Replaced 26 `next/image` and 3 `next/legacy/image` call sites across
`apps/studio` with plain `<img>` elements (every local `src` already
prepends `BASE_PATH` / `router.basePath`, and none used `loader`,
`priority`, `placeholder`, `quality`, or `onLoadingComplete`)
- Converted `fill` / `layout="fill"` usages in `IntegrationCard`,
`MarketplaceFeaturedHeroGrid`, `Integrations.constants`,
`useAvailableIntegrations`, and `IntegrationPanels` to Tailwind sizing
classes, and dropped no-op `layout="fixed"` props in `FormContents` and
`HookList`
- Replaced invalid `layout="fill" objectFit="cover"` props passed to
`next/image` in `HelpPanel` with `absolute inset-0 h-full w-full
object-cover`
- Cleaned up image accessibility across the touched call sites (accurate
alt text on feature preview screenshots and `HookList`, `alt=""` +
`aria-hidden="true"` on decorative icons/illustrations next to visible
labels)

**Removed:**

- `apps/studio/compat/next/image.tsx`
- `apps/studio/compat/next/legacy/image.tsx`
- `'next/image'` and `'next/legacy/image'` aliases from
`apps/studio/vite.config.ts`

## To test

- Confirm `git grep -E "next/(legacy/)?image" apps/studio/` has no
remaining imports
- Check images render as expected across the updated surfaces:
- **Integrations marketplace** (`/project/_/integrations`): featured
hero covers (`MarketplaceFeaturedHeroGrid`), integration icons in cards,
sidebar, and wrapper rows (`Integrations.constants`,
`useAvailableIntegrations`)
  - **Help panel**: Discord card background illustration
- **Account & settings**: Account Connections GitHub icon, Add-ons cards
(IPv4 / PITR / Custom Domain), Spend Cap card & side panel, user profile
avatars (`ProfileImage`), and Feature Previews modal images
- **Database Webhooks** (`FormContents`, `HookList`) and Third-Party
Auth provider dropdown/cards

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-26 16:23:41 +08:00
Joshen Lim 52a7fddc95 Joshenlim/fe 5198 clean up to be cleaned folder (#54106)
## Context

Another housekeeping - just deprecates the `to-be-cleaned` folder
- Removes `ListIcon -> Only `vercelIcon` was being used which I've
replaced to use the existing static SVG instead
- Removes `ProductEmptyState` -> replaced with
`EmptyStatePresentational`
2026-11-26 10:59:43 +07:00
supabase-vercel-tedd[bot] e508c3c3f0 feat(studio): track schema visualizer usage (#53955)
## Problem

The schema visualizer (`/project/[ref]/database/schemas`) sends no
telemetry. We can't tell whether people use it to explore a schema or to
export it, which export format they pick, or whether they edit tables
from the graph.

## Solution

Adds PostHog events for the visualizer's main actions: changing the
schema, selecting a Find table result, copying (schema or table as
SQL/Markdown, table or column name), downloading the graph as PNG or
SVG, applying Auto layout, and choosing Edit table or Edit column from a
node menu. Each event fires from the action's handler, so actions
started from a keyboard shortcut count too. Properties are only fixed
enums (`schemaType`, `content`, `format`, `action`); no schema, table,
or column names are sent. Each tracked element also gets a `data-attr`
for autocapture. View in Table Editor and the empty state's New table
link get a `data-attr` only, because the pageview already records them.

It also fixes an empty canvas after switching back to a schema that was
already loaded. The graph stays mounted in that case and fitted the view
only on first load, so the new schema's tables could sit off-screen
until a reload. The view now fits whenever the schema on the canvas
changes. Edits within the same schema still keep the current view.

Studio's database pages keep the selected schema name in the `schema`
URL param, and that name is chosen by the customer. Telemetry now
redacts its value to `redacted` wherever it already redacts `keywords`:
the event and pageview `page_url`, the query string, the referrer,
first-touch data, and the URL properties posthog-js adds. This applies
to every Studio event and pageview, not just this page. Params that only
contain the word, such as `schemas` or `myschema`, are left alone.

## How to verify

On the PR preview, open a project's Database > Schema Visualizer with
PostHog debugging on (or watch the network requests to the telemetry
endpoint), then:

1. Change the schema in the selector: one
`database_schema_selector_updated` event with `schemaType` of `public`,
`protected` (for example `auth`), or `custom`.
2. Open Find table and select a table: one
`database_schema_visualizer_find_table_clicked` event.
3. Click Copy as SQL: one `database_schema_visualizer_copied` with
`content: 'schema_sql'`. Copy as Markdown from the export menu sends
`content: 'schema_markdown'`.
4. Download as PNG and as SVG: one
`database_schema_visualizer_image_download_clicked` each, with `format`
of `png` or `svg`.
5. Open Auto layout and click Apply: one
`database_schema_visualizer_auto_layout_applied`. Cancel sends nothing.
6. From a table node menu, choose Copy name, Copy as SQL, and Copy as
Markdown: `database_schema_visualizer_copied` with `content` of
`table_name`, `table_sql`, and `table_markdown`. Column menu Copy name
sends `column_name`.
7. From a table node menu choose Edit table, and from a column menu
choose Edit column: `database_schema_visualizer_node_menu_clicked` with
`action` of `edit_table` and `edit_column`.
8. No event carries a schema, table, or column name.
9. Switch the schema from public to auth, then back to public, with no
reload: the public tables are shown and fitted on the canvas each time.
Repeat auth → public → auth.
10. Edit a column from the graph and save: the view does not jump.
11. In the telemetry requests from steps 1 to 7 and in the pageview,
`page_url` and `ph.search` show `schema=redacted`, never the schema
name. The page itself still shows and switches the real schema.

## Checks

Ran `pnpm turbo run typecheck --filter='...[origin/master]'`. Every
package passed except studio, which ran out of memory beside a parallel
lint run. `pnpm --filter studio run typecheck` alone then passed, and
passed again after the view fix. `pnpm turbo run lint
--filter='[origin/master]'` ran out of memory twice on studio's
`lint:type-checks` (2 GB default heap). So I ran `eslint` and `eslint
--config eslint.type-checks.config.cjs` on the changed Studio files with
a larger heap: no errors, only pre-existing warnings. `vitest run
components/interfaces/Database/Schemas/Schemas.utils.test.ts` passed.
For the redaction, `vitest run` in `packages/common` (all 310 tests,
including the new `schema` cases) and its `typecheck` passed; `common`
has no lint script. `oxfmt --check` passes on all changed files. Event
names and properties follow the repo's `telemetry-standards` skill.

## Checklist

- [x] I have read the [contributing
guidelines](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [x] The change is scoped to one feature
- [x] Events are defined in `packages/common/telemetry-constants.ts` and
added to the `TelemetryEvent` union

## Feedback for Tedd

To ask Tedd for a change to this PR, reply in Tedd's session on
[FE-5031](https://linear.app/supabase/issue/FE-5031/track-usage-on-the-schema-visualizer).
Tedd doesn't read comments on this PR.

---------

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
2026-11-25 11:35:03 +00:00
Alaister YoungandAlaister Young fcbdda8107 chore: migrate formatter from Prettier to oxfmt (#53835)
Migrate code formatting across the monorepo from Prettier to `oxfmt`
(`0.79.0`, pinned) for much faster formatting checks locally and in CI
while keeping code churn minimal (78 files total, 0.7% of the repo).

Studio's `@ianvs/prettier-plugin-sort-imports` ordering
(`<BUILTIN_MODULES>`, `<THIRD_PARTY_MODULES>`, blank line, then `@/` and
relative imports) is preserved via `oxfmt`'s native `sortImports`
override for `apps/studio/**/*.{js,jsx,ts,tsx}`.

### Performance (before vs after, uncached)

| Benchmark | Prettier (`3.8.x`) | oxfmt (`0.79.0`) | Speedup |
| --- | ---: | ---: | ---: |
| CI formatting step (`blacksmith-4vcpu-ubuntu-2404`, full repo) | `73s`
| **`7s`** | **~10×** |
| Local `apps/studio` JS/TS (`5,157` files) | `17.74s` | **`0.36s`** |
**~49×** |
| Local full monorepo (`11,131` files) | — | **`2.39s`** | — |

**Added:**

- `.oxfmtrc.jsonc` at repo root with Prettier-matching options,
`sortPackageJson: false`, the Studio `sortImports` override, and ignore
patterns migrated from `.prettierignore`
- `oxfmt` (`0.79.0` exact pin) in `pnpm-workspace.yaml` catalog and
workspace `devDependencies` / `dependencies`
- Shared `.agents/scripts/format_and_lint.sh` hook script and
`.agents/hooks.json` (used by both Claude Code and Antigravity)

**Changed:**

- Replaced `test:prettier` with `format:check` and switched `format` in
root `package.json` to `oxfmt`
- Updated `packages/api-types` (`codegen`,
`verify-production-types.mjs`), `apps/design-system` (`build:registry`),
`apps/docs` (`CodeSample.ts`, `generate-sitemap.ts`, `next.config.mjs`,
`spec/Makefile`), `apps/www` (`generate-sitemap.mjs`), and
`packages/build-icons` (`generateIconFiles.mjs`) from Prettier to
`oxfmt`
- Updated `.github/workflows/prettier.yml` (keeping the `format` job ID
intact), `.github/workflows/autofix_linters.yml`,
`.claude/settings.json`, `AGENTS.md`, `CONTRIBUTING.md`, and
`.github/copilot-instructions.md`
- Applied one-time `oxfmt` formatting pass in a separate commit (78
files: 30 `i18n/README.*.md` trailing spaces, 19 Studio files, 17 other
TS/TSX/generated types, 8 MD/MDX, 3 `package.json`, 2 example CSS files)

**Removed:**

- `prettier`, `@ianvs/prettier-plugin-sort-imports`, and
`prettier-plugin-sql-cst` from `devDependencies` (note: `.sql` files
were not part of the CI formatting glob; `eslint-config-prettier` is
kept for ESLint)
- `prettier.config.mjs`, `.prettierignore`, and
`.claude/scripts/format_and_lint.sh`

## To test

- Run `pnpm run format:check` and confirm it passes cleanly across all
matched files
- Run `pnpm --filter api-types test`, `pnpm --filter docs exec vitest
run features/directives/CodeSample.test.ts`, and `pnpm --filter www exec
vitest run generate-sitemap.test.ts`
- Edit an `apps/studio` file with out-of-order imports and run `pnpm run
format` to confirm builtin/third-party vs `@/`/relative grouping matches
prior behavior
- Check that the `Check Code Formatting` CI workflow passes on this PR

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-24 12:51:31 +08:00
Danny White 1c85e3efb7 fix(studio): clarify OAuth permission labels (#53699)
## Problem

OAuth mixes abbreviated access levels with permission names whose
meaning is hard to infer.

## Solution

Use **Read and write** and **Read only** consistently, and add
keyboard-accessible definitions for Database management and Environment.
Reuse the dotted underline from Pipelines and document above-label
placement.

| Before | After |
| --- | --- |
| <img width="926" height="1936" alt="CleanShot 2026-11-20 at 12 20
42@2x"
src="https://github.com/user-attachments/assets/053b4afa-f428-4c0d-8f3b-dbc3f3dd5cf8"
/> | <img width="886" height="1902" alt="CleanShot 2026-11-20 at 12 21
20@2x"
src="https://github.com/user-attachments/assets/8277064b-1e73-43ff-b7b5-4d4af7d6c68f"
/> |
| _No tooltips, old “READ-WRITE”._ | _Tooltips for ambiguous
permissions, “READ AND WRITE” for clarity and to match setup
terminology._ |

## Review instructions

1. **Before:** Open the [Scoped OAuth
tester](https://api.supabase.green/v1/oauth/authorize?response_type=code&client_id=a3999bfe-cfc7-4584-9c5a-ab6828d35aa3&redirect_uri=http%3A%2F%2Flocalhost%3A8765%2Foauth%2Fcallback)
and leave consent open.
2. **After:** Open the [deploy preview consent
screen](https://studio-staging-git-dnywh-oauth-permission-labels-supabase.vercel.app/dashboard/authorize?auth_id=606dbb8e-60ea-4155-bb36-70a7d31378dd).

**What to check**

1. Open consent for a test app that requests database read/write,
environment read, and projects read access.
2. Check the small **Read and write** and **Read only** headings. Hover
or Tab to Database management and Environment. Each definition should
appear above its dotted-underlined label.
3. Optionally open an existing Pipeline and hover over an annotated
status label to check the shared underline.
2026-11-24 10:13:36 +11:00
Joshen Lim c9a25cf11f Joshenlim/fe 5172 deprecate old table component (#53728)
## Context

More housekeeping - deprecates the old Table component in favor of the
Table component under `ui`

JFYI also realised as part of this that the following 2 routes are
unreachable from the dashboard and hence am opting to deprecate them
with a redirect
- /logs/explorer/recent
- /logs/explorer/saved

## Areas affected to check
- [ ] Integrations -> Webhooks
<img width="600" alt="image"
src="https://github.com/user-attachments/assets/58523cdb-6219-49be-9d2f-5bc26ae03d7f"
/>
- [ ] Database -> Column Privileges
<img width="600" alt="image"
src="https://github.com/user-attachments/assets/98bea654-24ac-4646-9c65-5bc4f18565e9"
/>
- [ ] Observability -> API  
<img width="600" alt="image"
src="https://github.com/user-attachments/assets/a6512c6f-bd04-4d25-8e3c-99c85883434a"
/>
- [ ] Observability -> Storage
  - Its a table under "Request caching" which I don't have data for 😅 🙏 
- [ ] Observability -> Database
<img width="600" alt="image"
src="https://github.com/user-attachments/assets/4f0ba203-64b3-41f7-971e-974e232bdedd"
/>
- [ ] Table Editor -> Project API Docs -> Column list
<img width="600" alt="image"
src="https://github.com/user-attachments/assets/6358e7a8-5770-46f9-a5a2-4851855ae97f"
/>
- [ ] Table Editor -> Project API Docs -> RPC parameters list
<img width="600" alt="image"
src="https://github.com/user-attachments/assets/5e45a1d6-cd29-451c-bf00-5d806ef37cec"
/>
2026-11-23 10:59:28 +07:00
Joshen Lim df6eafef7c Joshenlim/fe 5116 support editduplicatedelete tables from (#53662)
## Context

We previously introduced context menus to the table editor
[here](https://github.com/supabase/supabase/pull/53506), but prevented
edit, delete, and duplicate actions as those actions were coupled to the
router. Hence this PR decouples that by making those actions target a
table by a provided ID

"More options" action now also shows on every row, just visibly shown
only if its active or the user hovers over the row
<img width="335" height="183" alt="image"
src="https://github.com/user-attachments/assets/9897945d-37f4-4658-9420-29b948173208"
/>

## To test

Can test edit / delete / duplicate table on a table that you're not
currently actively on, via both context menu and dropdown menu
2026-11-20 10:19:00 +07:00
Riccardo Busetti 9437334289 feat(pipelines): Update docs and UI (#53665) 2026-11-19 11:27:04 +01:00
Joshen Lim 9e8e36fda1 Improve R2NP confirm flow (#53446)
## Context

Just tidying up the UI for the Restore to new project flow, some issues

- The previous step before confirming showed notes on what to expect,
but the language isn't smooth
- Updating to show the selected backup, organization and compute size
(as tooltips)
- Have verified on preview RE the selected backup for both logic + PITR
backup
- Remove the Additional Monthly Cost section as this step since this is
repeated in the next step when inputting the project name and password
  
    | Before                       | After |
    | --------- | ------------ |
| <img width="400"
src="https://github.com/user-attachments/assets/0c5ca5d1-a20e-4cb3-9eef-e80e9096469a"
/> | <img width="400"
src="https://github.com/user-attachments/assets/9ee11e6b-68de-4241-ac63-f7127fcd105d"
/> |

- The new project created will have its disk size increased by 1.5x, but
this triggers an "Exceeded usage" warning for the new project if spend
cap is enabled on the organization, since disk size cannot be increased
past 8GB if so
  - Show the compute size that the new project will have as a tooltip
- Updated the copy here + added an admonition to explain this if the org
has spend cap enabled
  
    | Before                       | After |
    | --------- | ------------ |
| <img width="400"
src="https://github.com/user-attachments/assets/004fd934-2128-4beb-b151-265fb9b92de6"
/> | <img width="400"
src="https://github.com/user-attachments/assets/35be6636-9b78-49ad-bfc1-02e2f6ce425a"
/> |
2026-11-17 17:04:28 +07:00
Alaister YoungandAlaister Young 7418124337 [FE-3106] (part 6) – refactor(studio): move project home and database page bodies (#53215)
Moves the project home, `/merge`, `/api` and all `/database/*` page
bodies into their route files and deletes the pages (FE-3106). Part 6 of
the stack.

**Depends on:** #53214

**Changed:**
- `routes/project/$ref/{index,merge,api/index}.tsx`,
`routes/project/$ref/database/**` – 26 page bodies inlined; redirects
use `<Navigate>`/`useNavigate` with typed params and `search`;
`next/link` → `Link`
- `database/pipelines/new` – same-origin header links navigate
client-side via `splitInternalUrl`, external ones via `href`, matching
the old shim
- `PipelineCreationPage.test.tsx` – renders the route with `renderRoute`

**Removed:**
- 26 page files, and `DatabaseTriggersLayout`/`PipelinesLayout`, which
only the deleted pages' `getLayout` used (the route shells already
inline them)

Addresses
[FE-3106](https://linear.app/supabase/issue/FE-3106/move-page-bodies-into-route-files-and-delete-pages).

## To test

- Click through Database (Tables, Functions, Triggers, Indexes, Roles,
Policies, Backups, Pipelines, Publications) – same layout, titles and
sidebar
- `/project/<ref>/database/triggers` – redirects to `triggers/data`
- `/project/<ref>/api` – redirects to the Data API docs, keeping the
query
- Create a pipeline and leave the wizard – unsaved-changes guard and
navigation behave as before

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-17 15:28:45 +09:00
Riccardo Busetti 2a9b02a99a feat(docs): Improve Pipelines docs and UI (#53450) 2026-11-16 16:25:00 +00:00
Charis b046f12571 chore(api-types): update generated API types from production (#53364)
Regenerates the API types with `pnpm api:codegen:prod` and fixes the
Studio type errors the new types caused.

## Changes from the API

- **Branch merge now requires production write permission.** `POST
/v1/branches/{branch_id_or_ref}/merge` changed from accepting either
`branching_development_write` or `branching_production_write` to
requiring `branching_production_write`. Studio's FGA refinement for
merge no longer matched and failed typecheck.
  - Removed the merge entry from `lib/fga-refinements.ts`.
- `merge.tsx` checks merge permission with `useGrant` instead of
`useBranchGrant`.
  - `BranchMergeGrant` uses `GrantFor` instead of `GrantForVariants`.
- Removed merge from the "requires a variant" test in
`guarded-fetch.test.ts`.
- Users with only development branching permissions can no longer merge
in Studio. This matches what the API now enforces.
- **Replication pipelines have a required `cluster_id`.** Added it to
the pipeline fixtures in six test files.
- **`MemberWithFreeProjectLimit` has a required
`free_plan_organizations`.** Added it to the mock in
`tests/pages/new/[slug].test.tsx`. No app code reads it yet.

## Testing

- `pnpm typecheck` passes.
- Vitest passes for the affected Studio tests.
2026-11-13 08:02:50 -05:00
Joshen Lim 42b6571e7d Chore/housekeeping org pages (#53303)
## Context

Some minor UI issues that I found while reviewing another PR

- Fix `NoProjectsOnPaidOrgInfo` prematurely showing while project
details is still loading
<img width="1249" height="376" alt="image"
src="https://github.com/user-attachments/assets/3f41f4a3-849f-4685-bcc4-6fed3b433042"
/>
- Fix padding alignment for Organization details form group
<img width="1115" height="282" alt="image"
src="https://github.com/user-attachments/assets/c0865614-208c-4335-87d3-176c4411b6a4"
/>
- Fix projects list on `/org/[slug]` showing stale projects while
switching orgs - just removed `keepPreviousData` so that the card
loaders shows up
- Fix organization settings in sidebar menu not showing active state
while on certain settings pages like audit-log-drains, webhooks, etc
2026-11-13 10:16:48 +07:00
Charis ed6d1b4c63 feat(studio): show error details in AlertError and attribute user faults in SQL errors (#53242)
## Problem

`AlertError` gives users and support no way to correlate a failure with
Sentry or platform logs. It also treats every failure the same: a bad
table editor filter or an offline browser gets "try refreshing, contact
support".

On the reporting side, SQL errors were attributed by who wrote the whole
statement. That made errors in the user's part of mixed SQL Studio's
fault: policy expressions, function bodies, cron schedules, table editor
filters and row edits. Marking them as user SQL instead would drop them
from Sentry entirely.

Part of FE-4772.

## Solution

**`AlertError`**
- Platform and Studio faults show the request ID, the Sentry event ID
(labeled "before sampling", since the event may be sampled out) and a
"Copy details" button.
- The copied text never includes `formattedError`, metadata, the cause
or SQL.
- SQL errors copy the SQLSTATE, position and query name instead of the
message.
- User faults (`isUserError`) show their message with "Please try again.
If the issue persists, try refreshing your browser." There is no support
link, no IDs and no copy button.
- Offline shows only "You may be temporarily offline. Check your
internet connection and try again."
- Defaults come from `getErrorPresentation`, and props the caller passes
still win. The table editor passes a filter-specific description when
filters are set.

**SQL error classification**
- `executeSql` takes an optional `isUserFaultSqlState` predicate for
Studio SQL. When it matches, the error is a `StudioSqlError` with reason
`user_input` and fault `user`, and is still redacted to SQLSTATE plus
query name.
- `isUserFaultForValues` (classes 22, 23 and P0, plus 42501 and 57014)
is for typed values: table editor filters and row edits, cron name and
schedule.
- `isUserFaultForSql` (any SQLSTATE except server classes 08, 53, 57
other than 57014, 58 and XX) is for embedded user SQL: policies,
functions, the custom access token hook.
- `isUserFaultForStatsStatement` is for `pg_stat_statements` text (Query
Insights `EXPLAIN`, index advisor). It treats 42P02 (`$1` placeholders)
as Studio's fault.
- `UserSqlError` is now only SQL the user wrote in full, and it is still
never sent.
- The policy, function and cron mutation hooks no longer take
`sqlOrigin`.

**Routing and types**
- `ERROR_ROUTING` is one table keyed by tag, then by fault. Its type
requires exactly the faults each class can produce.
- User faults get `SAMPLE_USER_FAULT` (default 0.01, set with
`NEXT_PUBLIC_SENTRY_SAMPLE_RATE_USER_FAULT`) to catch misclassification.
- The error class decides privacy (`isNeverReportedError`), separately
from the rate.
- Sentry events get a `reason` tag.
- Each class declares its `reasons`, so a mistyped reason fails
typecheck.

## Review instructions

1. Open the table editor, add a filter with a wrong-typed value (text on
an integer column). The alert shows the Postgres error, the filter hint,
and no support link, IDs or copy button.
2. Make a query fail with a platform error (e.g. block a `/platform/`
request in DevTools). The alert shows the request ID, the event ID and
"Copy details". Paste the copied text and check it has no SQL or
`formattedError`.
3. Go offline in DevTools and trigger a query. Only the offline message
shows.
4. Create a policy with an invalid `USING` expression. The toast shows
the Postgres error. In Sentry it is a `StudioSqlError` with reason
`user_input`, sampled at the user-fault rate.
5. Review `lib/errors/error-routing.ts` and
`data/error-classification.ts` for the routing table and the SQLSTATE
predicates.
2026-11-12 15:19:25 -05:00
Charis 115a2ffeef feat(studio): gate database functions, triggers, and webhooks on sql grants (#53269)
Resolves FE-4744. Part of the grants rollout; builds on the read/write
SQL variants from #53185.

## What

- **Data layer:** the database functions, triggers, database webhooks,
and event triggers queries now take a `read` grant (exposed as
`queryOptions` factories). All 8 create/update/delete mutations take a
`write` grant and mark their SQL with `asWriteSql`.
- **Guards:** the hand-written FGA checks in the functions, triggers,
event triggers, and database webhooks lists, the functions page, the
triggers layout/route, and the webhooks integration tab now derive from
grants, with denied and error states.
- **Other consumers** updated to pass grants: `CreateFunction`,
`TriggerSheet`, `EditHookPanel`, `DeleteHookModal`,
`ChooseFunctionForm`, `FunctionSelector`, `AutoEnableRLSNotice`, and SQL
editor definition/autocomplete hooks.

## Behavior changes

- **Webhooks integration tab:** was gated on
`database_webhooks_config_read`; now gated on `database_read`, which is
what the backend checks for the pg-meta query it uses. Both permissions
are granted to the same built-in roles, so there is no change for
built-in roles. A permissions-load failure now shows an error alert
instead of the content.
- **`AutoEnableRLSNotice`:** hidden unless the user has read access,
since it can't tell whether the trigger already exists without it.

## Out of scope

- User-authored SQL execution in `QueryEditor` / `useSqlEditorExecution`
stays `unguarded.migrating` (FE-4750).

## Testing

- New tests: query factories and write mutations
(`data/database-sql-grants.test.ts`), webhooks tab granted/denied/error,
functions list read/write granted/denied/error.
- Typecheck, Prettier, lint ratchet, and Studio vitest suites for
affected areas pass.
2026-11-12 14:58:01 -05:00
Riccardo Busetti 79e7836a5a feat(pipelines): Add support for unknown destination (#53272) 2026-11-12 10:53:15 +01:00
Anthony Lio 0ed90ae460 fix(ui): split button divider (#53258)
## Problem

- in dark mode split button shows a middle divider that is lighter and
heavier than the outer edge, and the design system
`button-split-dropdown` example has the same bug
- button edge is a translucent inset shadow over a translucent fill, so
the `-ml-px` overlap stacks two edges and two fills in one column
- light mode has the same defect on hover and with the menu open,
because the hover fill is translucent too

## Solution

- adds a `SplitButtonGroup` component to `ui`, so a split button has a
`role="group"` wrapper and one shared divider
- fixes the divider color in both themes, because only one button paints
the shared border column
- changes the shared column to follow the hovered button, so the divider
takes its edge color in a fixed place
- removes the press scale from buttons in the group, so no gap opens
between the two buttons
- changes the design system split button docs to `SplitButtonGroup`

| before | after |
| -------|------|
| <img width="428" height="219" alt="image"
src="https://github.com/user-attachments/assets/4cbc5dc9-3575-4eef-83b9-a6141796ccc8"
/> | <img width="428" height="219" alt="image"
src="https://github.com/user-attachments/assets/9c5b283d-e6bd-428a-bee1-7f59249aeb83"
/> |
| <img width="428" height="219" alt="image"
src="https://github.com/user-attachments/assets/046338f9-6dfd-4c32-8e33-30c1b0f84715"
/> | <img width="428" height="219" alt="image"
src="https://github.com/user-attachments/assets/c79e1c7a-e1ac-4682-a898-1a36c6b028fc"
/> |

<!--
## 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 the
[/design-system/docs/components/button](https://design-system-git-antlio-fix-split-button-divider-supabase.vercel.app/design-system/docs/components/button#split-with-dropdown)
preview in dark mode, and zoom in on the split example
2. make sure that the divider has the same color and weight as the outer
edge
3. hover the primary action, and make sure that the divider takes its
edge color and stays in the same place
4. hover the chevron and open the menu, and make sure that the divider
takes the chevron edge color
5. switch to light mode, and repeat steps 2 to 4
6. press and hold the primary action, and make sure that it does not
shrink
7. tab to the chevron, and make sure that the focus ring shows on all
four sides and that Enter opens the menu
8. open the
[/design-system/docs/fragments/admonition](https://design-system-git-antlio-fix-split-button-divider-supabase.vercel.app/design-system/docs/fragments/admonition#split-button-with-dropdown)
preview at a narrow width, and make sure that the split fills the row
with one divider
9. open the
[/dashboard/project/\_/settings/log-drains](https://studio-git-antlio-fix-split-button-divider-supabase.vercel.app/dashboard/project/_/settings/log-drains)
preview, and make sure that the `primary` split looks the same as on
master


## 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-12 09:17:27 +02:00
Monica Khoury 873b42c84d feat(studio): collapse previous restorations list in database backups (#53264)
## Problem

The "Previous restorations" list on the Database Backups restore page
keeps growing. Entries for cloned projects that were later removed stay
in the list and can't be deleted, so the list pushes the rest of the
page down.

Linear: FE-4402

## Solution

Make the list collapsible instead of deleting entries, which is the
safer option.

- The list is collapsed by default.
- The heading is now a trigger with a chevron that rotates when open.
- The heading shows the number of restorations, e.g. "Previous
restorations (12)", so a collapsed list still shows how much is hidden.

It reuses the existing `Collapsible` component from `ui`. Only
`RestoreToNewProject.tsx` changes.

## Review instructions

1. Open a project on a Pro plan or above with physical backups enabled,
then go to Database > Backups > Restore to a new project.
2. Make sure the project has previous restorations. If it doesn't, mock
the response of the `clone/status` request in DevTools with a few
entries.
3. Check that "Previous restorations (N)" is collapsed on load.
4. Click the heading and check that the list opens and the chevron
rotates.
5. Click again and check that the list closes.
2026-11-11 16:52:37 +02:00
Victor FarazdagiandJoshen Lim 00adb5a81b chore(studio): remove the Iceberg pipeline destination (#52229)
## Problem

Retire the deprecated Iceberg (Analytics Bucket) destination from
Pipelines.

## Solution

- Remove the destination UI, configuration mappings, feature-flag usage,
and generated API variants.
- Remove the legacy Pipelines integration from Storage while preserving
standalone Analytics Buckets.
- Remove unused components and sheet-layout support, and add regression
coverage for retained Storage operations.
- Remove the stale Pipelines claim from the Storage docs overview.

## Validation

- Pipelines, Storage, and replication data tests
- After the final cleanup: Studio typecheck and all 3 Analytics Bucket
regression tests passed.
- Formatting, scoped ESLint, Knip, and whitespace checks passed; lint
warnings are pre-existing.
- Storage overview: Prettier, ESLint with zero warnings, content-listing
schema validation, and Markdown rendering passed.

Production API-type verification remains pending the coordinated API
deployment. Legacy Iceberg pipelines, destinations, and slots must be
cleaned up before rollout.

## Review instructions

1. Verify that Pipelines offers BigQuery, DuckLake, Snowflake, and
ClickHouse, with no Analytics Bucket option.
2. Verify that Storage Analytics Bucket creation, namespace/table
operations, and wrapper/key cleanup remain available without Pipelines
controls.

## Checklist

- [x] Read CONTRIBUTING.md.
- [x] Updated the Storage overview copy and checked the docs authoring
guidance.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-11-11 12:18:04 +03:00
Etienne Stalmans f8afb1ee05 chore: mark new temporary support role (#53211)
## Problem

New temporary role that may be added during a support ticket. This shows
up as a normal role, rather than reserved

## Solution

New temporary read-only support role should be marked as supabase
managed.

<img width="1170" height="1057" alt="Image"
src="https://github.com/user-attachments/assets/8e42ac26-e88f-4772-a1b4-d3efc2e5a850"
/>

## Review instructions

Provide a clear numbered procedure that the PR reviewer can walk
through.

1. Create a support user on a staging project (admin-studio)
2. Check the role appears as a Supabase service role in
/dashboard/project/_/database/roles

## 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-10 16:16:04 +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
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
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
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 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
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
Charis df742bdb3b refactor(studio): rename ResponseError to StudioError (#52707)
## What

Moves the `ResponseError` class (`types/base.ts`) and the classified
error classes (`types/api-errors.ts`) into
`lib/errors/studio-errors.ts`, and renames `ResponseError` to
`StudioError`.

## Why

Studio's error classification is being expanded to cover errors that
don't come from API responses (thrown network failures, aborted
requests, unexpected client errors). The API-specific name and location
no longer fit. Landing the rename on its own keeps the follow-up PR,
which introduces the classified error model, small and reviewable.

## Notes for reviewers

- Mechanical change, no behavior change. Most of the diff is a one-line
import change per file plus import re-sorting by Prettier.
- Files that only use the type now use `import type { StudioError }`.
- `ResponseError` is no longer re-exported from `@/types`; there are no
compatibility shims at the old paths.
- Unrelated identifiers like `QueryResponseError` and
`parseResponseErrors` are unchanged.
2026-11-03 11:09:30 -05:00
Drew McLellan 5ff6930c2a feat(studio): send role passwords as precomputed SCRAM-SHA-256 verifiers (#52544)
## What kind of change does this PR introduce?

Feature.

## What is the current behavior?

Role passwords are sent as plaintext in the SQL (`create role ...
password '...'` and `alter role ... password '...'`), so they can end up
in Postgres logs.

## What is the new behavior?

ASCII role passwords are hashed in the browser with Web Crypto and sent
as a precomputed `SCRAM-SHA-256$...` verifier. Postgres stores a
verifier as given, so the plaintext no longer appears in the SQL or the
server logs. This applies to every flow that sets a role password,
because they all go through the role create and update mutations.

Non-ASCII passwords are still sent as plaintext. Postgres normalizes
passwords with SASLprep before hashing, and the browser code doesn't
apply it, so a verifier built from the raw text could stop the role from
logging in. For ASCII, SASLprep changes nothing, so the verifier always
matches. The `saslprep` package can't be used here because it reads its
table with `fs.readFileSync` at import time. Covering non-ASCII
passwords is a follow-up, most likely a server-side API.

Studio also falls back to plaintext when `crypto.subtle` isn't
available, which browsers only expose in secure contexts. This keeps
setting a password working on self-hosted Studio served over plain HTTP.

## Known limitations

- The verifier is built with 4096 iterations, the Postgres default. If a
project sets `scram_iterations` higher, these roles keep 4096, because
Postgres stores a supplied verifier as given. Reading the setting first
needs an extra query and a grant for it, so it's left for the follow-up
below.
- Non-ASCII passwords, and Studio over plain HTTP, still send plaintext.
- The follow-up is a server-side path that sets the password without it
going through the SQL, which would honor the server's own settings and
cover these cases.

A verifier isn't secret (it can be attacked offline), but it is a clear
improvement over plaintext.

## Testing

- Unit tests compare the helper with an independent `node:crypto`
implementation, and check that ASCII passwords become verifiers and
non-ASCII passwords pass through unchanged.
- I also checked against a real Postgres: roles given these verifiers
log in with the plaintext password and reject a wrong one.
- The `CreateRolePanel` test now expects a verifier and no plaintext in
the SQL.

Resolves FE-4822.
2026-11-02 15:42:59 +00:00
Drew McLellan 1e94d386a4 feat(studio): add a reset password action for custom roles (#52506)
## What kind of change does this PR introduce?

Feature.

## What is the current behavior?

The Dashboard only offers a reset password action for the `postgres`
role (Database Settings). To change the password of a custom role, users
have to run `alter role ... password` in the SQL editor.

## What is the new behavior?

Each role row in Database > Roles has a "Reset password" item in its
actions menu. It opens a dialog with a warning that anything using the
old password will be disconnected, and the shared password field
(generate and copy). The password is required in this dialog.

- The item is disabled for system roles, and for roles that can't log
in, with a tooltip explaining why.
- It uses the existing role update mutation, so no platform endpoint is
involved.
- `RolePasswordField` gains `isOptional` and `layout` props so the
dialog can reuse it.

<img width="271" height="174" alt="Screenshot 2026-11-02 at 11 11 33"
src="https://github.com/user-attachments/assets/36f05fa0-e95c-440c-b6bb-4fadb466c2f6"
/>

<img width="543" height="414" alt="Screenshot 2026-11-02 at 11 11 17"
src="https://github.com/user-attachments/assets/87ba4f50-1315-4e07-b390-9c5b6beba129"
/>


## Testing

New `RoleRow` component tests cover the item being available for a
custom role that can log in, disabled for system roles and roles that
can't log in, the required-password validation, and a successful reset.

Resolves FE-4813.
2026-11-02 13:52:18 +00:00
K-Dog (Kevin) 31c9854c2a chore: update api types (#52618)
Fixes API-types as per latest develop - pending prod deployment today to
clear out the failing action that checks against prod types
2026-11-02 18:27:59 +08:00
Riccardo Busetti cd0b65c03e feat(logs): Add Pipelines to unified logs and rename ETL to Pipelines (#52555) 2026-11-02 11:26:29 +01:00
Drew McLellan 5bb549efae feat(studio): allow setting a password when enabling login on an existing role (#52505)
## What kind of change does this PR introduce?

Feature.

## What is the current behavior?

Turning on "User can login" for an existing role that couldn't log in
gives no way to set a password. Users have to run `alter role ...
password` in the SQL editor.

## What is the new behavior?

In Database > Roles, turning on "User can login" for a role that
couldn't log in now shows the same optional password field as the create
panel, including the generate and copy actions.

- The field only shows for roles that don't currently have login. Roles
that can already log in don't get one.
- The password is sent only when login is gained in that save and the
field isn't empty. An empty field turns on login without a password, as
in create mode.
- The password is kept out of the "changed fields" diff, so unrelated
edits never send `password ''`.
- The password field is extracted from the create panel into a shared
`RolePasswordField`, which also owns the "Password generated"
announcement state.

Follow-up to #52463. Changing the password of a role that can already
log in is tracked separately and is the next PR in this stack.

<img width="840" height="655" alt="Screenshot 2026-10-29 at 15 47 33"
src="https://github.com/user-attachments/assets/8bb52e86-7b1e-4911-b625-2532fb7dfa25"
/>


## Testing

- New `RoleRow` component tests cover the field's visibility, sending
the password, and omitting it when empty or for roles that already have
login.
- Existing `CreateRolePanel` tests still pass.

Part of FE-4763.
2026-11-02 09:48:04 +00:00
Riccardo Busetti 6aed258d87 feat(migration): Move pipeline_id to string (#52489) 2026-10-29 15:16:51 +01:00
Coenen Benjamin 253d874e38 fix(warehouse): disallow warehouse installation on orioledb (#51913) 2026-10-29 11:31:54 +01:00
Drew McLellan 9b015c7427 feat(studio): allow setting a password when creating a role (#52463)
## Problem

The Create Role panel offers "User can login" but no way to set a
password, so a role created with login enabled can't authenticate with a
password until one is set elsewhere. The role SQL builder in `pg-meta`
already supports a password on create; the form just never sent one.

Resolves FE-4763.

## Solution

- Add an optional **Password** field to the Create Role panel, shown
only while "User can login" is on. It has a copy button and a "Generate
a password" action, matching how project creation handles database
passwords.
- Keep password optional. If the field is empty, or login is turned off
after typing one, the password is left out of the request, so behavior
is unchanged from today.
- Link the privilege switch labels to their switches (the label
previously pointed at a wrapper `div`), which also lets the new tests
find the switch by its label.
- Tests: a `pg-meta` case creating a role with a password containing
quotes, and component tests asserting the SQL sent for each of the four
password and login combinations.

Not in scope: editing or resetting an existing role's password. 

<img width="663" height="661" alt="Screenshot 2026-10-28 at 17 22 59"
src="https://github.com/user-attachments/assets/270fcfb4-4dc9-4dc1-b8e6-4141ee755ac2"
/>


## Review instructions

1. Open Database > Roles and click **Create role**.
2. Confirm no password field shows until you enable **User can login**.
3. Enable login, click **Generate a password**, then copy it with the
copy button, and create the role.
4. Confirm you can connect as the new role using that password.
5. Create another role with login enabled and the password left empty;
confirm it is created as before.
6. Click a switch label (for example "User can login") and confirm it
toggles the switch.

## 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-10-28 21:49:07 +00:00
Alaister Young c127901b64 test(studio): speed up flaky replication tests (#52326) 2026-10-27 01:21:54 +08:00
Gildas Garcia 8ea3ce7747 Fix: stabilize some long flaky units tests (#52297)
## Problem

Some of our units fail randomly because they can take a bit more than 5
seconds to complete

## Solution

Set their timeout to 10 seconds.
2026-10-26 16:22:58 +01:00
Charis 254e24b170 feat(studio): require grants in fetch wrappers for FGA-annotated endpoints (#52238)
## Problem

Resolves FE-4689 and FE-4690.

Builds on #52105. Studio's fetch wrappers don't know which FGA
permissions an endpoint requires, so a UI guard and the request it
protects can drift apart. This makes the `grant` minted by
`useGrant`/`getGrant`/`ensureGrant` part of the request itself: calling
an annotated endpoint without a matching grant is a compile error.

## Solution

### What changed

- **Fetch wrappers** (`data/fetchers.ts`, `data/guarded-fetch.ts`):
`get`/`post`/`put`/`patch`/`del` keep their names, so no imports change.
- The `grant` option is required for endpoints annotated with
`x-fga-permissions`, and forbidden for unannotated ones.
- It accepts a `Grant` for that exact endpoint (or one of its variants)
or `unguarded`.
  - The wrapper strips the grant before calling openapi-fetch.
  - `head`/`trace`/`options` are unchanged.
- **Owned params**: refinements can declare query params the wrapper
sets from the grant's variant (`ownedQuery`). These params are removed
from the init type (`Omit<Query, Owned> & { [K in Owned]?: never }`), so
callers can't pass them. Nothing uses this yet: the api-keys `reveal`
variant is the first.
- **`assertGrant`** runs in development only and throws
`GrantAssertionError`. It checks:
  - the endpoint;
  - a missing grant;
  - the variant against `when(init)` predicates;
- the path `ref` against the grant's project, also accepting the parent
project ref for a grant minted on a branch;
  - the path `slug` against the grant's organization.
- **Escape hatches**:
  - `unguarded.migrating` for unmigrated call sites.
- `unguarded.byDesign('reason')` for calls that intentionally skip the
check.
- **Grants** now record `permissionsProjectRef`, the ref permissions
were evaluated against. It's required once the scope is resolved.
- **Readable errors**: a missing or wrong grant reports the caller's own
init type plus the expected `grant` type, instead of openapi-fetch's
full options type. Under `noErrorTruncation`, the old message was tens
of KB per call site.
- **`executeSql`** now requires a grant for `POST
/platform/pg-meta/{ref}/query`, so every caller counts as unmigrated.
- **Codemod**: added `grant: unguarded.migrating` at every existing call
site that hits an annotated endpoint, including all `executeSql`
callers. No behavior change. A follow-up lint rule ratchets the count
down.
- **Dependencies**: adds `openapi-typescript-helpers` (the version
openapi-fetch already uses) for the helper types. Only openapi-fetch's
unexported `InitParam` is copied locally.

### Type-level notes

- The grant is checked in the parameter type rather than in `Init`'s
constraint. That way `Init` is still inferred from the argument, which
keeps both the return type and the error message tied to the caller's
code.
- The grant is replaced rather than intersected. Intersecting a wrong
grant with the expected one can reduce the init type to `never`, which
then accepts the call.
- `NoInfer<Path>` stops a grant's endpoint from becoming an inference
candidate for the path.

## Review instructions

### Tests

- `data/guarded-fetch.test.ts`:
- Type equality with the raw client: required params and body,
template-literal paths, `parseAs`, `signal`/`headers`, optional-init
endpoints, and `unguarded`. An openapi-fetch upgrade that breaks the
local `InitParam` copy fails typecheck.
  - Negative type cases:
    - a missing or `undefined` grant;
    - a missing init on an annotated endpoint;
    - a grant for a different path or method;
    - any grant or `unguarded` on an unannotated endpoint;
    - a forged grant;
    - params and body still checked;
    - an unknown path.
- `guardMethod` and `assertGrant` runtime behavior, including
branch-parent refs and org slugs.
- Variant and owned-param tests are deferred to the api-keys (`reveal`)
and pg-meta (`read`/`write`) PRs, since no refinements exist yet.

1. Run `pnpm typecheck` and confirm Studio passes. Then remove a `grant:
unguarded.migrating` and check that the error is short and names the
expected grant.
2. Run `pnpm test:studio`.
3. Skim the codemod commit: it only adds `grant: unguarded.migrating`
and the `unguarded` import.

## Checklist

Check all before review:

- [ ] 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-10-26 07:58:22 -04:00
Joshen Lim 60b51d74d5 Audit existing unit tests + Remove redundant ones (#52215)
## Context

_TLDR: Changes here speeds up unit tests on CI from ~14 minutes to ~3
minutes_ 😂
_TLDR 2: The file changes are solely only test files +
`studio-unit-tests.yml`_

We've currently got a lot of unit tests in the repository which while
great for coverage, hasn't been ideally written. There's a lot of
redundancy + overly specific tests that break easily, and our current
unit test takes about 15 minutes to run in the GHA per PR. Hence am
doing a audit clean up of all existing unit tests in the studio repo.

## Changes involved
- `.test.ts` files now run in `node`, `.test.tsx` in `jsdom`
- jsdom costs about 1s of setup per file. A `.ts` test that needs the
DOM opts in with `// @vitest-environment jsdom` (46 files do).
- Removed redundant and over-specific tests
- Duplicates are merged into `test.each`. Tests that only covered
libraries, existed for coverage, or asserted class names and snapshots
are deleted. 19 files are merged into a sibling or deleted.
- Fixed about 15 tests that couldn't fail 
- Examples: unawaited assertions, fixtures equal to the default, and a
`semverGte` test calling `semverLte`.
- Sped up the slowest files 
- Real sleeps are replaced with fake timers, `user.type` with paste, and
Radix option queries are scoped to the open listbox. For example,
`RestoringState` went from 18s to 0.3s and
`useTableEditorFiltersSort.navigation` from 20s to 3s.
- These ^ already shave down the unit tests time from 14 mins to 9 mins,
but am also sharding unit tests across 4 jobs to increase speed up
further which then shaves down time to 3 mins now
2026-10-23 18:51:27 +08:00
Joshen Limandcoderabbitai[bot] 2400e9537a Joshenlim/fe 4679 inconsistency with integrations that arent installed create (#52141)
## Context

Addresses some issues with the "One click integration" feature preview
for the following 3 integrations

### Database Webhooks
- The "Create a new hook" CTA can be clicked despite the integration not
being installed yet
- As such if you were to create a new webhook, you'll run into errors
- Am opting to follow the UX in wrappers where the dashboard will
install the integration for you if you're trying to create a new webhook
while the integration isn't installed yet
- So this allows users to go straight to creating webhooks without the
additional step of clicking "Install integration"
<img width="500" alt="image"
src="https://github.com/user-attachments/assets/7fb70937-94c2-4095-9eef-4fb71347d132"
/>
<img width="500" alt="image"
src="https://github.com/user-attachments/assets/7efcee65-34c0-438f-8fb5-3f0d855a0f34"
/>

### Cron and Queues
- The "Jobs" / "Queues" tab can be opened despite the integration not
being installed yet
- This results in a number of unnecessary API requests to fetch the data
for the corresponding grids, but they'd all error out since the database
extension isn't installed
- Opting to gate all the network calls via `enabled` if the integration
is not installed yet, and also render an empty state instead as such
(This aligns with the Stripe Sync Engine)
<img width="500" alt="image"
src="https://github.com/user-attachments/assets/e8203162-a249-4da0-9ef9-f47df194b20f"
/>

## To test
- [ ] For database webhooks, verify that you can create a webhook
without having to click "Install integration" prior
- [ ] For cron and queues, verify that there's no network requests to
fetch their data if the integration is not installed yet while you're on
the jobs / queues pages

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-10-23 16:16:33 +08:00
Alaister YoungandCursor Agent b410764409 test(studio): wait for pipeline step url before continuing (#52135)
<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
The "edits each section from Review" test clicks Continue as soon as the
step text shows. That text updates before the URL does. The step query
uses nuqs with `{ history: 'push', shallow: true }`, and
`NuqsTestingAdapter` resets its queue on every render. The previous push
then re-renders the adapter and drops the click that is still queued, so
the wizard snaps back and `Step 2 of 4` (or step 3) never stays. I
logged one run moving to Data, then the "Cannot update
PipelineCreationFlow while rendering NuqsTestingAdapter" warning, then a
render back on Connection.

This is flaky, not a broken wizard. The Next and TanStack adapters do
not reset that queue on render, and the browser Back/Forward tests in
this file still pass. The racy clicks have been in the test since
`306cd88a2b`. Master CI first failed it on `b7638a7244` (step subtitles
and Docs landed in the same test), passed once on `655a6624cf`, and
failed again on `bbf0e730f2`.

**Changed:**
- `PipelineCreationFlow.test.tsx` — wait for each step's URL write
before the next Continue or edit, including the empty query when
Destination is cleared by `clearOnDefault`

## To test

- `pnpm --filter studio exec vitest --run
components/interfaces/Database/Replication/CreatePipeline/PipelineCreationFlow.test.tsx`
— I ran this file 12 times (36 tests each, all passed)
- `pnpm --filter studio test` — 802 files, 9447 passed, 1 expected fail
- `pnpm --filter studio typecheck`, Prettier on the test file, and `pnpm
--filter studio run lint:ratchet`

<!-- CURSOR_AGENT_PR_BODY_END -->

<div><a
href="https://cursor.com/agents/bc-df2f864a-51a2-57e3-9a2a-c69a8a135b2c?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a
href="https://cursor.com/background-agent?bcId=bc-df2f864a-51a2-57e3-9a2a-c69a8a135b2c&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
alt="Open in Cursor" width="131" height="28"
src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-22 08:27:10 +00:00
655a6624cf test(studio): restore data value check across destination changes (#51931)
<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
Follow-up from #51924. Splitting the old flow test dropped the check
that Data step values survive a destination switch, and this adds that
check back to the connection test.

Open #51900 already conflicts with master on this file. This branch is
based on master and only edits the connection test.

**Changed:**

-
`apps/studio/components/interfaces/Database/Replication/CreatePipeline/PipelineCreationFlow.test.tsx`
– set Batch wait time to 750 before leaving Data and assert it is still
750 after switching BigQuery → Snowflake → BigQuery, so a destination
change that resets Data values fails the test

## To test

- [x] `pnpm --filter studio exec vitest run
components/interfaces/Database/Replication/CreatePipeline` – all pass
(13 files, 89 tests)
- [x] Resetting `maxFillMs` to `10000` on a destination change fails the
new assertion (`toHaveValue(750)`, received `10000`)
- [x] `pnpm --filter studio run lint:ratchet` – pass
- [x] `pnpm --filter studio typecheck` – pass
- [x] Prettier check on the changed file – pass
- [x] `pnpm knip --workspace apps/studio` – pass
- [x] `test (1)` on this PR – green

<!-- CURSOR_AGENT_PR_BODY_END -->

<div><a
href="https://cursor.com/agents/bc-59590606-1fef-5afa-afbf-cd3a89249c56?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a
href="https://cursor.com/background-agent?bcId=bc-59590606-1fef-5afa-afbf-cd3a89249c56&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
alt="Open in Cursor" width="131" height="28"
src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-10-22 13:37:29 +08:00
Danny White 9be9e570c3 feat(studio): adopt shared inline code defaults (#51981)
## Problem

Studio relies on repeated classes to style inline code. Bare `<code>`
elements can miss those styles.

## Solution

Import the shared styles from #51980 and remove the repeated classes.
Keep Markdown renderer behaviour and existing size overrides. Use
`data-code-style="plain"` for webhook headers, CLI and upgrade commands,
configuration comparisons and connected-resource labels that have their
own layout.

## Review instructions

Dashboard review: this PR changes Studio only.

1. Open [Database >
Extensions](https://studio-staging-git-dnywh-depr-707-code-studio-supabase.vercel.app/dashboard/project/_/database/extensions).
Search for `pg_trgm` or another disabled extension and turn on its
toggle to open the Enable dialog. Check the Extension and Schema values
and the help text under “Install in a different schema”. The SQL block
should keep its highlighting and copy control. Close without installing.
2. Open [Edge Functions >
Secrets](https://studio-staging-git-dnywh-depr-707-code-studio-supabase.vercel.app/dashboard/project/_/functions/secrets).
Scroll to “Default secrets” and check `SUPABASE_URL` and
`SUPABASE_DB_URL`: both should use the bordered inline-code style. Hover
a name to see “Click to copy”, then click it and confirm the name is
copied. No custom secret or deployed function is needed.
3. Compare light and dark themes at narrow and desktop widths.

| Before | After |
| --- | --- |
| <img width="812" height="1066" alt="CleanShot 2026-10-19 at 15 35
10@2x"
src="https://github.com/user-attachments/assets/e4a21310-1fac-4143-9ee6-d2452ab4f314"
/> | <img width="812" height="1068" alt="CleanShot 2026-10-20 at 15 39
20@2x"
src="https://github.com/user-attachments/assets/d2c91ef6-7836-4c71-8f15-d0c0df8e969d"
/> |
2026-10-22 00:48:56 +00:00