Commit Graph
135 Commits
Author SHA1 Message Date
Danny WhiteandJoshen Lim be27ad8cf5 feat(studio): show apps and confirm token access changes (#53917)
> [!WARNING]
> This PR relies on #53705 being merged first.

## Problem

Project admins need to see authorised apps before changing token access.
[DEPR-734](https://linear.app/supabase/issue/DEPR-734)

## Solution

- Show Apps below Members only when authorised apps exist; hide the
section while loading or empty, and retain verification errors.
- Show access levels and links to each app’s access sheet.
- Include members and authorised apps in toggle confirmations; wait for
complete counts and offer retry on errors.

| After |
| --- |
| <img width="725" height="560" alt="CleanShot 2026-12-02 at 14 44 13"
src="https://github.com/user-attachments/assets/6f033b2f-a8b4-4a64-824f-ef0cc270ff6c"
/> |
| No authorised apps (no empty state) |
| <img width="728" height="773" alt="CleanShot 2026-12-02 at 14 11 31"
src="https://github.com/user-attachments/assets/76b31461-abca-4f9a-b76d-bb664093dd67"
/> |
| Loading error |
| <img width="727" height="749" alt="CleanShot 2026-12-02 at 14 38 34"
src="https://github.com/user-attachments/assets/0722002c-a5cf-4877-b00b-15f9e4a6524c"
/> |
| 1× authorised app |
| <img width="418" height="222" alt="CleanShot 2026-12-02 at 14 39 27"
src="https://github.com/user-attachments/assets/db5cc89a-2099-4a6f-969c-b4e2c38ac972"
/> |
| Disabling token access whilst 1× app is relying on it |
| <img width="424" height="387" alt="CleanShot 2026-12-02 at 14 39 58"
src="https://github.com/user-attachments/assets/e15c1227-8190-42f4-876b-5f55a321848b"
/> |
| Re-enabling token access which will immediately restore access for N
members and apps |


## Review instructions

1. Open the [staging
preview](https://studio-staging-git-dnywh-depr-734-temporary-acc-b81819-supabase.vercel.app/dashboard),
select a project you administer, and open **Database → Settings**.
Enable database token access in **Feature previews**, plus `jitDbAccess`
and `enableScopedOAuthManage` in the dev toolbar’s **Flags** tab if
needed.
2. Open DevTools → **Console**, paste the setup below and run it.
Navigate to another Studio page (possibly outside of Database) and back
to **Database → Settings**, without reloading. Check **Test Partner
App** appears under Apps with **Read and write** access.
3. Turn token access off. Check the confirmation includes the app, then
choose **Cancel**.
4. Run `tokenAccessReview.state = 'disabled'` in Console, then navigate
away and back. Turn token access on, expand **Who will regain access?**,
check the app is listed, then choose **Cancel**.
5. Run `tokenAccessReview.state = 'enabled'; tokenAccessReview.fail =
true`, then navigate away and back. Check the Apps error disables the
toggle. Run `tokenAccessReview.fail = false` and choose **Retry apps**
to recover.
6. Run `tokenAccessReview.apps = false`, then navigate outside Database
and back. Check Apps is hidden once loaded. Reload to remove the setup.

The setup mocks GET responses only, requires no app authorisation, and
does not change saved access. Use **Cancel** in both confirmations. Do
not reload between steps; reloading removes the setup. Network’s
Response tab does not show these browser-generated responses.

<details>
<summary>Console setup</summary>

```js
(() => {
  if (window.tokenAccessReview) throw new Error('Review setup is already active. Reload to reset it.')
  const projectRef = location.pathname.match(/\/project\/([^/]+)/)?.[1]
  if (!projectRef) throw new Error('Open a project’s Database Settings first.')
  const appId = '75e64165-b74e-432f-bb70-80d6ae432f06'
  const grantId = 'review-org-grant'
  const scopes = ['database_token_access:write']
  const originalFetch = window.fetch
  const review = window.tokenAccessReview = { state: 'enabled', apps: true, fail: false }
  const approvals = /\/platform\/organizations\/[^/]+\/oauth\/approvals$/
  const grants = new RegExp(`/platform/organizations/[^/]+/oauth/approvals/${appId}/grants$`)
  const page = (data) => Response.json({ data, links: { next: null, prev: null } })
  window.fetch = function (input, init) {
    const url = new URL(input instanceof Request ? input.url : input, location.href)
    const method = init?.method ?? (input instanceof Request ? input.method : 'GET')
    if (method.toUpperCase() === 'GET') {
      if (url.pathname.endsWith(`/v1/projects/${projectRef}/jit-access`)) {
        return Promise.resolve(Response.json({ state: review.state, appliedSuccessfully: true }))
      }
      if (approvals.test(url.pathname)) {
        return Promise.resolve(page(review.apps ? [{
          id: appId, type: 'oauth_app', attributes: {
            app: { name: 'Test Partner App', icon: null, created_by: null },
            last_approved_at: '', target: 'organization',
            org_grant: { grant_id: grantId, approved_scopes: scopes, approved_at: '' },
          },
        }] : []))
      }
      if (grants.test(url.pathname)) {
        if (review.fail) return Promise.resolve(Response.json({ message: 'Review: apps unavailable' }, { status: 500 }))
        return Promise.resolve(page([{
          id: grantId, type: 'oauth_grant', attributes: {
            kind: 'organization_bound', user: null, approved_at: '', approved_scopes: scopes,
            projects: [{ ref: projectRef, name: 'Review project' }],
          },
        }]))
      }
    }
    return originalFetch.call(this, input, init)
  }
})()
```

</details>

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-12-02 19:55:19 +07:00
Drew McLellan d4ef834d4d feat(studio): track usage on the org projects list (FE-5025) (#54417)
## Problem

We don't have visibility into how people use the org projects list
(`/org/[slug]`) or the organizations list (`/organizations`): whether
they search, filter, sort or switch views, and which project card
actions they use. Resolves FE-5025.

## Solution

Adds four events, defined in `packages/common/telemetry-constants.ts`
with org-level groups (no project group):

- `org_projects_filter_applied` with `filterType: 'search' | 'status' |
'sort'`. Search sends only the result count, status sends the saved
statuses (`active`/`paused`), and sort sends the sort value.
- `org_projects_view_mode_updated` with `viewMode`.
- `org_project_card_action_clicked` with `action: 'copy_id' |
'settings'` and `viewMode`, from the grid card menu and the table row
menu and inline ref button.
- `org_list_search_submitted` with `orgCount`.

Notes for review:

- Every event fires from its handler, not an effect, so restoring
filters from local storage doesn't fire anything.
- Search events use the same 500ms debounce as the query, skip empty
input, and never include the search text. The project search count is
read from the list query's cache entry via `fetchInfiniteQuery` on the
same key, which reuses the in-flight request.
- Status, sort and view events don't fire when the value didn't change.
- `HomePageActions` and `ProjectList` also render on the `/project`
picker, so `@page` lists both routes.
- I didn't add the `data-attr` attributes from the ticket: autocapture
is off, so they would send nothing, and the telemetry standards ask for
explicit `track()` calls.

## How to test

- `pnpm --filter studio exec vitest run
components/interfaces/HomePageActions.test.tsx` covers view mode, status
filter, search and clearing before the debounce settles.
- In the browser network tab on `/org/[slug]`, each action sends one
`telemetry/event` request with the properties above. Checking the events
in PostHog staging is still to do.
2026-12-02 11:47:18 +00:00
Alaister YoungandAlaister Young 0c97b9789b [FE-3107] chore(studio): remove remaining Next.js references (#54426)
Removes the remaining Next.js dependencies, compatibility shims, test
mocks, ESLint/TypeScript presets, and webpack/Next workarounds from
Studio following the TanStack Start migration.

Addresses FE-3107.

**Removed:**

- `next` and `next-router-mock` from `apps/studio/package.json` (and
updated `pnpm-lock.yaml`)
- Orphaned `apps/studio/compat/next/script.tsx` shim, `script.test.tsx`,
`compat/**` knip entry, and `nextCompat()` / `ssr.noExternal` `/^next/`
plumbing from `apps/studio/vite.config.ts`
- `apps/studio/tests/lib/route-mock.ts` and all `next-router-mock`
setup/imports across `tests/vitestSetup.ts`,
`tests/lib/custom-render.tsx`, and 12 test files
- `apps/studio/tests/pages/` directory (moved the 3 remaining tests to
`components/interfaces/Organization/Organization.utils.test.ts` and
`apps/studio/tests/routes/`)
- Unused `'use client'` directives across 23 Studio files
- Next.js/webpack workarounds: `graphiqlViteWorkers()` in
`vite.config.ts`, webpack `import.meta.glob` `try/catch` fallback in
`ConnectStepsSection.tsx`, shell `NODE_ENV=test` override in
`vite.config.ts` / root `package.json` / `studio-e2e-test.yml`, Next
`getPathMatch` and `_next` passthrough in `redirects.shared.*`,
`window.next?.router` check in `monaco-graphiql-coexistence.spec.ts`,
and unused `ANALYZE` env var in `apps/studio/turbo.jsonc`
- Next-only Sentry/chunk-load filters (`NEXT_NOT_FOUND`,
`NEXT_REDIRECT`, Next `/org/[slug]/` regex, `/app:\/\//`, dead
`includeThirdPartyErrorFilter` plumbing, webpack chunk error regex) and
stale Next/Pages Router comments, docs, and `#__next` CSS selector

**Changed:**

- `apps/studio/eslint.config.cjs`: switched from
`eslint-config-supabase/next` to the new `eslint-config-supabase/react`
preset (dropping `@next/next/no-img-element: off`, keeping `.next` /
`next-env.d.ts` ignored for local checkouts with stale pre-migration
build artifacts)
- `apps/studio/tsconfig.json`: extends `tsconfig/base.json` directly
instead of `tsconfig/nextjs.json` (identical resolved compiler options)
- `apps/studio/.github/eslint-rule-baselines.json`: pruned 33 stale
`pages/...` and `types/next.ts` entries without changing any rule
thresholds
- `apps/studio/tests/lib/custom-render.tsx`: backed
`TestFrameworkProvider` with TanStack Router instead of
`next-router-mock`
-
`apps/studio/components/interfaces/Integrations/GraphQL/GraphiQLTab.tsx`:
imports `graphiql/setup-workers/vite` directly
- `apps/studio/styles/globals.css`: replaced `@source
'../pages/**/*.{js,ts,jsx,tsx}'` with `@source
'../routes/**/*.{js,ts,jsx,tsx}'`
- `apps/studio/turbo.jsonc`: declared `"NEXT_PUBLIC_*"` in
`tasks.build.env` now that Turborepo infers `nitro` instead of `nextjs`
-
`apps/studio/components/interfaces/Organization/Organization.utils.ts`:
narrowed `buildOrgUrl`'s `slug` parameter to `string[] | undefined`

**Added:**

- `packages/eslint-config-supabase/shared.js` and
`packages/eslint-config-supabase/react.js` (plus `presets.test.ts`),
decoupling non-Next React apps from `eslint-config-next` with verified
zero non-`@next/*` rule drift while keeping
`eslint-config-supabase/next` unchanged for the Next.js apps

## To test

- Run `pnpm --filter eslint-config-supabase run test` and confirm preset
parity tests pass
- Run `pnpm --filter studio run lint`, `pnpm --filter studio run
lint:ratchet`, `pnpm --filter studio run typecheck`, `pnpm knip
--workspace apps/studio`, and `pnpm --filter studio run test`
- Run `pnpm --filter studio run build` and verify the production build,
prerendered routes, chunk-cycle check, and GraphiQL web workers succeed
- Smoke-test Studio locally (`pnpm dev:studio`): verify GraphiQL loads
cleanly, ConnectSheet framework steps render, and Tailwind styles on
route pages are intact

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-02 17:01:50 +08:00
Danny White 59cddd41a9 feat(studio): group database access settings (#54350)
> [!WARNING]
> This PR relies on #54282 being merged first.

## Problem

Database password and token access appear as separate sections in
Database Settings, although both control connections to Postgres.

## Solution

Group the existing controls under **Database access**, with **Password
access** first and the switch beside **Token access**. Nest **Members**
inside the Token access card and label its action **Add member**.
Preserve the existing feature gates, permissions, toggle behaviour,
dialogs and section anchors. Use shared card headings for Members,
centre the token switch beside its description, and darken the Members
table header. Update the matching token-access and password-reset docs
instructions.

```text
Database access
├── Password access
└── Token access                 [switch]
    └── Members                  [Add member]
```

| After |
| --- |
| <img width="735" height="818" alt="CleanShot 2026-12-01 at 15 56 50"
src="https://github.com/user-attachments/assets/f1207a2f-80d5-480a-9529-e110b960f427"
/> |
| _App [token] access coming separately in
https://github.com/supabase/supabase/pull/53917._ |

## Review instructions

1. Open a project's **Database → Settings** page. Check that **Database
access** contains **Password access** first, with the existing **Reset
database password** button.
2. With the database token access preview enabled, check that **Token
access** has its switch on the same row and **Members** appears inside
the same card when enabled. Check that **Add member** opens the existing
access rule sheet.
3. Check the existing enable confirmation and password reset dialog.
Projects requiring SSL enforcement or a Postgres upgrade should keep
their existing notices and actions.
2026-12-02 00:03:43 +00:00
Alaister YoungandAlaister Young ccd691423b [FE-5114] (part 6) – refactor(studio): migrate platform storage routes (#54033)
## Problem

Studio's `routes/api/platform/storage/**` routes still run legacy Next
Pages Router handlers through `compat/next/api.ts`, and
`buckets/$id/objects/download.ts` has no remaining callers. Part 6 of 7
for
[FE-5114](https://linear.app/supabase/issue/FE-5114/rewrite-api-routes-as-native-tanstack-start-handlers-and-remove-the)
migrates the 14 active storage routes to native TanStack Start handlers
and removes the unused download route.

## Solution

**Changed:**

- Migrated 14 `buckets/**` and `vector-buckets/**` routes to
`createApiHandlers` and `parseJsonBody`
- Replaced the `parseAsInt`/`parseAsString`/`parseAsStringEnum` helpers
in `buckets/index.ts` with a zod query schema that drops invalid values,
keeping the conditional spreads so unset keys aren't sent to storage-js
- Forwarded upstream `StorageError` status codes across all storage and
vector-bucket routes via `storageErrorResponse` /
`getStorageErrorStatus` (falling back to the route's default 400/500
when no valid HTTP status is present)
- Guarded missing/invalid `SUPABASE_PUBLIC_URL` with a `500` error
response in `objects/public-url`, `objects/sign`, and
`objects/sign-multi`
- Typed the `vector-buckets/$id/indexes` POST body from storage-js's
`createIndex` options
- Corrected stale `Allow` headers on `vector-buckets/$id` (`GET,
DELETE`) and `vector-buckets/$id/indexes/$indexName` (`DELETE`) via
`createApiHandlers`

**Added:**

- `lib/api/self-hosted/storage.ts` with `getStorageErrorStatus`,
`storageErrorResponse`, `getStoragePublicOrigin`,
`missingStoragePublicUrlResponse`, and `remapStoragePublicUrl`
- Unit tests for `buckets/index` query parsing,
`buckets/$id/objects/sign-multi` (`SUPABASE_PUBLIC_URL` guard, origin
remapping, and upstream error status), and `vector-buckets` POST
(exercising the real storage client through MSW)

**Removed:**

- Removed unused
`routes/api/platform/storage/$ref/buckets/$id/objects/download.ts` and
regenerated `routeTree.gen.ts`

**Behavior changes vs master:**

- `buckets` GET drops malformed `limit`/`offset`/sort values instead of
`parseInt`-truncating them (e.g. `offset=1.5` is ignored rather than
sent as `1`)
- `vector-buckets` POST validates the body with zod and returns `400`
when `bucketName` is missing or not a string
- Storage routes forward the upstream HTTP status code from
`StorageApiError` instead of hardcoding `400`/`500`
- `objects/public-url`, `objects/sign`, and `objects/sign-multi` return
a `500` JSON error when `SUPABASE_PUBLIC_URL` is unset or invalid
instead of throwing an uncaught `TypeError`
- Unused `buckets/$id/objects/download` route has been removed

## Review instructions

1. Run `pnpm --filter studio exec vitest run
tests/routes/api/platform/storage/`.
2. On self-hosted Studio, create/list/empty/delete a storage bucket,
upload/download/move/sign/delete an object, and check vector bucket
operations.

## Checklist

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

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-01 22:55:25 +08:00
Alaister YoungandAlaister Young 37414c5a61 [FE-5114] (part 5) – refactor(studio): migrate platform project routes (#54032)
## Problem

Studio's `routes/api/platform/projects/**` routes still run legacy Next
Pages Router handlers through `compat/next/api.ts`, and
`projects/$ref/config/index.ts` and `projects/$ref/billing/addons.ts`
are unused in self-hosted mode. Part 5 of 7 for
[FE-5114](https://linear.app/supabase/issue/FE-5114/rewrite-api-routes-as-native-tanstack-start-handlers-and-remove-the)
migrates the 19 active project routes to native TanStack Start handlers
and removes the 2 unused routes.

## Solution

**Changed:**

- Migrated 19 project routes — analytics (`endpoints/$name`,
`log-drains`, `log-drains/$uuid`), API proxies (`api/graphql`,
`api/rest`), content snippets & folders (`content/**`), and
config/settings/databases/lints/keys/monitoring routes — to
`createApiHandlers`
- Preserved FE-5124 fixes on `log-drains/$uuid` (empty-body `204` on
`DELETE`, `try`/`catch` + `!response.ok` → `500`); its `Allow: GET, PUT,
DELETE` and the previously stale `Allow` on `log-drains` (`GET, POST`)
now come from `createApiHandlers`
- Forwarded upstream error status and JSON body (falling back to `500` /
`{ error: { message } }`) in `api/graphql` and `api/rest`
- Parsed the JSON body once in `content/index.ts` `PUT` so the `not
found` create fallback does not attempt to re-read the request stream
- `content/index.ts` and `content/folders/index.ts` read query params
through `getSearchParamsRecord`, so repeated `ids` (and repeated GET
params on `content/index`) return `400` as they did with Next's query
parsing
- `run-lints` forwards headers via
`constructHeaders(Object.fromEntries(request.headers))`

**Added:**

- `getSearchParamsRecord` in `lib/api/apiHelpers.ts`: collects URL
search params into a record, mapping repeated keys to arrays so zod
string schemas reject them
- `folderQueryParamsSchema` and `listFolderContents(request, folderId?)`
in `lib/api/snippets.utils.ts`, shared by `content/folders/index` and
`content/folders/$id`
- `getLogflareConfig()` in `lib/api/self-hosted/logflare.ts`: reads the
Logflare env vars at call time (same `500` naming the missing vars) and
builds the request URLs and headers for `analytics/log-drains` and
`analytics/log-drains/$uuid`
- Unit tests for `getSearchParamsRecord`, `analytics/endpoints/$name`,
`analytics/log-drains/$uuid`, `content/index`, `content/folders`, and
`api/rest` (`HEAD` and upstream error forwarding)

**Removed:**

- Removed 2 unused routes
(`routes/api/platform/projects/$ref/config/index.ts` and
`routes/api/platform/projects/$ref/billing/addons.ts`) and regenerated
`routeTree.gen.ts`

**Behavior changes vs master:**

- `analytics/endpoints/$name` GET strips `name` and `ref` from the
forwarded query (parity with master, where they arrived as route params
in `req.query`)
- `content/folders` and `content/folders/$id` GET validate query params
and return `400` for invalid or repeated values
- `api/graphql` and `api/rest` forward upstream non-OK status codes and
error bodies instead of always returning `500`
- Unused `projects/$ref/config/index` and `projects/$ref/billing/addons`
routes have been removed

## Review instructions

1. Run `pnpm --filter studio exec vitest run lib/api/apiHelpers.test.ts
tests/routes/api/platform/projects/`.
2. On self-hosted Studio, create/update/delete a log drain,
create/save/delete a SQL snippet and folder, and verify REST/GraphQL API
docs load.

## Checklist

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

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-01 22:38:58 +08:00
Charis 975689dcfc feat(studio): send pageview and global crash metrics on staging and preview (#54331)
## Problem

We need simple counts of every pageview and every global crash for SLO
monitoring. These counts need to go to observability ingest, not to
Sentry, etc., so they can be part of our Grafana dashboards pipeline.

## Solution

- `usePageviewMetric` sends one `pageview` event on first load
(hydration) and on every client-side navigation that changes the
pathname. Changes to only the query string or hash do not count.
- A `global_crash` event is sent once when the global crash screen is
shown. That covers both the root `ErrorBoundary` and the root route
`errorComponent`. Chunk-load errors that are recovered by an automatic
reload are not counted, which matches what is reported to Sentry.
- Both are gated by a new `IS_STAGING_OR_PREVIEW` constant. It is false
on production, local development, self-hosted and Nimbus.
- The request is a fire-and-forget `fetch` with `keepalive: true` and
`credentials: 'omit'`. It uses a `text/plain` body, so there is no CORS
preflight. Errors are swallowed.
- The endpoint origin is added to `connect-src` for all platform
environments, because production will need it later. No other CSP
directive changes.

## Review instructions

1. Open the Studio preview deployment for this PR with the network panel
open.
2. Load any page. See one `POST /api/metrics` request that returns 204.
3. Navigate to another page. See one more request.
4. Change only a query parameter (for example a table filter). See no
new request.

## 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-12-01 15:35:05 +01:00
Alaister YoungandAlaister Young be32a941cd [FE-5114] (part 4) – refactor(studio): migrate platform auth and misc routes (#54031)
## Problem

Studio's `routes/api/platform/auth/**` and platform misc/stub routes
still run legacy Next Pages Router handlers through
`compat/next/api.ts`, and 4 legacy database/props routes have no callers
left. Part 4 of 7 for
[FE-5114](https://linear.app/supabase/issue/FE-5114/rewrite-api-routes-as-native-tanstack-start-handlers-and-remove-the)
migrates the 16 active routes to native TanStack Start handlers and
removes the 4 unused ones.

## Solution

**Changed:**

- Migrated `platform/auth/$ref/{invite,magiclink,otp,recover}` to
one-line `createAuthSenderHandlers` routes, and `users/index`,
`users/$id/index`, and `users/$id/factors` to `createApiHandlers`,
preserving the FE-5124 fixes (`Promise.all` MFA factor deletion, `code
?? 500` on auth senders, `Allow: PATCH, DELETE` on `users/$id`, now
derived by `createApiHandlers`)
- Migrated 9 platform misc/stub routes (`deployment-mode`,
`integrations/{$slug,github/*}`,
`organizations/{index,$slug/billing/subscription}`, `profile/index`, and
`telemetry/event`)
- Moved the `FETCH_TYPE_BYPASS_EXCEPTIONS` entries for the four sender
routes in `eslint.config.cjs` to `lib/api/self-hosted/auth-senders.ts`

**Added:**

- `createAuthSenderHandlers(endpoint, field)` in
`lib/api/self-hosted/auth-senders.ts`: shared POST handler for the
self-hosted GoTrue `invite`, `magiclink`, `otp`, and `recover` endpoints
(forwards only `email` or `phone`, uses `constructHeaders` with the
service role key, and passes upstream errors through with `code ?? 500`)
- Regression tests for `auth/$ref/users/$id/factors`,
`auth/$ref/users/$id`, and all four auth sender routes

**Removed:**

- Removed 4 unused routes (`platform/database/$ref/pooling`,
`platform/props/org/$slug`, `platform/props/project/$ref/index`, and
`platform/props/project/$ref/api`) and regenerated `routeTree.gen.ts`

## Review instructions

1. Run `pnpm --filter studio exec vitest run
tests/routes/api/platform/auth/`.
2. On self-hosted Studio, invite/ban/delete a user, remove MFA factors
for a user, and confirm `GET /api/platform/auth/default/users/<id>`
returns `405` with `Allow: PATCH, DELETE`.

## Checklist

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

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-01 22:30:19 +08:00
anthony lioandDion Zeneli 5fb027c28f feat(studio): launch week + builder day sign-ins redirect (#54317)
## Problem

- dashboard sign-in sends a user back with `router.push(returnTo)`, and
the path stays under `/dashboard`
- lw16 card app at `/launch-week` (#54315) signs in with
`returnTo=/launch-week?claim=1` and the user lands on a 404 at
`/dashboard/launch-week?claim=1`
- `validateReturnTo` rejects full urls, and the Builder Day site at
`/builderday` has the same problem

## Solution

- adds `/dashboard/launch-week` and `/dashboard/builderday` pages that
load the same path outside the dashboard + keep the query and the hash
- adds a test that a query with another address does not change the
destination

## Preview links

| Site | Live | Preview | Search for |
| ---- | ---- | ------- | ---------- |
| Studio |
[/dashboard/launch-week?claim=1](https://supabase.com/dashboard/launch-week?claim=1)
|
[/dashboard/launch-week?claim=1](https://studio-git-antlio-studio-launch-week-return-supabase.vercel.app/dashboard/launch-week?claim=1)
| the address bar |
| Studio |
[/dashboard/builderday](https://supabase.com/dashboard/builderday) |
[/dashboard/builderday](https://studio-git-antlio-studio-launch-week-return-supabase.vercel.app/dashboard/builderday)
| the address bar |

## Review instructions

1. open the preview
[/dashboard/launch-week?claim=1](https://studio-git-antlio-studio-launch-week-return-supabase.vercel.app/dashboard/launch-week?claim=1)
and make sure that the address changes to `/launch-week?claim=1` outside
`/dashboard`
2. open the preview
[/dashboard/builderday](https://studio-git-antlio-studio-launch-week-return-supabase.vercel.app/dashboard/builderday)
and make sure that the address changes to `/builderday`
3. sign out and open the preview
[/dashboard/sign-in?returnTo=%2Flaunch-week%3Fclaim%3D1](https://studio-git-antlio-studio-launch-week-return-supabase.vercel.app/dashboard/sign-in?returnTo=%2Flaunch-week%3Fclaim%3D1)
4. sign in and make sure that the browser ends at `/launch-week?claim=1`
5. sign out, open the preview
[/dashboard/sign-in?returnTo=%2Forganizations](https://studio-git-antlio-studio-launch-week-return-supabase.vercel.app/dashboard/sign-in?returnTo=%2Forganizations)
and make sure that the sign-in still returns to
`/dashboard/organizations`

## 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)

---------

Co-authored-by: Dion Zeneli <101271736+Dionysos288@users.noreply.github.com>
2026-12-01 16:29:39 +02:00
Alaister YoungandAlaister Young 20a5212c42 [FE-5114] (part 3) – refactor(studio): migrate pg-meta and v1 routes (#54030)
## Problem

Studio's `routes/api/platform/pg-meta/**` and `routes/api/v1/**` routes
still run legacy Next Pages Router handlers through
`compat/next/api.ts`, and 10 legacy `pg-meta` GET proxy routes are no
longer called anywhere in the repo. Part 3 of 7 for
[FE-5114](https://linear.app/supabase/issue/FE-5114/rewrite-api-routes-as-native-tanstack-start-handlers-and-remove-the)
migrates the 9 active routes to native TanStack Start handlers and
deletes the 10 unused proxy routes.

## Solution

**Changed:**

- Migrated `platform/pg-meta/$ref/query/index.ts` and all 8 `v1` routes
(`api-keys`, `api-keys/$id`, `config/auth/signing-keys/{index,legacy}`,
`database/migrations`, `functions/{index,$slug/index}`,
`types/typescript`) to `createApiHandlers`; `query` and
`database/migrations` share `pgMetaErrorResponse`
- Enabled `{ withAuth: true }` on `api-keys`, `api-keys/$id`, and
`config/auth/signing-keys/{index,legacy}` for consistency with the other
`v1` routes
- Updated `api-keys` route tests to use `callRoute`

**Added:**

- `pgMetaErrorResponse(error)` in `lib/api/self-hosted/pg-meta.ts`
(keeps a `PgMetaDatabaseError`'s status and `{ message, formattedError
}` payload expected by `data/error-classification.ts`, otherwise `500`)
- Unit test for `pg-meta/$ref/query`
(`tests/routes/api/platform/pg-meta/$ref/query/index.test.ts`)

**Removed:**

- Removed all 10 unused `pg-meta` GET proxy routes (`column-privileges`,
`extensions`, `foreign-tables`, `materialized-views`, `policies`,
`publications`, `tables`, `triggers`, `types`, `views`), removed their
`FETCH_TYPE_BYPASS_EXCEPTIONS` entries from `eslint.config.cjs`, and
regenerated `routeTree.gen.ts`
- Removed `getPgMetaRedirectUrl` (`lib/api/apiHelpers.ts`) and
`parseRevealQuery` (`lib/api/self-hosted/api-keys.ts`)

**Behavior changes vs master:**

- Routes forward only `cookie` and `x-connection-encrypted` to pg-meta
via `constructHeaders(Object.fromEntries(request.headers))`, matching
what master's adapter forwarded
- `database/migrations` GET now forwards headers to
`listMigrationVersions` (master passed them as the wrong argument)
- `v1/projects/$ref/api-keys*` and `config/auth/signing-keys*` now pass
`{ withAuth: true }` (no-op in self-hosted mode; consistent with the
other `v1` routes)
- The 10 unused `pg-meta` GET proxy routes have been removed
(`pg-meta/$ref/query` and `v1/projects/$ref/types/typescript` remain)

## Review instructions

1. Run `pnpm --filter studio exec vitest run tests/routes/api/v1/
tests/routes/api/platform/pg-meta/`.
2. On self-hosted Studio, load tables/views/policies/extensions, run a
query in the SQL Editor, check API keys, and generate TypeScript types.

## Checklist

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

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-01 21:44:59 +08:00
Alaister YoungandAlaister Young c5fca0a0d7 [FE-5114] (part 2) – refactor(studio): migrate AI API routes (#54029)
## Problem

Studio's AI API routes under `routes/api/ai/**` still run legacy Next
Pages Router handlers through `compat/next/api.ts`. Part 2 of 7 for
[FE-5114](https://linear.app/supabase/issue/FE-5114/rewrite-api-routes-as-native-tanstack-start-handlers-and-remove-the)
migrates the active AI routes to native TanStack Start (`Request` →
`Response`) handlers and drops 3 unused AI endpoints.

## Solution

**Changed:**

- Migrated 8 active AI routes (`ai/code/complete`,
`ai/feedback/{classify,rate}`, and
`ai/sql/{check-api-key,cron-v2,filter-v1,generate-v4,title-v2}`) to
`createApiHandlers` and `parseJsonBody`
- Replaced Node `pipeUIMessageStreamToResponse` in
`ai/sql/generate-v4.ts` with native `createUIMessageStreamResponse`,
preserving the `x-braintrust-span-id` header
- Replaced `req.on`/`res.on` in `ai/sql/generate-v4.ts` with
`AbortSignal.any([request.signal, done.signal])` and a `TransformStream`
whose `flush`/`cancel` tear down the MCP connection opened in `getTools`
on stream completion, cancellation, or setup error
- Removed the custom malformed-JSON handling in `ai/code/complete.ts` in
favor of the wrapper's `400`
- Updated `lib/api/generate-v4.test.ts` to assert against the real
native SSE `Response` stream instead of mocking
`pipeUIMessageStreamToResponse`, with a shared `mockOpenStream()`
helper, a stream-cancellation abort test, and a Braintrust tracing test
asserting `x-braintrust-span-id` matches the exported root span
- Updated `lib/ai/README.md` to drop references to removed endpoints

**Removed:**

- Removed 3 unused AI routes (`routes/api/ai/onboarding/design.ts`,
`routes/api/ai/sql/parse-client-code.ts`, and
`routes/api/ai/sql/policy.ts`), dropped them from
`lib/hosted-api-allowlist.ts`, and regenerated `routeTree.gen.ts`
- Removed the now-unused `withoutApprovalTools` helper from
`lib/ai/tool-filter.ts` and its test from `lib/ai/tool-filter.test.ts`

**Behavior changes vs master:**

- `ai/code/complete` returns the wrapper's `400` JSON `{ error: {
message: 'Invalid JSON' } }` for malformed bodies
- Unused `ai/onboarding/design`, `ai/sql/parse-client-code`, and
`ai/sql/policy` endpoints have been removed

## Review instructions

1. Run `pnpm --filter studio exec vitest run lib/api/generate-v4.test.ts
lib/api/rate.test.ts lib/ai/tool-filter.test.ts`.
2. Send a prompt in the AI Assistant panel, verify streaming output, and
cancel mid-stream.
3. Trigger SQL title, cron, and filter generation as well as AI code
completion.

## Checklist

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

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-01 21:36:38 +08:00
Alaister YoungandAlaister Young b6c391a058 [FE-5114] (part 1) – refactor(studio): add native API helpers & routes (#54028)
## Problem

Studio's `routes/api/**` server routes still run legacy Next Pages
Router handlers through the `toWebHandler` shim in `compat/next/api.ts`.
Part 1 of 7 for
[FE-5114](https://linear.app/supabase/issue/FE-5114/rewrite-api-routes-as-native-tanstack-start-handlers-and-remove-the)
adds native TanStack Start (`Request` → `Response`) helpers and migrates
the top-level utility routes so we can remove the adapter at the end of
the stack.

## Solution

**Added:**

- `createApiHandlers` in `lib/api/apiWrapper.ts`: wraps native TanStack
Start route handlers with optional platform JWT auth, JSON `400` (`{
error: { message: 'Invalid JSON' } }`) on `InvalidJsonError`, Sentry
capture + generic `500` on unexpected throws, and an `ANY` handler that
returns `405` with an `Allow` header derived from the registered
methods. Exports `ApiHandler` / `ApiHandlerContext` (`params` is
`Record<string, string>`)
- `authenticateRequest` in `lib/api/apiAuthenticate.ts` (Web `Request`
counterpart of `apiAuthenticate`, same error messages)
- `InvalidJsonError` and `parseJsonBody` in `lib/api/apiHelpers.ts`
- `callRoute(route, request, params)` test helper in
`tests/lib/server-route.ts`
- Unit tests for `createApiHandlers` (exercising real
`authenticateRequest` through MSW in
`lib/api/createApiHandlers.test.ts`), `authenticateRequest`,
`parseJsonBody`, `/api/generate-attachment-url`, and
`/api/integrations/stripe-sync`

**Changed:**

- Updated `getRouteHandler` in `tests/lib/server-route.ts` to mirror
TanStack Start's `HEAD` → `GET` → `ANY` dispatch order
- Migrated 11 top-level API routes (`check-cname`,
`cli-release-version`, `content/graphql`, `edge-functions/test`,
`enabled-features-overrides`, `generate-attachment-url`,
`get-deployment-commit`, `get-ip-address`, `get-s3-keys`,
`get-utc-time`, `integrations/stripe-sync`) to native handlers
- Added `withAuth: true` to `check-cname`, `content/graphql`, and
`integrations/stripe-sync`, and updated `check-cname-mutation.ts` and
`data/graphql/execute.ts` to attach `constructHeaders()`
- Reused `withAuth` `claims` in `generate-attachment-url` to avoid a
duplicate GoTrue lookup in platform mode
- Converted `tests/routes/api/get-deployment-commit.test.ts` to
`callRoute`

**Removed:**

- Removed 2 unused routes (`routes/api/connect/index.ts` and
`routes/api/parse-query.ts`), dropped `/parse-query` from
`lib/hosted-api-allowlist.ts`, removed Nitro's `traceDeps:
['libpg-query*']` in `vite.config.ts` (no server runtime route imports
`libpg-query` anymore), and regenerated `routeTree.gen.ts`

**Behavior changes vs master:**

- Methods a route doesn't register now get a JSON `405` with an `Allow`
header (previously they fell through to the SSR app). `HEAD` requests
that TanStack Start dispatches to a `GET` handler also get `405`,
matching master's method switches
- `InvalidJsonError` returns JSON `{ error: { message: 'Invalid JSON' }
}` (`400`) instead of plain text
- `check-cname`, `content/graphql`, and `integrations/stripe-sync` now
verify the platform JWT via `withAuth: true`
- Unexpected throws return a generic `500` with `{ error: { message:
'Internal Server Error' } }`
- Unused `/api/connect` and `/api/parse-query` routes have been removed

## Review instructions

1. Run `pnpm --filter studio exec vitest run
lib/api/apiAuthenticate.test.ts lib/api/apiHelpers.test.ts
lib/api/apiWrappers.test.ts lib/api/createApiHandlers.test.ts
tests/routes/api/ scripts/__tests__/server-source-maps.test.ts`.
2. Smoke-test `/api/get-deployment-commit`, `/api/check-cname`,
`/api/content/graphql`, `/api/generate-attachment-url`, and
`/api/edge-functions/test` in Studio and confirm unsupported HTTP
methods return `405` with an `Allow` header.

## Checklist

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

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-01 20:53:57 +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
Francesco Sansalvadore a098c3be32 chore(studio): improve versioning onboarding comms (#54059)
## Problem

We're going to release versioning in Public Alpha instead of Private, so
we need to be more clear and loud about the new feature being
introduced.

## Solution

This PR makes a few changes mostly around communications and messaging:
- Update `Private Alpha` badges to `Public Alpha`
- Add admonitions in the feature preview modal
- Prompt confirmation before enabling versioning on a bucket
- Dedicated announcement banner in Storage layout
- shown only to users with `storage.capabilities.object_versioning`
enabled
- Popover card when hovering over the Public Alpha badge

See
[update](https://linear.app/supabase/project/storage-object-versioning-and-lifecycle-policies-b5e5809a718e/activity#project-update-e9a50e15)
for more context.

## Review instructions

Functionality changes are minor so mostly check the above mentioned
messaging and ui changes.
2026-11-30 18:18:41 +01:00
K-Dog (Kevin) 27c4433a3e feat: revised project add-ons page (#54186)
The current add-ons page only lists a subset of available add-ons, which
often causes confusion with things like Advanced MFA Auth (customers
cant find where to configure it).

The revised add-on page covers all potentially configured project
add-ons including replicas and advanced disk. This should help the
customer locate configured add-ons and at the same time discover
potentially interesting add-ons. This can be enhanced further in the
future with "smart" suggestions based on usage.
2026-11-30 21:54:44 +08:00
Maksym Ionutsa 028d329417 Fix/studio observability timezone labels (#54198)
## Problem

Observability date labels ignore the timezone set in the profile. They
always show the browser timezone or UTC. The header range label (for
example "Nov 27, 12:40pm → 12:50pm") uses bare `dayjs()`. The Data API
charts (Total Requests, Error Counts, Response Speed, Network Traffic)
pass `displayDateInUtc`, so the first and last timestamps under each
chart always show UTC.

## Solution

- Format the header range label with `useFormatDateTime()` on the
Database, Auth, Storage, Realtime, PostgREST and Edge Functions
observability pages.
- Remove `displayDateInUtc` from the four Data API charts in
`ApiRenderers.tsx`.
- Use `text-xs` for the date labels in `BarChart`, so they match
`ComposedChart` and `StackedBarChart`. This is a separate commit.

## Review instructions

1. Open Observability, Database, and set a timezone in your profile that
differs from your browser.
2. Check that the range label next to the date picker and the tooltip
show the same timezone.
3. Open Observability, Data API. Check that the labels under each chart
follow the profile timezone and use the same font size as the Database
charts.

<details>
<summary>Screenshots</summary>

<img width="1124" height="844" alt="CleanShot 2026-11-27 at 13 37 14@2x"
src="https://github.com/user-attachments/assets/e3d29c77-317a-4489-aa4c-1fbf4783cb57"
/>


font in Data API
<img width="318" height="72" alt="CleanShot 2026-11-27 at 13 40 19@2x"
src="https://github.com/user-attachments/assets/06e4d12f-245f-4d4e-9dc9-b7f2f7879e52"
/>
font in Database
<img width="342" height="66" alt="CleanShot 2026-11-27 at 13 41 08@2x"
src="https://github.com/user-attachments/assets/de200eb2-4351-471d-a220-bacea142b0d9"
/>


</details>


## Checklist

- [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 (not applicable, no docs
changes)
2026-11-27 16:39:47 +01:00
Maksym Ionutsa cddcdf5b41 Feat/studio observability chart grids (#54202)
## Problem

Observability chart grids use a window breakpoint (`md:`), so with a
side panel open the charts stay in two narrow columns. Several pages
also stack every chart in one long column.

## Solution

- Auth and Realtime: switch the chart grid from `md:` to a container
query (`@4xl:`), so it follows the width of the content area.
- Edge Functions, Storage and the shared API report (Data API, API
Gateway sections): use the same two-column grid at `@4xl:`.
- Database: two columns at `@6xl:`, because some charts are hard to read
at half of 56rem.

<details>
<summary>Before</summary>

<img width="3262" height="2168" alt="CleanShot 2026-11-27 at 15 05
58@2x"
src="https://github.com/user-attachments/assets/8b7eb4da-f8c8-477d-861a-ecc5717867fb"
/>
<img width="3206" height="2544" alt="CleanShot 2026-11-27 at 15 06
23@2x"
src="https://github.com/user-attachments/assets/de09dcdd-574a-433e-8bcd-a84e66352bfe"
/>
<img width="1146" height="1766" alt="CleanShot 2026-11-27 at 15 07
03@2x"
src="https://github.com/user-attachments/assets/93a3a5e4-90cf-4876-847a-fa9cb96e88d5"
/>

</details>

<details>
<summary>After</summary>

<img width="3146" height="2134" alt="CleanShot 2026-11-27 at 15 08
13@2x"
src="https://github.com/user-attachments/assets/ef46c6b1-f9de-4256-b7ad-6d20e1d3e030"
/>
<img width="3168" height="2212" alt="CleanShot 2026-11-27 at 15 08
26@2x"
src="https://github.com/user-attachments/assets/b83b0d8a-77f6-4ae4-a908-b29b55450e21"
/>
<img width="1084" height="2138" alt="CleanShot 2026-11-27 at 15 09
58@2x"
src="https://github.com/user-attachments/assets/9d3b6e48-f2ef-42d2-91cf-e076136c8bcb"
/>

</details>

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
2026-11-27 16:24:33 +01:00
Maksym Ionutsa d1c9d05335 fix(studio): correct PITR scheduled backups copy (#50861)
with PITR enabled scheduled backups copy states incorrect information
that might (and already have) confuse the customers

The backups are still taken and the WAL is archived. 

There's just no point exposing regular backups when the customer is
paying for a pretty expensive add-on, might as well point them at it
2026-11-27 16:07:04 +01:00
Joshen Lim 434c00cb14 Joshenlim/fe 5196 move off scaffold components for remaining (#53911)
## Context

Final clean up of deprecated Scaffold components, just touches
- Account audit logs
- Project home page
- Database -> Column privileges
- Storage -> Analytics bucket details
- Storage -> Vector bucket details
- Settings -> Infrastructure -> Disk management
- Settings -> Infrastructure -> Read replica details
- Integrations -> Wrappers overview (Only for non supported integration
UI)
- Edge functions -> Empty state
- Auth -> Performance

Also replaces usage of `ScaffoldDivider` with just the `Separator`
component
And also adjusts the page container sizes of database pages from large
to default - these only have visual differences on viewport widths
larger than a laptop

Testing just needs a quick sweep of all these surfaces to make sure
nothing looks weird - will do so on my end too once the builds go
through!

For @supabase/security's review - review requirement was triggered as
`Documents.tsx` was updated in the organization settings page. But it
was just to change the Divider component 🙏
2026-11-26 21:28:17 +07:00
Alaister YoungandAlaister Young 01d4d4d430 [FE-5113] refactor(studio): replace next/dynamic shim with React.lazy (#54022)
## Problem

Now that Studio runs on TanStack Start, `apps/studio` still routes 13
`next/dynamic` imports through a local compatibility shim
(`apps/studio/compat/next/dynamic.tsx` aliased in
`apps/studio/vite.config.ts`). Keeping the shim adds unnecessary
indirection during the Next.js teardown (FE-5113).

## Solution

Replaces every `next/dynamic` import in `apps/studio` with `React.lazy`
+ `Suspense` (or static imports where already inside a lazy chunk), then
deletes `compat/next/dynamic.tsx` and its Vite alias.

None of the previously `ssr: false` call sites need `ClientOnly`: Studio
runs TanStack Start with `spa: { enabled: true }` and only prerenders
the signed-out auth routes (`/sign-in`, `/sign-up`, `/sign-in-sso`,
`/forgot-password`), `__root.tsx` gates `<Outlet />` behind
`canRenderPage`, and `StudioCommandMenu` is already gated by
`useCommandMenuInitiated()` (which starts `false` per render).

**Removed:**

- `apps/studio/compat/next/dynamic.tsx` and the `'next/dynamic'` entry
in `nextShims` in `apps/studio/vite.config.ts`

**Changed:**

- Migrated all `next/dynamic` call sites to `React.lazy` + `Suspense`:
- `StudioCommandMenu`, `ContextSearchResults`,
`Marketplace/OverviewTab`, `QueryDetail` (`SqlMonacoBlock`),
`SQLEditorEditorPanel` (`MonacoEditor`, `DiffEditor`),
`SupportAssistantSuccessCard`, `LayoutSidebarProvider`,
`MessageMarkdown` (`Streamdown`), and
`SupportAssistantSuccessCardContent` (`Streamdown`)
- `ConnectStepsSection`: hoisted the lazy component cache out of
`useMemo` to module scope (also clears its
`react/no-unstable-nested-components` warning)
- `Integrations.constants.tsx` and `useAvailableIntegrations.tsx`:
hoisted all lazy integration tab/page definitions (including
`GraphiQLTab`) to module scope so `navigate()` returns stable component
references, added `Suspense` boundaries with `<Loading />` at both
render points (`MarketplaceDetail` and the integration child route), and
keyed integration tab/creation sheet instances (`integration.id` in
`MarketplaceDetail` and `wrapperMeta.name` in `WrappersTab`) so state
cannot leak when switching between wrappers or OAuth integrations;
preserves `umdAmdShortCircuit`, `ssrStubGraphiql`, and
`graphiqlViteWorkers` in `vite.config.ts`
- Replaced `dynamic()` calls for `AiIconAnimation`, `Badge`, and 4
`icons` in `CreateCommands.tsx` with static imports (already inside the
lazy `CommandMenu` chunk)
- Removed the stale `next/dynamic` mention from the
`lib/chunk-load-error.ts` doc comment (`React.lazy` chunk failures
continue bubbling to the root `ErrorBoundary` reload handler)

**Added:**

- Reference-stability tests for `INTEGRATIONS.navigate` in
`Integrations.constants.test.ts` (running in Vitest's Node environment)

## Review instructions

1. Open the SQL Editor and Query Performance query detail panel, and
confirm the Monaco editor and diff view load cleanly.
2. Open the GraphQL integration's GraphiQL tab, and confirm the loading
skeleton displays while the chunk loads and GraphiQL mounts with working
autocomplete/workers.
3. Open a Wrapper integration's Wrappers tab, open the create sheet,
then navigate via history to a different wrapper's create sheet and
confirm the form resets to the new wrapper's defaults.
4. Open the Command Menu (`Cmd+K`), navigate to context search (for
example, Search Database Tables) and Create commands, and confirm icons,
badges, and search results load without flicker.
5. Open the Connect sheet and switch between frameworks/steps,
confirming step content loads with the skeleton fallback.
6. Toggle sidebars (AI Assistant, Inline SQL Editor, Advisor, Help) and
verify markdown streaming in AI Assistant.
7. Confirm CI passes `pnpm --filter studio run build` (including
prerendering and chunk-cycle checks), typecheck, lint ratchet, and
Studio tests.

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-26 08:46:55 +00: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
Alaister YoungandAlaister Young d6e4089b1a feat(common): add FrameworkProvider and remove next imports (#53905)
Introduces a lightweight `FrameworkProvider` React context in
`packages/common` (`Link`, `Image`, `pathname`, `asPath`, `isReady`,
`params`, `push`), wires it up in the consuming apps, and removes the
`next` dependency from `packages/common`.

**Added:**

- `FrameworkProvider`, `useFramework`, `FrameworkLink`, and
`FrameworkImage` in `packages/common/framework.tsx`, with plain HTML
defaults (`DefaultFrameworkLink` / `DefaultFrameworkImage`).
`useFramework().push` always exists and falls back to
`window.location.assign`
- App-level framework providers wiring `next/link`, `next/image`, and
router state in `www` (App + Pages routers), `docs`, `design-system`,
`learn`, and `ui-library`, and native TanStack Router bindings in
`studio` (`StudioFrameworkProvider`)
- `StudioFrameworkProvider` reuses the common defaults (its image only
applies the basePath) and reports `isReady` once the first route load
commits, so the first page view carries the final route after any
redirect
- Unit tests for `StudioFrameworkProvider` (`useParams`,
`FrameworkLink`, `FrameworkImage`, query/hash-only navigation,
`isReady`) and for `PageTelemetry` route-change sends and the
`TelemetryTagManager` consent gate

**Changed:**

- `common/hooks/useParams.ts`: read params from `useFramework()` instead
of `next/compat/router`
- `common/telemetry.tsx`: replace `next/script` in `TelemetryTagManager`
with `useEffect` script injection, and read route state from
`useFramework()` in `PageTelemetry`
- `common/MetaFavicons/app-router.ts`: drop type-only `Metadata` import
from `next`
- Moved `MetaFaviconsPagesRouter` to
`apps/www/components/MetaFaviconsPagesRouter.tsx` (its sole consumer)
- Studio: `toRoutePattern` and `applyBasePath` now live once in
`lib/internal-url.ts`, shared by the provider and the `compat/next`
shims
- `PageTelemetry` throws outside production when no `FrameworkProvider`
is mounted, since it would otherwise send only the landing pageview.
`useFramework()` itself still falls back to the defaults
- `ui-library`: renamed its code-sample framework context to
`FrameworkPreferenceProvider` / `useFrameworkPreference` so
`FrameworkProvider` only means the `common` one

**Removed:**

- `learn`'s unused copy of that context (`useCourse` had no callers)

- `next` from `packages/common/package.json` peerDependencies

App Router adapters set `asPath` to the pathname only, same as the
`usePathname`-based telemetry on master (reading search params at the
root would opt static pages out of static rendering).

## To test

- Run `packages/common` tests and typecheck, and `apps/studio`
`StudioFrameworkProvider` / `route-render` / `telemetry` tests
- Navigate between routes in Studio, Docs, and WWW and confirm page
telemetry fires once per navigation (and does not duplicate on hash-only
changes)
- Load Studio at `/` (which redirects) and confirm the first page event
has the final route
- Verify URL params (`useParams`) continue resolving route and search
params in Studio

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-25 20:13:22 +08:00
Jordi Enric 15fcb7dc49 fix(studio): refresh observability charts for the selected range FE-5122 (#53931)
## Problem

A custom date range in a Storage report URL could show one window in the
header and another in the charts. Refresh also left Database Size and
several Auth charts showing cached results.

## Fix

Use the selected window for all Storage report requests, run the
Database Size query on refresh, and refresh Auth Usage, Errors and
Latency alongside the shared API charts.

## How to test

- Open Storage with a custom start and end time in the URL. Inspect the
chart requests on load and after Refresh. Both sets should use those
exact timestamps.
- Refresh the Database report and check that the large objects query
runs again.
- Open Auth with a fixed range and press Shift+R. The Usage, Errors,
Latency and API charts should request fresh data for the same range.

Fixes [FE-5122](https://linear.app/supabase/issue/FE-5122).
2026-11-24 15:31:11 +01:00
Joshen Lim 85194a05d8 Joshenlim/fe 5190 move off scaffold components in (#53849)
## Context

Housekeeping to deprecate more deprecated UI components, this one's
focusing on the `Scaffold` components.
The main visual differences are just the width within PageSections since
the new components where the right content takes up a bit more width
than the left content. (Ref org billing + usage)

Starting the refactor with the organization pages:
- Billing
- Team
- Usage
- Settings -> SSO
- Settings -> Security
- Settings -> Audit Logs
- Settings -> Documents
2026-11-24 10:39:33 +07:00
Joshen Lim 764c676951 Joshenlim/fe 5170 deprecate pagelayout component (#53836)
## Context

Final piece to the housekeeping for removing the deprecated `PageLayout`
component.
Moves off the organization and project home routes to the new layout
components and deletes the `PageLayout` component within studio
2026-11-23 16:21:23 +07:00
Joshen Lim 98876d2e90 Joshenlim/fe 5167 refactor pagelayout for branching pages (#53717)
## Context

Just some housekeeping to move off old layout components - this PR
targets the branching pages, specifically

Branching
Branching -> Merge requests
Branching -> Merge

Just need to make sure that these pages still render fine
2026-11-23 12:43:20 +07:00
Joshen Lim f5ac51d4c6 Joshenlim/fe 5168 refactor pagelayout for advisor database (#53718)
## Context

Just some housekeeping to move off old layout components - this PR
targets the database + advisor pages, specifically

Advisor -> Settings (Rules), this is behind a feature preview
Database -> Tables
Database -> Publications

Just need to make sure that these pages still render fine
2026-11-23 12:43:10 +07:00
Joshen Lim 4a73166675 Add support for downloading edge functions when file size exceeds max cap (#53709)
## Context

Just creating a separate PR cause I messed up the [previous
one](https://github.com/supabase/supabase/pull/53453) with a bad merge 🫠
Also changed the implementation to no longer use `@deno/eszip`.

For edge functions, functions which exceed 5MB cannot be fetched and
displayed in the dashboard editor (API will return a 507). The CTA we
give to users is to download the function via the CLI, but this PR
explores allowing users to download their edge functions via the browser
still, by calling `/v1/functions/slug/body` without the
`multi-part/data` header. This returns the function in a raw eszip
stream which we're then parsing using a custom reader

We'll do this via the "Download as ZIP" CTA here - but this way of
downloading only kicks in if the GET Edge Function body endpoint returns
a 507. Otherwise it'll just be status quo where we bundle the files that
were already fetched to render in the browser into a ZIP file.
<img width="343" height="186" alt="image"
src="https://github.com/user-attachments/assets/4ffc9fee-7e6d-46a6-bdbe-294610abc802"
/>

Also updated the warning for 507s:
- To use a normal admonition instead of `AlertError` since its
technically not an issue
- To avoid rendering the API error message in this case specifically as
the API message contains "Use multipart instead" which isn't relevant to
the dashboard from a user's POV
<img width="500" alt="image"
src="https://github.com/user-attachments/assets/8242a875-f142-419d-81f0-0dbc30807f87"
/>

## To test

- [ ] Upload an edge function of size larger than 5MB to a staging
project via the CLI
- [ ] Verify that there's an Admonition for the large function instead
of an error
- [ ] Verify that you can still download the edge function via the
Download button (Which triggers a POST /body request without multipart)
2026-11-23 10:59:57 +07: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 3cfd882683 Joshenlim/fe 5169 refactor pagelayout for storage functions (#53719)
## Context

Just some housekeeping to move off old layout components - this PR
targets the Storage + Edge Function + Wildcard pages, specifically:

Project wildcard route (/project/_)
Organization wildcard route (/org/_)
Storage -> Analytics Buckets
Storage -> Vector Buckets
Edge Function -> New function

Just need to make sure that these pages still render fine
2026-11-23 10:59:11 +07:00
Joshen Lim cea3232469 Joshenlim/fe 5166 refactor pagelayout for auth api pages (#53716)
## Context

Just some housekeeping to move off old layout components - this PR
targets Auth and Settings pages, specifically
- Auth -> Emails
- Auth -> Providers
- Settings -> API Keys
- Settings -> JWT Keys
- Settings -> Log Drains
- Settings -> Read Replica/id

The only visual change is just that navigation tabs take the full width
of the viewport now

Just need to make sure that these pages still render fine
2026-11-23 10:58:53 +07:00
Gildas Garcia e6986b5296 feat(studio): OAuth apps consent screen should allow to select another org (#53744)
## Problem

The OAuth apps consent screen does not allow users to change the
selected org. If the calling app didn't provide the org slug, we select
the first available org from the users orgs.

## Solution

Add an organization selector:
<img width="436" height="570" alt="image"
src="https://github.com/user-attachments/assets/a5579f2c-ff54-4d02-9d4a-ac75ed245719"
/>

## Review instructions

Requirements:
- have multiple orgs
- have a published app that needs projects selection and at least one
authorization already granted
- have the oauth example app ready

Tests:
- authorizing the app again on the same org it was before should
preselect the projects
- you should be able to select another org and if you do, that should
clear the selected projects and you should see only this org projects in
the options
- reselecting the initially granted org should reselect the projects it
had in the existing grant
2026-11-20 18:16:48 +01:00
Gildas Garcia ea5cd851ed fix(studio): OAuth apps consent screen should always select the org provided in URL (#53727)
## Problem

The organization provided by its slug in the URL isn't selected unless a
project ref was also provided.

## Solution

Always select the org provided in URL

## Review instructions

- Publish an oauth app
- Use the oauth example and provide an org slug in the form
- Check the consent screen selected this org

Do check this with multiple different orgs to ensure you weren't lucky
with the org array sorting
2026-11-20 12:04:48 +01:00
supabase-vercel-tedd[bot]andAlaister Young 6fda122771 chore(studio): show the TanStack devtools only with ?tanstack-devtools (#53708)
## What kind of change does this PR introduce?

Chore (local developer experience)

## What is the current behavior?

In local development, Studio renders the TanStack devtools floating
trigger in the bottom-right corner on every page. It overlaps Studio's
own dev toolbar trigger and gets in the way.

## What is the new behavior?

The TanStack devtools (Router and Query panels) only show when Studio is
loaded with `?tanstack-devtools` in the URL, using the library's
built-in `requireUrlFlag` setting. Once loaded, they stay available
while navigating within Studio, and a reload without the flag hides them
again.

Use a URL that doesn't redirect, for example
`/org/<slug>?tanstack-devtools` or `/project/<ref>?tanstack-devtools`.
The library reads the flag when the devtools mount, so a redirect that
drops the query string can hide them.

**If you've opened the devtools before**, the library has saved its
settings to localStorage, and those override the `config` prop. Turn on
**Require URL Flag** in the devtools Settings tab once, or delete the
`tanstack_devtools_settings` localStorage key.

## How to verify

- With no `tanstack_devtools_settings` in localStorage, run `pnpm
dev:studio` and open `/org/<slug>`: no TanStack trigger appears.
- Open `/org/<slug>?tanstack-devtools`: the trigger appears and opens
the panel. Click through to another page: it's still there.
- Reload without the flag: the trigger is gone.
- Production and test builds are unchanged.

---------

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-20 07:40:47 +00: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
Gildas Garcia 4442d91d77 feat(studio): Wire org and users authorized apps list to backend (#53674)
## Description

Part of the work for OAuth apps with the scoped permissions. This PR
wires the org and users authorized apps lists to backend.
2026-11-19 21:40:12 +01:00
Gildas Garcia 10488ed799 feat(studio): Wire the OAuth apps consent screen to the backend (#53511)
## Description

Part of the work for OAuth apps with the scoped permissions. This PR
wires consent screen to the backend.

## Review instructions

### Setup
Copy the `examples/oauth-app-authorization-flow/.env.example` to
`examples/oauth-app-authorization-flow/.env`

> [!IMPORTANT]  
> In next steps, make sure to copy the apps ids/secrets in the
`examples/oauth-app-authorization-flow/.env` with a way to differentiate
them:
> ```
> # org bound all projects
> SUPABASE_CLIENT_ID=xxx
> SUPABASE_CLIENT_SECRET=xxx
> ```

As an organization admin, go to the _Organization settings/OAuth Apps_
and create the following _Publishable apps_:

- `test_org_bound`: 
  - _Use the permissions of the person who connects_ unchecked
  - _Ask for specific projects_ unchecked
  - Select only _Database Read_ for the permissions
 
- `test_org_bound_projects`: 
  - _Use the permissions of the person who connects_ unchecked
  - _Ask for specific projects_ checked
  - Select only _Database Read_ for the permissions

- `test_member_bound`: 
  - _Use the permissions of the person who connects_ checked
  - _Ask for specific projects_ unchecked
  - Select only _Database Read/Write_ for the permissions
 
- `test_member_bound_projects`: 
  - _Use the permissions of the person who connects_ checked
  - _Ask for specific projects_ checked
  - Select only _Database Read/Write_ for the permissions

Make sure you have 3 projects in the org. Add a team member that have
Administration rights on the first project, read-only access to the 2nd
and no access to the third.

Install the `examples/oauth-app-authorization-flow` dependencies and
start the app.
- `test_org_bound`: 
  - connected on studio as the org admin
    - click the `oauth-app-authorization-flow` button
- check that you don't have to select a project on the consent screen
- check that the permissions requested are correct and you can approve
the app
- update the published app to include the _Database Write_ permissions
- return to the `oauth-app-authorization-flow` index and click its
button again
- check that the consent screen shows the permissions difference and
approve it again
- connected as a simple team member, check that you have a message
indicating you can't approve this app
  
- `test_org_bound_projects`: 
  - connected on studio as the org admin
    - click the `oauth-app-authorization-flow` button
    - check that you have to select projects on the consent screen
- check that the permissions requested are correct and you can approve
the app
- update the published app to include the _Database Write_ permissions
- return to the `oauth-app-authorization-flow` index and click its
button again
- check that the consent screen shows the permissions difference and
approve it again
- connected as a simple team member, check that you have a message
indicating you can't approve this app

- `test_member_bound`: 
  - connected on studio as a member 
    - click the `oauth-app-authorization-flow` button
- check that you don't have to select a project on the consent screen
- check that the permissions requested are correct and you can approve
the app
    - update the published app to add another permission
- return to the `oauth-app-authorization-flow` index and click its
button again
- check that the consent screen shows the permissions difference and
approve it again
   
- `test_member_bound_projects`: 
  - connected on studio as the org admin
    - click the `oauth-app-authorization-flow` button
- check that you have to select projects on the consent screen (you
should see only the two you have access to) and select them all one by
one
    - check that the permissions requested are correct
- approve the app and check that you have an error related to the
project with read-only access
    - unselect it and approve the app
- update the published app to include the _Database Write_ permissions
- return to the `oauth-app-authorization-flow` index and click its
button again
- check that the consent screen shows the permissions difference and
approve it again
2026-11-19 17:47:03 +01:00
Riccardo Busetti 9437334289 feat(pipelines): Update docs and UI (#53665) 2026-11-19 11:27:04 +01:00
supabase-vercel-tedd[bot] 800a8ef0b8 fix(studio): return correct status codes from self-hosted API handlers (#53530)
## Problem

Several self-hosted Studio API route handlers report success after a
failure or send invalid responses:

- `DELETE /api/platform/auth/{ref}/users/{id}/factors` started the
factor deletions with `forEach(async ...)` and returned 200 without
waiting. A failed delete was never reported.
- `POST /api/platform/auth/{ref}/{invite,magiclink,otp,recover}` called
`res.status(code)` with the upstream error code. When the request failed
with no HTTP response (a network error or an abort), `code` is undefined
and the web response adapter fell back to 200.
- `PUT /api/platform/projects/{ref}/analytics/log-drains/{uuid}` wrote a
500 inside `.catch` and then continued to `res.status(200)`. It also
returned 200 when Logflare answered with a non-2xx status.
- `DELETE` on the same route had the same `.catch` problem and sent
`res.status(204).json(...)`. The web `Response` constructor rejects a
body on a 204, so every successful delete threw and became a 500.
- `GET /api/connect` pushed every file path twice.
- The 405 `Allow` headers were wrong: `['PATCH']` on `users/{id}` (which
also handles DELETE) and `['GET', 'POST']` on `log-drains/{uuid}` (which
handles GET, PUT, and DELETE).

## Solution

- Factors: await every `deleteFactor` call with `Promise.all`, and
return 400 with the first error message if any delete failed.
- Auth senders: `res.status(code ?? 500)`.
- Log drain PUT/DELETE: use `try`/`catch` around `fetch`, check
`response.ok`, and return 500 from the handler itself on failure. DELETE
returns `res.status(204).end()` with no body.
- Connect: remove the duplicate `push` (`.DS_Store` is already skipped
earlier in the loop).
- Fix both `Allow` headers.

## Review instructions

On a self-hosted Studio:

1. Delete a log drain. The request returns 204 with an empty body, the
drain disappears from the list, and no error toast shows.
2. Update a log drain with values that Logflare rejects. The request
returns 500 and Studio shows an error, not success.
3. `GET /api/connect` returns each file path once.
4. Remove MFA factors for a user who has factors. The request returns
200 only after the factors are deleted, and the user's factor list is
empty afterwards.
5. Send an unsupported method (e.g. `GET`) to
`/api/platform/auth/{ref}/users/{id}`. The 405 response has `Allow:
PATCH, DELETE`.

Checks run: `pnpm turbo run typecheck --filter='...[origin/master]'`,
`pnpm turbo run lint --filter='[origin/master]'`, and prettier on the
changed files. Lint ran out of memory twice at the default heap size,
then passed with `NODE_OPTIONS=--max-old-space-size=8192`. No unit tests
cover these route files.

## Checklist

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


[FE-5124](https://linear.app/supabase/issue/FE-5124/self-hosted-studio-api-handlers-hide-errors-and-return-wrong-status)

---------

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
2026-11-19 14:49:30 +09:00
Danny WhiteandJoshen Lim 8fcd5e7f65 feat(studio): add Warehouse report date controls (#53494)
## Problem

The Warehouse report only shows the last hour.

## Solution

Add date selection and refresh using the shared report controls. Respect
the organisation’s log retention limits and the metrics API’s 30-day
maximum.

| After |
| --- |
| <img width="1688" height="1050" alt="CleanShot 2026-11-18 at 11 35
24@2x"
src="https://github.com/user-attachments/assets/88267bf8-1054-480b-ac26-c0c2b58386bc"
/> |
| _The new controls._ |
| <img width="2420" height="1028" alt="CleanShot 2026-11-18 at 11 47
52@2x"
src="https://github.com/user-attachments/assets/383c06a0-5470-4748-b9a6-fe80647a1399"
/> |
| _The standard retention upgrade prompt follow tapping either of these
on a Pro plan._ |

## Review instructions

1. Open the [Studio staging
preview](https://studio-staging-git-dnywh-warehouse-metrics-range-supabase.vercel.app)
and select a staging project with Warehouse access.
2. Open **Observability > Warehouse**, or
`/project/<ref>/observability/warehouse`
([example](https://studio-staging-git-dnywh-warehouse-metrics-range-supabase.vercel.app/dashboard/project/yirnfrgkxmnqgexikhfc/observability/warehouse)).
Change Last 60 minutes to Last 24 hours and check that the chart or
no-data state reflects the selected period.
3. Refresh the report. Check that the selected period stays selected.
4. On a paid staging organisation, select a period beyond its log
retention (for example, Last 14 days with 7-day retention). Check that
the retention upgrade prompt appears and the current period stays
selected.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-11-19 15:08:18 +11:00
Danny WhiteandJoshen Lim 48c90094d9 feat(studio): show Warehouse query activity in Observability (#53495)
## Problem

Warehouse query activity is not available in Observability.

## Solution

Add a Warehouse report showing query rate over the last hour, with
loading, setup, no-data and request-error states. The report uses live
project metrics and appears in navigation for projects with Warehouse
access.

| After |
| --- |
| <img width="2548" height="1416" alt="CleanShot 2026-11-17 at 16 55
33@2x"
src="https://github.com/user-attachments/assets/4d6796e0-72f1-45d5-b6b7-2cd4a3577496"
/> |
| <img width="2552" height="1390" alt="CleanShot 2026-11-17 at 16 56
18@2x"
src="https://github.com/user-attachments/assets/d96efdfd-4ca9-42fe-ac30-9cb4667c95d7"
/> |
| <img width="2544" height="1388" alt="CleanShot 2026-11-17 at 16 32
11@2x"
src="https://github.com/user-attachments/assets/bc80af8d-0468-4229-98d0-ac2681823059"
/> |
| <img width="2560" height="1344" alt="CleanShot 2026-11-17 at 16 59
53@2x"
src="https://github.com/user-attachments/assets/1ed70348-c2fc-4673-85a7-530d9734886c"
/> |


Visitor | What they see
-- | --
Signed-in customer without Warehouse access | No Warehouse entry in
Observability
Customer with Warehouse access, not configured | “Warehouse is not set
up” empty state and setup button
Customer with Warehouse disabled | “Warehouse is disabled” empty state
and setup button
Customer with active Warehouse | Query rate chart, or the relevant
loading/empty/error state



## Review instructions

1. Open the [Studio staging
preview](https://studio-staging-git-dnywh-warehouse-metrics-client-supabase.vercel.app)
with a staging project that has Warehouse access.
2. Go to **Observability > Warehouse**, or
`/project/<ref>/observability/warehouse`
([example](https://studio-staging-git-dnywh-warehouse-metrics-client-supabase.vercel.app/dashboard/project/yirnfrgkxmnqgexikhfc/observability/warehouse)).
3. Check the query-rate chart after running Warehouse queries. A project
without measurements shows an explicit last-hour empty state.
4. Open the report on a project where Warehouse is not set up and check
the setup link.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-11-19 14:57:39 +11:00
supabase-vercel-tedd[bot] f1e7e6e339 fix(studio): redirect to sign-in when sign-out fails on the logout page (#53529)
## Problem

The `/logout` route awaited `signOut()` without handling errors, and the
returned promise was not handled either. If any step of sign-out threw
(for example clearing local storage or the assistant's IndexedDB
storage), the rejection went unhandled, the redirect to `/sign-in` never
ran, and the page stayed on the loading spinner indefinitely.

## Solution

Wrap the sign-out in `try / catch / finally` in
`apps/studio/routes/logout.tsx`:

- On success, show the existing "Successfully logged out" toast.
- On failure, log the error and show an error toast.
- In both cases, navigate to `/sign-in`.

The promise from the async `logout()` call is now explicitly discarded
with `void`, since it can no longer reject.

## Review instructions

1. Sign in to the preview, then open `/dashboard/logout`. You see
"Successfully logged out" and land on `/dashboard/sign-in`.
2. To check the failure path, make sign-out throw (for example, block
IndexedDB for the site, or temporarily throw in `useSignOut`), then open
`/dashboard/logout`. You see an error toast and still land on
`/dashboard/sign-in` instead of a spinner that never ends.

Checks run: `pnpm turbo run typecheck --filter='...[origin/master]'`,
`pnpm turbo run lint --filter='[origin/master]'`, and Prettier on the
changed file. There are no unit tests for this route. The Studio lint
type-check ran out of memory on the first run with the default Node heap
and passed with a larger heap.

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)


[FE-5123](https://linear.app/supabase/issue/FE-5123/logout-page-gets-stuck-if-sign-out-fails)

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
2026-11-18 16:00:40 +09:00
Gildas Garcia 45f4a115fa feat(studio): Refactor oauth app consent screen (#53357)
## Description

Part of the work for OAuth apps with the scoped permissions. This PR:
- refactors the authorize OAuth app consent screen to make it more
consistant with how we handle load requests
- remove the copy constants in favor of direct JSX like we do everywhere
- ensure the data hooks have optional parameters with runtime check to
be usable even when all needed data isn't loaded yet

> [!NOTE]  
> At this stage, the UI still only use mock data

## Review instructions

If all tests pass, we're good.
2026-11-17 16:58:49 +01:00
supabase-vercel-tedd[bot] cf556ebd2a fix(studio): wait for permissions before showing no-permission on auth logs (#53527)
## Problem

The auth logs route rendered the full-page `NoPermission` state whenever
`useAsyncCheckPermissionsV2` returned `can: false`. The hook returns
`can: false` until the permissions query succeeds. Users who can read
logs therefore saw a short "No permission" flash before the logs loaded.

## Solution

`apps/studio/routes/project/$ref/logs/auth-logs.tsx` now reads
`isSuccess` from `useAsyncCheckPermissionsV2`:

- While permissions load, the route renders nothing.
- Once they load, a user without `ANALYTICS_LOGS_READ` gets the
full-page `NoPermission` state.
- Otherwise the route renders `LogsPreviewer` as before.

This is the same `isSuccess && !can` gating that other routes use, such
as `database/extensions.tsx`. No other route under
`routes/project/$ref/logs/` uses this pattern.

## How to verify

- As a user with log access, open `/project/<ref>/logs/auth-logs`.
Hard-reload the page. The "No permission" state never appears, and the
auth logs view loads.
- As a user without analytics log read access, open
`/project/<ref>/logs/auth-logs`. The page shows the full-page "No
permission" state for authentication logs.

## Checks run

- `pnpm turbo run typecheck --filter='...[origin/master]'`: pass
- `pnpm turbo run lint --filter='[origin/master]'`: pass, no errors. It
ran out of memory once at the default heap and passed with
`NODE_OPTIONS=--max-old-space-size=8192`.
- Prettier check on the changed file: pass
- No unit tests cover this route.


[FE-5121](https://linear.app/supabase/issue/FE-5121/auth-logs-page-flashes-no-permission-while-permissions-load)

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
2026-11-17 09:18:05 -06:00
Drew McLellan 8cda1fc977 fix(studio): apply query performance calls and total time filters in SQL (#53459)
## Problem

On the Query Performance page, the calls filter only applied to rows
already loaded in the grid. The page loads 20 rows at a time, so a
filter like `calls >= 200` showed "No queries detected" whenever none of
the loaded rows matched, even if matching queries existed further down.
The filter bar writes a `callsFilter` URL param, but the page only
passed a separate `minCalls` param to the SQL, which nothing set.

The total time filter had a related gap: only `>` and `>=` reached the
SQL, and the other operators were ignored.

Fixes part of FE-5092. The lazy-load fix is in #53457.

## Solution

- `generateQueryPerformanceSql` takes `callsFilter` and
`totalTimeFilter` and builds the `WHERE` clause for all six comparison
operators. The operator comes from a fixed lookup and the value goes
through `literal()`. Filters with a non-finite value or an unknown
operator are dropped.
- The page passes both filters to the query, and the unused `minCalls`
param is removed.
- The grid no longer filters search, roles or calls in memory, since the
SQL already does.

- The query search is now a literal, case-insensitive substring match.
It was a regex (`~*`), so characters like `[` or `(` produced a SQL
error while typing. This matches what the grid's old in-memory search
did.

Behavior changes to be aware of:

- Regex search no longer works. Searching for `a.*b` now looks for that
exact text.
- Old `?minCalls=` links no longer have any effect. The UI never
produced them.

## Review instructions

1. Open Observability → Query Performance on a project with more than 20
statements.
2. Add a Calls filter of `>= 200` (or a value higher than anything in
the first 20 rows). Confirm matching queries appear.
3. Try the other operators on Calls and on Total time, including `!=`.
4. Search for `[` and `pg_sleep(` and confirm the grid shows matches (or
an empty state) instead of a SQL error.
5. Clear the filters and confirm the full list returns.

## 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-17 15:09:52 +00:00
supabase-vercel-tedd[bot] 943f02f413 fix(studio): make organization search case-insensitive (#53526)
## Problem

The search on the organizations page lowercased each organization's name
and slug but compared them with the raw input. Any search term with an
uppercase letter matched nothing, and leading or trailing spaces broke
matches too.

## Solution

Normalize the input once (`search.trim().toLowerCase()`) and use it for
the filter and for the empty-state check. A whitespace-only search now
counts as no filter, and the no-results message shows the trimmed term.

## Review instructions

1. Sign in to the preview with an account that has at least one
organization and open `/dashboard/organizations`.
2. Type an organization's name in a different case (for example all
uppercase). The organization still shows.
3. Type part of an organization's slug in uppercase. The organization
still shows.
4. Add spaces before and after a matching term. The organization still
shows.
5. Type only spaces. Every organization shows, and the no-results state
does not appear.
6. Type a term that matches no organization. The no-results state
appears.

Checks run: `pnpm turbo run typecheck --filter='...[origin/master]'`
(pass), `eslint` on the changed file (pass), Prettier check (pass).
`pnpm turbo run lint` ran out of memory twice in the
`studio#lint:type-checks` step.

## Checklist

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


[FE-5119](https://linear.app/supabase/issue/FE-5119/organization-search-on-the-organizations-page-is-case-sensitive)

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
2026-11-17 14:48:00 +00:00
supabase-vercel-tedd[bot] 6d2cf769a5 fix(studio): replace history entry in project billing usage redirect (#53525)
## Problem

`/project/[ref]/settings/billing/usage` only redirects: to
infrastructure settings for the `#cpu`, `#ram` and `#disk_io` hashes,
and to the org usage page otherwise. The redirect runs on the client
because it reads the URL hash. It used `navigate` with the default push
behaviour, so the redirect page stayed in history. Pressing Back landed
on the redirect page, which sent the user forward again, and the user
could not go back.

## Solution

Pass `replace: true` to both `navigate` calls in
`apps/studio/routes/project/$ref/settings/billing/usage.tsx`, so the
redirect replaces its own history entry.

## How to verify

1. From any project page, open
`/project/<ref>/settings/billing/usage#cpu`. You land on
`/project/<ref>/settings/infrastructure#cpu`. Pressing Back returns to
the project page you came from, not to the infrastructure page again.
2. From any project page, open `/project/<ref>/settings/billing/usage`
with no hash. You land on `/org/<slug>/usage?projectRef=<ref>`. Pressing
Back returns to the project page you came from.

## Checks

- `pnpm turbo run typecheck --filter='...[origin/master]'`: passed.
- `eslint` on the changed file: passed. Prettier `--check`: passed.
- `pnpm turbo run lint --filter='[origin/master]'` ran out of memory
twice in the sandbox (`studio#lint:type-checks`).


[FE-5120](https://linear.app/supabase/issue/FE-5120/project-billing-usage-redirect-breaks-the-back-button)

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
2026-11-17 08:43:39 -06:00
59df3513bd [FE-3106] (part 15) – docs(studio): retire the tanstack migration guardrails (#53224)
Retires the migration guardrails now that `pages/**` is gone (FE-3106).
Last part (15) of the stack.

**Depends on:** #53223

**Changed:**
- `apps/studio/AGENTS.md` – replaces the "TanStack Start migration"
rules (never delete a page, mirror page edits) with a short routing
section
- `apps/studio/README.md`, `routes/project/$ref/editor.tsx` – stale Next
references

**Removed:**
- `apps/studio/TANSTACK_MIGRATION.md`
- the `apps/studio/pages/**` `path_instructions` rule in
`.coderabbit.yaml`

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

## To test

- Docs-only; nothing to exercise beyond reading `apps/studio/AGENTS.md`

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2026-11-17 18:00:04 +09:00
Alaister YoungandAlaister Young bbb0af65cb [FE-3106] (part 14) – refactor(studio): drop the dual-runtime shims and aliases (#53223)
Drops the remaining Next-era shims and aliases that only existed for the
dual runtime (FE-3106). Part 14 of the stack.

**Depends on:** #53222

**Changed:**
- ~45 files – import Sentry from `@sentry/react` directly instead of the
aliased `@sentry/nextjs`
- `hooks/ui/usePreventNavigationOnUnsavedChanges.ts` – is now the
TanStack `useBlocker` implementation (previously swapped in by a Vite
alias)
- `components/interfaces/App/RouteValidationWrapper.tsx` – `next/router`
→ `useNavigate` + the leaf route's `fullPath` (`/project/$ref/sql/$id`)
for the exempt-route and last-visited checks
- `hooks/misc/withAuth.tsx` – no `getLayout` forwarding
- `TemplateEditor.test.tsx` – renders inside a router for the
unsaved-changes blocker

**Removed:**
- `compat/sentry-nextjs.ts` and its Vite alias, the
`usePreventNavigationOnUnsavedChanges` alias and Next hook,
`types/next.ts` (`NextPageWithLayout`), the `@sentry/nextjs` dependency

The `compat/next/*` shims for `link`, `router`, `head`, `image`,
`navigation`, `dynamic` and `script` stay: about 300 components outside
`routes/**` still import them.

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

## To test

- Trigger an error (e.g. a failing query) – it reaches Sentry as before
- Edit an email template or edge function and navigate away – the
unsaved-changes prompt appears
- Open an org you don't belong to – toast and redirect home; open a SQL
snippet, leave and come back – last snippet is restored

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-17 17:49:20 +09:00
Alaister YoungandAlaister Young cf223ae74a [FE-3106] (part 13) – chore(studio): remove next entry files and config (#53222)
Removes the Next-only entry files and config now that every page lives
in `routes/**` (FE-3106). `routes/__root.tsx` already mirrors
`pages/_app.tsx` (dayjs plugins, providers, telemetry, error boundary,
favicons). Part 13 of the stack.

**Depends on:** #53221

**Changed:**
- `components/interfaces/App/{NotFoundPage,ServerErrorPage}.tsx` – the
404/500 pages, rendered by `__root.tsx`, now with native
`Link`/`useNavigate` and `<img>`
- `routes/api/{status-page,scoped-access-token-permissions}.ts` – App
Router handlers from `app/api/**` moved in (`NextResponse.json` →
`Response.json`); `buildAPIPermissionScopeMap` moves to `lib/api/`
- `package.json`, `tsconfig.json` – no `next typegen` step or
`.next/types` include
- `packages/ui-patterns/.../InstructionBlocks.tsx` – asset map typed
`StaticImageData | string`: under Vite a png import is a URL string,
which Next's global image types used to hide
- `vite.config.ts`, `knip.jsonc`, `turbo.jsonc` and comments across
studio – Next build references removed

**Removed:**
- `pages/{_app,_document,404,500}.tsx`, `pages/_error.jsx`,
`pages/README.md`, `app/**`, `next.config.ts`, `proxy.ts`,
`instrumentation{,-client}.ts`, `sentry.{server,edge}.config.ts`,
`fonts/index.ts` (next/font), `BootTimeoutFallback`,
`postcss.config.cjs`, the `next/server` shim
- `@next/bundle-analyzer`, `raw-loader`, `postcss`,
`@tailwindcss/postcss` dev dependencies

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

## To test

- Open an unknown URL – the 404 page renders with working "Head back"
- `/api/status-page` and `/api/scoped-access-token-permissions` on
platform – same JSON and `Cache-Control`
- Fonts (Inter, Manrope, Source Code Pro) still load

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-17 17:33:02 +09:00