mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
docs/auth-rate-limits-reference
1518
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
dc4f247e79 |
Revert "chore: update prod api types (#54394)" (#54404)
This reverts commit
|
||
|
|
b6c391a058 |
[FE-5114] (part 1) – refactor(studio): add native API helpers & routes (#54028)
## Problem Studio's `routes/api/**` server routes still run legacy Next Pages Router handlers through the `toWebHandler` shim in `compat/next/api.ts`. Part 1 of 7 for [FE-5114](https://linear.app/supabase/issue/FE-5114/rewrite-api-routes-as-native-tanstack-start-handlers-and-remove-the) adds native TanStack Start (`Request` → `Response`) helpers and migrates the top-level utility routes so we can remove the adapter at the end of the stack. ## Solution **Added:** - `createApiHandlers` in `lib/api/apiWrapper.ts`: wraps native TanStack Start route handlers with optional platform JWT auth, JSON `400` (`{ error: { message: 'Invalid JSON' } }`) on `InvalidJsonError`, Sentry capture + generic `500` on unexpected throws, and an `ANY` handler that returns `405` with an `Allow` header derived from the registered methods. Exports `ApiHandler` / `ApiHandlerContext` (`params` is `Record<string, string>`) - `authenticateRequest` in `lib/api/apiAuthenticate.ts` (Web `Request` counterpart of `apiAuthenticate`, same error messages) - `InvalidJsonError` and `parseJsonBody` in `lib/api/apiHelpers.ts` - `callRoute(route, request, params)` test helper in `tests/lib/server-route.ts` - Unit tests for `createApiHandlers` (exercising real `authenticateRequest` through MSW in `lib/api/createApiHandlers.test.ts`), `authenticateRequest`, `parseJsonBody`, `/api/generate-attachment-url`, and `/api/integrations/stripe-sync` **Changed:** - Updated `getRouteHandler` in `tests/lib/server-route.ts` to mirror TanStack Start's `HEAD` → `GET` → `ANY` dispatch order - Migrated 11 top-level API routes (`check-cname`, `cli-release-version`, `content/graphql`, `edge-functions/test`, `enabled-features-overrides`, `generate-attachment-url`, `get-deployment-commit`, `get-ip-address`, `get-s3-keys`, `get-utc-time`, `integrations/stripe-sync`) to native handlers - Added `withAuth: true` to `check-cname`, `content/graphql`, and `integrations/stripe-sync`, and updated `check-cname-mutation.ts` and `data/graphql/execute.ts` to attach `constructHeaders()` - Reused `withAuth` `claims` in `generate-attachment-url` to avoid a duplicate GoTrue lookup in platform mode - Converted `tests/routes/api/get-deployment-commit.test.ts` to `callRoute` **Removed:** - Removed 2 unused routes (`routes/api/connect/index.ts` and `routes/api/parse-query.ts`), dropped `/parse-query` from `lib/hosted-api-allowlist.ts`, removed Nitro's `traceDeps: ['libpg-query*']` in `vite.config.ts` (no server runtime route imports `libpg-query` anymore), and regenerated `routeTree.gen.ts` **Behavior changes vs master:** - Methods a route doesn't register now get a JSON `405` with an `Allow` header (previously they fell through to the SSR app). `HEAD` requests that TanStack Start dispatches to a `GET` handler also get `405`, matching master's method switches - `InvalidJsonError` returns JSON `{ error: { message: 'Invalid JSON' } }` (`400`) instead of plain text - `check-cname`, `content/graphql`, and `integrations/stripe-sync` now verify the platform JWT via `withAuth: true` - Unexpected throws return a generic `500` with `{ error: { message: 'Internal Server Error' } }` - Unused `/api/connect` and `/api/parse-query` routes have been removed ## Review instructions 1. Run `pnpm --filter studio exec vitest run lib/api/apiAuthenticate.test.ts lib/api/apiHelpers.test.ts lib/api/apiWrappers.test.ts lib/api/createApiHandlers.test.ts tests/routes/api/ scripts/__tests__/server-source-maps.test.ts`. 2. Smoke-test `/api/get-deployment-commit`, `/api/check-cname`, `/api/content/graphql`, `/api/generate-attachment-url`, and `/api/edge-functions/test` in Studio and confirm unsupported HTTP methods return `405` with an `Allow` header. ## Checklist - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide) --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> |
||
|
|
37d4f444b4 |
chore: update prod api types (#54394)
Updated API types and addressed any type issues. Had to update shared-types alongside. |
||
|
|
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> |
||
|
|
c2edb29076 |
fix(studio): explain Supavisor session pool limits DEBUG-43 (#53930)
## Problem When Supavisor rejects a session because its connection pool is full, Studio shows the error without explaining how to recover. ## Fix Show a troubleshooting step for the session-mode limit that explains how pool size limits concurrent clients and links to the configuration guide. ## Screenshot The Table Editor’s troubleshooting step, rendered locally with a sample session-pool error. <img width="660" alt="Expanded Supavisor session pool limit guidance in the Table Editor" src="https://github.com/user-attachments/assets/6072eec4-e243-4d53-a40f-30fb14d21d05" /> ## How to test - Display a classified MaxClientsInSessionMode error in Studio and expand its troubleshooting step. The link should open the pool size section of the database connection management guide. - Display a generic transaction-mode connection limit error. It should keep its usual fallback. - The pattern, classification and ErrorMatcher suites exercise these paths (144 tests passed locally). Fixes [DEBUG-43](https://linear.app/supabase/issue/DEBUG-43). |
||
|
|
27c4433a3e |
feat: revised project add-ons page (#54186)
The current add-ons page only lists a subset of available add-ons, which often causes confusion with things like Advanced MFA Auth (customers cant find where to configure it). The revised add-on page covers all potentially configured project add-ons including replicas and advanced disk. This should help the customer locate configured add-ons and at the same time discover potentially interesting add-ons. This can be enhanced further in the future with "smart" suggestions based on usage. |
||
|
|
d7ad2cdb32 |
fix(studio): order object versions by archived_at (#54104)
## Problem Object versions are sorted by `created_at`, but a version's `created_at` doesn't always reflect when it was written. When a bucket is suspended, an upload replaces the null version in place and keeps that row's original `created_at`, so the current version can show up below older ones in the versions panel. ## Solution Sort by `archived_at`. The current version has no `archived_at`, so it comes first, followed by the most recently archived. Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
15e95ab013 |
Joshenlim/fe 5242 jit db access show assigned role (#54214)
## Context Building on top of https://github.com/supabase/supabase/pull/54192, there was a missing piece to the JIT DB access UI which was showing the assigned access to the user if any (On staging it just shows an error, on the previous PR we show a "Contact your project admin" CTA). So this PR addresses that - there's a couple of cases to consider and I'd love for design to feedback / adjust as well as I'm not convinced this is the best way to do things. Am deliberately leaving out the "copyable connection strings" part for now as Danny's investigating into that one ### If you're a non-owner If not assigned a role: <img width="500" alt="image" src="https://github.com/user-attachments/assets/111d7c4f-0083-4bd5-88d5-ec45974ccf4d" /> If assigned a single role: <img width="500" alt="image" src="https://github.com/user-attachments/assets/1b4b1f3c-9a20-4010-bff8-7bf68a455e26" /> If assigned multiple roles: <img width="500" alt="image" src="https://github.com/user-attachments/assets/42cc66f6-4604-42eb-ab30-f58b1396ca6b" /> <img width="500" alt="image" src="https://github.com/user-attachments/assets/0914e1a3-9c7d-463e-851d-65f6b9793bb7" /> If (all) access expired: <img width="500" alt="image" src="https://github.com/user-attachments/assets/bda0fc65-e22a-49d9-b444-fc5d58a4745a" /> ### If you're an owner If not assigned a role: Status quo <img width="500" alt="image" src="https://github.com/user-attachments/assets/435abe70-ae88-49bb-86b9-7a03963b5b66" /> If yourself is assigned a role: <img width="500" alt="image" src="https://github.com/user-attachments/assets/9fafc74a-1a33-489e-a7da-70f57356a034" /> If yourself is assigned multiple roles: <img width="500" alt="image" src="https://github.com/user-attachments/assets/f4af901b-a24e-4272-b573-9ccb474bb7e2" /> If (all) access expired: Same as not assigned a role, just refer back to the table |
||
|
|
4e589266af |
chore(billing): revised card errors (#54179)
- Improved error messaging around card errors and toast position to be closer to the actual action (customers often miss it in the top right) - For card errors when setting up payment methods with a direct error via the Stripe API, map to an appropriate actionable error message |
||
|
|
d85e9b8616 |
feat(billing): use new upcoming invoice data (#53342)
Makes use of the new data returned from the upcoming invoice endpoint and wraps it in an accordion-based layout. The current implementation is fairly bare-bones, so discussed with @kevcodez that we roll out this version first (which should already be an improvement), then talk to a designer on the team to get it polished. Ran `pnpm api:codegen:prod` from the root of the repo. The $10.01 in Compute Credits are an upstream data issue on Orb 😢 ## Testing If you'd like to test this in the browser, these are the steps: 1. checkout commit, launch local stack, create org + project; upgrade to paid 2. reach out to me so I can set up some usage and credits for your project/org 3. click around the upcoming invoice https://github.com/user-attachments/assets/6a814560-5d05-479a-a3f8-d658532b91c1 <img width="1180" height="235" alt="Screenshot 2026-11-13 at 10 03 01" src="https://github.com/user-attachments/assets/682083b7-77ea-4da8-a599-36f5063e922b" /> <img width="910" height="235" alt="Screenshot 2026-11-13 at 10 02 59" src="https://github.com/user-attachments/assets/59903f2a-2af4-4e18-8d97-35baee7401e0" /> <img width="815" height="140" alt="Screenshot 2026-11-13 at 12 03 17" src="https://github.com/user-attachments/assets/4370d10a-dc5a-4010-b03e-dcf0b23140d1" /> <img width="507" height="143" alt="Screenshot 2026-11-13 at 12 03 21" src="https://github.com/user-attachments/assets/3243855e-b02a-4e93-8139-5a7dfaad3230" /> |
||
|
|
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> |
||
|
|
cbcdf4c84c |
fix(studio): storage lifecycle policy execution (#54138)
## Problem Non-current versions in storage weren't showing the correct expiration value based on the lifecycle policies settings. ## Solution Fix client logic and improve communication around expiration. Adding "Archived at" info make the version history crowded, so some information has been moved into the dropdown menu of each noncurrent version. <img width="445" height="314" alt="Screenshot 2026-11-26 at 16 58 23" src="https://github.com/user-attachments/assets/efb345f7-9a1c-4a53-b5e2-8b05505f9856" /> Note: when the "Newest noncurrent versions to keep" threshold is met, older versions that exceed such thresholds will expire no earlier than in 1d. ## Review instructions - Enable object versioning and set lifecycle policies on a File Storage bucket - add new versions to reach and exceed policy threasholds - check that expiration rules apply as intended |
||
|
|
0755ba6556 | feat(studio): use the onboarding survey in the AWS Marketplace org form (#53938) | ||
|
|
0246fb34b5 |
fix: clear free project limit cache on project operations (#54108)
When pausing/creating/restoring/cloning a project, we are not clearing the react-query cache for the free project limit check and therefore still displaying potentially wrong states to the user. PR addresses this by clearing the free project limit react query cache on relevant project operations. |
||
|
|
8f75187422 |
fix(studio): stop dev No queryFn error from grantedQueryOptions (#54004)
Fixes TanStack Query spamming `No queryFn was passed as an option` in dev whenever a grant-gated query renders without a grant or required variable (such as `branchesQueryOptions` when `projectRef` is `undefined`). **Changed:** - Replaced `queryFn: undefined` in `grantedQueryOptions` with a stable `fallbackQueryFn` while keeping `enabled: false`. This satisfies `useBaseQuery`'s dev-mode check and still delegates to a subscribed granted observer on invalidation (avoiding the `skipToken` shared-cache regression from #53088). - Updated `granted-query-options.test.ts` and `api-keys-query.test.tsx` to verify no `console.error` is logged when rendering without a grant or `projectRef` and that invalidation still refetches via the granted observer. - Updated the `studio-queries` skill note to match. ## To test - Run `pnpm dev:studio` and open a non-branch project's home page. Confirm the browser console and dev terminal no longer spam `[["projects",null,"branches"]]: No queryFn was passed as an option`. - Open Project Settings -> API Keys, create or delete a key, and confirm the list still refreshes cleanly. - Run `pnpm --filter studio test data/granted-query-options.test.ts data/api-keys/api-keys-query.test.tsx`. Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> |
||
|
|
4fa8afe918 | feat(studio): support grouped OR filters in unified logs (#53943) | ||
|
|
15fcb7dc49 |
fix(studio): refresh observability charts for the selected range FE-5122 (#53931)
## Problem A custom date range in a Storage report URL could show one window in the header and another in the charts. Refresh also left Database Size and several Auth charts showing cached results. ## Fix Use the selected window for all Storage report requests, run the Database Size query on refresh, and refresh Auth Usage, Errors and Latency alongside the shared API charts. ## How to test - Open Storage with a custom start and end time in the URL. Inspect the chart requests on load and after Refresh. Both sets should use those exact timestamps. - Refresh the Database report and check that the large objects query runs again. - Open Auth with a fixed range and press Shift+R. The Usage, Errors, Latency and API charts should request fresh data for the same range. Fixes [FE-5122](https://linear.app/supabase/issue/FE-5122). |
||
|
|
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>
|
||
|
|
4a73166675 |
Add support for downloading edge functions when file size exceeds max cap (#53709)
## Context Just creating a separate PR cause I messed up the [previous one](https://github.com/supabase/supabase/pull/53453) with a bad merge 🫠 Also changed the implementation to no longer use `@deno/eszip`. For edge functions, functions which exceed 5MB cannot be fetched and displayed in the dashboard editor (API will return a 507). The CTA we give to users is to download the function via the CLI, but this PR explores allowing users to download their edge functions via the browser still, by calling `/v1/functions/slug/body` without the `multi-part/data` header. This returns the function in a raw eszip stream which we're then parsing using a custom reader We'll do this via the "Download as ZIP" CTA here - but this way of downloading only kicks in if the GET Edge Function body endpoint returns a 507. Otherwise it'll just be status quo where we bundle the files that were already fetched to render in the browser into a ZIP file. <img width="343" height="186" alt="image" src="https://github.com/user-attachments/assets/4ffc9fee-7e6d-46a6-bdbe-294610abc802" /> Also updated the warning for 507s: - To use a normal admonition instead of `AlertError` since its technically not an issue - To avoid rendering the API error message in this case specifically as the API message contains "Use multipart instead" which isn't relevant to the dashboard from a user's POV <img width="500" alt="image" src="https://github.com/user-attachments/assets/8242a875-f142-419d-81f0-0dbc30807f87" /> ## To test - [ ] Upload an edge function of size larger than 5MB to a staging project via the CLI - [ ] Verify that there's an Admonition for the large function instead of an error - [ ] Verify that you can still download the edge function via the Download button (Which triggers a POST /body request without multipart) |
||
|
|
53f2bb416d |
feat(studio): saved views in sidebar (#53630)
## Problem Unified Logs had saved views behind a dropdown in the toolbar. The dropdown couldn't show more than a name per row, had no room for grouping, and gave new projects nothing to start from — an empty list until you built and saved a filter combination yourself. ## Solution Moved saved views into the filter sidebar as a second level, following the Explorer notebooks/chats pattern: a Saved views button in the sidebar header swaps the filters out for a Views panel, with a breadcrumb back to Logs. Key choices: - **`FilterSideBar` stays generic.** It takes `section`, `headerAction` and `onReset` slots; all saved-views specifics live in `LogsViewsPanel`. - **Presets are virtual, not seeded.** Three built-in views (Errors, Failed requests, Database health) render from a constant with `preset:` ids. No per-project write, so they work for read-only members and can't be deleted into oblivion. They can be duplicated into a real saved view, but not renamed, edited or deleted. - **One dialog for naming.** `ViewNameDialog` backs create, rename and duplicate. - **Clicking a modified view opens the update prompt** instead of re-applying it, which previously discarded unsaved filter edits with no warning. Also fixed two pre-existing alignment issues in the sidebar: filter options sat 4px left of their section heading, and the User filter — a hand-copied clone of the filter row markup — had drifted from the shared one. ## Review instructions 1. Enable the Unified Logs feature preview and the `logsSavedViews` flag, then open **Logs**. 2. Click the layers button in the sidebar header. The filters swap for the Views panel, with **Preset views** above **Saved views**. 3. Click **Errors**. The filter applies and the row highlights; the layers icon turns green. 4. Change a filter. The row reads **Modified** and the update prompt appears. Go back to Logs and return — the prompt is still available. 5. Open the ⋮ menu on a preset: only **Duplicate** is offered. Duplicate it and confirm it lands under Saved views with rename/delete available. 6. Click **+** in the Views header to save the current filters, then rename and delete it. 7. Hit the reset button in the header and confirm the active view clears along with the filters. |
||
|
|
2372aa0fc2 |
feat(studio): show Warehouse query latency (#53570)
## Problem The Warehouse report shows query activity and outcomes, but not how long queries spend waiting or running. ## Solution Add query-duration percentiles, worker-acquisition waits and successful-query duration. Durations are shown in milliseconds, with missing measurements kept distinct from zero. Latency loads separately so a failed request does not hide query activity. | After | | --- | | <img width="1678" height="1796" alt="CleanShot 2026-11-18 at 12 28 53@2x" src="https://github.com/user-attachments/assets/48c6545e-8f2d-40c4-aa3c-977dd2ae6479" /> | | _New latency section._ | ## Review instructions 1. Open the [Studio staging preview](https://studio-staging-git-dnywh-warehouse-report-latency-supabase.vercel.app) with a staging project that has Warehouse access ([example](https://studio-staging-git-dnywh-warehouse-report-latency-supabase.vercel.app/dashboard/project/yirnfrgkxmnqgexikhfc/observability/warehouse?its=2026-11-18T00%3A23%3A52.901Z&ite=2026-11-18T01%3A23%3A52.901Z&isHelper=true&helperText=Last+60+minutes)), then go to **Observability > Warehouse**. 2. Check **Query duration**, **Time waiting for a worker** and **Successful query duration** below the query charts. Hover the lines to compare timing measurements. 3. Change the date range and refresh. Both query activity and latency should update. 4. Check the selected period without measurements. Empty or unavailable data must remain distinct from measured zeroes. Shared ChartLine accessibility changes are separate in #53706. --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com> |
||
|
|
4442d91d77 |
feat(studio): Wire org and users authorized apps list to backend (#53674)
## Description Part of the work for OAuth apps with the scoped permissions. This PR wires the org and users authorized apps lists to backend. |
||
|
|
10488ed799 |
feat(studio): Wire the OAuth apps consent screen to the backend (#53511)
## Description
Part of the work for OAuth apps with the scoped permissions. This PR
wires consent screen to the backend.
## Review instructions
### Setup
Copy the `examples/oauth-app-authorization-flow/.env.example` to
`examples/oauth-app-authorization-flow/.env`
> [!IMPORTANT]
> In next steps, make sure to copy the apps ids/secrets in the
`examples/oauth-app-authorization-flow/.env` with a way to differentiate
them:
> ```
> # org bound all projects
> SUPABASE_CLIENT_ID=xxx
> SUPABASE_CLIENT_SECRET=xxx
> ```
As an organization admin, go to the _Organization settings/OAuth Apps_
and create the following _Publishable apps_:
- `test_org_bound`:
- _Use the permissions of the person who connects_ unchecked
- _Ask for specific projects_ unchecked
- Select only _Database Read_ for the permissions
- `test_org_bound_projects`:
- _Use the permissions of the person who connects_ unchecked
- _Ask for specific projects_ checked
- Select only _Database Read_ for the permissions
- `test_member_bound`:
- _Use the permissions of the person who connects_ checked
- _Ask for specific projects_ unchecked
- Select only _Database Read/Write_ for the permissions
- `test_member_bound_projects`:
- _Use the permissions of the person who connects_ checked
- _Ask for specific projects_ checked
- Select only _Database Read/Write_ for the permissions
Make sure you have 3 projects in the org. Add a team member that have
Administration rights on the first project, read-only access to the 2nd
and no access to the third.
Install the `examples/oauth-app-authorization-flow` dependencies and
start the app.
- `test_org_bound`:
- connected on studio as the org admin
- click the `oauth-app-authorization-flow` button
- check that you don't have to select a project on the consent screen
- check that the permissions requested are correct and you can approve
the app
- update the published app to include the _Database Write_ permissions
- return to the `oauth-app-authorization-flow` index and click its
button again
- check that the consent screen shows the permissions difference and
approve it again
- connected as a simple team member, check that you have a message
indicating you can't approve this app
- `test_org_bound_projects`:
- connected on studio as the org admin
- click the `oauth-app-authorization-flow` button
- check that you have to select projects on the consent screen
- check that the permissions requested are correct and you can approve
the app
- update the published app to include the _Database Write_ permissions
- return to the `oauth-app-authorization-flow` index and click its
button again
- check that the consent screen shows the permissions difference and
approve it again
- connected as a simple team member, check that you have a message
indicating you can't approve this app
- `test_member_bound`:
- connected on studio as a member
- click the `oauth-app-authorization-flow` button
- check that you don't have to select a project on the consent screen
- check that the permissions requested are correct and you can approve
the app
- update the published app to add another permission
- return to the `oauth-app-authorization-flow` index and click its
button again
- check that the consent screen shows the permissions difference and
approve it again
- `test_member_bound_projects`:
- connected on studio as the org admin
- click the `oauth-app-authorization-flow` button
- check that you have to select projects on the consent screen (you
should see only the two you have access to) and select them all one by
one
- check that the permissions requested are correct
- approve the app and check that you have an error related to the
project with read-only access
- unselect it and approve the app
- update the published app to include the _Database Write_ permissions
- return to the `oauth-app-authorization-flow` index and click its
button again
- check that the consent screen shows the permissions difference and
approve it again
|
||
|
|
48c90094d9 |
feat(studio): show Warehouse query activity in Observability (#53495)
## Problem Warehouse query activity is not available in Observability. ## Solution Add a Warehouse report showing query rate over the last hour, with loading, setup, no-data and request-error states. The report uses live project metrics and appears in navigation for projects with Warehouse access. | After | | --- | | <img width="2548" height="1416" alt="CleanShot 2026-11-17 at 16 55 33@2x" src="https://github.com/user-attachments/assets/4d6796e0-72f1-45d5-b6b7-2cd4a3577496" /> | | <img width="2552" height="1390" alt="CleanShot 2026-11-17 at 16 56 18@2x" src="https://github.com/user-attachments/assets/d96efdfd-4ca9-42fe-ac30-9cb4667c95d7" /> | | <img width="2544" height="1388" alt="CleanShot 2026-11-17 at 16 32 11@2x" src="https://github.com/user-attachments/assets/bc80af8d-0468-4229-98d0-ac2681823059" /> | | <img width="2560" height="1344" alt="CleanShot 2026-11-17 at 16 59 53@2x" src="https://github.com/user-attachments/assets/1ed70348-c2fc-4673-85a7-530d9734886c" /> | Visitor | What they see -- | -- Signed-in customer without Warehouse access | No Warehouse entry in Observability Customer with Warehouse access, not configured | “Warehouse is not set up” empty state and setup button Customer with Warehouse disabled | “Warehouse is disabled” empty state and setup button Customer with active Warehouse | Query rate chart, or the relevant loading/empty/error state ## Review instructions 1. Open the [Studio staging preview](https://studio-staging-git-dnywh-warehouse-metrics-client-supabase.vercel.app) with a staging project that has Warehouse access. 2. Go to **Observability > Warehouse**, or `/project/<ref>/observability/warehouse` ([example](https://studio-staging-git-dnywh-warehouse-metrics-client-supabase.vercel.app/dashboard/project/yirnfrgkxmnqgexikhfc/observability/warehouse)). 3. Check the query-rate chart after running Warehouse queries. A project without measurements shows an explicit last-hour empty state. 4. Open the report on a project where Warehouse is not set up and check the setup link. --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com> |
||
|
|
248dbefbe9 |
fix(studio): skip notifications and service status queries without a session (#53538)
## Problem
`useNotificationsV2Query` and `useProjectServiceStatusQuery` run
whenever their component is mounted, whether or not a session exists.
When a session ends and the app redirects to `/sign-in`, they can still
fetch (or refetch) `/platform/notifications` and
`/v1/projects/{ref}/health` with no `Authorization` header. The API then
responds 401 `No access token provided`, and the response is classified
as an `UnclassifiedApiError` and reported.
## Solution
Both hooks now gate `enabled` on `useIsLoggedIn()` from `common`.
`usePermissionsQuery` and `useOverdueInvoicesQuery` already follow this
pattern. The caller's `enabled` option still applies on top of it.
Self-hosted builds always count as logged in, so their behavior is
unchanged.
Checks run:
- `pnpm turbo run typecheck --filter='...[origin/master]'`: passes
- `pnpm turbo run lint --filter='[origin/master]'`: passes. The first
run of `studio#lint:type-checks` ran out of heap memory. It passed on a
rerun with `NODE_OPTIONS=--max-old-space-size=8192`.
- `pnpm exec vitest run
components/layouts/AppLayout/AdvisorButton.test.tsx
components/layouts/AppLayout/AdvisorButton.platform.test.tsx
components/ui/AdvisorPanel/AdvisorSignals.integration.test.tsx` (in
`apps/studio`): passes
- Prettier check on the changed files: passes
## Review instructions
1. Sign out of the Studio preview. Open
`/dashboard/sign-in?returnTo=/project/<ref>`, keep the network tab open,
and confirm that no request to `/platform/notifications` or
`/v1/projects/<ref>/health` returns 401.
2. Sign in and open a project's home page. The service status indicator
still loads its status.
3. Open the Advisor/Issues panel from the header. Notifications still
load, and the header button still shows the unread/critical indicator
when it applies.
## Checklist
- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
[FE-4989](https://linear.app/supabase/issue/FE-4989/unclassifiedapierror-no-access-token-provided)
Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
|
||
|
|
7b37f0c774 |
feat(studio): update oauth apps mocks and UI to the latest API payloads formats (#53363)
## Description Part of the work for OAuth apps with the scoped permissions. This PR: - Update the mock data to the new format returned or expected by the backend - Remove unnecessary hooks that have their feature merged in another one (`useOAuthOrgAppDetailsQuery` is now merged in `useOAuthAppsPreflightValidationQuery`) > [!NOTE] > At this stage, the UI still only use mock data ## Review instructions If all tests pass, we're good. |
||
|
|
b58913895c |
feat(studio): Refactor OAuth app consent screen for project selection (#53361)
## Description Part of the work for OAuth apps with the scoped permissions. This PR: - Update `<MultiSelector>` to allow consumers to react to search terms changes - Refactor OAuth app consent screen to ensure we can load projects asynchronously with an infinite list and server side filtering > [!NOTE] > At this stage, the UI still only use mock data ## Review instructions If all tests pass, we're good. |
||
|
|
f0986f5f24 |
fix(studio): treat 401 API errors as a user fault for Sentry routing (#53411)
## Problem
A 401 from the platform API means the browser sent no valid session
token: the user signed out, or the session expired. Studio then
redirects to sign-in. `classifyResponseError` turns any 4xx into
`UnclassifiedApiError` with `fault: 'studio'`, so every query that fails
while the session is gone goes to Sentry at the Studio-owned sample
rate. The first query to fail is often the read-replicas query. Sentry
fills with errors that Studio can't fix.
## Solution
- `UnclassifiedApiError` now derives its fault from the status: a 401 is
`user`, and every other 4xx stays `studio`.
- `ERROR_ROUTING.UnclassifiedApiError` gets a `user` entry at
`SAMPLE_USER_FAULT`. 401s still send a small trickle to catch
misclassification, and 403/404/429 keep `SAMPLE_OWNED`.
- Because the fault is `user`, `AlertError` shows the user-fault
presentation for a 401 ("try again / refresh"), with no contact-support
prompt.
- Tests: `handleError.test.ts` expects `user` for a 401, and
`error-routing.test.ts` covers the 401 and 403 routing.
## Review instructions
This change has no new UI. To check it:
1. In `apps/studio`, run `vitest run lib/errors data/handleError.test.ts
data/error-classification.test.ts data/fetchers-errors.test.ts
data/query-client-reporting.test.ts components/ui`. All tests pass.
2. In `apps/studio`, run `eslint` on the changed files. It reports
nothing.
3. `tsc --noEmit` in `apps/studio` reports one error, in
`packages/ui-patterns/src/McpUrlBuilder/components/InstructionBlocks.tsx`.
The same error appears without this change: it comes from running `tsc`
without `next typegen` first.
[FE-5086](https://linear.app/supabase/issue/FE-5086/unclassifiedapierror-no-access-token-provided)
Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
|
||
|
|
b23e9e8d94 |
fix(consent): clear tracking state and reload when consent is withdrawn (#53294)
## Problem Opting out from the Privacy Settings modal (www, docs, kb) clears no cookies, and GTM keeps running. The banner's Opt out misses `_ga_<id>`, `_dcid`, and PostHog. ## Solution - `revokeTrackingConsent()` runs from `denyAll`, and from `updateServices` unless every service is accepted. It clears `_ga`, `_ga_*`, `_gcl_*`, `FP*`, `_dcid`, `session_id`, `ph_*_posthog`, PostHog's localStorage, stale consent copies. - PostHog resets and opts out, with persistence off. The opt-out survives sign-out. A saved accept opts back in. - Every opt-out calls `POST /platform/telemetry/reset` (keepalive, errors ignored) to clear the API's HttpOnly `session_id`, `anonymous_id`, and `user_id`. Studio's own call is removed. - To stop GTM, a saved opt-out reloads the page if tracking was on, waiting at most 1s for the reset. ## Review instructions 1. `cd packages/common && npx vitest run consent-state.test.ts posthog-client.test.ts` 2. On prod: accept, open Privacy Settings, turn Marketing off, Confirm. The page reloads with cookies gone and no `collect` request. Tested: `common` (237 pass), `AnalyticsSettings` tests, CI unit tests and typecheck. No browser test (previews lack Usercentrics). ## 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 |
||
|
|
45f4a115fa |
feat(studio): Refactor oauth app consent screen (#53357)
## Description Part of the work for OAuth apps with the scoped permissions. This PR: - refactors the authorize OAuth app consent screen to make it more consistant with how we handle load requests - remove the copy constants in favor of direct JSX like we do everywhere - ensure the data hooks have optional parameters with runtime check to be usable even when all needed data isn't loaded yet > [!NOTE] > At this stage, the UI still only use mock data ## Review instructions If all tests pass, we're good. |
||
|
|
dde52ce6e8 |
feat(studio): update oauth publishable apps to include new options (#53355)
## Description Part of the work for OAuth apps with the scoped permissions. This PR updates the publishable apps UI to actually submit the new options > [!NOTE] > The backend may reject the API call if your organization isn't enrolled in scoped oauth apps. That does not prevent to check the payload is correct ## Review instructions - Open _Organizations settings/OAuth Apps_ - Click the _Publish OAuth app_ button - Check that both options in the _Authorization_ section require a confirmation with a checkbox - Before submitting, open your devtool - Submit the app - Check that the API route `https://api.supabase.green/platform/organizations/[org_slug]/oauth/apps` was called with the options you selected: - if _Use the permissions of the person who connects_ was checked: `grant_kind: "member_bound"`, otherwise `grant_kind: "organization_bound"` - If _Ask for specific projects_ was checked: `project_scoping_mode: true` otherwise `project_scoping_mode: false` |
||
|
|
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> |
||
|
|
2a9b02a99a | feat(docs): Improve Pipelines docs and UI (#53450) | ||
|
|
f7f27aac78 |
fix(studio): escape json and jsonb values in SQL copy and export (#53372)
## What Fixes invalid or corrupted SQL from "Copy rows as SQL" and "Export table as SQL" for json/jsonb columns (FE-4860, closes #49196). ## Why The SQL formatter built json literals by rewriting `JSON.stringify` output with regexes. That corrupted values containing double quotes or backslashes, and produced invalid SQL for jsonb columns holding plain strings or other non-object values. ## How - `formatTableRowsToSQL` now serializes the parsed value and only escapes single quotes. - Grid rows carry json columns as text (the grid query casts them to `::text`), so a new `parseGridJsonColumns` helper parses untruncated json cells before formatting. It is used by "Copy rows as SQL" and the selected-rows export. Truncated cells are left alone so they are still fetched in full. - The SQL export keeps json columns unstringified (`preserveJsonValues`), so a jsonb string like `"hello"` stays distinguishable from JSON text. CSV and JSON exports are unchanged. No `::text` cast was added to the export query: the API already returns json values parsed. ## Testing - Unit tests for values with `"`, `\`, `'`, plain-string jsonb, arrays, numbers, booleans and null, plus `parseGridJsonColumns`. - Ran the formatter output against a local Postgres: both the parsed (fetch-all) and grid-text (copy / selected rows) shapes loaded and round-tripped identically for jsonb and json columns. The old formatter's output failed with `invalid input syntax for type json` on the same data. - Not exercised end to end in the Studio UI, and the truncated-cell path is covered by unit tests only. ## Not in scope The JSON export still stringifies objects before `JSON.stringify`, so json columns come out as nested strings. That is separate pre-existing behavior. |
||
|
|
311e2c721c |
fix(studio): suggest cli download when function code exceeds max size limit (#53421)
<!-- claude-slack-attribution --> _Requested by **Kalleby Santos** · [Slack thread](https://supabase.slack.com/archives/C02KMRX22NR/p1794750855761849?thread_ts=1794750855.761849&cid=C02KMRX22NR)_ ## Problem **Before:** When an Edge Function's source is too large to load in Studio, the function's Code tab shows "Failed to load function code" with the same steps as any other load failure: update the CLI, then redeploy with `supabase functions deploy` or use the Management API. Redeploying does not help here, because the problem is the size of the code, not a bad deployment. **After:** When the function body request fails because the code exceeds the maximum size (HTTP 507), the same error screen tells the reader to update the CLI and then download the function with `supabase functions download <function-slug>`. All other load errors keep the existing redeploy and Management API steps. ## Solution Adds `isFunctionBodyMaxSizeError` (true when the error code is 507) next to the function body query, and the Code page uses it to pick which step 2 to show. Studio already preserves the HTTP status as `error.code`, so no changes to error classification are needed. This ports Kalleby's fork commit [498a1b1](https://github.com/kallebysantos/supabase/commit/498a1b1b386accea4fa57a85a3a2328b79a3b34c) onto current master. Differences from the original: it types the helper against Studio's current error shape instead of `ResponseError`, fixes the "Donwload" typo, and adds a small unit test for the helper. Co-authored-by: Kalleby Santos <kalleby_santos@hotmail.com> ## Review instructions 1. Open a function's Code tab where the function body request returns 507 (for example by mocking the response) and confirm step 2 reads "Download your function using: `supabase functions download <slug>`" with no Management API step. 2. Trigger any other body load error and confirm the redeploy and Management API steps are unchanged. ## 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 (not applicable, no docs changes) --- _Generated by [Claude Code](https://claude.ai/code/session_01JZqbAVr5Epmzu7mKWMj9jD)_ --------- Co-authored-by: Kalleby Santos <kalleby_santos@hotmail.com> Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com> |
||
|
|
4ed3627d72 |
Joshenlim/fe 3891 improve handling of partition tables in (#53268)
## Context The Table Editor doesn't really handle partitioned tables well given the following issues: - Partitioned tables are rendered as a flat list in the Table Editor side menu, so the menu could get very long and noisy - this was the primary motivation for this PR - Child partitioned tables are not indicated with a proper icon, they're treated as regular tables in the Table Editor which is incorrect ## Changes involved - Table Editor side menu now only lists parent partitioned tables, omits all child partitioned tables - Child partitioned tables can be viewed by clicking on the button tooltip here or drilling down via "View partitions" <img width="300" alt="image" src="https://github.com/user-attachments/assets/e3cfbe4b-21ff-47df-8fcd-81d0c9f68d94" /><br /> <img width="400" alt="image" src="https://github.com/user-attachments/assets/5d0747cb-fb52-4301-ad9e-c7be504f43c9" /> - Selecting that will then render a nested nav as such <img width="291" height="323" alt="image" src="https://github.com/user-attachments/assets/bff0a42b-4265-4317-8299-537d82544388" /> - Sub partitioned tables can be drilled into the same way, and the back CTA steps up one level <img width="485" height="306" alt="image" src="https://github.com/user-attachments/assets/66f6f6cb-8b7d-46c5-8ea3-4ee4fd57aa84" /> - Parent partition tables have the following actions (Previously was only copy name and schema) <img width="465" height="257" alt="image" src="https://github.com/user-attachments/assets/2aa90995-7c30-4bcf-a446-d01ab52c1ede" /> - Deleting a parent partition table will also delete the child partition table, and that's highlighted in the confirmation modal <img width="418" height="316" alt="image" src="https://github.com/user-attachments/assets/0d61984b-f85e-4c93-84d0-549d300838c9" /> - Child partition tables have the following actions (Edit + duplicate removed since they aren't supported via the UI) <img width="482" height="229" alt="image" src="https://github.com/user-attachments/assets/e028b13d-2e92-4491-b05c-7a6cb0a129d6" /> ## To test In general, just verify the viewing UX of partitioned tables to see if it all feels alright, can use the following SQL to quickly set up partitioned tables ```sql create schema if not exists tint; create table public.nest_demo (id int, hue int not null, primary key (id, hue)) partition by range (hue); create table public.nest_demo_blue partition of public.nest_demo for values from (200) to (300) partition by range (hue); create table public.nest_demo_blue_light partition of public.nest_demo_blue for values from (200) to (250); create table tint.nest_demo_blue_deep partition of public.nest_demo_blue for values from (250) to (300); create table public.nest_demo_other partition of public.nest_demo for values from (0) to (200); ``` |
||
|
|
f4d8252427 |
Improve postgres upgrade warning for pipelines (#53359)
## Context For upgrading a project's Postgres version, the eligibility check returns blockers if a project has active pipelines running. However, the notices are currently confusing and not actionable from a user's POV for these reasons: - The warnings mention the slot name in the title, but as a user i've no idea what slot names these are referring to - There's no CTA as a user to action on to unblock myself - There's multiple warnings due to each replication slot that the pipelines take up, although they all point to the same reason that pipelines just needs to be stopped before upgrading - Example here if i have 3 active pipelines: I get 10 warnings here <img width="500" alt="image" src="https://github.com/user-attachments/assets/c4d99cd4-df3b-4e8e-90cd-896c0f2fa52b" /> Am opting to consolidate all Pipelines related upgrade warnings into just one row as such, by grouping them if the upgrade eligibility error type is `active_replication_slot` and the slot name begins with `supabase_etl_`. Added a "Manage" CTA as well that brings users to the Pipelines page <img width="799" height="234" alt="image" src="https://github.com/user-attachments/assets/50a0c64a-6afe-44e2-9bf8-a21e8ecfc47a" /> Also small nit but this PR fixes the weird list decorator in the rows too <img width="165" height="81" alt="image" src="https://github.com/user-attachments/assets/8c0a0ff6-225f-48d1-a25f-8ffa9e65533c" /> |
||
|
|
4998b77ab2 |
feat(studio): ask whether org creators know how to code (#53317)
I added the "Do you know how to code?" question (Yes / No, optional) to the onboarding survey on the new organization form and in the follow-up dialog. The answer is sent as `can_code` in the same survey request as the other answers. I removed an earlier version of this question before the survey shipped because the platform didn't store it; the platform now accepts `can_code`. **Changed:** - **New question, always visible**: it shows on both surfaces without waiting on another answer, so it can be answered on its own. Only the `org_form` arm of the experiment shows the survey. - **Follow-up dialog shows every question at once**: "What are you building?" used to appear only after "Who is this org for?" was answered. "How many people?" still appears only for the Company org type. - **Follow-up card above other banners**: I raised its priority in the banner stack so it sits in front of the project-page cards for its five-minute window. - **Telemetry**: I added a `hasCanCode` boolean to `onboarding_survey_submit_button_clicked` and `onboarding_survey_submit_failed`. **Note:** Merge only after the platform change that accepts `can_code` is in production: before that, the API drops the key and still returns 204, so answers are lost with no error. The change is live once `can_code` is listed under `OnboardingSurveyBody` in the production platform OpenAPI spec. I widened `OnboardingSurveyBody` locally because `packages/api-types` can only be regenerated once the production spec has the field. ## To test Setup: sign in and set the `onboardingSurveyPlacement` flag to `org_form` with the dev toolbar. Tested on the PR preview: - [x] Open `/new`: expect "Do you know how to code?" below "What are you building?" with Yes then No, before any other question is answered. Answer both and create the org: expect one `POST /platform/organizations/onboarding-survey` whose body has `building` and `can_code`. Observed: both questions on the untouched form, options Yes then No; one request, 204, body has `"can_code":"yes"`. - [x] Create an org with only "Do you know how to code?" answered: expect one request whose body has `can_code` and no `building` key. Observed: one request, 204, `"can_code":"no"`, no `building` key, and no follow-up card on the new org's page. - [x] Create an org with the org type changed to Company, a size picked and "Do you know how to code?" answered, leaving "What are you building?" blank: expect one request with `kind`, `size` and `can_code`, and no follow-up card on the new org's page. Observed: one request, 204, `"kind":"COMPANY","size":"50","can_code":"yes"`; no follow-up card. - [x] Create an org with "What are you building?" answered and the new question left blank: expect the request body to have no `can_code` key, and the org to be created. Observed: one request, 204, no `can_code` key. - [x] Create an org without touching the survey, then open the new org's page: expect the "Help improve Supabase" card. Click Answer: expect all three questions in the dialog right away. Answer all three questions and send: expect one request with `kind`, `building` and `can_code`. Observed: no survey request at creation; the card shows on the org page; the dialog opens with all three questions blank; one request, 204, body has `"can_code":"yes"`. - [x] Set the flag to `control` and open `/new`: expect no survey questions. Observed: none of the survey questions render. - [x] Added check: `onboarding_survey_submit_button_clicked` carries `hasCanCode`. Observed: `true` when answered on both surfaces, `false` when left blank. ## Linear - fixes GROWTH-1487 |
||
|
|
f1d9d3a96a |
feat(studio): add saved views in unified logs (#53286)
Persist saved views through project-scoped content endpoints. Restore custom attribute filters and saved options, and validate content with focused Zod schemas. |
||
|
|
b046f12571 |
chore(api-types): update generated API types from production (#53364)
Regenerates the API types with `pnpm api:codegen:prod` and fixes the
Studio type errors the new types caused.
## Changes from the API
- **Branch merge now requires production write permission.** `POST
/v1/branches/{branch_id_or_ref}/merge` changed from accepting either
`branching_development_write` or `branching_production_write` to
requiring `branching_production_write`. Studio's FGA refinement for
merge no longer matched and failed typecheck.
- Removed the merge entry from `lib/fga-refinements.ts`.
- `merge.tsx` checks merge permission with `useGrant` instead of
`useBranchGrant`.
- `BranchMergeGrant` uses `GrantFor` instead of `GrantForVariants`.
- Removed merge from the "requires a variant" test in
`guarded-fetch.test.ts`.
- Users with only development branching permissions can no longer merge
in Studio. This matches what the API now enforces.
- **Replication pipelines have a required `cluster_id`.** Added it to
the pipeline fixtures in six test files.
- **`MemberWithFreeProjectLimit` has a required
`free_plan_organizations`.** Added it to the mock in
`tests/pages/new/[slug].test.tsx`. No app code reads it yet.
## Testing
- `pnpm typecheck` passes.
- Vitest passes for the affected Studio tests.
|
||
|
|
ed6d1b4c63 |
feat(studio): show error details in AlertError and attribute user faults in SQL errors (#53242)
## Problem `AlertError` gives users and support no way to correlate a failure with Sentry or platform logs. It also treats every failure the same: a bad table editor filter or an offline browser gets "try refreshing, contact support". On the reporting side, SQL errors were attributed by who wrote the whole statement. That made errors in the user's part of mixed SQL Studio's fault: policy expressions, function bodies, cron schedules, table editor filters and row edits. Marking them as user SQL instead would drop them from Sentry entirely. Part of FE-4772. ## Solution **`AlertError`** - Platform and Studio faults show the request ID, the Sentry event ID (labeled "before sampling", since the event may be sampled out) and a "Copy details" button. - The copied text never includes `formattedError`, metadata, the cause or SQL. - SQL errors copy the SQLSTATE, position and query name instead of the message. - User faults (`isUserError`) show their message with "Please try again. If the issue persists, try refreshing your browser." There is no support link, no IDs and no copy button. - Offline shows only "You may be temporarily offline. Check your internet connection and try again." - Defaults come from `getErrorPresentation`, and props the caller passes still win. The table editor passes a filter-specific description when filters are set. **SQL error classification** - `executeSql` takes an optional `isUserFaultSqlState` predicate for Studio SQL. When it matches, the error is a `StudioSqlError` with reason `user_input` and fault `user`, and is still redacted to SQLSTATE plus query name. - `isUserFaultForValues` (classes 22, 23 and P0, plus 42501 and 57014) is for typed values: table editor filters and row edits, cron name and schedule. - `isUserFaultForSql` (any SQLSTATE except server classes 08, 53, 57 other than 57014, 58 and XX) is for embedded user SQL: policies, functions, the custom access token hook. - `isUserFaultForStatsStatement` is for `pg_stat_statements` text (Query Insights `EXPLAIN`, index advisor). It treats 42P02 (`$1` placeholders) as Studio's fault. - `UserSqlError` is now only SQL the user wrote in full, and it is still never sent. - The policy, function and cron mutation hooks no longer take `sqlOrigin`. **Routing and types** - `ERROR_ROUTING` is one table keyed by tag, then by fault. Its type requires exactly the faults each class can produce. - User faults get `SAMPLE_USER_FAULT` (default 0.01, set with `NEXT_PUBLIC_SENTRY_SAMPLE_RATE_USER_FAULT`) to catch misclassification. - The error class decides privacy (`isNeverReportedError`), separately from the rate. - Sentry events get a `reason` tag. - Each class declares its `reasons`, so a mistyped reason fails typecheck. ## Review instructions 1. Open the table editor, add a filter with a wrong-typed value (text on an integer column). The alert shows the Postgres error, the filter hint, and no support link, IDs or copy button. 2. Make a query fail with a platform error (e.g. block a `/platform/` request in DevTools). The alert shows the request ID, the event ID and "Copy details". Paste the copied text and check it has no SQL or `formattedError`. 3. Go offline in DevTools and trigger a query. Only the offline message shows. 4. Create a policy with an invalid `USING` expression. The toast shows the Postgres error. In Sentry it is a `StudioSqlError` with reason `user_input`, sampled at the user-fault rate. 5. Review `lib/errors/error-routing.ts` and `data/error-classification.ts` for the routing table and the SQLSTATE predicates. |
||
|
|
115a2ffeef |
feat(studio): gate database functions, triggers, and webhooks on sql grants (#53269)
Resolves FE-4744. Part of the grants rollout; builds on the read/write SQL variants from #53185. ## What - **Data layer:** the database functions, triggers, database webhooks, and event triggers queries now take a `read` grant (exposed as `queryOptions` factories). All 8 create/update/delete mutations take a `write` grant and mark their SQL with `asWriteSql`. - **Guards:** the hand-written FGA checks in the functions, triggers, event triggers, and database webhooks lists, the functions page, the triggers layout/route, and the webhooks integration tab now derive from grants, with denied and error states. - **Other consumers** updated to pass grants: `CreateFunction`, `TriggerSheet`, `EditHookPanel`, `DeleteHookModal`, `ChooseFunctionForm`, `FunctionSelector`, `AutoEnableRLSNotice`, and SQL editor definition/autocomplete hooks. ## Behavior changes - **Webhooks integration tab:** was gated on `database_webhooks_config_read`; now gated on `database_read`, which is what the backend checks for the pg-meta query it uses. Both permissions are granted to the same built-in roles, so there is no change for built-in roles. A permissions-load failure now shows an error alert instead of the content. - **`AutoEnableRLSNotice`:** hidden unless the user has read access, since it can't tell whether the trigger already exists without it. ## Out of scope - User-authored SQL execution in `QueryEditor` / `useSqlEditorExecution` stays `unguarded.migrating` (FE-4750). ## Testing - New tests: query factories and write mutations (`data/database-sql-grants.test.ts`), webhooks tab granted/denied/error, functions list read/write granted/denied/error. - Typecheck, Prettier, lint ratchet, and Studio vitest suites for affected areas pass. |
||
|
|
79e7836a5a | feat(pipelines): Add support for unknown destination (#53272) | ||
|
|
53ffdf75c9 |
Joshenlim/fe 4945 cmd k support searching for all table (#53262)
## Context Probably the final piece for this series of changes towards resource aware Cmd K. We currently only present results for tables when searching in Cmd K, this PR adds in other entity types like views, materialized views, foreign tables, and partitioned tables (only the parent) Note that the results excludes entities created from database extensions to reduce the chance of noise <img width="500" alt="image" src="https://github.com/user-attachments/assets/27bf5026-937a-4883-b365-75694d551a39" /> ## Related changes - Tweaked the entity icon for partitioned tables a little to be blue (previously gray) and - Added an entity icon for child partition tables in the table editor that's slightly lighter than the partition table icon, currently child partition tables just render with the same icon as tables which can be confusing <img width="286" height="128" alt="image" src="https://github.com/user-attachments/assets/638af7c3-512d-4264-bfae-0a8827b3ef94" /> - Note that i'm planning to look into this separately RE how to better render child partition tables so this might go away subsequently ## Performance As always, ran a claude benchmarking session - this runs on debounced keystrokes against a live catalog, so it's benchmarked at scale: **45,653 `pg_class` rows** - 12k tables - 3,143 views - 3,002 matviews - 3,001 foreign tables) Taking a median of 15 runs, all variants measured against the same catalog in one process. | scenario | query | master | this PR | worst | |---|---|---|---|---| | exact table name | `t_500` | 19.5ms | 24.3ms | 29.1ms | | view name | `v_10` | 19.3ms | 23.7ms | 25.8ms | | foreign table name | `ft_10` | 18.9ms | 24.1ms | 26.9ms | | no match | `zzz_nothing` | 19.4ms | 24.0ms | 27.5ms | | broad prefix (~3k matches) | `t_1` | 30.8ms | 38.7ms | 45.1ms | | broad matview prefix | `mv_1` | 26.6ms | 37.5ms | 41.7ms | |
||
|
|
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> |
||
|
|
00adb5a81b |
chore(studio): remove the Iceberg pipeline destination (#52229)
## Problem Retire the deprecated Iceberg (Analytics Bucket) destination from Pipelines. ## Solution - Remove the destination UI, configuration mappings, feature-flag usage, and generated API variants. - Remove the legacy Pipelines integration from Storage while preserving standalone Analytics Buckets. - Remove unused components and sheet-layout support, and add regression coverage for retained Storage operations. - Remove the stale Pipelines claim from the Storage docs overview. ## Validation - Pipelines, Storage, and replication data tests - After the final cleanup: Studio typecheck and all 3 Analytics Bucket regression tests passed. - Formatting, scoped ESLint, Knip, and whitespace checks passed; lint warnings are pre-existing. - Storage overview: Prettier, ESLint with zero warnings, content-listing schema validation, and Markdown rendering passed. Production API-type verification remains pending the coordinated API deployment. Legacy Iceberg pipelines, destinations, and slots must be cleaned up before rollout. ## Review instructions 1. Verify that Pipelines offers BigQuery, DuckLake, Snowflake, and ClickHouse, with no Analytics Bucket option. 2. Verify that Storage Analytics Bucket creation, namespace/table operations, and wrapper/key cleanup remain available without Pipelines controls. ## Checklist - [x] Read CONTRIBUTING.md. - [x] Updated the Storage overview copy and checked the docs authoring guidance. --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com> |
||
|
|
5eb68c5df2 |
Add indexes to cmd k related resources in table editor (#53204)
## Context We previously added a "Related resources" section in Cmd+K if you're on the Table Editor with a table opened, this included resources pertaining to the table such as policies, triggers, and functions. We're adding indexes as well in this PR - thinking that might also be appropriate to have in this context <img width="500" alt="image" src="https://github.com/user-attachments/assets/5cd383ff-6617-49ba-bdb8-6f65d8fd0680" /> ## Performance Benchmarked with Claude against the stress catalog (`PG_META_STRESS_TABLES=12000`), with master and this branch timed in the same run on the same database, median of 9. | Table | master | This PR | Worst of 9 | |---|---|---|---| | Hub table — 8 indexes, policy, many FK triggers | 1.6 ms | 2.3 ms | 2.8 ms | | Policy + user trigger | 1.0 ms | 1.3 ms | 2.0 ms | | Mid-chain table | 1.1 ms | 1.5 ms | 1.7 ms | | Deliberately over-indexed table — 20 indexes | 0.8 ms | 2.0 ms | 4.6 ms | | Table that doesn't exist | 1.1 ms | 1.5 ms | 4.5 ms | |
||
|
|
395a54f2b7 |
feat(studio): gate jwt signing keys, legacy api keys, and third-party auth on grants (#53241)
Resolves [FE-4732](https://linear.app/supabase/issue/FE-4732/grants-rollout-jwt-signing-keys-legacy-api-keys-and-third-party-auth). ## Changes Gates the JWT signing keys, legacy API keys, and third-party auth endpoints on grants instead of `unguarded.migrating`, and replaces their V2 permission guards with `useGrant`: - **Data layer (11 sites):** `data/jwt-signing-keys/*`, `data/api-keys/legacy-api-keys-status-query`, `data/api-keys/legacy-api-key-toggle-mutation`, and `data/third-party-auth/*`. Queries become grant-gated query option factories; mutations take the grant in their variables. - **Consumers:** the JWT settings page, the JWT signing keys table and its dialogs, `jwt-settings`, `ToggleLegacyApiKeys`, `Project/APIKeys`, and the third-party auth page, form, and create dialogs. Each consumer renders denied and error states. - **JWT signing keys table:** - It's gated only on the signing keys reads (`GET signing-keys` and `GET signing-keys/legacy`, both `auth_signing_keys_read`). - The legacy API keys status is only used by the revoke dialogs. If it can't be read, revoking the legacy JWT secret fails closed: the user sees the "disable legacy API keys first" warning, with copy explaining why, instead of the confirm modal. - **Legacy JWT secret query:** a 404 (secret not imported as a signing key yet) resolves to `null` and shows the "Migrate JWT secret" panel. Other errors now render an error instead of being treated as "not migrated". - **Write actions:** - `getWriteGrantTooltip` moves from `APIKeys.utils` to `lib/grants` and takes a resource noun. Disabled write actions use it to explain why they're disabled. - New `getWriteGrantToastMessage`: handlers that run without a grant now show a toast instead of silently doing nothing. This includes the API keys handlers from #52966. ## Permission changes - **Legacy API keys toggle and status** (`GET`/`PUT /v1/projects/{ref}/api-keys/legacy`): the guard moves from `auth_signing_keys_read`/`_write` to the endpoint annotation, `api_gateway_keys_read`/`_write`. The annotation was confirmed against the backend controller (FE-4728). As a result, the JWT signing keys table's legacy revoke check now depends on `api_gateway_keys_read`. - **API keys last-used analytics** (`/platform/projects/{ref}/analytics/endpoints/api_keys.last_used.otel`): this endpoint uses legacy permissions (`analytics:Read` on `logflare`), not FGA. Its check moves from the V2 `auth_signing_keys_read` check to `useAsyncCheckPermissions(PermissionAction.ANALYTICS_READ, 'logflare')`. - Every other guard already matched its annotation: - `auth_signing_keys_read`/`_write` for signing keys - `auth_config_read`/`_write` for third-party auth ## Testing - Data layer: `jwt-signing-keys.test.ts`, `legacy-api-keys.test.ts`, and `third-party-auth.test.ts` cover every migrated fetcher, check that factories stay disabled without a grant, and cover legacy-key 404 vs. 500. - `jwt-secret-keys-table/index.platform.test.tsx`: - Legacy status denied: the table still renders, and revoking the legacy key shows only the warning. - Legacy status known enabled or disabled. - Signing keys read denied. - Legacy key 404 vs. 500. - `create-key-dialog.platform.test.tsx`: triggering create without a grant shows the toast and sends no request. - `ToggleLegacyApiKeys.platform.test.tsx`, `ThirdPartyAuthForm.platform.test.tsx`, and `settings/jwt/index.platform.test.tsx`: granted, denied, error, and partial-permission cases. - `lib/grants.test.ts`: the tooltip and toast helpers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) |
||
|
|
c8aad267cb |
fix(studio): use read grant variant for table related resources queries (#53231)
Fixes the Studio typecheck failure on \`master\`. ## What Two PRs merged close together and conflict at the type level. #53079 added the table related resources queries with a plain \`POST /platform/pg-meta/{ref}/query\` grant. #53185 then made a variant required for that endpoint. Both queries only read data, so they now request and accept the \`read\` variant. ## Testing - \`tsc --noEmit\` in \`apps/studio\` passes. |
||
|
|
1353178ac9 |
feat(studio): add read/write grant variants for pg-meta query (#53185)
Resolves FE-4729. First PR of the SQL grants series (FE-4697).
## What
Adds the mechanism for read and write grants on `POST
/platform/pg-meta/{ref}/query`. Every caller keeps `unguarded.migrating`
until its domain PR.
- `fga-refinements.ts`: `read` (`database_read`) and `write`
(`database_write`) variants, with `variantRequired`.
- `@supabase/pg-meta`: a `WriteSqlFragment` brand and `asWriteSql()`.
`safeSql` and `joinSqlFragments` return `WriteSqlFragment` when any
input is one, so composing write SQL keeps the brand.
- `executeSql`: overloads tie the grant to the SQL type. Write SQL needs
a write grant; other SQL takes a read or write grant.
## Notes
- The write check is type-only. Nothing in a pg-meta query request marks
it as a write, so the development-only `assertGrant` can't detect one.
The branch variants make the same trade-off, and the backend enforces
permissions either way.
- SQL written from scratch still needs `asWriteSql` where it's built.
Domain PRs mark their builders.
- Server-side callers (AI tools) will use `unguarded.byDesign`: they
forward the user's token, so the platform API enforces permissions.
FE-4750 applies this.
## Testing
- Type tests: grant/raw-client equality for both variants, rejection of
plain and unknown-variant grants, read/write brand invariance,
`executeSql` and `mutate()` rejecting write SQL with a read grant, and
brand propagation through `safeSql` and `joinSqlFragments`.
- `unguarded.migrating` count unchanged.
|