mirror of
https://github.com/supabase/supabase.git
synced 2026-12-03 23:18:57 +00:00
docs/tutorial-template
395
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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> |
||
|
|
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>
|
||
|
|
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) |
||
|
|
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) |
||
|
|
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> |
||
|
|
d98f706b7c |
[FE-5109] (part 1) refactor(studio): migrate core hooks, lib, and prefetchers off next/router (#54053)
Part 1 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 ← this PR** | **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 | Remove `next/router` & `next/compat/router` shims, `_router-events.ts`, Vite aliases, and test mocks | Introduces the shared TanStack navigation helpers needed across the stack and migrates `hooks/**`, `lib/**`, and `data/prefetchers/**` off `next/router`. **Added:** - `navigateToUrl` in `apps/studio/lib/navigation.ts` (plus unit tests in `lib/navigation.test.ts`): shared helper for navigating to internal string URLs via TanStack's `useNavigate` (splitting pathname, search params, and hash via `splitInternalUrl`, and handling external/protocol-relative URLs) - `useRoutePattern` in `apps/studio/hooks/misc/useRoutePattern.ts` (plus `useRoutePattern.test.tsx`): returns the active matched TanStack route template (e.g. `/project/$ref/editor/$id`) as the replacement for Next's `router.pathname` **Changed:** - Migrated `hooks/misc/*` (`useHydratedQuery`, `useStudioCommandMenuTelemetry`, `useTableEditorFiltersSort`, `withAuth`) and `hooks/use-check-latest-deploy.tsx` to TanStack's `useLocation`, `useNavigate`, `useRoutePattern`, and `useParams` from `common` - Migrated `lib/profile.tsx` and `lib/telemetry/track.ts` off `next/router` - Migrated `data/prefetchers/project.$ref.tsx`, `project.$ref.editor.tsx`, and `project.$ref.editor.$id.tsx` to `useRouter().preloadRoute` - Wrapped `ReactQueryTestConfig` in `apps/studio/tests/helpers.tsx` with `RouterContextProvider` and updated hook/navigation tests (`useTableEditorFiltersSort*.test.*`, `useFilterLifeCycle.navigation.test.tsx`, `useTableFilter.navigation.test.tsx`, `useInboundBranding.test.ts`, `state/tabs.test.ts`) **Simplified:** - `navigateToUrl` passes `replace` straight through and documents that `url` must be an app-relative path or an external URL. `StudioFrameworkProvider`'s `push` now reuses it. - `useRoutePattern` reads matches and location in a single `useRouterState` subscription - `useTrack` and `useStudioCommandMenuTelemetry` take the pathname from `useFramework()`, the same source as pageviews, so custom events and pageviews always send the same pattern (e.g. `/project/[ref]/sql/[id]`). New tests pin the strings sent, and `toRoutePattern` now has its own unit tests. - Removed `useCurrentPath` (a one-line wrapper with one consumer): `OrganizationSettingsLayout` calls `useLocation` directly - Dropped the no-op `.catch(() => {})` on `preloadRoute` in the prefetchers (`preloadRoute` never rejects) - `useTableEditorFiltersSort` builds the next search with a spread instead of a delete loop - Added `createTestRouter()` to `tests/lib/custom-render.tsx`, and `customRender`/`customRenderHook` now return the `router`. The rest of the stack uses these instead of hand-copied `createRouter` setups. Addresses [FE-5109](https://linear.app/supabase/issue/FE-5109/replace-the-nextrouter-shims-with-tanstack-router-hooks) ## To test - [ ] Auth redirect flow (`withAuth`) still preserves `returnTo` query parameters when redirecting unauthenticated users to `/sign-in` - [ ] Table Editor sort and filter URL sync (`useTableEditorFiltersSort`) persists and clears `?sort=` / `?filter=` across table switches - [ ] Hovering project and table editor links still triggers route/data prefetching without console errors - [ ] Page view and command menu telemetry still records route patterns and paths accurately --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> |
||
|
|
953e508a3e |
[FE-5110] refactor(studio): replace next/navigation with TanStack (#54041)
Moves the remaining `next/navigation` imports in Studio onto TanStack
Router hooks (and `useParams` from `common`), finishes migrating the
remaining `next/link` and `next/router` usages in the touched
components, and removes the `compat/next/navigation.ts` shim and its
Vite alias. Shared packages (`packages/**`) no longer import
`next/navigation`, so the alias can be dropped now.
**Removed:**
- `apps/studio/compat/next/navigation.ts` and the `'next/navigation'`
entry in `apps/studio/vite.config.ts`
- Global `next/navigation` mock in `apps/studio/tests/vitestSetup.ts`
and the obsolete `apps/studio/tests/lib/route-mock.test.tsx`
**Changed:**
- Replaced `usePathname` (12 files) and `useSearchParams` (3 files) with
`useLocation({ select })` from `@tanstack/react-router`
- Replaced `useRouter` in Storage bucket tables, SQL Editor commands,
and `SignInMfaForm` with `useNavigate` from `@tanstack/react-router`,
and updated `createNavigationHandler` in `lib/navigation.ts` to accept
either `NextRouter` or TanStack's `useNavigate`
- Replaced remaining `next/link` imports in touched components
(`SignInMfaForm`, `Restriction`, `DownloadLogsButton`,
`DownloadResultsButton`, `AuthEmailsLayout`, `AuthProvidersLayout`,
`JWTKeysLayout`, `StorageBucketsLayout`) with TanStack Router's `Link`
- Replaced `useParams` in `CreatePublishableAPIKeyDialog` with
`useParams` from `common` (matching `CreateSecretAPIKeyDialog`)
- Wrapped `CustomWrapper` (`tests/lib/custom-render.tsx`) in a default
TanStack `RouterContextProvider` (with optional `router` / `initialUrl`
overrides) and updated affected component tests to drop their
`next/navigation` mocks
Addresses
[FE-5110](https://linear.app/supabase/issue/FE-5110/replace-the-nextnavigation-shim-with-tanstack-router-hooks)
## To test
1. Check active tab highlighting and navigation across Auth Emails, Auth
Providers, JWT Keys, Storage Buckets, and Editor layouts
2. Verify clicking, Cmd/Ctrl-clicking, middle-clicking, and pressing
Enter on Storage bucket rows (Files, Analytics, Vector) navigates as
before
3. Run "Query a table..." and open SQL snippets from the Command Menu
and confirm `/project/$ref/sql/$id` opens with multi-line SQL preserved
in `?content=`
4. In the MFA sign-in flow, verify the recovery code link and
`forgot-password` completion preserve query params (`returnTo`,
`context=forgot-password`), and Cancel signs out and replaces history
with `/sign-in`
5. Confirm Table Editor sort/filter URL sync persists filters per table
without leaking across table switches
---------
Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
|
||
|
|
fcbdda8107 |
chore: migrate formatter from Prettier to oxfmt (#53835)
Migrate code formatting across the monorepo from Prettier to `oxfmt`
(`0.79.0`, pinned) for much faster formatting checks locally and in CI
while keeping code churn minimal (78 files total, 0.7% of the repo).
Studio's `@ianvs/prettier-plugin-sort-imports` ordering
(`<BUILTIN_MODULES>`, `<THIRD_PARTY_MODULES>`, blank line, then `@/` and
relative imports) is preserved via `oxfmt`'s native `sortImports`
override for `apps/studio/**/*.{js,jsx,ts,tsx}`.
### Performance (before vs after, uncached)
| Benchmark | Prettier (`3.8.x`) | oxfmt (`0.79.0`) | Speedup |
| --- | ---: | ---: | ---: |
| CI formatting step (`blacksmith-4vcpu-ubuntu-2404`, full repo) | `73s`
| **`7s`** | **~10×** |
| Local `apps/studio` JS/TS (`5,157` files) | `17.74s` | **`0.36s`** |
**~49×** |
| Local full monorepo (`11,131` files) | — | **`2.39s`** | — |
**Added:**
- `.oxfmtrc.jsonc` at repo root with Prettier-matching options,
`sortPackageJson: false`, the Studio `sortImports` override, and ignore
patterns migrated from `.prettierignore`
- `oxfmt` (`0.79.0` exact pin) in `pnpm-workspace.yaml` catalog and
workspace `devDependencies` / `dependencies`
- Shared `.agents/scripts/format_and_lint.sh` hook script and
`.agents/hooks.json` (used by both Claude Code and Antigravity)
**Changed:**
- Replaced `test:prettier` with `format:check` and switched `format` in
root `package.json` to `oxfmt`
- Updated `packages/api-types` (`codegen`,
`verify-production-types.mjs`), `apps/design-system` (`build:registry`),
`apps/docs` (`CodeSample.ts`, `generate-sitemap.ts`, `next.config.mjs`,
`spec/Makefile`), `apps/www` (`generate-sitemap.mjs`), and
`packages/build-icons` (`generateIconFiles.mjs`) from Prettier to
`oxfmt`
- Updated `.github/workflows/prettier.yml` (keeping the `format` job ID
intact), `.github/workflows/autofix_linters.yml`,
`.claude/settings.json`, `AGENTS.md`, `CONTRIBUTING.md`, and
`.github/copilot-instructions.md`
- Applied one-time `oxfmt` formatting pass in a separate commit (78
files: 30 `i18n/README.*.md` trailing spaces, 19 Studio files, 17 other
TS/TSX/generated types, 8 MD/MDX, 3 `package.json`, 2 example CSS files)
**Removed:**
- `prettier`, `@ianvs/prettier-plugin-sort-imports`, and
`prettier-plugin-sql-cst` from `devDependencies` (note: `.sql` files
were not part of the CI formatting glob; `eslint-config-prettier` is
kept for ESLint)
- `prettier.config.mjs`, `.prettierignore`, and
`.claude/scripts/format_and_lint.sh`
## To test
- Run `pnpm run format:check` and confirm it passes cleanly across all
matched files
- Run `pnpm --filter api-types test`, `pnpm --filter docs exec vitest
run features/directives/CodeSample.test.ts`, and `pnpm --filter www exec
vitest run generate-sitemap.test.ts`
- Edit an `apps/studio` file with out-of-order imports and run `pnpm run
format` to confirm builtin/third-party vs `@/`/relative grouping matches
prior behavior
- Check that the `Check Code Formatting` CI workflow passes on this PR
---------
Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
|
||
|
|
7e92210d31 |
Replace useUrlState with useQueryState, and deprecate (#53726)
## Context We've got a `useUrlState` hook that was written a long time ago, which is now deprecated and can be replaced with nuqs' `useQueryState` - so this PR cleans that up and deletes the hook. ## To test Just 2 surfaces in the dashboard that's affected - Project -> Settings -> Addons - [ ] Verify that opening/closing the addon panels toggle the panel URL param accordingly - Table Editor filters and sorts - [ ] Verify that landing on the editor with `?create=table` URL param opens the new table panel + removes the URL param - [ ] Verify that filter and sorts still work + including refreshing the browser should land back on the same state - [ ] Verify that renaming a column while there's a filter/sort applied for that column will also update the URL param |
||
|
|
037ee2afad |
fix(studio): name the actual config file on the code configuration page (#53518)
## Problem
The Code configuration page (`ConfigDrift`) hard-codes `config.toml` in
its copy. The GitHub connection config endpoint (`GET
/platform/integrations/github/connections/{id}/config`) now also reads
`supabase/config.json` and `supabase/config.jsonc` and returns the file
it read in `path`, so a project with a JSON config sees wording about a
file it doesn't have.
Linear: CLI-2954
## Solution
- `useSelectedGitHubConfigDrift` returns `configFileName`, the basename
of the response's `path`.
- The drift page uses it in the column header, drift banner, decode
error title, overwrite warning and the Matching / Not tracked sections.
Where no file is known (the no-connection empty state) it says "config
file".
- `formatGitHubConfigDecodeMessage` takes the file name, falling back to
"The config file".
- The `config-toml` error source is renamed to `config-file`.
- Small copy fix in the warning: "redeploys … and overwrites changes
made here".
TOML projects see the same text as before, since `path` resolves to
`config.toml`.
## Review instructions
1. Open the Code configuration page for a project connected to a repo
with `supabase/config.toml` and confirm the copy is unchanged.
2. Repeat for a repo with only `supabase/config.jsonc` and confirm the
page names `config.jsonc` throughout.
3. `pnpm --filter studio exec vitest run
components/interfaces/ConfigDrift` covers both cases, including a JSONC
decode error.
## Checklist
- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [x] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
|
||
|
|
8fcd5e7f65 |
feat(studio): add Warehouse report date controls (#53494)
## Problem The Warehouse report only shows the last hour. ## Solution Add date selection and refresh using the shared report controls. Respect the organisation’s log retention limits and the metrics API’s 30-day maximum. | After | | --- | | <img width="1688" height="1050" alt="CleanShot 2026-11-18 at 11 35 24@2x" src="https://github.com/user-attachments/assets/88267bf8-1054-480b-ac26-c0c2b58386bc" /> | | _The new controls._ | | <img width="2420" height="1028" alt="CleanShot 2026-11-18 at 11 47 52@2x" src="https://github.com/user-attachments/assets/383c06a0-5470-4748-b9a6-fe80647a1399" /> | | _The standard retention upgrade prompt follow tapping either of these on a Pro plan._ | ## Review instructions 1. Open the [Studio staging preview](https://studio-staging-git-dnywh-warehouse-metrics-range-supabase.vercel.app) and select a staging project with Warehouse access. 2. Open **Observability > Warehouse**, or `/project/<ref>/observability/warehouse` ([example](https://studio-staging-git-dnywh-warehouse-metrics-range-supabase.vercel.app/dashboard/project/yirnfrgkxmnqgexikhfc/observability/warehouse)). Change Last 60 minutes to Last 24 hours and check that the chart or no-data state reflects the selected period. 3. Refresh the report. Check that the selected period stays selected. 4. On a paid staging organisation, select a period beyond its log retention (for example, Last 14 days with 7-day retention). Check that the retention upgrade prompt appears and the current period stays selected. --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com> |
||
|
|
cc2024fca5 |
fix(studio): clarify data access during project creation (#53430)
Resolves [FE-5087](https://linear.app/supabase/issue/FE-5087/gradually-default-automatic-table-exposure-to-unchecked-behind-a) ## Problem The new project form does not clearly distinguish API access, automatic table grants, and RLS. ## Solution Rename “Security” to “Data access”, shorten the copy, and align the checkboxes. Show automatic table grants only when Data API is enabled. Keep automatic RLS available independently. Default automatic grants to off, with inline warnings for disabled Data API queries and unrestricted table access. <!-- linear:table-colwidths:689 --> <table> <thead> <tr> <th>After</th> </tr> </thead> <tbody> <tr> <td> https://github.com/user-attachments/assets/b545a6ec-7f05-46e7-badc-382020d44d5e </td> </tr> </tbody> </table> ## Review instructions 1. Open an organisation’s **New project** form from the [dashboard](<https://studio-staging-git-fix-studio-project-data-access-supabase.vercel.app/>). 2. Under **Data access**, toggle Data API off and on. Check that automatic table grants hide and reappear with the selection preserved. --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com> |
||
|
|
9aed3bcb6e |
fix(studio): load more query performance rows when the grid isn't scrollable (#53457)
## Problem On the Query Performance page, more rows only load when the grid fires a scroll event. The first page is 20 rows at 44px each, so on a tall viewport the rows don't overflow the grid. The user can't scroll, and the remaining rows never load. Zooming in works around it. The same dead end happens whenever a client-side filter leaves too few loaded rows to fill the grid. Fixes part of FE-5092. The `calls >= N` filter returning no results is a separate cause and will follow in its own PR. ## Solution `useInfiniteScroll` now takes an optional `containerRef` (the `DataGrid` ref) and `rowCount`. When the ref is passed, the hook also requests the next page whenever the grid's content doesn't overflow its container and there is another page, and it re-checks when the container resizes. Existing callers that don't pass it behave as before. The three `react-data-grid` consumers of the hook share the same dead end, so all three now pass the ref: Query Performance, Cron Jobs and Cron Job runs. For Query Performance, the hook call moved from `WithStatements` into `QueryPerformanceGrid`, which owns the grid ref. ## Review instructions 1. Open Observability → Query Performance on a project with more than 20 statements. 2. Make the browser window tall (or zoom out) so 20 rows don't fill the grid. 3. Confirm more rows load automatically until the grid scrolls, and that scrolling to the bottom still loads further pages. 4. Resize the window taller and confirm more rows load. 5. Repeat on Integrations → Cron (the jobs list and a job's previous runs) if the project has enough jobs or runs to need more than one page. ## 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) |
||
|
|
bbb0af65cb |
[FE-3106] (part 14) – refactor(studio): drop the dual-runtime shims and aliases (#53223)
Drops the remaining Next-era shims and aliases that only existed for the dual runtime (FE-3106). Part 14 of the stack. **Depends on:** #53222 **Changed:** - ~45 files – import Sentry from `@sentry/react` directly instead of the aliased `@sentry/nextjs` - `hooks/ui/usePreventNavigationOnUnsavedChanges.ts` – is now the TanStack `useBlocker` implementation (previously swapped in by a Vite alias) - `components/interfaces/App/RouteValidationWrapper.tsx` – `next/router` → `useNavigate` + the leaf route's `fullPath` (`/project/$ref/sql/$id`) for the exempt-route and last-visited checks - `hooks/misc/withAuth.tsx` – no `getLayout` forwarding - `TemplateEditor.test.tsx` – renders inside a router for the unsaved-changes blocker **Removed:** - `compat/sentry-nextjs.ts` and its Vite alias, the `usePreventNavigationOnUnsavedChanges` alias and Next hook, `types/next.ts` (`NextPageWithLayout`), the `@sentry/nextjs` dependency The `compat/next/*` shims for `link`, `router`, `head`, `image`, `navigation`, `dynamic` and `script` stay: about 300 components outside `routes/**` still import them. Addresses [FE-3106](https://linear.app/supabase/issue/FE-3106/move-page-bodies-into-route-files-and-delete-pages). ## To test - Trigger an error (e.g. a failing query) – it reaches Sentry as before - Edit an email template or edge function and navigate away – the unsaved-changes prompt appears - Open an org you don't belong to – toast and redirect home; open a SQL snippet, leave and come back – last snippet is restored --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> |
||
|
|
362c974153 | fix(studio): record onboarding survey exposure only for signed-in users (#53253) | ||
|
|
f38928ad90 |
fix(studio): resolve disk limits from the project's instance configuration (#52367)
## Problem Studio validates disk IOPS/throughput against one minimum value per compute size. Projects whose hardware supports more get blocked below their actual limits, charts and banners can show the wrong baseline, and burst charts are gated by a hardcoded size list that is wrong for some configs. Fixes PROD-674 ## What changed - New per-configuration limits table: `packages/shared-data/instance-disk-limits.ts` (values from the AWS EBS-optimized tables). - The size-wide floors in `compute-disk-limits.ts` are now derived from that table as per-size minimums. Published values are unchanged and pinned in tests. - New `useProjectDiskLimits()` resolves a project's limits from its primary database, falling back to the floors. - Disk form validates against the project's actual limits (floors when a different compute size is selected). New inline hint when provisioning between baseline and max. - Burst charts/tiles/metrics show only if baseline is below max. - Chart reference lines and the disk IO banner use the resolved values. ## How to test 1. Settings → Database → Disk on a Large+ project: IOPS/throughput accept values up to the project's actual limits, error above them, and show the burst hint between baseline and max. 2. Reports: burst metrics are offered only for projects whose disk IO bursts; a saved burst chart on a non-bursting project renders an "unavailable" placeholder instead. 3. `pnpm --filter studio vitest run components/interfaces/DiskManagement/DiskManagement.test.ts data/reports/database-charts.test.ts` --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
2ce7f1f33c |
experiment(studio): expanded onboarding survey (#45707)
Adds an optional onboarding survey to the new-organization form, so we
learn who new orgs are for and what they are building. Users in the
`org_form` arm of the `onboardingSurveyPlacement` PostHog flag see a
**Help improve Supabase** section. Users in `control` get today's form
unchanged and still record exposure, so the two arms can be compared;
users the flag doesn't assign get the existing form and record nothing.
**Changed:**
- **Survey on the new-org form**: asks **Who is this org for?** (plus
**How many people?** for companies) and **What are you building?** (AI
assistant or agent, AI search or knowledge base, B2B SaaS, internal
tool, consumer app, social or community, marketplace or booking,
e-commerce, developer tool or app builder, analytics or reporting,
other). Every question ends with **Prefer not to say**. Answers go to
`POST /platform/organizations/onboarding-survey` as `kind`, `size` and
`building`.
- **Follow-up card for a blank survey**: if the creator answers nothing,
a card in the bottom-right asks the same questions for 5 minutes after
the org is created (not on project creation pages). Only the creator
sees it, once, tracked in localStorage. A blank form sends nothing at
creation, because the platform keeps only the first survey response per
user and org. Skipping the card, closing it, or letting the 5 minutes
run out still saves the org type and size picked on the form.
- **Telemetry**: exposure for both arms, plus submit, submit failed,
dismissed (including `follow_up_expired` when the card times out) and
Answer clicked events with `surface` set to `org_form` or `follow_up`.
**Note:** I cut **How comfortable are you working with code?** from v1.
The survey endpoint doesn't accept `coding_experience` yet, and the
question is planned to move to the user level later.
## To test
Setup: override `onboardingSurveyPlacement` to `org_form` in the dev
toolbar. Close the Terms of Service banner first, since the follow-up
card shares its slot.
Tested on the PR preview:
- [x] Create an org with **Who is this org for?** and **What are you
building?** answered, expect one `POST
/platform/organizations/onboarding-survey` carrying `kind` and
`building` (plus `size` for companies), no `coding_experience` key, and
no `kind` or `size` in the org-create request. Observed: 204 with
`{"slug":"<slug>","kind":"COMPANY","size":"10","building":"b2b_saas"}`;
org-create body was `{"name":"<name>","tier":"tier_free"}`
- [x] Create an org with the survey left blank, then open its projects
page, expect the follow-up card; answer it, expect the same survey
request and a "Thanks for sharing" toast. Observed: no survey request at
creation; after answering, 204 with
`{"slug":"<slug>","kind":"PERSONAL","building":"consumer_app"}` and the
toast
- [x] Override to `control`, open the new-org form, expect the same form
as master (Name, Type, Company size with "How many people are in your
company?" for Company, then Plan), no survey section, and an
`onboarding_survey_placement_experiment_exposed` event with `variant:
control`. Observed: screenshots match master's form field for field; the
exposure arrived in PostHog with `variant: control`
- [x] Create an org with the survey left blank and don't act on the
follow-up card for 5 minutes, expect the card to disappear, one `POST
/platform/organizations/onboarding-survey` carrying the form's `kind`
(plus `size` for companies) and no `building`, and an
`onboarding_survey_dismissed` event with `reason: follow_up_expired`.
Observed (stored follow-up time moved to near expiry instead of
waiting): the card disappeared at the 5-minute mark with one 204
carrying `{"slug":"<slug>","kind":"AGENCY"}` and the `follow_up_expired`
event; an already-expired follow-up sends on page load; with the dialog
open past expiry nothing is sent until it is closed
## Linear
- fixes GROWTH-771
- part of GROWTH-1463
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
Co-authored-by: Pamela Chia <pamelachiamayyee@gmail.com>
Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
|
||
|
|
bc9d68a813 |
fix(studio): handle architecture-prefixed Postgres versions in version helpers (#53162)
## Problem `getDatabaseMajorVersion` and `getSemanticVersion` in `apps/studio/lib/helpers.ts` returned `NaN` for Postgres versions with an architecture prefix, e.g. `supabase-postgres-arm64-17.9.0.019` (expected 17 / 1790019). `parseAppVersionKey` already handled `arm64-` and `x86_64-`, but the two helpers did not. Fixes FE-4974 Closes #53109 ## Solution - `formatSemver` now strips any leading architecture token (`^[a-z][a-z0-9_]*-`) rather than a hardcoded list. A version segment always starts with a digit, so this covers `arm`, `arm64`, `x86_64`, `aarch64`, `amd64` and future values. - `APP_VERSION_KEY_RE` in `useSelectedProject.utils.ts` uses the same rule, so the two parsers stay consistent. - Because the rule is generic, strings like `supabase-postgres-custom-123` would otherwise parse as a number. `formatSemver` now rejects anything that doesn't look like `\d+.\d+` after stripping, and both helpers return `0` for it (matching their existing empty-string behavior). Callers only compare the result numerically, so `0` behaves like the previous `NaN`. Tests cover each prefix on both helpers and on `parseAppVersionKey`, a release suffix (`-vault-rc1`), and non-version strings. Not changed: `getSemanticVersion` concatenates segments without padding (`17.10.0.001` becomes 171001, which compares below `17.9.0.019`). That predates this change and its callers pin to a single major line. |
||
|
|
c0e92057a6 |
feat(studio): split SQL errors into user and Studio SQL (#53059)
Part of FE-4772. ## Why Errors from the pg-meta query endpoint didn't say who wrote the SQL, so a Sentry issue like SUPABASE-APP-KXE couldn't tell a user's query from one Studio composed. That event came from the assistant's `execute_sql` tool and was captured by the Vercel AI integration on the server, so it skipped `reportStudioError` and had no fault tags. The Postgres message also went to Sentry as-is, and it can contain user SQL and data. ## What - **`sqlOrigin` is required on `executeSql`.** `'user'` covers SQL the user or an AI agent wrote, in whole or in part: SQL editor, editor panel, Explorer, AI `execute_sql` and `run_notebook`, report blocks, Query Insights EXPLAIN, the policy, function, and cron editors, and running a stored cron job. Everything else is `'studio'`. The policy, function, and cron mutation hooks and `useDbQuery` take `sqlOrigin` too. - **`classifySqlResponseError`** turns a 400 from the query endpoint into `UserSqlError` (`user`, `user_sql`) or `StudioSqlError` (`studio`, `studio_sql`). Pattern rules (connection timeouts) and other statuses keep their classes. - **`UserSqlError` never reaches Sentry.** Its routing is `SAMPLE_NEVER`, `alwaysCapture` doesn't override it, and `beforeSend` drops it. - **`StudioSqlError` is redacted.** Error classes can set `sentryMessage`; for `StudioSqlError` it is the SQLSTATE and the query's `queryName`, a static name that `executeSql` requires for Studio SQL. The query key is never reported, since its segments can hold IDs, schemas, and search terms. `applyStudioErrorPolicy` applies it from `beforeSend` on the client and the server, so it holds however the error was captured. The server config gets a `beforeSend` for this. Events get `query_name` and `sql_state` tags and are grouped by both, since every SQL error shares the `executeSql` stack. - **A custom `handleError` gets the classified error**, matching its declared type. The SQL editor, editor panel, and policy editor rethrow it, so their errors are now `UserSqlError` instead of being reported as `UnexpectedError`. The error keeps Postgres's `position` for the editor's line highlight. The error message, `formattedError`, and `position` stay on the error for the UI. The query-performance Sentry context no longer carries the raw error message, which bypassed redaction. ## Known gaps - Index advisor queries run users' query text from `pg_stat_statements` but are marked `'studio'`. Redaction keeps the text out of Sentry, but their failures count as Studio faults. - 5xx responses for user SQL are still `PlatformError` and keep their message. - The self-hosted MCP `executeSql` calls `executeQuery` directly and isn't covered. ## Testing - Unit tests for `classifySqlResponseError`, `applyStudioErrorPolicy`, and the client `beforeSend`. - Full Studio vitest suite passes except `useReportDateRange.test.ts` (169 vs 168 hourly buckets across the DST change), which this PR doesn't touch. |
||
|
|
5cf3cf1032 |
feat(studio): make security the home for sign-in and recovery setup (#52358)
## Problem - Sign-in methods are in Preferences, separate from MFA and recovery settings. - The risk of a single sign-in method (e.g. GitHub, and getting locked out of that account) isn’t clearly communicated. ## Solution - Bring sign-in methods, MFA and recovery codes together on the Security page. If Security is disabled, sign-in methods remain accessible in Preferences. - Highlight the most important next step with a primary button. For example, when MFA is off, “Set up MFA” takes priority over adding a password. - Explain the risk of relying on a single sign-in provider, and make it clear which email address a new password will apply to. - After connecting a sign-in provider, return users to the settings page they can access. Links to password setup open the password dialog directly. | After | | --- | | <img width="1460" height="1426" alt="CleanShot 2026-11-06 at 14 54 23@2x" src="https://github.com/user-attachments/assets/afb82601-1b6f-43be-9e98-a0edb8d529c8" /> | | _The “Sign-in methods” section moved to Account → Security. Note also the new Admonition regarding the risk of a single (GitHub) sign-in method._ | ## Review instructions 1. Open [Security](https://studio-staging-git-dnywh-recovery-security-home-supabase.vercel.app/dashboard/account/security#sign-in-methods). Check sign-in methods appear above MFA and recovery codes. With MFA off, “Set up MFA” should be primary. 2. Open Preferences. Sign-in methods should be absent unless Security is disabled. 3. On a test account, check password setup, email editing and provider linking. [Open password setup directly](https://studio-staging-git-dnywh-recovery-security-home-supabase.vercel.app/dashboard/account/security?securityAction=set-password#sign-in-methods), then cancel and confirm it stays closed. |
||
|
|
52cc917752 |
feat(studio): clarify authenticator setup and backup status (#52354)
## Problem MFA setup and backup status are difficult to scan, and unverified factors can appear as configured authenticators. ## Solution - Show only verified authenticators (non-abandoned setup), with a clear setup state when none are configured. - Show backup guidance from the shared recovery checks and emphasise the most relevant MFA action once those checks succeed. - Align authenticator rows with the existing controls, use removal icons with tooltips, and prevent removal when recovery-code status cannot be confirmed. | Before | After | | --- | --- | | <img width="1024" height="759" alt="7693" src="https://github.com/user-attachments/assets/1deb07ef-91ce-481b-87f6-4baa7b023f94" /> | <img width="1024" height="759" alt="18215" src="https://github.com/user-attachments/assets/f17248a2-2001-4d95-ba28-3f16b75af0fb" /> | | <img width="1024" height="759" alt="Security Account Supabase" src="https://github.com/user-attachments/assets/ede61c84-0baa-4139-9773-0953a05cbd94" /> | <img width="1024" height="759" alt="14038" src="https://github.com/user-attachments/assets/58ab1a70-0392-4706-8df3-2ba078c5a8ba" /> | ## Review instructions 1. Open [MFA settings](https://studio-staging-git-dnywh-recovery-mfa-status-supabase.vercel.app/dashboard/account/security#mfa) without a verified authenticator. Confirm the setup empty state offers “Set up MFA”. 2. Use an account with one authenticator and healthy codes. Check the backup warning, aligned icon row, and remove tooltip. ## Validation 14 focused tests passed, including Auth SDK network responses and failed recovery-status reads keeping removal unavailable. Formatting passed. Focused ESLint passed with the locally incompatible TanStack exhaustive-deps rule disabled; standard lint is blocked by the installed plugin rejecting the current rule options. Full local typecheck still reports errors in untouched panel and MCP files; none remain in this PR's changed files. |
||
|
|
597d1ce56e |
fix(studio): pass caller options to grant-gated query factories (#53088)
## Context Grant-gated query factories returned `queryFn: skipToken` when the caller had no grant. TanStack Query keeps one options object per cache entry, overwritten by whichever observer rendered last. When that was a grant-less observer, invalidation refetched with `skipToken` and failed with `Missing queryFn`, breaking the query for every other observer on the key. #53075 patched two call sites; this fixes the factories. ## Changes - New `grantedQueryOptions` helper (`data/granted-query-options.ts`). Without a grant, the factory sets `queryFn: undefined` instead of `skipToken`, so TanStack borrows the query function from a subscribed observer that has one. The caller's `enabled` applies only when the factory has a query function. - `apiKeysQueryOptions`, `revealedApiKeysQueryOptions`, `branchesQueryOptions`, `branchQueryOptions` and `branchDiffQueryOptions` take caller options as a second argument. Call sites change from `useQuery({ ...f(vars), enabled })` to `useQuery(f(vars, { enabled }))`, so callers can't override the grant gate. - New type-aware `fga/no-spread-granted-query-options` lint rule (error). `grantedQueryOptions` returns a type-only brand, and the rule flags any spread or `Object.assign` of a branded value, however it was built or named. - Restores typed linting as a separate pass (`eslint.type-checks.config.cjs`, run by `pnpm lint` via `lint:type-checks`), as #44678 did. Enabling type info in the main config changes what other plugins report, so it stays separate. - `studio-queries` skill documents the pattern. Callers still pass their own grant, so the UI gates on the same grant the request carries. ## Testing - `data/api-keys/api-keys-query.test.tsx`: a granted and a grant-less component share the key, with the grant-less one rendering last; invalidation via the delete mutation refetches successfully. Fails on master with `Missing queryFn`. - `data/granted-query-options.test.ts`: `enabled` gating, factory fields win over caller fields, `select` type inference. - Lint rule cases in `scripts/__tests__/fga-eslint-rules.test.ts`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) |
||
|
|
c5cdb59c47 |
feat(studio): prerender signed-out auth pages in the TanStack build (#52690)
## Problem
The TanStack Start build serves every document from the prerendered SPA
shell (`_shell.html`). For signed-out pages such as `/sign-in` and
`/sign-up`, the first HTML response holds only the loading fallback and
the generic `<title>Supabase</title>`. The page content and route
`head()` tags only appear after the JS bundle hydrates.
## Solution
On platform builds, prerender `/sign-in`, `/sign-up`, `/sign-in-sso` and
`/forgot-password` to static HTML next to the shell.
- `lib/prerendered-routes.ts`: the list of prerendered paths, shared by
the build config, the Vercel routes and the root route.
- `vite.config.ts`: passes the paths to `tanstackStart({ pages })` with
link crawling off, so only these pages are prerendered. Self-hosted
builds prerender nothing (self-hosted sign-in redirects straight to the
default project).
- `scripts/vercel-spa-routes.ts`: serves `<path>/index.html` for each
prerendered path (with and without the base path, optional trailing
slash, case-sensitive), ahead of the shell catch-all.
- `routes/__root.tsx`: renders `<Outlet />` once hydrated, or before
hydration when the path is prerendered; otherwise `<ShellFallback />`.
The Outlet stays at the same position in the tree, so navigating away
from a prerendered page doesn't remount it.
One prerendered file serves every visitor and every query string, so the
first render of these pages can't depend on per-visitor state:
- Search-param reads that affect render return empty until
`useHydrated()`, then update. `useInboundBranding` checks this directly,
and the "Sign up", "Sign in" and "Continue with SSO" link hrefs read
from `useHydratedQuery`.
- The "Sign in" links on `/sign-up` and `/forgot-password` now carry the
query params. The `/sign-up` link drops `returnTo=/new`, the default the
"Sign up" link sets, so existing users don't land in the new-org flow.
- Form controls sit in a `DisabledUntilHydrated` fieldset, so input
typed before hydration isn't lost and Enter can't natively POST the
form.
- The sign-in/forgot-password logo switches light/dark via CSS (`dark:`
classes) instead of `resolvedTheme` after mount, so dark-theme users
don't see the light logo first.
- `SignInLayout`'s session redirect effect skips the redirect after
unmount.
Also adds page titles for `/sign-in-sso` and `/forgot-password`.
## Review instructions
1. View source (not the inspector) of `/dashboard/sign-in`,
`/dashboard/sign-up`, `/dashboard/sign-in-sso` and
`/dashboard/forgot-password` on the preview: the HTML holds the form and
the page title, not the loading fallback. `/dashboard/organizations`
still returns the shell.
2. Load `/dashboard/sign-in?returnTo=%2Fproject%2F<ref>`: no hydration
errors in the console, and the "Sign up" link (hover / open in new tab)
carries the same `returnTo`. The "Sign in" links on `/dashboard/sign-up`
and `/dashboard/forgot-password` carry the query params too.
3. Sign in from that URL: you land on the project, with no second
redirect to `/organizations`.
4. Load `/dashboard/sign-in?destination=cli`: the CLI-branded heading
renders without a hydration error.
5. Links between the four pages navigate client-side, and dark mode
shows the dark logo straight away.
## Checks
- Platform `vite build` (`NEXT_PUBLIC_IS_PLATFORM=true
NEXT_PUBLIC_BASE_PATH=/dashboard`): prerenders the four pages plus the
shell; each file has its title, inputs and a disabled fieldset.
Self-hosted build prerenders only the shell.
- Served the build locally with Vercel-equivalent routing and checked in
a browser: no hydration errors for plain, `?returnTo=…`,
`?destination=cli` (with and without `method`),
`/sign-up?destination=cli` and `/Sign-In`; hrefs carry `returnTo` after
hydration; navigating from `/sign-in` to other routes doesn't remount
the sign-in form or flash the shell loader; with JS blocked, inputs and
submit are disabled.
- Unit tests for `isPrerenderedRoute` and the prerendered Vercel routes;
`tsc --noEmit`, ESLint on changed files, Prettier, knip and the lint
ratchet pass.
- Not covered locally: the signed-in `returnTo` redirect end to end
(review step 3).
## Checklist
- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
---------
Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
Co-authored-by: Kody Jackson <kody.jackson@supabase.io>
Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
|
||
|
|
df742bdb3b |
refactor(studio): rename ResponseError to StudioError (#52707)
## What
Moves the `ResponseError` class (`types/base.ts`) and the classified
error classes (`types/api-errors.ts`) into
`lib/errors/studio-errors.ts`, and renames `ResponseError` to
`StudioError`.
## Why
Studio's error classification is being expanded to cover errors that
don't come from API responses (thrown network failures, aborted
requests, unexpected client errors). The API-specific name and location
no longer fit. Landing the rename on its own keeps the follow-up PR,
which introduces the classified error model, small and reviewable.
## Notes for reviewers
- Mechanical change, no behavior change. Most of the diff is a one-line
import change per file plus import re-sorting by Prettier.
- Files that only use the type now use `import type { StudioError }`.
- `ResponseError` is no longer re-exported from `@/types`; there are no
compatibility shims at the old paths.
- Unrelated identifiers like `QueryResponseError` and
`parseResponseErrors` are unchanged.
|
||
|
|
9b7cbd1803 |
feat(studio): migrate branches to FGA grants with production/development variants (#52331)
## Problem Branch actions in Studio were guarded by hand-written permission checks (`useAsyncCheckPermissionsV2(FGA_PERMISSIONS.PROJECT.BRANCHING_*)`, plus one legacy `useAsyncCheckPermissions` in `Branch.Commands.tsx`) that weren't tied to the endpoints they protect. Every branches request in `data/branches` was marked `unguarded.migrating`. This is the pilot migration for endpoint-bound FGA grants. Resolves [FE-4693](https://linear.app/supabase/issue/FE-4693/pilot-migrate-branches-to-grants-8-endpoints-createbranchmodal). ## Solution ### Data layer * `data/branches` has no `unguarded.migrating` left (was 10). * The list, detail, and diff queries are now `branchesQueryOptions`, `branchQueryOptions`, and `branchDiffQueryOptions`. They take a grant, use `skipToken` without one, and keep the grant out of the query key. * Mutations take the grant in their variables. The merge mutation also takes `diffGrant`, because it reads the diff before merging. ### Production and development variants The backend doesn't treat development and production branching permissions as interchangeable: * Actions on a single branch (`/v1/branches/{branch_id_or_ref}` and its diff, merge, push, reset, and restore) need the production permission for the default branch and the development permission for preview branches. * Creating a default branch or a branch with data needs production create. To model this, `lib/fga-refinements.ts` gets its first entries: * The 8 single-branch endpoints have `production` and `development` variants. A new `variantRequired` flag makes the fetch wrapper reject a grant without a variant, at compile time and in `assertGrant`. * `POST /v1/projects/{ref}/branches` has a `production` variant. `assertGrant` requires it when the body sets `is_default` or `with_data`. * `useBranchGrant(endpoint, { projectRef, isDefault })` picks the variant from the branch's `is_default`. It stays `loading` until the branch is known. * `GrantForVariants<M, P>` types a grant for any of an endpoint's variants. ### UI * The old checks are replaced with grants in `CreateBranchButton`, `CreateBranchModal`, `Overview`, `DeleteBranchPanel`, `DeleteBranchModal`, the branches and merge-requests pages, and `Branch.Commands.tsx`. * Grants are evaluated against the parent project, where branch permissions live. The scope is passed explicitly, because `/v1/branches/*` paths don't include the project. * Pages that are mainly about branches show `NoPermission` when the grant is denied and `AlertError` when the permission check fails. Action buttons are disabled with a tooltip. Places that use the branch list incidentally (nav, project home, usage) treat a denied grant as "no branches" instead of loading forever. * "Include data" in `CreateBranchModal` is disabled without production create. It previously failed after submitting. * `OutOfDateNotice`'s "Update branch" is disabled without the push grant. It previously did nothing. * The GitHub integration form blocks saving without the production-branch grant. Previously the connection was saved while the branch request failed, and a repo change deleted the old connection first. ### Where the old checks differed from the backend * **Too strict:** the branches and merge-requests pages required development read, and the create button required development create. The backend accepts development or production for both. * **Wrong for the default branch:** single-branch actions always checked development permissions, or production write for the main branch menu, regardless of which branch was targeted. * **Missing:** reset and "Switch to persistent" in `Overview` had no check. * **Legacy check:** `Branch.Commands.tsx` used the legacy `CREATE preview_branches` check. `BranchingPITRNotice` is unchanged: its check guards a subscription update, not a branches request. ### Other changes * The two new query options use an `eslint-disable` for `@tanstack/query/exhaustive-deps`, because grants stay out of query keys. A separate PR upgrades the plugin and allowlists `grant`, after which these can be removed. * `upsertMigration` in the merge mutation still uses `unguarded.migrating`. It belongs to the database-migrations domain. ## Testing * New component tests for `CreateBranchButton`, `DeleteBranchPanel`, the branches page, and `GitHubIntegrationConnectionForm` cover granted, denied, and error states. * New `useBranchGrant` tests: default vs. preview branch, and loading until the branch is known. * `guarded-fetch.test.ts` covers required variants (types and runtime) and the production variant for default and data branches. * Shared fixtures are in `tests/lib/branch-test-utils.ts`. * Studio typecheck passes, affected suites pass, the ESLint ratchet is stable, and knip is clean. |
||
|
|
cd0b65c03e | feat(logs): Add Pipelines to unified logs and rename ETL to Pipelines (#52555) | ||
|
|
253d874e38 | fix(warehouse): disallow warehouse installation on orioledb (#51913) | ||
|
|
ce52277546 |
feat(studio): migrate branches list query to FGA grants (#52373)
Part 2 of 7 in a stack that splits #52331 into reviewable pieces. Resolves part of [FE-4693](https://linear.app/supabase/issue/FE-4693/pilot-migrate-branches-to-grants-8-endpoints-createbranchmodal). There are no functional changes beyond #52331, and the top of the stack is identical to it. See #52331 for the full rationale. ## Stack 1. #52372 Grant infra for branch variants 2. 👉 #52373 Branches list query 3. #52374 Page gates on the list grant 4. #52375 Branch creation 5. #52376 Branch read, delete, reset, and restore 6. #52377 Branch update and push 7. #52378 Branch diff and merge ## Changes `useBranchesQuery` becomes `branchesQueryOptions`, which takes a grant, uses `skipToken` without one, and keeps the grant out of the query key. Every call site moves to `useGrant('GET /v1/projects/{ref}/branches')`. Places that use the list incidentally (nav, project home, usage, settings, GitHub status) treat a denied grant as "no branches" instead of loading forever. Config drift no longer stays pending when its prerequisites fail. Page gating is unchanged here and moves in the next PR. ## Testing Usage, General, `useGitHubConfigDrift`, and ConfigurationDriftPage tests. |
||
|
|
7ce15123ab |
feat(studio): grant infra for production and development branch variants (#52372)
Part 1 of 7 in a stack that splits #52331 into reviewable pieces. Resolves part of [FE-4693](https://linear.app/supabase/issue/FE-4693/pilot-migrate-branches-to-grants-8-endpoints-createbranchmodal). There are no functional changes beyond #52331, and the top of the stack is identical to it. See #52331 for the full rationale. ## Stack 1. 👉 #52372 Grant infra for branch variants 2. #52373 Branches list query 3. #52374 Page gates on the list grant 4. #52375 Branch creation 5. #52376 Branch read, delete, reset, and restore 6. #52377 Branch update and push 7. #52378 Branch diff and merge ## Changes Adds `lib/fga-refinements.ts` entries: `production`/`development` variants for the 8 single-branch endpoints, with a new `variantRequired` flag. The fetch wrapper and `assertGrant` reject a grant without a variant. Also adds the `production` variant for `POST /v1/projects/{ref}/branches` when the body sets `is_default` or `with_data`. Adds `GrantForVariants`, the `useBranchGrant` hook, and shared fixtures in `tests/lib/branch-test-utils.ts`. Behavior-neutral: existing branch calls still use `unguarded.migrating`, which skips these checks. ## Testing `guarded-fetch.test.ts` and `useBranchGrant.test.ts`. |
||
|
|
04ea14c103 |
fix(studio): isolate account recovery checks by user (#52120)
## Problem Account checks need consistent query gating and recovery-gap evaluation. Sign-in and sign-out already reset the query cache; user-scoped keys add defence in depth. ## Solution Tie account query caches to the signed-in person, honour query gating, and centralise recovery-gap evaluation. No layout changes. ## Review instructions 1. Open [Account Security](https://studio-staging-git-dnywh-recovery-account-queries-supabase.vercel.app/dashboard/account/security) in staging, or `/account/security` locally. Sign in with a test account that has MFA enabled; confirm its authenticators and recovery-code status load normally. 2. Sign out and sign in as a different test account with a different MFA setup. Confirm the page shows that account’s setup, without the previous account’s authenticators or code status. 3. Reload with MFA enabled and complete the sign-in challenge. Account Security should load normally after verification. |
||
|
|
254e24b170 |
feat(studio): require grants in fetch wrappers for FGA-annotated endpoints (#52238)
## Problem Resolves FE-4689 and FE-4690. Builds on #52105. Studio's fetch wrappers don't know which FGA permissions an endpoint requires, so a UI guard and the request it protects can drift apart. This makes the `grant` minted by `useGrant`/`getGrant`/`ensureGrant` part of the request itself: calling an annotated endpoint without a matching grant is a compile error. ## Solution ### What changed - **Fetch wrappers** (`data/fetchers.ts`, `data/guarded-fetch.ts`): `get`/`post`/`put`/`patch`/`del` keep their names, so no imports change. - The `grant` option is required for endpoints annotated with `x-fga-permissions`, and forbidden for unannotated ones. - It accepts a `Grant` for that exact endpoint (or one of its variants) or `unguarded`. - The wrapper strips the grant before calling openapi-fetch. - `head`/`trace`/`options` are unchanged. - **Owned params**: refinements can declare query params the wrapper sets from the grant's variant (`ownedQuery`). These params are removed from the init type (`Omit<Query, Owned> & { [K in Owned]?: never }`), so callers can't pass them. Nothing uses this yet: the api-keys `reveal` variant is the first. - **`assertGrant`** runs in development only and throws `GrantAssertionError`. It checks: - the endpoint; - a missing grant; - the variant against `when(init)` predicates; - the path `ref` against the grant's project, also accepting the parent project ref for a grant minted on a branch; - the path `slug` against the grant's organization. - **Escape hatches**: - `unguarded.migrating` for unmigrated call sites. - `unguarded.byDesign('reason')` for calls that intentionally skip the check. - **Grants** now record `permissionsProjectRef`, the ref permissions were evaluated against. It's required once the scope is resolved. - **Readable errors**: a missing or wrong grant reports the caller's own init type plus the expected `grant` type, instead of openapi-fetch's full options type. Under `noErrorTruncation`, the old message was tens of KB per call site. - **`executeSql`** now requires a grant for `POST /platform/pg-meta/{ref}/query`, so every caller counts as unmigrated. - **Codemod**: added `grant: unguarded.migrating` at every existing call site that hits an annotated endpoint, including all `executeSql` callers. No behavior change. A follow-up lint rule ratchets the count down. - **Dependencies**: adds `openapi-typescript-helpers` (the version openapi-fetch already uses) for the helper types. Only openapi-fetch's unexported `InitParam` is copied locally. ### Type-level notes - The grant is checked in the parameter type rather than in `Init`'s constraint. That way `Init` is still inferred from the argument, which keeps both the return type and the error message tied to the caller's code. - The grant is replaced rather than intersected. Intersecting a wrong grant with the expected one can reduce the init type to `never`, which then accepts the call. - `NoInfer<Path>` stops a grant's endpoint from becoming an inference candidate for the path. ## Review instructions ### Tests - `data/guarded-fetch.test.ts`: - Type equality with the raw client: required params and body, template-literal paths, `parseAs`, `signal`/`headers`, optional-init endpoints, and `unguarded`. An openapi-fetch upgrade that breaks the local `InitParam` copy fails typecheck. - Negative type cases: - a missing or `undefined` grant; - a missing init on an annotated endpoint; - a grant for a different path or method; - any grant or `unguarded` on an unannotated endpoint; - a forged grant; - params and body still checked; - an unknown path. - `guardMethod` and `assertGrant` runtime behavior, including branch-parent refs and org slugs. - Variant and owned-param tests are deferred to the api-keys (`reveal`) and pg-meta (`read`/`write`) PRs, since no refinements exist yet. 1. Run `pnpm typecheck` and confirm Studio passes. Then remove a `grant: unguarded.migrating` and check that the error is short and names the expected grant. 2. Run `pnpm test:studio`. 3. Skim the codemod commit: it only adds `grant: unguarded.migrating` and the `unguarded` import. ## Checklist Check all before review: - [ ] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide) |
||
|
|
60b51d74d5 |
Audit existing unit tests + Remove redundant ones (#52215)
## Context
_TLDR: Changes here speeds up unit tests on CI from ~14 minutes to ~3
minutes_ 😂
_TLDR 2: The file changes are solely only test files +
`studio-unit-tests.yml`_
We've currently got a lot of unit tests in the repository which while
great for coverage, hasn't been ideally written. There's a lot of
redundancy + overly specific tests that break easily, and our current
unit test takes about 15 minutes to run in the GHA per PR. Hence am
doing a audit clean up of all existing unit tests in the studio repo.
## Changes involved
- `.test.ts` files now run in `node`, `.test.tsx` in `jsdom`
- jsdom costs about 1s of setup per file. A `.ts` test that needs the
DOM opts in with `// @vitest-environment jsdom` (46 files do).
- Removed redundant and over-specific tests
- Duplicates are merged into `test.each`. Tests that only covered
libraries, existed for coverage, or asserted class names and snapshots
are deleted. 19 files are merged into a sibling or deleted.
- Fixed about 15 tests that couldn't fail
- Examples: unawaited assertions, fixtures equal to the default, and a
`semverGte` test calling `semverLte`.
- Sped up the slowest files
- Real sleeps are replaced with fake timers, `user.type` with paste, and
Radix option queries are scoped to the open listbox. For example,
`RestoringState` went from 18s to 0.3s and
`useTableEditorFiltersSort.navigation` from 20s to 3s.
- These ^ already shave down the unit tests time from 14 mins to 9 mins,
but am also sharding unit tests across 4 jobs to increase speed up
further which then shaves down time to 3 mins now
|
||
|
|
1bcc472d64 |
feat(studio): add Grant type and useGrant/getGrant/ensureGrant (#52105)
## Problem
Resolves FE-4688.
Core types and minting for endpoint-bound FGA grants. A `Grant<E, V>` is
minted by checking the user's v2 permissions against the generated
`fgaRequirements` map for endpoint `E` (and optional variant `V`).
Nothing consumes grants yet: the fetch wrappers that require them come
in a follow-up PR.
## Solution
### What changed
- **`lib/grants.ts`** (new)
- `Grant<E, V>`: the brand is a function type, so it's invariant in both
the endpoint and the variant. A grant only satisfies its exact endpoint
and variant.
- `GrantResult` is `loading | granted | denied | error`, and `.grant` is
defined only when granted.
- `GrantFor<Method, Path>` resolves to the grant type for an annotated
endpoint, or `never` otherwise.
- Minting functions:
- `getGrant` is pure.
- `useGrant` resolves org and project from the URL unless the scope
overrides them.
- `ensureGrant` is for imperative code and prefetch.
- Self-hosted always mints. A failed permissions request returns
`error`. Grants are never part of query keys.
- **`lib/fga-refinements.ts`** (new): an empty map defining the shape
for named variants. Each entry records the base annotation it was
written against, so typecheck fails if that annotation changes.
- **`permissions-query-v2.ts`**: adds a `permissionsQueryOptionsV2`
factory. `usePermissionsQueryV2` is now a thin wrapper around it, with
the same signature and the same 5-minute `staleTime`.
- **`doPermissionsCheckV2`**:
- Now accepts OR-of-AND requirement groups. Existing single-permission
and flat-list calls behave as before.
- Empty input never grants, including an empty group.
- **`usePermissionScopeV2`**: org/project/branch-parent resolution
extracted from the V2 hook, so `useGrant` and
`useAsyncCheckPermissionsV2` share one implementation.
- **Invalidation**: the role assign, unassign, and update mutations,
`UpdateRolesConfirmationModal`, and project creation now invalidate the
v2 permissions query.
- **knip**: temporary `files` ignore for `lib/grants.ts` until its first
consumer lands.
### Behavior change
`useAsyncCheckPermissionsV2` with an explicit `projectRef` equal to the
URL's project ref now resolves branch projects to their parent before
checking. Previously, any explicit ref skipped that resolution, so users
with project-scoped roles were denied on branch projects. An explicit
ref that differs from the URL ref is still used as-is.
## Review instructions
### Tests
- Unit tests for `doPermissionsCheckV2` with OR-of-AND groups.
- `lib/grants.test.ts`:
- `getGrant`, `useGrant`, and `ensureGrant` across OR-of-AND groups,
branch projects, explicit scope, self-hosted, and loading/denied/error
states.
- Type tests: a grant can't be used for a different endpoint, a plain
object isn't a grant, `GrantFor`, and status narrowing.
The type test that a grant without a variant can't satisfy a variant
parameter moves to the api-keys refinement PR, since no endpoint has
variants yet.
1. Run `pnpm test:studio` and confirm the `doPermissionsCheckV2` and
`lib/grants` tests pass.
2. Run `pnpm typecheck` to confirm the grant type tests hold.
3. Check the branch-project behavior in `useAsyncCheckPermissionsV2`
with an explicit `projectRef` matching the URL's project ref.
## 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)
|
||
|
|
53c3b41065 |
feat(studio): show Realtime on High Availability projects in production (#52091)
## Problem The Realtime pages, publications, the Realtime toggle in the table editor and the Realtime status on the project home are hidden for High Availability projects outside staging and local. That was a temporary gate while Realtime on High Availability projects was validated, and the platform now registers those projects as Realtime tenants. ## Solution Remove the gate instead of flipping a default. It always resolved to available once enabled, so keeping `resolveRealtimeUnavailable` and its second argument would only leave dead code: - `useHighAvailability.ts`: drop `resolveRealtimeUnavailable` and `useIsRealtimeUnavailable`. - `RealtimeLayout`, the two publications pages and `ServiceStatus`: drop the "unavailable on High Availability projects" states. `PublicationsAvailability` and `resolveRealtimeServiceStatus` are deleted. - `TableEditor`: `TableRealtimeToggle` no longer takes the unavailable and pending props, and the toggle is never forced off. - Tests for the removed code are deleted, and the toggle test now covers the toggle itself. Whether a project is actually registered as a Realtime tenant is still decided by the platform, so this should land after the platform change. ## Review instructions 1. On a High Availability project, open Realtime in the sidebar: the inspector, policies and settings pages load instead of the "unavailable" empty state. 2. Open Database > Publications: the list loads. 3. Open the table editor's new-table panel: the "Enable Realtime" checkbox is enabled. 4. On the project home, the Realtime service reports its health check status instead of "Disabled". 5. A standard (non-High Availability) project looks the same as before. `pnpm vitest run` on the affected folders passes (28 files, 184 tests). |
||
|
|
fffb1e23ca |
feat: implement profile permissions v2 api (#50966)
## Problem Migrating Studio's permission checks from the old RLS json logic to openfga backed permissions. ### New hooks and helpers - `usePermissionsQueryV2` fetches the new profile openfga permisisons - `useAsyncCheckPermissionsV2` the replacement for the old check hook; takes an FGA permission string (or a list) - `FGA_PERMISSIONS` permission constants derived from `@supabase/shared-types`. At the moment, the hook also accepts plain strings for permissions not yet published in the package - `useAsyncCheckUserContentPermissions` new hook for permission checks on user content (SQL snippets, reports, log snippets). This wraps ``useAsyncCheckPermissionsV2` and adds existing content level rules on top of the fga permission check ### Notes - ~~Need api to support new permissions: project_operations_write, billing_read/write, audit_logs_read~~ [DONE] - ~~Still need to support: organization_config_read/write, auth hooks and users permissions~~ [DONE] --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com> |
||
|
|
23b93e9123 |
fix(studio): guard unsaved edits in TanStack (#51042)
Unsaved Edge Function, email template, and report edits block TanStack navigation until the user chooses whether to leave. Keep editing preserves the current route and draft, while Discard changes navigates on the first click. Depends on #51067 for the coordinated TanStack upgrade and published history fix. This layer contains only the navigation behavior and its regression coverage. **Changed:** - Select a native TanStack blocker through the Vite alias while retaining the original Next hook for the fallback runtime. - Preserve the latest navigation destination across repeated cancel/confirm attempts and browser history traversal. **Added:** - Regression coverage for dirty state, cancel/confirm, unload protection after traversal, encoded URLs, browser history, and the original Next hook. ## To test - In TanStack Studio, open a new Edge Function draft, edit its code, and navigate to another section. Keep editing should preserve the URL and code; retrying with Discard changes should navigate immediately. - Repeat with browser Back and Forward. Cancel should restore the editor URL; confirm should reach the intended history entry. - Repeat an unsaved edit in an existing function or email template, then discard it without saving. - Undo an edit back to its original value and confirm navigation does not prompt. - In Next Studio, confirm dirty-editor cancellation and `/dashboard` destinations still use the original guard. Validation on the upgraded dependency graph: 73 focused guard, navigation, URL and SSR tests passed, including 15 native TanStack cases and four original Next guard cases. Studio typecheck, lint ratchet, scoped ESLint, formatting and knip passed. The prerequisite's Next and UI Library production builds passed; this layer changes only TanStack's runtime alias and leaves the original Next guard source unchanged. The restacked TanStack Vercel/skew production build passed with uploads disabled. Local TanStack browser checks passed for repeated Keep editing, ordinary native Back/Forward cancellation, one Discard toward the latest breadcrumb destination, and Undo-to-clean navigation/reload. Disposable local drafts were fully discarded without deploying or editing existing functions. Native Next UI, multi-entry history jumps and unload prompts were not browser-tested; dedicated guard tests cover the latter two behaviors separately. ## Latest restack Head `d6e7e7f23800319ceba15570057f5227a904debe` is stacked on #51067 head `e11cce3ad28bec3e0656e98da7d00a80810da30d`. The guard patch is unchanged. The lower layer now skips unchanged table-filter URL sync to preserve Forward history; its conditional reproduction is separate from this guard change. Both PRs are mergeable after the trunk lockfile conflict was resolved. All 56 focused router/filter/Next/guard checks, Studio typecheck and scoped lint/format pass on the restack; all 20 required CI checks pass on both exact heads, including Next and TanStack E2E, full Studio tests, builds, Docker and typecheck/lint. The reviewer independently rechecked the earlier identical guard head and did not reproduce the reported unguarded Back behavior. Both history invocation methods showed the dialog, cancellation retained the draft and restored its URL, and Discard completed navigation. No additional guard change is justified by that retest; it does not establish the cause of the earlier failed snapshot. Final-head browser coverage remains distinct from this previous-head retest. Both final Studio staging deployments are ready and serve TanStack/Nitro assets. The upper sign-in page renders successfully; its unchanged guard behavior was not additionally browser-retested on this final head. Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> |
||
|
|
f2876c7787 |
chore(studio): upgrade the TanStack dependency set (#51067)
TanStack Start 1.169 is the stable release. This moves the shared catalog to Start 1.169.2 and Router 1.170.44, the newest matching pair that clears the 72-hour release-age gate, and updates Studio React Query and its devtools to 5.104.3. The ui-library TanStack auth blocks switch to `.validator()` because Start 1.169 removes `.inputValidator()`. **Changed:** - `pnpm-workspace.yaml` – `@tanstack/react-router` `^1.170.44` and `@tanstack/react-start` `^1.169.2`, so Router, Start, router-core, and the Start plugin install as one set - `pnpm-lock.yaml` – react-router 1.170.44, react-start 1.169.2, router-core 1.171.37, router-plugin 1.168.46, start-plugin-core 1.171.53, history 1.162.5, and Studio React Query 5.104.3 - `apps/studio/package.json` – `@tanstack/react-query` and `@tanstack/react-query-devtools` `~5.104.3`, `@tanstack/react-router-devtools` `^1.167.2` - `apps/ui-library/registry/default/blocks/password-based-auth-tanstack/routes/auth/confirm.ts` – `createServerFn` uses `.validator()` - `apps/ui-library/registry/default/blocks/social-auth-tanstack/routes/auth/oauth.ts` – `createServerFn` uses `.validator()` - `apps/ui-library/tests/sign-up-redirect.test.tsx` – the server-function mock follows the `validator` chain - `apps/ui-library/public/r/password-based-auth-tanstack.json` – registry JSON regenerated from the block - `apps/ui-library/public/r/social-auth-tanstack.json` – registry JSON regenerated from the block - `apps/ui-library/content/docs/tanstack/password-based-auth.mdx` – note that the block requires `@tanstack/react-start` 1.168.25 or later, since `.validator()` is missing from earlier Start versions - `apps/ui-library/content/docs/tanstack/social-auth.mdx` – note that the block requires `@tanstack/react-start` 1.168.25 or later, since `.validator()` is missing from earlier Start versions - `apps/studio/server.ts` – correct the header comment: `wrapFetchWithSentry` only adds a span, trace meta tags, and a flush, and request errors are captured by the Sentry middleware in `start.ts` **Removed:** - `minimumReleaseAgeExclude` pins for: - `@tanstack/react-router@1.170.41` - `@tanstack/react-start-client@1.168.39` - `@tanstack/react-start-rsc@0.1.59` - `@tanstack/react-start-server@1.167.46` - `@tanstack/react-start@1.168.60` - `@tanstack/react-store@0.11.2` - `@tanstack/router-core@1.171.34` - `@tanstack/router-generator@1.167.40` - `@tanstack/router-plugin@1.168.42` - `@tanstack/start-client-core@1.170.34` - `@tanstack/start-plugin-core@1.171.49` - `@tanstack/start-server-core@1.169.39` - `@tanstack/start-storage-context@1.167.36` - `@tanstack/store@0.11.2` ## To test - TanStack Studio, open a project home – the shell loads with no router error - TanStack Studio, open a table, switch schema, then Back and Forward – the table id follows history, and Forward returns to the later table - TanStack Studio, run a query in the SQL Editor – results render - TanStack Studio, open Project Settings – the general settings page renders - Next Studio, repeat home, Table Editor, SQL Editor, and Settings – the same pages render - ui-library TanStack password and social auth blocks, follow a sign-up confirm and OAuth confirm link – the server function accepts the search params through `.validator()` and redirects --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> |
||
|
|
b328ca6d5a |
fix(studio): sync table editor filters from the URL on back/forward (#51437)
Back/Forward between two history entries of the same table changed the URL but left the old filters in the filter bar and grid, because filters were only read from the URL on mount. Happens on both Next and TanStack; follow-up from #51391. **Changed:** - `useSyncFiltersToUrl` now also syncs URL → filter state for the current table (ignoring our own debounced push, and another table's URL while a TanStack navigation is pending). - State → URL skips pushes the URL already reflects, which also removes the no-op push on every grid mount. - `useTableEditorFiltersSort` returns `path` (same lines as #51391, so they merge cleanly). **Behavior choice:** if a filter is applied and Back/Forward happens before its 500ms debounce fires, the navigation wins and the unpushed filter is discarded, rather than pushing a stale filter over the entry the user navigated to. Back/Forward (`popstate`) cancels the pending push even when the `filter` param is unchanged; other URL changes such as a sort keep it. Documented on the hook. **Added:** - Real-TanStack-router navigation test and a router-agnostic unit test for the sync (master's hook fails 4 of 6). ## To test - Table A → add a filter → open table B → Back (A with filter) → Back (A, filter bar empty, all rows) → Forward (filter back) - Apply a filter and hit Back immediately – you land on the previous entry and the filter isn't re-pushed - Add/remove a sort, Back/Forward – sorts and filters stay in sync with the URL - Reload a filtered + sorted URL – both restored --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> |
||
|
|
4507b20370 |
fix(studio): stop table editor filters leaking across tables on Back (#51391)
On TanStack, the URL moves to the next table before the route params and rendered table do. Two places in the Table Editor read the table from one and its filters from the other, so one table's filters got applied to another during Back navigation. Reproduces on master (TanStack only); reported while testing #51067. **Changed:** - `useSyncTableEditorStateFromLocalStorageWithUrl` skips saving while the URL's table id doesn't match the rendered table, so a table no longer reopens (from tabs/sidebar) with another table's filter. - The sidebar's row count (`EntityListItem`) only uses URL filters when the URL belongs to that table (`useUrlTableFilters`), so it no longer runs `count(B) where <A's filter>` (which 400s when the column doesn't exist). **Added:** - Real-TanStack-router regression tests for both, with a delayed route load (each fails without its fix). ## To test - Add a filter on table A, switch to table B and back a few times via the sidebar, then hit browser Back repeatedly - Open B from its tab/sidebar – it shouldn't pick up A's filter - Watch network: no `table-rows-count` for B should include A's filter - A's own filter (and its filtered sidebar count) should still work when on A --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> |
||
|
|
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) |
||
|
|
fe8b4df66d |
Chore/tiny refactor org limit (#51550)
## Context Tiny refactor that I happened to pass by as I was reviewing other PRs `useOrgProjectsInfiniteQuery` has a default `limit` value at 96 set in the hook, 96 mainly for the home page to render a full row of cards since cards are rendered in rows of 3 However, we have a couple of callsites for `useOrgProjectsInfiniteQuery` that were passing a different `limit` value, hence these would be triggered as a separate API request. Am opting to remove the `limit` parameter from `useOrgProjectsInfiniteQuery` so that the limit is standardized to 96 - So that data can be cached without having to invoke another API request wherever `useOrgProjectsInfiniteQuery` is called - I doubt that there'll be a need in a UI that will require calling `useOrgProjectsInfiniteQuery` with a separate value for `limit` but please do let me know otherwise if I might be overlooking anything! |
||
|
|
1c97fe51be |
docs: move C# SDK from community to official support (#51487)
## Problem Remove COMMUNITY badge from C# SDK Reference, and fix links pointing to `supabase community`. ## 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) |
||
|
|
0d8cd9c315 |
feat(studio): prompt for a higher AI opt-in level instead of "no tool access" (#51411)
## Motivation When an Assistant tool needs a higher opt-in level than the org has, the user only sees the model say it has no access with (inconsistent) written instructions how to fix, instead of Assistant proactively facilitating the fix. <img width="400" alt="CleanShot 2026-10-07 at 3 44 29 PM@2x" src="https://github.com/user-attachments/assets/ba95568a-5db4-4d8c-b4ff-64855f2b87ec" /> The majority of recent labelled [Assistant Issues](https://www.braintrust.dev/app/supabase.io/p/Assistant/topics) in Braintrust are tools or query results blocked by the org opt-in level. We've considered making Assistant disabled entirely when data opt-in is off to eliminate the most common footgun (AI-405), but that's an intrusive change which could break legitimate use cases. ## Changes https://github.com/user-attachments/assets/206a2438-630e-4368-9cec-2b04b66c9cd4 A new `update_opt_in_level` tool renders an inline card which prompts admins to review the opt-in level and highlights the proposed change (non-admins see a message telling them to contact their admin to change the setting). Saving approves the call and the turn resumes at the new level. Results appear in a Braintrust tool span based on https://github.com/supabase/supabase/pull/45654. I added 5 evals that simulate the user answering the opt-in card to verify that the Assistant asks when blocked, continues after the user accepts, and doesn't invent data after a skip. Tool Usage and Correctness are at 100% in the [sample run](https://www.braintrust.dev/app/supabase.io/p/Dev%20(mattrossman%2FAssistant)/experiments/mattrossman%2Fai-158-prompt-users-to-update-settings-instead-of-showing-no-tool-1791483991). <details> <summary>📸 Screenshots</summary> | Admin, pending | Modal, Current and Proposed | | -- | -- | | <img width="100%" alt="CleanShot 2026-10-07 at 3 23 37 PM@2x" src="https://github.com/user-attachments/assets/2fc8ba11-0530-4028-a056-40ca02afd3ef" /> | <img width="1184" height="1754" alt="CleanShot 2026-10-07 at 3 32 37 PM@2x" src="https://github.com/user-attachments/assets/73639633-89ac-4d4c-b869-d9301735d5b9" /> | | **After saving, turn continues** | **Non-admin** | | <img width="100%" alt="CleanShot 2026-10-07 at 3 27 14 PM@2x" src="https://github.com/user-attachments/assets/a91c6760-6dfb-4f51-9ef8-4bdbe1b22495" /> | <img width="100%" alt="CleanShot 2026-10-07 at 3 15 33 PM@2x" src="https://github.com/user-attachments/assets/ecb9aa87-26dc-4b69-a086-cb77a28bb860" /> | </details> ## Verification To test in staging, set your org's Assistant opt-in level to Disabled, ask "What tables do I have?", and review the card. Try selecting the proposed (or different) opt-in level and saving to continue. [This trace](https://www.braintrust.dev/app/supabase.io/p/Dev%20(mattrossman%2FAssistant)/experiments/mattrossman%2Fai-158-prompt-users-to-update-settings-instead-of-showing-no-tool-1791483991?r=90066cd9-4da3-4817-9650-c369d2b42cea) is a sample from the accept eval case after saving Schema Only, note the `update_opt_in_level` span. ## Safety considerations I added a banner to the modal to make it more obvious that this setting impacts the whole org, not just the current chat or project: <img width="592" height="78" alt="CleanShot 2026-10-08 at 2 04 44 PM@2x" src="https://github.com/user-attachments/assets/6b140ed6-65fb-4bc0-b5cc-9c82fe2a67aa" /> I leave the current opt-in value selected by default in the form so the user has to consciously select the proposed value instead of mindlessly clicking save without understanding implications. `execute_sql` and `run_notebook` outputs are now stamped with the level they ran under, and history is sanitized by the least permissive of the stamped vs current opt-in levels. That way raising the level mid-chat doesn't unexpectedly expose earlier query rows to the model. Closes AI-158 |
||
|
|
1ee88e0fee |
feat(studio): show Realtime on High Availability projects in staging (#51372)
## What kind of change does this PR introduce? Feature, limited to staging and local. ## What is the current behavior? On High Availability projects, Studio always disables Realtime: the Realtime pages and the Publications pages show an "unavailable" message, the table editor's "Enable Realtime" checkbox is disabled, and the project home shows Realtime as disabled. ## What is the new behavior? A new `useIsRealtimeUnavailable()` hook treats Realtime as unavailable only on High Availability projects outside staging and local (via `IS_STAGING_OR_LOCAL`). Those four places use it instead of checking `high_availability` directly. - **Production:** unchanged. - **Staging and local:** Realtime behaves as on standard projects. ## Additional context Whether a High Availability project is actually registered as a Realtime tenant is gated separately on the platform side. Until then, the pages render but Realtime connections for that project fail. Tests: a new `resolveRealtimeUnavailable` test, and the `TableRealtimeToggle` and `resolveRealtimeServiceStatus` tests updated for the renamed parameter. |
||
|
|
22886fd304 |
feat(studio): add flag-gated general region selection (#51274)
## Problem
We want to be able to show free-plan organizations a simplified region
selector that only lists general regions (Americas, Europe,
Asia-Pacific), controlled per organization through ConfigCat.
## Solution
- ConfigCat flags are now evaluated with `organization_slug` and
`organization_created_at` (Unix seconds) custom attributes, so flags can
target and bucket by organization.
- `organization_created_at` is read from `GET
/platform/organizations/{slug}`, fetched only for free-plan
organizations, since the organization list response doesn't include it.
- Two flags:
- `freeTierGeneralRegionEnrollment`: the organization is enrolled
(control or test).
- `freeTierGeneralRegionSelection`: the organization sees only general
regions.
- For enrolled free organizations, the region selector stays in its
loading state until flags have been evaluated with the organization's
creation time, so specific regions aren't shown and then removed.
- In the test variant, the selector hides specific regions and shows a
footer linking to the plan upgrade panel. High Availability keeps its
own region list.
- Telemetry: new `free_tier_general_region_experiment_exposed` and
`free_tier_general_region_upgrade_clicked` events, and
`freeTierGeneralRegionExperiment` / `regionSelectionType` properties on
`project_creation_simple_version_submitted`.
- `created_at` is added to `OrganizationSlugResponse` in the generated
platform types, matching the API.
## Review instructions
1. With both flags off, open `/new/[slug]` for a free organization and
confirm the region selector is unchanged.
2. Using the dev toolbar, set `freeTierGeneralRegionEnrollment` and
`freeTierGeneralRegionSelection` to `true`. Confirm only general regions
are listed and the footer links to the billing plan panel.
3. Set `freeTierGeneralRegionSelection` to `false` and confirm the full
selector is shown.
4. Repeat with a paid organization and confirm the full selector is
always shown.
|
||
|
|
4b2d163a1d |
fix(orioledb): use alpha and beta conditionally based on AMI version (#51162)
## Problem - Older orioledb projects show "Public Beta" instead of "Public Alpha" in UI. - List of backups in the "Scheduled backups" tab hangs. ## Solution - show in the UI "Public Alpha" for projects older than 17.11.0.001-orioledb - show in the UI "Public Beta" for new projects - enable scheduled-backup query for "Public Beta" <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Backup availability messages now reflect OrioleDB’s current release stage rather than always describing it as public beta. * AWS backup queries are no longer disabled for every OrioleDB project; they remain disabled during the alpha stage. * **New Features** * Added an informational notice and documentation link for scheduled backups on AWS OrioleDB projects in alpha. * Added release-stage details to the PITR availability notice. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> |
||
|
|
d22702e907 |
refactor(studio): extract user project regions + emergency override hooks (#51033)
## Summary - Extracts `useUserProjectRegions` (org + project region aggregation, fail-open on fetch errors) and `useEmergencyIncidentOverride` (the `ongoingIncident` flag / env var check) out of `useStatusPageBannerVisibility`, so the upcoming incident.io status-page banner can reuse both without duplicating the org/project fan-out logic. - No behavior change for the legacy banner except one intentional fix: `StatusPageBanner.utils.ts` compared the incident's affected regions (lowercased) against the user's regions (not normalized), so a mixed-case region on either side could silently fail to match. Both sides now go through the same `normalizeRegion` helper. - Part of the Linear FE-4057 stack (PR 5a of 6). Base branch is PR 4 (`charis/fe-4057-pr4-project-creation-status-admonition`), not master. Linear: FE-4057 ## Test plan - [x] `pnpm --filter studio run typecheck` - [x] `pnpm --filter studio run lint:ratchet` - [x] `pnpm knip --workspace apps/studio` - [x] `pnpm test:prettier` - [x] `pnpm --filter studio exec vitest run` on the touched test files and the `hooks/misc/` and `components/layouts/AppLayout/` directories (all passing, no regressions) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved status banner targeting by matching incidents against normalized regions across the user’s projects. * Updated banner visibility checks to handle incomplete project or region data, including when project information fails to load. * Improved loading behavior so the banner can be evaluated based on user-region data rather than waiting for separate organization and project requests. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
b2cf3693dd |
feat(studio): /api/status-page endpoint backed by incident.io Widget API (#50931)
## Summary * Adds `/api/status-page` (Next route + TanStack wrapper), backed by the [incident.io](<http://incident.io>) Widget API, annotating each item with `visible`, `show_banner`, and (for scheduled maintenances) `banner_lead_days`. * Deployment-mode visibility is driven by a new `status_page:visibility_field_ids` custom-content key. * Widget array parsing is fault-tolerant: a malformed item in one array is dropped and logged rather than failing the whole response, so one bad item can't hide a real ongoing incident. * 429s from [incident.io](<http://incident.io>) are retried with equal-jitter exponential backoff, respecting `Retry-After`, up to 2 retries. * Nothing consumes this endpoint yet — it replaces no existing behavior and changes nothing user-visible. Later PRs (this is PR 1 of a stack) wire up consumers behind the `incidentIoStatusPage` ConfigCat flag. Part of [FE-4057](https://linear.app/supabase/issue/FE-4057/frontend-bannerbot-reconfigured) — see Linear for full design context. ## Test plan - [X] `pnpm --filter studio run typecheck` - [X] `pnpm --filter studio run lint:ratchet` - [X] `pnpm knip --workspace apps/studio` - [X] `pnpm test:prettier` - [X] `pnpm --filter studio exec vitest run status-page` — 44 tests passing, including a regression test built from a real production [incident.io](<http://incident.io>) payload that initially failed to parse, and a compile-time type-safety regression test for the array-parsing helper Co-authored-by: Claude Code [charis@supabase.io](<mailto:charis@supabase.io>) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a status page that displays ongoing incidents and maintenance, with visibility and banner settings based on linked incident details. * Status page data is available through a new API endpoint, with caching for successful responses and degraded results. * **Bug Fixes** * Status page data can still display when some linked incident details are unavailable; affected results are marked as degraded. * Improved handling of invalid widget entries so they don’t prevent valid items from being processed. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Code <charis@supabase.io> |
||
|
|
7994191e49 |
feat(studio): group consecutive assistant tool calls (#50893)
<img width="913" height="572" alt="image" src="https://github.com/user-attachments/assets/e8112085-508a-49e4-abb1-7550248e611e" /> ## Problem A single Assistant response often produces 10+ reasoning and lookup rows ("Reasoned", "Ran search_docs", …). They push the answer down the chat, use raw tool names, and a fast tool call flashes past before the row goes back to "Thinking...". ## Solution Consecutive reasoning and lookup rows fold into one collapsible group. - **Running:** the header shows a tool only while it executes ("Checking policies in public..."). Between calls it reads "Thinking...", however long that lasts. Each header label stays up for at least 1 second, so quick calls no longer flash. - **Finished:** the header lists what the tools did, e.g. "Searched docs and checked policies", or "…, and 2 more". - **Expanded (any time):** every call is listed under a vertical rule. Rows still in progress shimmer, including several at once for parallel calls. ## How to test 1. Run `pnpm dev:studio` and open the Assistant on a project with a few tables. 2. Ask something that needs several lookups, e.g. "What RLS policies do I have and what do the docs recommend for them?" 3. While it streams, check the collapsed header: - It shows each tool while it runs, then goes back to "Thinking..." between calls. - Labels don't flash. Each stays up for about a second. - Only the shimmer marks progress, with no blinking cursor underneath. 4. Expand the group mid-stream. Rows read like "Checking policies in public..." rather than tool names, and only rows still in progress shimmer. 5. When it finishes, the header lists the actions ("Searched docs and checked policies") and stops shimmering. 6. Press Stop while a group is running. The unfinished row reads "Response interrupted" and stops spinning. 7. Reload the chat. Older groups show their collapsed summaries. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * AI assistant tool activity is grouped into collapsible sections with progress labels while work is underway and summaries when complete. * Expand grouped activity to review reasoning and tool details. Active tools and reasoning are highlighted, while completed reasoning without text is hidden. * Progress labels remain visible briefly during transitions, and active responses display a shimmer effect. * **Bug Fixes** * The loading indicator no longer appears while the assistant is processing a tool group. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com> |
||
|
|
509afd0bf0 | fix(o11y): support partial metric loading (#50867) |