Commit Graph
6116 Commits
Author SHA1 Message Date
Francesco Sansalvadore 1550b09037 chore(studio): object versioning additions (#54432)
- Improve warning when public bucket and versions are being enabled on
storage bucket
enabling public bucket:
<img width="712" height="553" alt="Screenshot 2026-12-01 at 18 56 50"
src="https://github.com/user-attachments/assets/327f9e77-11dd-41b6-83b5-c3941aaf3d39"
/>

warning with non-public bucket:
<img width="651" height="456" alt="Screenshot 2026-12-01 at 18 56 42"
src="https://github.com/user-attachments/assets/0078abd7-7246-43c0-afca-2352329369ae"
/>

- Add "Get url" action for an object version
<img width="470" height="311" alt="Screenshot 2026-12-01 at 18 54 42"
src="https://github.com/user-attachments/assets/b3b2f92d-f341-4bda-93b8-473e59bf8ae6"
/>

- Add copy button to versionId

<img width="437" height="275" alt="Screenshot 2026-12-01 at 18 53 33"
src="https://github.com/user-attachments/assets/50a068a1-616b-42a2-bd23-7270bbef649e"
/>

- Add gh discussion link for feedback
2026-12-03 17:53:48 +01:00
Drew McLellan 6019742b8c chore(studio): remove local-only header events (#54535)
## Problem

Part of FE-5266 (remove or sample noisy Studio events).
`header_local_dropdown_opened` and `header_local_version_popover_opened`
only render in local Studio, which never sends telemetry, so they can
never fire. Their owner signed off on removing them.

## Solution

- Remove the `track()` calls from `LocalDropdown` and
`LocalVersionPopover`, along with the `useTrack` imports and the empty
`onOpenChange` wrappers they left behind.
- Remove the two event types and their `TelemetryEvent` union entries.

There is no runtime change. This is a standalone PR so it can be
reverted on its own. The catalog deletion sits next to the one in
#54533, so whichever merges second may need a trivial rebase.
2026-12-03 14:37:55 +00:00
Drew McLellan 663f077b47 chore(studio): remove header dropdown opened events (#54533)
## Problem

Part of FE-5266 (remove or sample noisy Studio events). The
`header_{organization,project,branch,user}_dropdown_opened` events are
among the highest-volume events and don't answer a product question: the
next pageview already shows what was selected. Their owner signed off on
removing them.

## Solution

- Remove the `track()` calls from the organization, project, branch and
user dropdowns. Each now passes its state setter straight to
`onOpenChange`.
- Drop the `useTrack` import from `BranchDropdown` and
`ProjectDropdown`, which no longer track anything.
- Remove the four event types and their `TelemetryEvent` union entries.

`header_feedback_dropdown_opened` is kept. `upgrade_cta_clicked` in the
user and organization dropdowns is untouched. This is a standalone PR so
it can be reverted on its own.
2026-12-03 14:18:55 +00:00
Drew McLellan 0a3a53298b chore(studio): remove home_connect_section_exposed event (#54531)
## Problem

Part of FE-5266 (remove or sample noisy Studio events).
`home_connect_section_exposed` fires on every project home load and is
no longer needed. Its owner signed off on removing it.

## Solution

- Remove the exposure effect from `ConnectSection` and the imports it
left unused.
- Remove the `HomeConnectSectionExposedEvent` type and its
`TelemetryEvent` union entry.

`home_connect_action_clicked` is untouched. This is a standalone PR so
it can be reverted on its own.
2026-12-03 14:18:02 +00:00
Jordi Enric 833a875ea2 fix(studio): friendly database metric errors DEBUG-155 (#52216)
## Problem

The Database section of Observability displays raw infrastructure API
errors in metric cards, making failures confusing and repetitive.

## Fix

Show one friendly alert with refresh, support, and service-status
guidance when the infrastructure request fails. Keep Slow Queries
visible, and show “Unable to load” only on affected cards for partial
failures while preserving healthy metrics.

The Overview Refresh button now invalidates the active project’s
connection-limit query. Previously it used a cache key that matched no
active query, so Peak Connections could stay on “Unable to load” while
the other cards refreshed.

Consolidates and supersedes #47491 and #47495, adapted to the current
batched metrics implementation.

## How to test

- Open Observability and verify that successful database metrics still
render.
- Simulate a failed infrastructure request. Expect one friendly alert,
no raw backend message, and Slow Queries still visible.
- Simulate an individual metric or connection-limit failure. Expect only
the affected card to show “Unable to load”.

- With the connection-limit request failing, click **Refresh** and
confirm that Peak Connections shows “Unable to load”. Restore the
response and click **Refresh** again. The card should show the peak and
limit without a browser reload.

## QA results

- **Hosted Refresh recovery passed on `ee646999af`.** After the
connection-limit request recovered, one click sent a new request and
replaced “Unable to load” with `6/90`. The other five hosted cases
passed on `dbf78487f5`. [Automated QA
review](https://github.com/supabase/supabase/pull/52216#pullrequestreview-6169329677)
- **Local Chromium recovery passed on the same commit.** With a
simulated HTTP 500 followed by success, Refresh retried the query and
displayed `12/100`. CPU, Memory, and Disk remained healthy.
- All 52 focused tests passed with retries disabled and shuffled order.
The recovery test failed with the original Refresh handler. Studio
typecheck passed. GitHub reported 38 successful checks and six skipped
checks.

Fixes
https://linear.app/supabase/issue/DEBUG-155/frontend-should-render-nice-error-message-on-infra-monitoring-api

## QA screenshots

### Peak Connections before and after the Refresh fix

**Before · `dbf78487f5`.** Peak Connections still showed “Unable to
load” after two Refresh clicks, even as the other metrics reloaded.

![Peak Connections stuck on Unable to load after
Refresh](https://k6dwnfm8zepsmdni.public.blob.vercel-storage.com/qa/wrun_41M8XTANCW0GQ8139AY6ECPK81/1796297469653-screenshot-1796297456016.png)

**After · `ee646999af`.** Once the connection-limit request could
succeed, the next Refresh click restored Peak Connections to `6/90`.

![Peak Connections showing 6/90 after in-app
Refresh](https://k6dwnfm8zepsmdni.public.blob.vercel-storage.com/qa/wrun_41M8XTANCW0GQ8139AY6ECPK81/1796299167534-screenshot-1796299160944.png)

### Local browser with HTTP overrides

Actual PR component at `dbf78487f5`, rendered in a local fixture harness
at a 1440 × 900 viewport. Playwright intercepted the infrastructure API
request; these are local simulated error states, not hosted-preview
captures.

**Full request failure:** one friendly alert; raw backend details are
hidden and Slow Queries remains visible.

![Full request failure — local HTTP
override](https://github.com/user-attachments/assets/f9b85b1d-f836-47ce-ad48-bab13e558079)

**Partial failure:** only Disk IO Budget shows “Unable to load”; healthy
metrics and Slow Queries remain visible.

![Partial metric failure — local HTTP
override](https://github.com/user-attachments/assets/f7dbc088-d505-4f20-8a55-45d832b828a8)

**Recovery:** after restoring a successful response and reloading, all
metric cards render normally.

![Healthy recovery — local HTTP
override](https://github.com/user-attachments/assets/34d3332e-717b-47ff-ba56-e00128fa474c)

### Verified hosted preview

Studio staging deployment for `dbf78487f5`, 1440 × 900. All database
metric cards and Slow Queries return after Refresh.

![Overview after
Refresh](https://github.com/user-attachments/assets/67304cac-3dfd-4afe-b717-0a1fa12a30ba)

The CPU card opens the Database report and preserves Last 24 hours.

![Database report opened from a metric
card](https://github.com/user-attachments/assets/c70eb7c8-4151-4080-ba6c-69efb675d7ab)
2026-12-03 14:03:33 +01:00
supabase-vercel-tedd[bot] 2922cc2190 feat(studio): track inline cell edits in the Table Editor grid (#54477) 2026-12-03 18:35:00 +08:00
Danny White 9052601faf fix(studio): validate direct database access permissions (#54506)
## Problem

Direct database access requires Database management read access, but
OAuth app settings currently allow saving an invalid combination. The
consent screen’s readiness checks then fail.

## Solution

Show an inline error when direct database access lacks Database
management read access, and prevent saving through the button, keyboard
shortcut, or form submission. Both controls stay editable, and neither
changes the other automatically.

| After |
| --- |
| <img width="1280" height="1103" alt="OAuth Apps Organization Settings
Office Supabase (1)"
src="https://github.com/user-attachments/assets/6cfd203b-d320-46da-b7b5-9ede2e9d814c"
/> |
| _Immediate inline error, cleared as soon as it’s corrected._ |
| <img width="1280" height="1103" alt="OAuth Apps Organization Settings
Office Supabase"
src="https://github.com/user-attachments/assets/f2637d92-c149-4d1a-9d83-130e0f54ce66"
/> |
| _Follow-up footer pattern if that error (or any inline error) is
ignored._ |

## Review instructions

1. Open the [staging
preview](https://studio-staging-git-dnywh-trusted-partner-permis-56807c-supabase.vercel.app/dashboard)
→ Organization → OAuth Apps. Edit an organisation-bound app, or select
**Publish OAuth app**. If your organisation is not a Trusted Partner,
use the DevTools steps below first.
2. Select Direct database access, then set Database management to No
access or Write. Check that the inline error explains that “Database
management” requires at least read access and Confirm stays enabled.
Click Confirm: saving should be blocked and “Fix the errors above to
continue.” should appear in red above the footer actions.
3. Select Database management Read only or Read and write. Check that
the inline and footer errors clear. Confirm should remain enabled.
4. Repeat in the opposite order, or remove Direct database access.
Neither control should change automatically.


<details>
<summary>Review without a Trusted Partner organisation (Chrome
DevTools)</summary>

1. In the Studio dev toolbar’s **Flags** tab, enable
`enableScopedOAuthPublish` if needed.
2. Open Chrome DevTools → **Network**, then open **Publish OAuth app**
or edit an existing app.
3. Select the **GET** request whose URL ends in
`/platform/organizations/YOUR_ORG_SLUG`, without `/oauth/apps` after it.
Its response contains your organisation’s name and slug.
4. Right-click the request → **Override content**. Choose a local folder
and click **Allow**. Add `"is_trusted_partner": true` to the top-level
JSON object, or change the existing value to `true`. Keep every other
field and save with **Cmd/Ctrl+S**.
5. Reload with DevTools open and reopen the app form. For a new app,
choose **An owner, once for the whole organization** under
**Authorization**. Fill in the required name, website and callback URL
so other validation does not interfere.
6. Under **Application permissions**, select **Direct database access →
Read only** while **Database management** has **No access**. Check that
the inline error appears and **Confirm** stays enabled. Click
**Confirm** and check that saving is blocked, with “Fix the errors above
to continue.” in red above the footer actions.
7. Set **Database management → Read only** or **Read and write**. Check
that the inline and footer errors clear, while **Confirm** remains
enabled. Change it to **Write** and check that the error returns.
Neither permission should change automatically.
8. Set **Direct database access → No access**. Check that the inline and
footer errors clear. Cancel the form without saving.
9. Turn off **Sources → Overrides → Enable Local Overrides** and reload
when finished.

The override only changes the response in your browser. It does not
grant backend Trusted Partner eligibility, so use it to review the UI
validation. Saving an app with direct database access requires a
genuinely eligible organisation.

</details>
2026-12-03 13:39:50 +07:00
Danny White 0b9e4f6ab1 fix(studio): clarify token access settings and SSL prerequisites (#54507)
## Problem

- Token access confirmations use stilted copy. 
- The SSL prerequisite notice sits outside the Token access card,
repeats “enabled”, and includes an unnecessary project reference.
- SSL configuration also shows enforcement as off when the latest update
failed, and its dependency tooltip needs clearer guidance.

## Solution

- Rewrite the token access and SSL confirmations, keeping the connection
warnings.
- Group prerequisite notices inside the Token access card with one
divider, remove the project reference, and simplify their descriptions.
- Keep the SSL switch tied to the fetched configuration independently of
update success.
- Explain the token access dependency in the disabled switch’s tooltip:
“Database token access requires SSL enforcement.” Leave the existing SSL
failure warning unchanged apart from its final full stop.

| Before | After |
| --- | --- |
| <img width="727" height="501" alt="CleanShot 2026-12-03 at 11 21 35"
src="https://github.com/user-attachments/assets/9fd18a91-528a-47dd-82e8-7349e26a8daa"
/> | <img width="736" height="506" alt="CleanShot 2026-12-03 at 12 05
57"
src="https://github.com/user-attachments/assets/8263303a-49d8-4910-9c88-e2fe5ecc1c34"
/> |
| <img width="362" height="236" alt="CleanShot 2026-12-03 at 11 21 54"
src="https://github.com/user-attachments/assets/026852d4-9c1b-4a9d-9833-02e047794199"
/> | <img width="421" height="229" alt="CleanShot 2026-12-03 at 12 06
24"
src="https://github.com/user-attachments/assets/9a53c459-c7ca-4c18-8567-499d67a9c068"
/> |
| <img width="420" height="206" alt="CleanShot 2026-12-03 at 11 22 36"
src="https://github.com/user-attachments/assets/4d2f8711-fd75-4730-832f-ac9e2e3d85ad"
/> | <img width="420" height="207" alt="CleanShot 2026-12-03 at 11 52
51"
src="https://github.com/user-attachments/assets/2fce238e-c8d7-4087-8402-05c2122f92f0"
/> |
| <img width="420" height="208" alt="CleanShot 2026-12-03 at 11 32 11"
src="https://github.com/user-attachments/assets/f081e782-0a6c-499a-947d-0da149311218"
/> | <img width="417" height="219" alt="CleanShot 2026-12-03 at 11 52
05"
src="https://github.com/user-attachments/assets/6b6cfcf5-2c54-4f38-9b16-bcc0cdd500a0"
/> |
| <img width="809" height="255" alt="CleanShot 2026-12-03 at 12 28 47"
src="https://github.com/user-attachments/assets/19cffa41-691f-4f60-96b5-7ba1ebcfb78e"
/> | <img width="804" height="246" alt="CleanShot 2026-12-03 at 12 44
39"
src="https://github.com/user-attachments/assets/2c3f2b74-21a8-41e7-b25e-ea2293350fcc"
/> |


## Review instructions

1. Open Project → Database → Settings in the preview for a project that
requires SSL enforcement before token access.
2. Check that SSL enforcement required sits inside Token access,
separated by one divider, with no project reference in its description.
3. Select Enable SSL enforcement and review the confirmation copy.
Cancel without applying the change.
4. On a project where token access is available, toggle it on and off to
review both confirmations. Cancel each dialog.
5. With token access on, check that SSL enforcement stays on and locked,
with a tooltip explaining that database token access requires SSL
enforcement. Check that the tooltip also opens on keyboard focus.
6. If the API reports an unsuccessful SSL update, check that the switch
still reflects `currentConfig.database` and the existing warning remains
visible.
2026-12-03 11:46:10 +07:00
barcofourie 7e56800992 fix(assistant): update support assistant messaging for clarity and consistency (#54112)
## Problem

The AI Assistant follow-up on support requests (behind the
`supportAssistantFollowUp` flag) told users with service restrictions to
ask Support for an exception. In almost every restriction ticket we
reviewed during the production test, the Assistant suggested this, and
Support then declined.

## Solution

Rather than a rule for each ticket type, this adds one general rule to
the server-side support-mode context and removes the "a human will
reply" framing.

`escalate_to_human` is unchanged, so users who ask for a person can
still be escalated.

## Review instructions

Read the diff to `assistant-context.ts` and `SupportAssistant.utils.ts`,
and check that the rule is general and doesn't name a particular ticket
type.


## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [x] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
2026-12-03 06:23:54 +02:00
Danny White 52614926a3 feat(studio): promote Launch Week 16 in the Banner Stack (#54512)
## Problem

Launch Week 16 is promoted on www but needs the same promotion in hosted
Studio.

## Solution

Add a low-priority card to the existing bottom-right Banner Stack across
project, organisation, and account pages. It uses the shared dot artwork
from #54511, links to the Launch Week site, saves dismissal, and expires
after December 11 in San Francisco. Signed-out and self-hosted Studio do
not show it.

| After |
| --- |
| <img width="995" height="584" alt="1211"
src="https://github.com/user-attachments/assets/ff1a60a3-6a4e-4b32-a3df-7fdfe74f4afb"
/> |
| <img width="995" height="584" alt="68318"
src="https://github.com/user-attachments/assets/3a41c56a-fe59-4800-ae14-82ec42c6f260"
/> |

## Review instructions

1. Open a hosted project, organisation, or account page on the Studio
preview. If another notice is in front, expand the Banner Stack to find
**Launch Week 16**.
2. Check the artwork, copy, and **Claim your ticket** button in light
and dark mode. The button opens the Launch Week site in a new tab and
dismisses the card.
3. Close the card and reload. It should stay dismissed.
2026-12-03 10:56:14 +07:00
Monica Khoury 67923f6e0b fix(studio): keep selected events while saving a webhook endpoint (#54474)
## Problem

When editing the events a webhook endpoint is subscribed to and clicking
save, the event checkboxes flip back to the previously saved selection
while the save is in progress. The saved endpoint has the correct
events, but the sheet shows the wrong ones.

Closes FE-5275.

## Solution

The edit sheet resets its form whenever the event types it receives
change. The page built that list as a new array on every render, so any
re-render of the page counted as a change. Clicking save puts the
mutation into its pending state, which re-renders the page, which reset
the form to the old saved events.

- Memoized the event type options in the page, so the array only changes
when the scope changes.
- Added tests that hold the save request open and check the checkboxes
while it is pending: one for unchecking an event and one for adding an
event. Both failed before the change.

## How to test

1. Open a webhooks page and select an endpoint that is subscribed to all
events.
2. Click Edit, uncheck a few events, and click Save changes.
3. Check that the unchecked events stay unchecked while the sheet is
saving, and that the endpoint shows the events you picked afterwards.
4. Edit an endpoint that is subscribed to only one or two events, check
an extra event, and click Save changes.
5. Check that the extra event stays checked while the sheet is saving,
and that the endpoint shows it afterwards.
6. Try the same on an organization webhooks page.
2026-12-02 18:10:54 +02:00
kemal.earth 6d8af8e950 chore(api-types): regenerate types from production specs (#54472)
## Problem

`packages/api-types` has drifted from the production OpenAPI specs.
#54394 regenerated them but was reverted in #54404, because the API had
rolled out ahead of its OpenFGA model. That has since been fixed on the
backend, so the regen can land.

...plus I need the new spec for #54391 and didn't want to blow up my
branch.

## Solution

Regenerated with `pnpm --filter=api-types codegen:prod` (production
specs, not the localhost `codegen`), plus the type fixes the new specs
require:

- `platform-webhooks-fetchers.ts` — `page` is now a deep object in the
spec, so the query params move from `page[limit]` keys to a nested
`page` object with a `deepObject` serializer.
- `InvoicesSettings.test.tsx` — four newly-required invoice fields in
the mock.
- `packages/shared-data` — `@supabase/shared-types` 0.1.98 → 0.1.102,
matching `apps/studio`.

Notable additions: the `environment_*` FGA scopes and `GET
/v2/projects/{ref}/analytics/traces/{trace_id}`.

## Review instructions

1. `pnpm --filter=api-types run verify-production-types` — passes.
2. `pnpm typecheck` and `pnpm --filter=studio test` — pass.
3. Only the three non-generated files need reading; the rest is
generated output.

Note: `verify-production-api-types` was removed from the required checks
during the #54394 incident and hasn't been restored. Worth putting back
after this merges.
2026-12-02 13:51:52 +00:00
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
Pamela Chia ec1b9dae02 fix(studio): drop deleted route-mock from table menu test (#54471)
The Studio typecheck fails on master: `TableEditorMenu.test.tsx` (added
in #53960) imports `@/tests/lib/route-mock`, which #54426 removed a few
hours earlier. Each PR passed on its own, so the break only showed once
both were merged, and every PR based on current master now fails
`typecheck`.

I removed the import and its `routerMock.setCurrentUrl` call, and passed
the same URL through `customRender`'s `initialUrl` option, the way
#54426 migrated the other tests that used the mock.

## Linear
- fixes GROWTH-1602
2026-12-02 11:21:35 +00:00
Alaister YoungandAlaister Young 217b9ca3f3 [FE-5024] feat(studio): track Table Editor sidebar and side panels (#53960)
Adds PostHog telemetry events across the Table Editor sidebar, new-tab
page, and column/table/row/cell side panels so we can measure schema
usage, entity-list search/filtering, entity menu actions, and panel
saves without logging schema, table, column, or search names.

**Added:**

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

## To test

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

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

Notes for review:

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

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-02 18:54:08 +08:00
Danny WhiteandJoshen Lim 4dbb966b2e feat(studio): show Trusted Partner access on OAuth consent (#53583)
> [!WARNING]
> Live readiness checks require
[CTRL-2277](https://linear.app/supabase/issue/CTRL-2277) in the target
environment; production deployment is pending.

## Problem

Trusted Partner consent must explain direct database access and project
blockers before authorisation.
[DEPR-732](https://linear.app/supabase/issue/DEPR-732)

## Solution

- Show Direct database access alongside the requested permissions.
- Check selected projects, or every project page for organisation-wide
grants.
- Separate blocking issues from SSL notices; block authorisation during
loading or errors and offer retry.

| After |
| --- |
| <img width="1280" height="1323" alt="Authorize API Access Supabase"
src="https://github.com/user-attachments/assets/adb6367a-bace-4b62-81b5-68ba4c11396c"
/> |
| Consent screen with Direct database access (previously “Table data”)
and Database management |
| <img width="1280" height="1323" alt="Authorize API Access Supabase"
src="https://github.com/user-attachments/assets/0c35900c-1059-49cd-b1c5-4e0cf5441b9b"
/> |
| Selected-project blockers and the separate SSL notice |
| <img width="1280" height="1323" alt="95741"
src="https://github.com/user-attachments/assets/1fbef4f0-0433-4c93-b390-84d210dfb665"
/> |
| Organisation-wide blockers _without_ project-removal actions |

## Review instructions

1. Open the [staging consent
screen](https://studio-staging-git-dnywh-depr-732-trusted-partn-f24cfb-supabase.vercel.app/dashboard/authorize?auth_id=11666aa8-7f7e-4705-b33a-981903fd682e).
Enable `enableScopedOAuthConsent` in the dev toolbar’s **Flags** tab if
needed.
2. Open Chrome DevTools → **Network** and reload. Select the **GET**
request ending in `/platform/oauth/authorizations/{id}`.
3. Right-click that request → **Override content**. Choose a local
folder and click **Allow**. Add `database_token_access:read` and
`database_token_access:write` to `scopes`. Use only the read scope to
check read-only access. Keep every other field, save with
**Cmd/Ctrl+S**, then reload with DevTools open.
4. Select projects. Override each **GET** request ending in
`/platform/organizations/{slug}/oauth/authorizations/{id}/projects/{ref}/database-access`.
Use `{"issues":[],"enables_ssl":false}` for ready projects, then
`{"issues":[],"enables_ssl":true}` for an SSL notice. Save and reload
after each change. Check Direct database access and Database management
are separate, and SSL alone allows authorisation.
5. Change a readiness response to
`{"issues":["postgres_upgrade_required","platform_unsupported"],"enables_ssl":true}`.
Save and reload. Check blockers prevent authorisation, SSL stays
separate, and removing a blocked project clears its blockers.
6. Set `project_scoping_mode: false` in the authorisation override. Save
and reload. Check any blocked project prevents organisation-wide
authorisation, with no project-removal actions.
7. Block a database-access request in Network and reload. Check
authorisation stays disabled. Unblock it and choose **Retry checks**.
8. For a returning app, override `existing_grant.approved_scopes` in the
request ending in `/preflight`. Save and reload. Check added, removed
and unchanged permissions.
9. Disable **Sources → Overrides → Enable Local Overrides**. Repeat
ready and blocked project checks with a real staging authorisation
before approving live readiness behaviour.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-12-02 16:19:30 +07: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 WhiteandJoshen Lim 05cbf8ca50 feat(studio): show Trusted Partner access in Authorized Apps (#53705)
## Problem

Organisation admins need to see authorised apps’ direct database access.
[DEPR-731](https://linear.app/supabase/issue/DEPR-731)

## Solution

- Show the approved direct-access level in Authorized apps.
- Show permissions and project coverage in **View access**.

| After |
| --- |
| <img width="1280" height="813" alt="OAuth Apps Organization Settings
Basket Supabase"
src="https://github.com/user-attachments/assets/d2bbc682-6e6f-462f-b5c2-3a2a8ff813ba"
/> |
| Authorized apps list showing read-only direct access |
| <img width="1280" height="813" alt="OAuth Apps Organization Settings
Basket Supabase (4)"
src="https://github.com/user-attachments/assets/24506547-461a-44e0-880f-6ade23fd734c"
/> |
| Authorized apps list showing read-write direct access |
| <img width="1280" height="813" alt="OAuth Apps Organization Settings
Basket Supabase (1)"
src="https://github.com/user-attachments/assets/53ac2662-9fb7-4cfc-b118-31ef5778b339"
/> |
| View access sheet with permission groups and project coverage |
| <img width="1280" height="813" alt="OAuth Apps Organization Settings
Basket Supabase (3)"
src="https://github.com/user-attachments/assets/a21cefa7-c656-4b5c-bb0c-075c724350f9"
/> |
| View access sheet with permission groups and project coverage |
| <img width="424" height="297" alt="CleanShot 2026-12-02 at 15 09 39"
src="https://github.com/user-attachments/assets/e1f83068-21a8-43c4-9ca8-dcf6a3164b01"
/> |
| Added second paragraph for revoking access to apps with direct
database access. This “existing connections will close shortly” is only
accurate one CTRL-2141 merges, as discussed
[here](https://github.com/supabase/supabase/pull/53705/changes#r4764576735).
|

## Review instructions

1. Open the [staging
preview](https://studio-staging-git-dnywh-depr-731-authorized-apps-supabase.vercel.app/dashboard),
select a test organisation and open **Apps**
(`/dashboard/org/{slug}/apps`). Enable `enableScopedOAuthManage` in the
Studio dev toolbar’s **Flags** tab if needed.
2. Open Chrome DevTools → **Network** and reload. Select the **GET**
request ending in `/platform/organizations/{slug}/oauth/approvals`.
3. Right-click that request → **Override content**. Choose a local
folder and click **Allow**. For an existing organisation-bound app, add
`database_token_access:read` to `attributes.org_grant.approved_scopes`.
Keep every other field, save with **Cmd/Ctrl+S**, then reload with
DevTools open.
4. Open the app’s **View access**. Override the **GET** request ending
in `/platform/organizations/{slug}/oauth/approvals/{app_id}/grants`. Add
the same scope to the matching grant’s `attributes.approved_scopes`.
Save and reload.
5. Check read-only direct access in the list and access sheet. Change
the scope to `database_token_access:write` in both overrides, save and
reload. Check read-write access and compare it with a standard app.
6. Compare the grants response’s existing `attributes.projects` list
with `null` for all projects. Save and reload after each change. Check
permission groups, project coverage and the app ID in **View access**.
7. Open **Revoke access**, check the existing OAuth access explanation,
then choose **Cancel**.
8. Disable **Sources → Overrides → Enable Local Overrides**. Repeat with
real authorised staging apps.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-12-02 14:05:39 +07:00
Danny WhiteandJoshen Lim 0265ff935e feat(studio): configure direct database access in OAuth app settings (#54006)
> [!WARNING]
> Partner eligibility requires
[CTRL-2282](https://linear.app/supabase/issue/CTRL-2282) in the target
environment; production deployment is pending.

## Problem

Trusted Partners need to configure direct database access for OAuth
apps. [DEPR-733](https://linear.app/supabase/issue/DEPR-733)

## Solution

- Save and reload direct-access scopes independently of Database
management.
- Allow new grants only for eligible organisations and
organisation-bound apps.
- Allow existing direct access to be removed when eligibility changes.

| After |
| --- |
| <img width="1280" height="754" alt="OAuth Apps Organization Settings
Basket Supabase"
src="https://github.com/user-attachments/assets/e9b78fb6-65e4-4299-ad07-a2f9538a36d5"
/> |
| `"is_trusted_partner": false` or missing |
| <img width="1280" height="754" alt="OAuth Apps Organization Settings
Basket Supabase (1)"
src="https://github.com/user-attachments/assets/cf78db2c-952c-47e9-9239-82aab2c8398a"
/> |
| `"is_trusted_partner": true` |

## Review instructions

1. Open the [staging
preview](https://studio-staging-git-dnywh-depr-733-oauth-app-dat-c71d4a-supabase.vercel.app/dashboard),
select a test organisation and open **OAuth Apps**. It should already be
`true, but enable `enableScopedOAuthPublish` in the Studio dev toolbar’s
**Flags** tab if needed.
2. Open Chrome DevTools → **Network**, then click **Publish OAuth app**.
3. In Network, select the **GET** request whose URL ends in
`/platform/organizations/YOUR_ORG_SLUG`, without `/oauth/apps` after it.
Its response contains the organisation’s name and slug.
4. Right-click that request → **Override content**. Choose a local
folder and click **Allow**. Add `"is_trusted_partner": true` to the
top-level JSON object, keeping every other field. Save with
**Cmd/Ctrl+S**.
5. Reload with DevTools open, reopen **Publish OAuth app**, and choose
**An owner, once for the whole organization** under authorisation.
6. Under **Application permissions**, find **Direct database access**.
Try **No access**, **Read only** and **Read and write**. Change
**Database management** separately and check the two values stay
independent.
7. With direct access selected, check **Each member, for themselves** is
unavailable. Set direct access to **No access**, choose member
authorisation, and check the Direct database access dropdown becomes
disabled.
8. Switch back to organisation authorisation, select direct access and
open **Preview consent for users**. Check its label and access level
match the form.
9. Change the overridden field to `false`, save and reload. Reopen the
new-app form and check Direct database access is hidden.
10. Disable **Sources → Overrides → Enable Local Overrides**. In a
genuinely eligible staging organisation, create a disposable app with
direct access, save and reopen it. Change its access level, save and
reopen again, then remove direct access. Check Database management
remains unchanged.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-12-02 16:50:36 +11: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
Danny White 30a1b38da0 feat(studio): rename temporary access to database token access (#54282)
## Problem

The database access preview still uses “Temporary access” across its
settings and member rules.

## Solution

Use “Database token access” for the feature and “Member access” for
member rules. Update the preview, settings, dialogs, feedback, member
status messages and docs together. Move the guide to
`/guides/platform/token-access`, permanently redirect the old URL, and
preserve existing section anchors.

## Review instructions

1. Open [the Studio
preview](https://studio-staging-git-dnywh-database-token-access-naming-supabase.vercel.app),
then Feature previews and find **Database token access**. Enable the
preview for a supported project, then open [Database
Settings](https://studio-staging-git-dnywh-database-token-access-naming-supabase.vercel.app/project/_/database/settings).
2. Check the **Database token access** heading, **Allow token access**
switch and **Member access** table. Open **Add rule** and an existing
rule to check the sheet titles. Open a rule’s delete confirmation and
cancel it.
3. With an assigned role, check the access status above the member
table. As a member without management permission, check the access
notice uses the same feature name.
4. Open the [database token access guide in the docs
preview](https://docs-git-dnywh-database-token-access-naming-supabase.vercel.app/docs/guides/platform/token-access).
Check the guide and navigation use the new name, the dashboard
instructions match Studio, and the existing section links from the
member guide still work. Open `/docs/guides/platform/temporary-access`
and its `.md` variant to check they permanently redirect to the new
URLs.

| Before | After |
| --- | --- |
| <img width="726" height="367" alt="CleanShot 2026-11-30 at 16 06 00"
src="https://github.com/user-attachments/assets/be351f0c-d578-4289-8785-5c4e69a254a7"
/> | <img width="729" height="374" alt="CleanShot 2026-11-30 at 16 05
38"
src="https://github.com/user-attachments/assets/f02b470d-ef1a-4b6c-bdbb-20fe10b847c6"
/> |
2026-12-02 00:03:43 +00:00
Miranda Limonczenko 58b468916c docs(auth): Solve eval for Anonymous sign-in page (#53489)
Closes DOCS-1676

## Problem

The drafted Eval for this guide has one failing check. This PR fixes
that check and also runs the `edit-the-docs` and `test-the-docs` skill
to improve the page as a whole.

The Anonymous Sign-Ins guide tells readers to check the `is_anonymous`
JWT claim in RLS policies. When a guest links an email, phone, or OAuth
identity, the user becomes permanent at once, but the token the client
holds keeps `is_anonymous: true` until it refreshes. A policy on the
claim refuses that new customer with `42501` until then.

## What changed

- **Access control:** a caution on the stale claim, and a policy that
reads `auth.users.is_anonymous` through a `security definer` function in
a non-exposed schema with `search_path = ''`.
- **Convert an anonymous user:** a "Refresh the session after linking"
step with `refreshSession()`.
- **Whole-page edit**, one commit per change type:
- Style: wording, word list, sentence-case and imperative headings, no
time-anchored text.
- Structure (moves only): Access control before Convert, identity
conflicts under Convert, the Next.js caution under Sign in.
- Technical: the `anon` key uses the `anon` role, not `anonymous`; the
opening caution no longer says to check the JWT claim; the
existing-account sample throws instead of a top-level `return`.

Renamed headings with no inbound links: Resolving identity conflicts,
Linking an anonymous user to an existing account, Automatic cleanup.
`#access-control` (Studio) and `#link-an-email--phone-identity` are
unchanged.

## Eval on the preview

`build-docs-016-auth-anonymous` with `REFERENCE` pointed at the preview,
3 runs ([workflow
run](https://github.com/supabase/evals/actions/runs/43983385855)).

| Run | Score | Guest who just made an account can post a review |
Failed check |
| --- | --- | --- | --- |
| Baseline (published page) | 9/10 in all 3 runs | Fail in all 3 | Guest
who just made an account can post a review |
| 1 | 10/10 | Pass | None |
| 2 | 9/10 | Pass | Agent read the guide |
| 3 | 9/10 | Pass | Agent read the guide |

All 3 runs fetched the preview and wrote the `security definer` policy.
The guide-read check only counts fetches from `supabase.com`, so it
can't pass on a preview. Run 1 passed it because that agent also opened
the published page.

## Manual testing

1. Open the [Anonymous sign-ins
preview](https://docs-git-docs-anonymous-claim-refresh-supabase.vercel.app/docs/guides/auth/auth-anonymous).
2. Check the new caution and function example under **Access control**,
and the new **Refresh the session after linking** section.
3. Click the anchor links between the two sections and to the RLS guide.
2026-12-01 10:13:18 -08:00
b53403e1d7 docs(integrations): add Build a Supabase integration guide (#54088)
## Problem

The steps to build a Supabase integration are spread across five pages:
the Partner Catalog page, creating an OAuth app, OAuth scopes, the
partner install flow, and the Management API reference. A partner has no
single page that says where to start or what to do next. Linear:
DOCS-1720.

## Solution

Add one guide, **Build a Supabase integration**, as the first item under
**Build Your Own** in the integrations sidebar. It does not repeat the
detail on the other pages. It links to them.

- **The path at a glance:** two short paths. Partner Catalog: apply,
build a landing page, publish. Integration: apply, build the OAuth flow,
build the integration, publish.
- **Apply to the Partners program**, then **Choose: Partner Catalog or
Integration**, a comparison table with wireframe images (SVG, light and
dark).
- **Partner Catalog: Build your landing page** and **Integration**
(build the OAuth flow, build the integration), each with "Build it"
cards that link to the top of the existing page.
- **Publish:** ask the partner manager to list the partner on the
Partner Catalog or the Integrations page.
- Removes the redirect from
`/docs/guides/integrations/build-a-supabase-integration` to the OAuth
guide, so the new page is reachable at that URL. The old `/oauth-scopes`
redirect stays.
- The progression and card data is in
`apps/docs/data/content-listings/build-a-supabase-integration.data.ts`.

Not in this PR: edits to the existing pages. The cards link to page
tops, so nothing here depends on those edits.

## Please check

- The five progression icons are placeholders from the built-in set. New
icons are coming.
- The table images sit inside table cells with a fixed width. I checked
them in the dev server only.
- I rendered the page with `pnpm dev` and ran `oxfmt --check` on the
changed files. I did not run the docs tests or `build:guides-markdown`.
- Two details are unverified: how partners hand their public key to
Supabase for a signed redirect, and partner status callbacks. The guide
does not describe either.
- The Dashboard Integrations tab wireframe is a drawing, not a
screenshot.

## Preview links

| Site | Live | Preview | Search for |
| ---- | ---- | ------- | ---------- |
| Docs |
[/docs/guides/integrations/build-a-supabase-integration](https://supabase.com/docs/guides/integrations/build-a-supabase-integration)
(redirects to the OAuth guide until this merges) | Vercel bot comment |
`The path at a glance` |

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

---------

Co-authored-by: John Stokvis <345546350+stokvis-at-supabase@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Nik Richers <nik@validmind.ai>
Co-authored-by: John Stokvis <johnstokvis@Johns-MacBook-Pro.local>
2026-12-01 09:53:58 -06:00
Alaister YoungandAlaister Young 07101b6894 [FE-3200] chore(studio): lift bundler workarounds and stabilize hooks (#54121)
Cleans up obsolete Rolldown/Vite bundler workarounds from the TanStack
Start migration and fixes unstable router selectors and inline default
array props that could cause unnecessary re-renders or render loops.

Addresses
[FE-3200](https://linear.app/supabase/issue/FE-3200/lift-bundler-workarounds-and-fix-latent-issues-next-was-masking).

**Removed:**

- Emptied `KNOWN_CHUNK_CYCLES` in `apps/studio/vite.config.ts` while
keeping the `assertNoChunkCycles` build guard enabled
- Removed obsolete `manualChunks` workarounds
(`class-variance-authority`, `ui-field`, `ui-drawer`, `ui-form`,
`ui-sidebar`, `ui-slider`, `ui-avatar`), keeping the React and
`lucide-react` vendor chunks so React stays a single leaf chunk and
Lucide does not fan out into per-icon modulepreload requests
- Removed the obsolete `sharedDefines` (`global: 'globalThis'`)
substitution from `apps/studio/vite.config.ts`

**Changed:**

- `StudioLink` (`StudioFrameworkProvider.tsx`): split `useRouterState`
into primitive `currentPathname` and `currentSearch` selectors instead
of returning a fresh object on every router state tick
- `useNuqsTanStackRouterAdapter` (`nuqs-tanstack-adapter.tsx`): select a
serialized query string key from `useLocation` so `useQueryState`
consumers do not re-render when unwatched search params change
- `FilterPopover`: replaced inline `[]` defaults for `options` and
`activeOptions` with shared `EMPTY_ARR` (`@/lib/void`), and guarded
`setSelectedOptions` with an element-wise equality check when closed
- `InputWithSuggestions`: replaced inline `[]` default for `suggestions`
with shared `EMPTY_ARR` (`@/lib/void`) so `useEffect` does not loop when
`suggestions` is omitted at runtime

**Added:**

- Regression tests covering router selector stability and default-prop
render loops in `StudioFrameworkProvider.test.tsx`,
`nuqs-tanstack-adapter.test.tsx`, `FilterPopover.test.tsx`, and
`InputWithSuggestions.test.tsx`

## To test

- Run `pnpm --filter studio run build` and verify the build passes with
`KNOWN_CHUNK_CYCLES` empty and `assertNoChunkCycles` enabled
- Run the new/updated unit tests in `apps/studio`
(`StudioFrameworkProvider.test.tsx`, `nuqs-tanstack-adapter.test.tsx`,
`FilterPopover.test.tsx`, `InputWithSuggestions.test.tsx`)
- Smoke-test Studio navigation, URL search-param filters (`nuqs`), Table
Editor column suggestions, `FilterPopover` interactions, and
`/auth/hooks` (confirming no `global` ReferenceError)

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-01 23:45:00 +08:00
hallidayo 0cf8b266ff fix(studio): tables not showing on mobile (#54412)
## Problem

On a mobile device the list of tables in the table editor are not
showing:

<img width="403" height="702" alt="Screenshot 2026-12-01 at 15 27 07"
src="https://github.com/user-attachments/assets/cfb23739-50c8-4997-9d7b-f86ef5375e7d"
/>


## Solution

Tables are now showing:

<img width="403" height="702" alt="Screenshot 2026-12-01 at 15 27 28"
src="https://github.com/user-attachments/assets/8bc8c909-b866-4351-83bd-4bee4631cdd8"
/>

Closes #54400
2026-12-01 15:35:27 +00:00
Gildas Garcia fd5c02f1a0 fix(studio): Scoped OAuth apps - improve text for projects with permission issues (#54409)
## Problem

When an authorization fails because of permission issues, we currently
display _Unavailable_ next to the problematic projects in the project
selector list. This is confusing as those projects are available, just
not selectable for this authorization

## Solution

Display _permission issues_ instead

<img width="417" height="601" alt="image"
src="https://github.com/user-attachments/assets/331073ac-71e0-45b0-a607-dcbd47268d91"
/>
2026-12-01 16:07:27 +01: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
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
K-Dog (Kevin) dc4f247e79 Revert "chore: update prod api types (#54394)" (#54404)
This reverts commit 37d4f444b4.

OpenFGA model needs updating first before updating the API types
2026-12-01 21:46:40 +08:00
Joaquim Moreno Prusi a27ef81d2e feat(studio): enable advanced V3 deployment for allowlisted organizations (#53158)
## Problem

Currently, in production, the Supabase UI doesn't allow for a set of
advanced deployment options, that we need to properly test new clusters
before getting those into production.

## Solution

Allow production dashboard requests to specify an AWS_K8S cluster when
the organization is included in the comma-separated
`orgsAllowedToUseV3AdvancedDeployment` setting.

Limited the exception to cluster placement fields. Preserve existing
permissions and cluster validation, require force for cordoned clusters,
and keep system requests supported. Default the allowlist to empty.

Updated the API descriptions and document ConfigCat setup.

## Review instructions
-

## Checklist

Check all before review:

- [X] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [X] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
2026-12-01 14:18:26 +01:00
Jordi Enric 431a55435a fix(studio): keep the function overview range in logs FE-4973 (#53867)
## Problem

An Edge Function’s Overview can show an invocation from two hours ago.
Selecting **Open logs** or pressing **O** then **L** opens the
function’s Logs page with its default one-hour window, which hides that
invocation.

## Fix

Both actions now pass the start and end of the selected Overview window
to the function’s Logs page.

## How to test

1. Open an Edge Function with invocations in the last three hours and
select the three-hour interval on Overview.
2. Select **Open logs**. Check that Logs opens for the same function and
the date range spans exactly three hours. If an invocation is older than
one hour, confirm it appears in that range.
3. Return to Overview, select three hours again, and press **O** then
**L**. Check the same function and time range.

Related to [FE-4973](https://linear.app/supabase/issue/FE-4973).

## Verification

On the Studio staging preview, both **Open logs** and **O** then **L**
opened the same function with the exact Overview timestamps,
13:03:16.960 through 16:03:16.960 UTC. The results included a successful
invocation more than one hour before the window ended.

All 72 focused Overview and Logs navigation tests passed. Removing the
date range from either entry point independently failed its regression
assertion.
2026-12-01 13:03:23 +00:00
K-Dog (Kevin) 37d4f444b4 chore: update prod api types (#54394)
Updated API types and addressed any type issues. Had to update
shared-types alongside.
2026-12-01 19:42:54 +08:00
supabase-vercel-tedd[bot]andIvan Vasilov 31f68587f6 feat(studio): track remaining usage on project home (#54143)
## Problem

Project home tracked most interactions, but not which credential people
copy from the "Copy" popover, or how often they use the custom report
and notebooks beyond adding blocks. Opening the Connect sheet from the
popover's "Get Connected" button also reported a stale
`connect_sheet_opened` source, because the popover never set one.

## Solution

Project home gets three new events: `home_project_credential_copied`
(with a `credentialType` enum), `home_custom_report_refresh_clicked`,
and `home_notebook_action_clicked` (`action: 'create' | 'analyze'`).
"Get Connected" in the popover now sets a new `home_popover` Connect
sheet source. The compute and GitHub stats now send
`home_activity_stat_clicked` as well, with two new `stat_type` values.
Every event fires from its click handler with a typed `track()` call,
and none sends the copied value or any user-defined name. This follows
the telemetry standards, so no `data-attr` attributes are added.

## How to verify

1. On a project's home page, open the "Copy" popover and copy each item.
Each copy sends one `home_project_credential_copied` event, with
`credentialType` set to `project_url`, `publishable_key`,
`direct_connection_string`, or `cli_setup`. No event contains the copied
value.
2. In the same popover, click "Get Connected". The Connect sheet opens
and sends `connect_sheet_opened` with `source: 'home_popover'`. Opening
it from the header button afterwards still sends `source:
'header_button'`.
3. Click the "Compute size" stat. It sends `home_activity_stat_clicked`
with `stat_type: 'compute'` and no `stat_value`.
4. Click the "GitHub" stat. It sends `home_activity_stat_clicked` with
`stat_type: 'github'`, and `stat_value` is 1 when a repository is
connected and 0 when none is.
5. With the custom report section shown, click "Refresh report". It
sends one `home_custom_report_refresh_clicked` event.
6. With the Notebooks section shown, click "New notebook" (or "Create
your first notebook" when there are none). It sends
`home_notebook_action_clicked` with `action: 'create'`. Click "Analyze"
on a notebook with cells: it sends `action: 'analyze'`.

## Checks

Ran `tsc --noEmit` in `apps/studio` and `packages/common`, `eslint` and
the type-aware `eslint.type-checks.config.cjs` lint on the changed
Studio files, `oxfmt --check` on every changed file, and `vitest run`
for `ProjectConnectionPopover.platform.test.tsx` and
`ActivityStats.test.tsx`.

## Checklist

- [x] I have read the [Contributing
Guidelines](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] I have checked that the change works in the preview deployment

## Feedback for Tedd

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

---------

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2026-12-01 11:54:29 +01:00
Alaister YoungandAlaister Young 680633ee4f [FE-5108] (part 5) refactor(studio): migrate remaining interfaces off next/link (#54308)
Part 5 of a 6-PR stack migrating all `next/link` imports in
`apps/studio` onto TanStack Router's `Link` (or plain `<a>` for known
external URLs) and removing `compat/next/link.tsx`.

| Part | PR | Scope |
| --- | --- | --- |
| 1 | #54304 | `data/prefetchers/PrefetchableLink.tsx` and
`components/ui/**` |
| 2 | #54305 | `components/layouts/**` and top-level shell components |
| 3 | #54306 | Database, TableGridEditor, Storage, SQLEditor,
BranchManagement, Branching, Functions, Realtime |
| 4 | #54307 | Integrations, Settings, Observability, LogDrains, Issues,
Linter, Reports, QueryPerformance, QuerySources, ConfigDrift,
DiskManagement, Compute |
| **5** | **#54308 ← this PR** | **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 the remaining `components/interfaces/**` directories off
`next/link`, leaving zero `next/link` component imports in
`apps/studio`.

**Changed:**

- Replaced `next/link` across all 73 remaining interface files
(`Organization`, `OrganizationInvite`, `Billing`, `Auth`, `Support`,
`ProjectHome`, `Home`, `Project`, `ProjectCreation`, `ProjectAPIDocs`,
`ApiAuthorization`, `App`, `ConnectSheet`, `SignIn`, `APIKeys`,
`Account`, `CliLogin`, `Docs`, `JwtSecrets`, `Platform`)
- Converted the sole remaining `UrlObject` link (`<Link href={{
pathname: '/sign-in-sso', query }}>`) in `SignInSSOForm.tsx` to `<Link
to="/sign-in-sso" search={query}>`
- Migrated `SupportLink.tsx` onto `DynamicLink`
(`createSupportFormUrl(...)`)
- Standardized external `target="_blank"` anchors with `rel="noreferrer
noopener"`, switched `OverviewMetrics.tsx` observability link to typed
`<Link to="/project/$ref/observability/auth">`, and adopted `InlineLink`
/ `InlineLinkClassName` on inline paragraph links per review feedback

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

## To test

- [ ] Check Organization (billing, usage, team, documents, AWS
Marketplace), Auth (providers, templates, rate limits, users, OAuth
apps), Support form/links, Project Home, Connect sheet, and Sign-In/SSO
links
- [ ] Verify `SignInWithSSOButton` preserves query params when
navigating to `/sign-in-sso`
- [ ] Verify `SupportLink` pre-populates support form query parameters
cleanly

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-01 17:33:03 +08:00
Gildas Garcia 7a6c6f7df8 fix(studio): fix Publish OAuth app button tooltips (#54359)
## Problem

Users who don't have the required permissions to publish an oauth app
may see two tooltips when hovering the _Publish OAuth app_ button.

<img width="620" height="208" alt="image"
src="https://github.com/user-attachments/assets/fedf7150-35e6-4429-b0c0-2fbc4cd2aa5e"
/>

## Solution

Hide the shortcut tooltip when users don't have the required permissions
to publish an oauth app
2026-12-01 10:15:50 +01:00
Alaister YoungandAlaister Young df798783e1 [FE-5108] (part 4) refactor(studio): migrate integrations, settings & observability off next/link (#54307)
Part 4 of a 6-PR stack migrating all `next/link` imports in
`apps/studio` onto TanStack Router's `Link` (or plain `<a>` for known
external URLs) and removing `compat/next/link.tsx`.

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

Migrates
`components/interfaces/{Integrations,Settings,Observability,LogDrains,Issues,Linter,Reports,QueryPerformance,QuerySources,ConfigDrift,DiskManagement,Compute}/`
off `next/link`.

**Changed:**

- Replaced `next/link` across all 72 files in Integrations, Settings,
Observability, LogDrains, Issues, Linter, Reports, QueryPerformance,
QuerySources, ConfigDrift, DiskManagement, and Compute interfaces
- Updated legacy permanent-redirect hrefs (`/settings/database` →
`/database/settings`, `/settings/vault/secrets` →
`/integrations/vault/secrets`, `/reports/database#database-size-report`
→ `/observability/database#database-size-report`) to canonical routes
- Flattened legacy nested `<Link><a>...</a></Link>` markup in
`DatabaseReadOnlyAlert.tsx` and dropped `passHref` in
`Integrations/Queues/QueueTab.tsx`
- Standardized external `target="_blank"` anchors with `rel="noreferrer
noopener"`, switched `ObservabilityOverviewFooter.tsx` to `InlineLink` +
`DOCS_URL`, and applied `InlineLinkClassName` to the typed billing links
in `DatabaseReadOnlyAlert.tsx` per review feedback
- Removed `vi.mock('next/link', ...)` from
`Settings/General/Project.test.tsx` and
`MobileIssuesNavigation.platform.test.tsx`

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

## To test

- [ ] Navigate across Integrations (marketplace, cron, queues, wrappers,
Vercel/GitHub), Settings (database, infrastructure, read replicas,
logs), Observability, Issues, and Compute pages
- [ ] Verify Logs Preview → Logs Explorer links preserve multi-line SQL
queries in search params
- [ ] Verify billing and database-size links preserve query parameters
and hash fragments

---------

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

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

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

**Changed:**

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

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

## To test

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

---------

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

| Part | PR | Scope |
| --- | --- | --- |
| 1 | #54304 | `data/prefetchers/PrefetchableLink.tsx` and
`components/ui/**` |
| **2** | **#54305 ← this PR** | **`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 all `apps/studio/components/layouts/**` files and top-level
navigation shell components off `next/link`.

**Changed:**

- Replaced `next/link` across `components/layouts/**` (`AccountLayout`,
`AppLayout`, `AuthLayout`, `BranchLayout`, `DatabaseLayout`,
`EdgeFunctionsLayout`, `ExplorerLayout`, `IssuesLayout`, `LogsLayout`,
`Navigation`, `ObservabilityLayout`, `ProjectLayout`,
`ProjectNeedsSecuring`, `SQLEditorLayout`, `SignInLayout`,
`TableEditorLayout`, `Tabs`) and top-level shell components
(`Sidebar.tsx`, `UserDropdown.tsx`, `LocalDropdown.tsx`,
`HomePageActions.tsx`)
- Removed `vi.mock('next/link', ...)` from `LocalDropdown.test.tsx` and
`ProjectNeedsSecuring.test.tsx`
- Added accessible labels where external icon/logo links switched from
`<Link>` to plain `<a>` (`AdminStudioButton.tsx`,
`ForgotPasswordLayout.tsx`)

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

## To test

- [ ] Navigate across top header, left sidebar, user/local dropdown, and
project/org/branch switchers
- [ ] Verify mobile navigation menu items and recent-tab links navigate
with expected query params
- [ ] Verify sign-in and forgot-password layout links work cleanly

---------

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

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

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

**Added:**

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

**Changed:**

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

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

## To test

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

---------

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

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

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

**Removed:**

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

**Changed:**

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

**Simplified:**

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

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

## To test

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

---------

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

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

Migrates all remaining `apps/studio/components/interfaces/**`
directories off `next/router`, including the last production
`router.events` consumer (`QueryInsightsTable`) and the only default
`next/router` import (`DiscordCTACard`). After this PR, zero files under
`apps/studio/components/**` import `next/router` or
`next/compat/router`.

**Added:**

-
`apps/studio/components/interfaces/QueryInsights/QueryInsightsTable/QueryInsightsTable.test.tsx`:
verifies that pathname changes clear selected query state without
mutating destination or history search params, while same-pathname
search updates preserve selection

**Changed:**

- Replaced the sole production `router.events.on('routeChangeStart',
...)` consumer in `QueryInsightsTable.tsx` with a `pathname` effect that
clears `onCurrentSelectQuery` on pathname changes, and derived
`searchQuery` directly from `nuqs` (`urlSearch`) instead of mirroring it
in local state. Drops the legacy `setQueryStates({ search: null })` call
on leave, which ran after `history.push` on TanStack Router (targeting
the destination URL rather than the previous history entry, while
browser Back is expected to restore previous search params).
- Removed the `router: NextRouter` prop from `ReportWidgetRendererProps`
in `Reports/ReportWidget.tsx` and updated its callers (`ChartBlock`,
`ReportHeader`, `CreateReportModal`)
- Updated `LOG_ROUTES_WITH_REPLICA_SUPPORT` in
`Settings/Logs/Logs.constants.ts` from `[ref]` to `$ref` for TanStack
route patterns
- Replaced the default `import router from 'next/router'` in
`Support/DiscordCTACard.tsx` with `useNavigate`
- Replaced `useRouter` across `Account`, `Advisors`, `App`, `Auth`,
`ErrorHandling`, `Home`, `HomePageActions`, `Integrations`, `Linter`,
`LocalDropdown`, `Observability`, `Organization`, `OrganizationInvite`,
`Platform/Webhooks`, `Project`, `ProjectCreation`, `ProjectHome`,
`QueryPerformance`, `RedeemCredits`, `Settings`, `Sidebar`, `SignIn`,
`Support`, `UnifiedLogs`, and `UserDropdown`
- Updated affected tests (`Auth/Users/UserPanel`, `Home/ProjectList`,
`LocalDropdown`, `Organization/*`, `OrganizationInvite`,
`RedeemCredits`, `Settings/General/*`, `SignIn/SignInRecoveryCodeForm`,
`UnifiedLogs/*`)

**Simplified:**

- `LocalDropdown`, `UserDropdown` and `RedeemCredits` build the current
route from `location.href`, so the hash keeps its leading `#`
- `NewOrgForm` navigates to the `returnTo` path instead of an absolute
URL, which was being treated as external. It also uses a typed
`/new/$slug` navigate.
- Read search params from `useParams()` instead of `location.search`
casts (`CronJobPage`, `QueuePage`, `LogsPreviewer`,
`LinkSupportTicketPage`, `MarketplaceSidebar`, `PlanCards`,
`SignUpForm`)
- Dropped the dead `isReady`/`isRouterReady` constants and the
`navigate<AnyRouter, string>` casts where typed routes work
(`ForgotPasswordWizard`, `SignInPartner`, `ReportWidget`,
`ProjectUpgradeAlert`)
- Linter, `ReportHeader` and `LogsPreviewer` use `to: '.'` instead of a
separate pathname subscription. `CreateReportModal` builds the preserved
query params in `onSuccess` instead of a `useMemo`.
- Tests use the shared `createTestRouter` and `customRender` router.
`LocalDropdown` now tests that the hash is kept.

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

## To test

- [x] Query Insights: select a query and confirm search/filter updates
keep selection while switching projects/routes clears it; navigating to
Logs keeps Logs' query params intact and pressing Back restores Query
Insights' `?search=` param cleanly
- [x] Auth / Sign-in flows: sign in, sign up, MFA, recovery code,
forgot/reset password, and partner sign-in preserve `returnTo` and
redirect as expected
- [x] Organization & Project flows: creating an org/project, accepting
an org invite, claiming a project, redeeming credits, and
deleting/pausing/restarting a project or branch navigate cleanly
- [ ] Logs & Reports: replica selector appears on supported log routes
(`LOG_ROUTES_WITH_REPLICA_SUPPORT`), saved log queries open, and custom
reports create/navigate properly
- [ ] Sidebar, LocalDropdown, UserDropdown, Integrations
(Cron/Queues/Marketplace), Advisors/Linter, and Unified Logs navigate
cleanly

---------

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

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

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

**Changed:**

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

**Simplified:**

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

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

## To test

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

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-01 14:44:59 +08:00
Alaister YoungandAlaister Young 57d40e4705 [FE-5109] (part 3) refactor(studio): migrate layout components off next/router (#54055)
Part 3 of a 6-PR stack migrating all `next/router` and
`next/compat/router` imports in `apps/studio` onto TanStack Router hooks
and removing the router shims.

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

Migrates all `apps/studio/components/layouts/**` files and the studio
tab router integration off `next/router`.

**Added:**

- `useTabRouter()` in `apps/studio/state/tabs.tsx` so tab state actions
navigate via TanStack's `useNavigate` + `navigateToUrl` instead of
taking a `NextRouter` instance

**Changed:**

- Replaced `useRouter` across all layout directories (`AccountLayout`,
`AdvisorsLayout`, `AppLayout`, `AuthLayout`, `BranchLayout`,
`ComputeLayout`, `DatabaseLayout`, `DefaultLayout`,
`EdgeFunctionsLayout`, `ExplorerLayout`, `LogsLayout`, `Navigation/*`,
`ObservabilityLayout`, `OrganizationLayout`, `ProjectLayout`,
`ProjectNeedsSecuring`, `ProjectSettingsLayout`, `RealtimeLayout`,
`SQLEditorLayout`, `SignInLayout`, and `Tabs`) with TanStack Router
hooks (`useNavigate`, `useLocation`, `useRoutePattern`) and `useParams`
from `common`
- Updated `ProjectDropdown.utils.ts` and `ProjectDropdown.test.ts` to
work with TanStack `$param` route templates
- Updated layout component tests (`AccountLayout.selfhosted.test.tsx`,
`AdvisorsNavigationShortcuts.test.tsx`, `BranchLink.test.tsx`,
`ExplorerLayout.test.tsx`, `ExplorerNavChats.test.tsx`,
`ObservabilityMenu.utils.test.tsx`,
`MobileIssuesNavigation.platform.test.tsx`,
`ProjectLayout/index.test.tsx`, `ProjectNeedsSecuring.test.tsx`,
`ProjectDropdown.test.tsx`)

**Simplified:**

- `OrganizationLayout` and `SettingsLayout` match against
`useRoutePattern()` instead of the real pathname. An org slug ending in
a settings segment (e.g. `acmeapps`) no longer gets the settings title.
- `ProjectSettings.Commands` opens the Connect sheet through nuqs, the
same way `Connect.Commands` does
- `OrgMenuContent`, `OrganizationSettingsMenu` and `useTabRouter` read
`orgSlug`/`schema` from `useParams` instead of casting `location.search`
- Removed the dead `getPathnameWithoutQuery` helpers and their tests
- `usePreservedQueryParams` builds its string in the `useLocation`
selector (no `useMemo`), and `UnhealthyState` only navigates when `ref`
is set
- Moved `MobileIssuesNavigation.platform.test.tsx` onto a TanStack test
router. It now covers the active-route logic again.
- Tests use the shared `createTestRouter` and `customRender` router

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

## To test

- [ ] Switching projects, organizations, and branches from the top
header dropdowns preserves the current sub-route where supported
- [ ] Opening, switching, and closing Table Editor / SQL Editor tabs
updates the URL and active tab cleanly
- [ ] Active sidebar item highlighting works across Database, Auth, Edge
Functions, Observability, Logs, Realtime, Explorer, and Project Settings
layouts
- [ ] Mobile navigation menu and floating toolbar sheets open and
navigate properly

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-01 14:30:25 +08:00
supabase-vercel-tedd[bot]andJoshen Lim bd4912cbdc feat(studio): track SQL editor sidebar, snippet and editor tab usage (#54170)
## Context
Adds seven PostHog events through `useTrack` for the SQL Editor to
better identify usage patterns there, each fired from its click or
submit handler:
- `sql_editor_new_item_clicked` (`itemType`) for the "+" menu.
<img width="229" height="150" alt="image"
src="https://github.com/user-attachments/assets/f6281bdb-d70e-4e7c-adf3-edce0ec2116c"
/>
- `sql_editor_snippet_search_submitted`: once per search session, on the
first keystroke into an empty search box.
<img width="285" height="214" alt="image"
src="https://github.com/user-attachments/assets/4c482385-cab1-49d3-9aaa-e2be1aafb1af"
/>
- `sql_editor_snippet_sort_updated` (`sortBy`) when the sort order
changes.
<img width="226" height="121" alt="image"
src="https://github.com/user-attachments/assets/0e7268ee-bf4a-46d4-ba8d-f07a6e9b0675"
/>
- `sql_editor_snippet_action_clicked` (`action`, `isBulk`) for snippet
and folder context-menu actions.
<img width="254" height="275" alt="image"
src="https://github.com/user-attachments/assets/7338df06-47df-47be-b44d-6fc2dd49c586"
/>
- `sql_editor_snippet_share_submitted` when the share modal is
confirmed.
<img width="531" height="309" alt="image"
src="https://github.com/user-attachments/assets/997e7567-9fdb-400e-af1a-147a5dcbb7a7"
/>
- `sql_editor_snippet_moved` (`snippetCount`, `toNewFolder`) after a
move succeeds.
<img width="539" height="247" alt="image"
src="https://github.com/user-attachments/assets/f0da9544-d29e-402f-a0d3-9b7f5e3fa3c6"
/>
- `editor_tab_closed` (`closeType`, `editor`) in the tab bar that the
SQL, Table and Explorer editors share. It fires when the tabs actually
close, after any unsaved-changes confirmation.
<img width="147" height="64" alt="image"
src="https://github.com/user-attachments/assets/96073c69-acf1-4829-8532-beb283b7f373"
/>

No property carries names, SQL or search text, and every event is sent
with an explicit `track()` call.

## How to verify

On the PR's Studio preview, with analytics consent accepted, watch the
network requests to the telemetry endpoint:

1. In the SQL editor, open the "+" menu and pick a new snippet, a new
folder and (when available) a new logs query. Each one sends
`sql_editor_new_item_clicked` with the matching `itemType`.
2. Type into the snippet search box. One
`sql_editor_snippet_search_submitted` goes out on the first character,
and none on later ones. Clear the box and type again: one more goes out.
3. Change the sort to Alphabetical, then to Created At. Each change
sends `sql_editor_snippet_sort_updated` with `sortBy` `name` or
`inserted_at`. Picking the current sort again sends nothing.
4. Right-click a snippet and pick each action (open in new tab, rename,
move, share, unshare, duplicate, add to or remove from favorites,
export, delete). Each sends `sql_editor_snippet_action_clicked` with
that `action` and `isBulk: false`. Shift-click several snippets and pick
move or delete: `isBulk: true`.
5. Right-click a folder and pick create snippet, rename or delete:
`action` is `folder_create_snippet`, `folder_rename` or `folder_delete`.
6. Confirm the share modal: `sql_editor_snippet_share_submitted` goes
out. Move a snippet into a new folder: after it succeeds,
`sql_editor_snippet_moved` goes out with `snippetCount: 1, toNewFolder:
true`.
7. In the SQL editor and the Table editor tab bars, use Close, Close
Others, Close to the Right and Close All, and the tab's X button. Each
sends `editor_tab_closed` with the matching `closeType` and `editor`. If
you cancel an unsaved-changes prompt, nothing is sent.

---------

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-12-01 13:29:53 +07:00
K-Dog (Kevin) c76cbaaeed chore: micro upgrade copy (#54348)
We are trying to move away from the "Free" copy - it is free as in no
additional costs, but not FREE
2026-12-01 13:55:46 +08:00
Danny White 3dcb524f9e fix(studio): make OAuth access levels single-select (#54109)
## Problem

The OAuth app editor has separate Read and Write checkboxes. The menu
closes after each click, so choosing both scopes takes two trips through
the menu.

## Solution

Use Studio’s single-select control to set the full access level in one
step. The current scopes determine the label on the trigger. The choices
are **No access**, **Read only**, **Write**, and **Read and write**.
Each choice updates the scopes for that row and preserves other rows.

This is the base for #54006. The scoped personal access token editor has
a companion update in #54164.

| Before | After |
| --- | --- |
| <img width="651" height="297" alt="CleanShot 2026-11-26 at 15 33 36"
src="https://github.com/user-attachments/assets/dd74666a-9a5a-42fa-97f3-d866e5394d93"
/> | <img width="649" height="307" alt="CleanShot 2026-11-27 at 11 30
25"
src="https://github.com/user-attachments/assets/48395dd5-032e-49eb-9663-709eeac40fc3"
/> |

## Review instructions

1. Open the [OAuth Apps
preview](https://studio-staging-git-dnywh-oauth-permission-acces-6a3679-supabase.vercel.app/dashboard/org/_/apps)
and select **Publish OAuth app**.
2. Under **Application permissions**, try each access level on a row.
Check that one selection closes the menu and updates the trigger.
3. Select **No access** and check that both scopes are cleared for that
row. Check that another row’s selection stays in place.
2026-12-01 14:53:15 +11:00
Danny White 556faeab51 feat(studio): clarify authorized app grant details (#54284)
## Problem

The grants dialog makes project coverage and each member’s permissions
hard to inspect.

## Solution

- Replace the dialog with a grant-details sheet.
- Separate organisation and member access, with project references and
permissions grouped by access level.
- Move app IDs into Details and add a revoke action for authorised
admins.
- Build on #54285 using the existing grants API.

| Before | After |
| --- | --- |
| <img width="1280" height="1323" alt="OAuth Apps Organization Settings
Basket Supabase"
src="https://github.com/user-attachments/assets/b6bb0082-9cee-48b4-adb4-058f14f10f9f"
/> | <img width="1280" height="1323" alt="OAuth Apps Organization
Settings Basket Supabase"
src="https://github.com/user-attachments/assets/b32a7723-9fa0-452d-95f5-1762fd364163"
/> |
| <img width="1280" height="1185" alt="OAuth Apps Organization Settings
Basket Supabase"
src="https://github.com/user-attachments/assets/9a7982ba-aebe-42f4-9ac6-9308136150f7"
/> | <img width="1280" height="1221" alt="OAuth Apps Organization
Settings Basket Supabase"
src="https://github.com/user-attachments/assets/1965f7e4-8554-4fa9-86ef-7e53af1d0038"
/> |

## Review instructions

1. Sign in to staging and use an authorised app, or [authorise the test
app](https://api.supabase.green/v1/oauth/authorize?client_id=75e64165-b74e-432f-bb70-80d6ae432f06&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A54321%2Fcallback&state=grant-sheet-review).
The localhost callback may fail after the grant is saved.
2. Open the
[preview](https://studio-staging-git-dnywh-oauth-grant-details-supabase.vercel.app/dashboard/org/_/apps#authorized-apps),
select the same organisation and choose **Manage app → View access**.
3. Check the grant sections, project references and permission groups.
Test narrow widths, closing the sheet and cancelling **Revoke access**.

### Mixed-grant overrides

In **DevTools → Network**, override only the GET ending in
`/oauth/approvals/<app-id>/grants` with this response. Save, reload and
reopen the sheet. Remove any parent `/approvals` override to avoid
Chrome’s file/folder clash.

<details>
<summary>grants.json</summary>

```json
{
  "data": [
    {
      "id": "22222222-2222-4222-8222-000000000001",
      "type": "oauth_grant",
      "attributes": {
        "approved_at": "2026-11-30T00:00:00Z",
        "approved_scopes": [
          "database:read",
          "database:write",
          "projects:read"
        ],
        "kind": "organization_bound",
        "projects": null,
        "user": null
      }
    },
    {
      "id": "22222222-2222-4222-8222-000000000002",
      "type": "oauth_grant",
      "attributes": {
        "approved_at": "2026-11-30T00:00:00Z",
        "approved_scopes": [
          "projects:read"
        ],
        "kind": "member_bound",
        "projects": [
          {
            "name": "Example storefront",
            "ref": "example-storefront"
          }
        ],
        "user": {
          "username": "alex",
          "email": "alex@example.com",
          "gotrue_id": "33333333-3333-4333-8333-000000000001"
        }
      }
    },
    {
      "id": "22222222-2222-4222-8222-000000000003",
      "type": "oauth_grant",
      "attributes": {
        "approved_at": "2026-11-30T00:00:00Z",
        "approved_scopes": [],
        "kind": "member_bound",
        "projects": [],
        "user": {
          "username": "sam",
          "email": "sam@example.com",
          "gotrue_id": "33333333-3333-4333-8333-000000000002"
        }
      }
    }
  ],
  "links": {
    "next": null,
    "prev": null
  }
}
```

</details>

Check that organisation access covers all projects, Alex has only read
access to Example storefront, and Sam has no projects or permissions.
Disable overrides when finished.

Requires `enableScopedOAuthManage` for the organisation.
2026-12-01 09:57:35 +11:00
Danny WhiteandGildas Garcia 99a665b8d7 feat(studio): polish authorized app access actions (#54285)
## Problem

Authorized Apps hides access details behind a menu and uses a lengthy
revoke confirmation. Opening and closing these views should work
consistently with a mouse and keyboard.

## Solution

- Open access details from the app row, app name or **View access** menu
action.
- Remove the menu tooltip, use consistent labels and hide
unavailable-action separators.
- Use a compact **Revoke access** confirmation with focus returned to
the initiating control.
- Keep the existing grants dialog and table IDs; the sheet follows in
#54284.

| Before | After |
| --- | --- |
| <img width="1274" height="687" alt="CleanShot 2026-11-30 at 17 40 25"
src="https://github.com/user-attachments/assets/e7eb9411-cc2e-4bf2-8599-979f06069791"
/> | <img width="1273" height="679" alt="CleanShot 2026-11-30 at 17 40
05"
src="https://github.com/user-attachments/assets/d6b38690-7ba2-4c8c-adfc-0e0e356f7687"
/> |
| <img width="576" height="284" alt="CleanShot 2026-11-30 at 17 44 18"
src="https://github.com/user-attachments/assets/e2b7f015-c214-4034-b6ab-a4afc050510d"
/> | <img width="424" height="207" alt="CleanShot 2026-11-30 at 17 44
36"
src="https://github.com/user-attachments/assets/77df776d-bc93-4cdb-b333-2c6c54ed6554"
/> |


## Review instructions

1. Use a staging test organisation with an authorised app. If needed,
[authorise the existing test
app](https://api.supabase.green/v1/oauth/authorize?client_id=75e64165-b74e-432f-bb70-80d6ae432f06&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A54321%2Fcallback&state=grant-sheet-review).
The localhost callback may fail to load after the grant is saved.
2. In the [Studio staging
preview](https://studio-staging-git-dnywh-oauth-access-list-polish-supabase.vercel.app/dashboard/org/_/apps#authorized-apps),
open **OAuth Apps → Authorized Apps** at
`/dashboard/org/_/apps#authorized-apps`. Click an app row or name, then
use **Manage app → View access**. Each opens the existing grant-details
dialog.
3. Focus the app name and press Enter or Space. Close the dialog and
check focus returns to the app name. Opening from the row or menu should
return focus to **Manage app**.
4. As an admin, select **Manage app → Revoke access**. Check the compact
confirmation names the app and explains the organisation and member
impact. Cancel it and check that grant details do not open accidentally
and focus returns to the app menu. Revoke only a disposable test grant
when checking submission.
5. As a user without revoke permission, check the menu has no revoke
action or stray separator. Repeat the controls and confirmation at a
narrow width.

---------

Co-authored-by: Gildas Garcia <1122076+djhi@users.noreply.github.com>
2026-12-01 09:47:05 +11:00
9b3435010c fix(studio): show client ID and app ID on OAuth apps page (#54324)
## Problem

On the OAuth apps page in Studio, the table showed only the Client ID,
and the edit panel showed the app ID as unlabeled `ID: ...` text under
the app name. It was hard to tell the two IDs apart, or to copy the
right one. That contributed to the wrong ID type being handed to the
team that manages the Stripe pipeline allowlist (incident, Nov 20–23).

## Solution

- **Table:** add an **App ID** column next to **Client ID**. Both are
shown shortened (`65****9a71`) with a copy button. Hover an ID to show
the whole value. The copy button always copies the whole value.
- **Edit panel:** show **Client ID** and **App ID** as separate labeled,
copiable fields (full value, not shortened), each with one line of
helper text:
- Client ID: "Used to identify your app when it makes OAuth requests to
Supabase."
- App ID: "Used to manage your app on Supabase, such as updating or
deleting it."
- Remove the old `ID: ...` description under the app name.
- Add one small shared component, `OAuthAppId`, used by the table and
the edit panel.

The helper text follows the discussion in Slack: `client_id` is what the
deployed app sends in OAuth requests to the Management API, and `app_id`
is the primary key the app's author uses in platform APIs (for example
to update or delete the app).

Not in this PR: the Authorized apps table already shows its App ID with
a copy button, so it is unchanged. No API or data changes.

## Please check

- **Helper text wording.** Is it accurate for both IDs?
- **Shortened IDs.** The first 2 and last 4 characters, with `****`
between, only for IDs longer than 20 characters.

## Review instructions

1. Open **Organization → OAuth Apps** (`/org/<slug>/apps`) and create an
app if there is none.
2. In **Publishable apps**, check that **Client ID** and **App ID** both
show as shortened values, and that each copy button copies the full
value.
3. Hover a shortened ID. It should show a tooltip with the full value.
4. Open the app's edit panel. Check that Client ID and App ID are
labeled, show the full value, and copy correctly, and that the old `ID:
...` text under the app name is gone.

Checked locally against the full platform stack (format, lint,
type-check, and by eye). No tests added: the change is layout and
display only.

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

---------

Co-authored-by: John Stokvis <345546350+stokvis-at-supabase@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: kemal <hello@kemal.earth>
2026-11-30 15:55:56 -06:00