Commit Graph
10 Commits
Author SHA1 Message Date
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
Alaister Young c3a7e1019e chore(api-types): sync types with production OpenAPI specs (#53839) 2026-11-23 17:38:29 +08:00
Charis e05ef0e50c fix(studio): use API collation warning for read replica eligibility (#53049)
## What

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

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

## API types

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

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

## Testing

- Studio typecheck passes (the one remaining error, in `ui-patterns`
McpUrlBuilder, is also on `master`).
- Read replica and infrastructure settings unit tests pass.
2026-11-05 15:20:51 -05:00
Jordi Enric 8ba2f0a63b feat(studio): clarify memory commitment risk thresholds FE-4467 (#51799)
## Problem

The memory commitment chart presents the kernel commit limit as a hard
failure threshold, even though committed memory can remain unused.

Closes
[FE-4467](https://linear.app/supabase/issue/FE-4467/update-memory-commitment-ui-with-risk-zones).

## Fix

Show only the highest risk threshold exceeded anywhere in the selected
time range: Acknowledgment (yellow), Problematic (orange), or Severe
(red). Draw its dashed line and place a matching Warning badge in the
card header with keyboard-accessible guidance. Show neither a warning
line nor a badge when no threshold is exceeded; equality alone does not
trigger a warning.

Thresholds remain 50%, 80%, and 90% of estimated physical RAM plus 1 GiB
of swap, using each timestamp's capacity. Missing readings stay
unavailable. Remove in-chart labels and keep only Committed in the
source legend.

Keep the vertical range anchored at zero and full estimated capacity,
expanding for observed overcommitment. A neutral dashed capacity line
follows historical infrastructure changes. Dashed references render
above the bars and area fills. The hover tooltip identifies Full
commitment capacity at that timestamp and excludes it from Total.

The developer toolbar includes a Metrics tab with a Memory commitment
selector: Default (real data), Warn, Problematic, and Severe. Simulated
states include a capacity change and apply only to the selected
project’s memory chart. Overrides are in-memory, leave real query data
untouched, and are enabled only in local/staging. Both Studio runtimes
register the tab.

## Screenshots

### Capacity changes with connected dashed lines

![Capacity changes with connected dashed
lines](https://github.com/user-attachments/assets/6773f250-4189-4039-aaeb-d82404751e39)

### Chart tooltip with full commitment capacity

![Chart tooltip with full commitment
capacity](https://github.com/user-attachments/assets/c1f02232-c04f-4646-ac51-83c9d2815bcf)

### Problematic warning and connected threshold lines

![Problematic warning and connected threshold
lines](https://github.com/user-attachments/assets/3d48f1f9-a74d-43c5-a9bc-d8f274ea5d28)

## How to test

1. Open Observability > Database and inspect Memory commitment in bar
and line views.
2. With no threshold exceeded, confirm no warning badge or threshold
line appears.
3. In the developer toolbar, open Metrics and select Warn, Problematic,
then Severe. Confirm the matching badge and only the highest crossed
warning threshold appear. Close the toolbar to inspect the chart; the
selected state remains active.
4. Hover or focus Warning to read the matching threshold and guidance.
5. Confirm the neutral capacity line steps down midway through each
simulated range.
6. Select Default (real data) to restore live readings. Reloading also
clears simulations.

Validation: 168 affected tests passed with retries disabled and shuffled
runs. Production-guard and incorrect-risk-level mutations failed as
expected; tests passed after restoring the implementation. Formatting
and code review passed.
2026-10-22 14:30:49 +02:00
Drew McLellan 1d9808ab8b fix(studio): name the organization in the overdue invoices banner (#51747)
## Problem

The "Outstanding invoices in other organization" banner asks users to
pay invoices to avoid service disruption, but never says which
organization has them. Users with several organizations have to guess
where to go.

The banner also looked at only the first overdue organization. Its link
pointed at that organization's billing page without naming it, and if
the lookup failed, it fell back to the current organization's billing
page.

Linear: FE-4587

## Solution

- `useOrganizationRestrictions` now collects every other organization
with overdue invoices from the organizations list. It dedupes them,
excludes the current one, and orders them by name, which the list
already is. It no longer falls back to the current organization's slug.
- The banner names only the first organization, linked to its billing
page: "Pay invoices for **Acme** to avoid service disruption". When more
organizations are affected it adds a count: "…for **Acme** and 2
others…". Paying the first often clears the rest, and the next one
appears once it's resolved.
- If no affected organization can be resolved, for example the user lost
access, the banner shows "Pay outstanding invoices to avoid service
disruption", linking to `/organizations`.
- The title is now plural: "Outstanding invoices in other
organizations".
- The dev toolbar's "overdue invoices from other org" override now
injects overdue invoices for every real other organization. It
previously used a made-up ID, so the banner could never show a name. I
also replaced a nested ternary there, per Studio's style rules.


For one org:
<img width="1022" height="42" alt="Screenshot 2026-10-14 at 12 01 32"
src="https://github.com/user-attachments/assets/8f34c2ff-d47f-45fc-80a4-c7cdc3df558b"
/>

For multiple orgs:
<img width="1057" height="42" alt="Screenshot 2026-10-14 at 13 39 42"
src="https://github.com/user-attachments/assets/2100b0b5-65a3-4d7c-8521-48d8e71b62ef"
/>

Note: Overdue invoice counts are not shown by design, only that one or
more overdue invoices exist for an org.

## Review instructions

1. Run Studio in platform mode with at least three organizations, and
open a project page.
2. Enable the dev toolbar from the account menu ("Local tools" > "Dev
toolbar").
3. In the Warnings tab when on a Project page, choose "Overdue invoices
from other org".
4. Check that the banner names the first other organization
alphabetically, shows "and N others" when there's more than one, and
that the name links to that organization's billing page.
5. Use "Reset to real data" to clear the override.

Tests: `pnpm --filter studio exec vitest run
components/interfaces/Organization/restriction.constants.test.tsx
hooks/misc/useOrganizationRestrictions.test.tsx`

### Mocking in QA

Mock `/platform/stripe/invoices/overdue` for overdue invoice counts in
different organizations.
Note: The endpoint will not return an org in the result if the overdue
invoice count is zero.

## 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)
(not applicable)
2026-10-15 12:45:30 +01:00
Joshen Lim bc0c1999ca Update dev toolbar to support mocking org restrictions (#48136)
## Context

Only applies for local development - adds a way to mock org restrictions
with the dev toolbar
<img width="1392" height="484" alt="image"
src="https://github.com/user-attachments/assets/64b8b0c6-c59a-453a-88fa-ffbc2565cd87"
/>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added organization-level warning controls to the development toolbar,
including a new “Organization warnings” section to simulate restriction
status variants (none, grace periods, restricted, and overdue-invoice
scenarios, including an “other org” option).
* Updated the existing project-warning controls’ guidance to reference
the current organization or project.
* **Bug Fixes**
* Improved cleanup so resetting or closing warning overrides reliably
restores the real organization and invoice warning data, including after
navigation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-21 17:13:55 +08:00
Danny White e3d7267845 fix(studio): chip away explicit-tabindex ratchet debt (#48040)
## What kind of change does this PR introduce?

A11y cleanup follow-up to #47984 /
[DEPR-626](https://linear.app/supabase/issue/DEPR-626).

## What is the current behavior?

Studio had 82 ratcheted `supabase/require-explicit-tabindex` violations
(raw `<button>` / `role="button"` without explicit `tabIndex`).

## What is the new behavior?

- Explicit `tabIndex={0}` (or disabled → `-1`) on those Studio call
sites across nav, `components/ui`, Database, Storage, and the remainder
- Ratchet baseline cleared (**82 → 0**) and the rule **removed from the
Studio ratchet** (debt is gone; ratchet is temporary)
- Rule remains a shared **`warn`** for now — promoting to `error` (and
sweeping www/docs/design-system) is a follow-up
- Also fixed the learn/ui-library call sites that surfaced while
experimenting with error promotion
- Small follow-ups where making controls focusable exposed gaps:
accessible names, disabled/focus consistency, focus-ring polish on
To-test surfaces, home section `KeyboardSensor`, and an E2E locator
tightened after `aria-label="Remove column"`

Prefer migrating to `Button` from `ui` in future touch-ups; this PR
takes the minimal path so Studio debt can stay at zero.

## Additional context

Batches landed together so baseline conflicts stayed simple while
chipping away:

- Hotspots / nav (FirstLevelNav, Marketplace, AttachmentUpload, Column,
Tabs, …)
- `components/ui` shared
- Database + Storage
- Remainder

**Out of scope / intentional deferrals**

- Promoting `supabase/require-explicit-tabindex` to a lint **error**
(follow-up after www/docs/design-system sweeps)
- Tabs/Radio roving, tooltips, context menus, in-menu items
- Full keyboard-accessible tab-close UX (close stays hover +
`tabIndex={-1}`; context menu still closes tabs)
- Data API docs links (`/project/<ref>/api` redirect)

**Reviewer notes**

- Rule only flags raw `<button>` / `role="button"` without a `tabIndex`
prop. `Button` from `ui` already bakes this in
- `tabIndex={-1}` is intentional for disabled controls, in-menu /
roving-focus children, and hover-only tab close
- For dnd-kit grips, put `tabIndex` **after** `{...attributes}` so it
isn’t overwritten (TS2783)

### To test

Use **Safari** with macOS Keyboard navigation **off** (System Settings →
Keyboard). Chrome once for a sanity pass. For each surface below: Tab
until the control is focused, then activate with Enter/Space where
relevant.

1. **API Docs side panel** (Table Editor → open a table → **API docs**)
- Floating API Docs panel — **not** `/project/<ref>/api` (that redirects
to Data API docs; language ToggleGroup uses arrow keys; links are out of
scope)
- Left nav buttons — Tab through several and activate one; active
highlight / navigation still works

2. **Integrations → Marketplace**
- Enable **Integrations layout** feature preview first (avatar menu →
Feature previews)
   - `/org/<slug>/integrations` or project integrations marketplace
   - “Clear all”, grid/list toggles — Tab + activate

3. **Table Editor → create a table → Columns**
- Drag handles only appear while **creating** (not when editing an
existing table)
   - Tab to grip / remove (X) / sensitive-data eye if shown

4. **Project Home** — section drag handles
   - Tab to a grip (visible focus ring)
- Optional: Space to pick up, arrows to move, Space/Esc to drop
(KeyboardSensor added)
   - Mouse dnd still works

5. **Storage → Policies** — expand/collapse bucket list chevron
(design-system focus ring, no stuck grey open bg)

6. **Support form** (Help → Support) — attachment remove (×) and
add-attachment control when visible

Disabled controls should be **skipped** by Tab.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Accessibility Improvements**
* Improved keyboard navigation throughout Studio by explicitly managing
focus (`tabIndex`) across many interactive controls (menus, tabs,
tables, charts, dialogs, navigation, and form actions).
* Disabled or non-interactive controls are now removed from the tab
order (or made unfocusable), while available actions remain reachable.
* Ensured `type="button"` on relevant controls to prevent unintended
submissions, and refined keyboard focus behavior for various toggles and
copy/remove actions.
* **Chores**
* Updated the ESLint rule baseline configuration to match the new focus
behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-21 08:22:43 +10:00
Jordi Enric dbdbe1540b fix(studio): make paused project messaging easier to scan DEPR-581 (#47807)
## Problem

The free-plan paused project notice was a dense paragraph, so the key
points (data is safe, resume window, download-after-expiry, upgrade)
were easy to skip.

## Fix

Present those points as a scannable bullet list, keeping the dynamic
day-count tooltip, restore-deadline timestamp, and the existing
Pro-wording variant.

Also adds a "Project Status" tab to the dev toolbar (local and staging
only) with a select for forcing the current project's status, so the
paused state and other statuses are easy to preview without touching the
backend. It overrides the status in the React Query cache and reverts on
close, project navigation, or reset.

## How to test

- Run Studio locally against the platform API
- Open the dev toolbar, go to the Project Status tab, and select
INACTIVE
- Navigate to a project page and confirm the paused screen renders
- On a free-plan org, confirm the notice now shows the details as bullet
points with the day-count tooltip and restore-deadline date intact
- Click "Reset to real data" (or close the toolbar) and confirm the
status reverts

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added a development toolbar “Project Status” tab to simulate project
status and pause states in non-production environments.
* Status and pause-state overrides persist locally, can be reset, and
are reflected across project detail and paused-state views.
* **Style**
* Refined paused-project messaging: updated the heading and reworked the
free-plan explanation into bullet points, while keeping paid-plan
messaging paragraph-based for readability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-13 10:30:28 +02:00
Ivan VasilovandJordi Enric 56de26fe22 chore: Migrate the monorepo to use Tailwind v4 (#45318)
This PR migrates the whole monorepo to use Tailwind v4:
- Removed `@tailwindcss/container-queries` plugin since it's included by
default in v4,
- Bump all instances of Tailwind to v4. Made minimal changes to the
shared config to remove non-supported features (`alpha` mentions),
- Migrate all apps to be compatible with v4 configs,
- Fix the `typography.css` import in 3 apps,
- Add missing rules which were included by default in v3,
- Run `pnpm dlx @tailwindcss/upgrade` on all apps, which renames a lot
of classes
- Rename all misnamed classes according to
https://tailwindcss.com/docs/upgrade-guide#renamed-utilities in all
apps.

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-04-30 10:53:24 +00:00
Jordi EnricandClaude Sonnet 4.6 1545df1fe6 feat(dev-tools): add resource warnings tab to dev toolbar (#44857)
## Problem

There was no way to trigger resource warning banners in the dev toolbar,
making it hard to test different warning states (warn/critical,
read-only mode) without manually mocking API responses or waiting for
real exhaustion events.

## Fix

- Adds an ExtraTab extension point to DevToolbar so Studio can inject
custom tabs without coupling the package to app-specific hooks
- Adds a ResourceWarningsTab in Studio with per-type off/warn/crit
toggles for disk IO, CPU, memory, disk space, and auth rate limit
warnings, plus a read-only mode toggle
- Auth rate limit only exposes warn (no crit) since critical is not a
valid API return value
- The tab component is dynamically imported so it stays out of
production bundles, controlled by the same NEXT_PUBLIC_ENVIRONMENT guard
used by the toolbar

## How to test

1. Run Studio locally or open a Vercel preview deployment
2. Open the browser console and run window.devTelemetry() to enable the
toolbar
3. Click the toolbar trigger to open the panel
4. Switch to the "Warnings" tab
5. Toggle any warning type to "Warn" or "Crit" and confirm the banner
appears at the top of the page
6. Toggle read-only mode on and confirm the read-only banner appears
7. Click "Reset to real data" and confirm banners return to their actual
state
8. Confirm the Auth Rate Limit row only has Off and Warn buttons (no
Crit)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* New "Warnings" tab in the developer toolbar (enabled in local and
staging) for managing resource warning banners.
* Per-resource severity overrides (Off / Warning / Critical) with
immediate preview in the toolbar.
  * Local "read-only" toggle to simulate read-only mode.
* "Reset to real data" clears overrides, disables the local toggle, and
refreshes server state.
* Tab loads lazily and shows a disabled/loading state if org/project
context is unavailable.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 11:09:47 +02:00