mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
bot/decrease-eslint-ratchet-baselines
7336
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
253d874e38 | fix(warehouse): disallow warehouse installation on orioledb (#51913) | ||
|
|
9b015c7427 |
feat(studio): allow setting a password when creating a role (#52463)
## Problem The Create Role panel offers "User can login" but no way to set a password, so a role created with login enabled can't authenticate with a password until one is set elsewhere. The role SQL builder in `pg-meta` already supports a password on create; the form just never sent one. Resolves FE-4763. ## Solution - Add an optional **Password** field to the Create Role panel, shown only while "User can login" is on. It has a copy button and a "Generate a password" action, matching how project creation handles database passwords. - Keep password optional. If the field is empty, or login is turned off after typing one, the password is left out of the request, so behavior is unchanged from today. - Link the privilege switch labels to their switches (the label previously pointed at a wrapper `div`), which also lets the new tests find the switch by its label. - Tests: a `pg-meta` case creating a role with a password containing quotes, and component tests asserting the SQL sent for each of the four password and login combinations. Not in scope: editing or resetting an existing role's password. <img width="663" height="661" alt="Screenshot 2026-10-28 at 17 22 59" src="https://github.com/user-attachments/assets/270fcfb4-4dc9-4dc1-b8e6-4141ee755ac2" /> ## Review instructions 1. Open Database > Roles and click **Create role**. 2. Confirm no password field shows until you enable **User can login**. 3. Enable login, click **Generate a password**, then copy it with the copy button, and create the role. 4. Confirm you can connect as the new role using that password. 5. Create another role with login enabled and the password left empty; confirm it is created as before. 6. Click a switch label (for example "User can login") and confirm it toggles the switch. ## 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) |
||
|
|
19aa27384a |
feat(studio): guard branch creation with FGA grants (#52375)
Part 4 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 The create mutation takes a grant. `CreateBranchButton`, `CreateBranchModal`, and `Branch.Commands` (legacy `CREATE preview_branches`) switch to `useGrant('POST /v1/projects/{ref}/branches')`. "Include data" is disabled without production create; previously it failed after you submitted. The GitHub integration form gets a minimal production-create guard, which ##52377 replaces. ## Testing New `CreateBranchButton` test. |
||
|
|
4f75659942 |
feat(studio): show request timelines with ordered active log folding (#50836)
Add a Timeline tab that displays related request logs and opens a selected step in the overview. The panel summary, timestamp, and navigation controls follow the active log. Long timelines show the first three steps and retain the active log in its chronological position. Separate controls count hidden rows before and after it, for example `+3 more`, the active log, then `+2 more`. Expanding either control restores the full order. Query construction and fetching are reviewed separately in #50840. ### How to test 1. With `otelUnifiedLogs` enabled, open a non-compute log with related request activity and select Timeline. Check chronological order, then select a step and confirm its overview and panel summary update. 2. Expand a long timeline, select a later step, and return to Timeline. The active step should stay in order, with separate hidden counts above and below. For nine steps with the seventh active, expect `+3 more`, the active step, then `+2 more` after the first three steps. Expand using both mouse and Enter. 3. If a long request is unavailable, run the deterministic folding/navigation cases: `pnpm --filter studio exec vitest run components/interfaces/UnifiedLogs/components/RequestTimeline.platform.test.tsx components/interfaces/UnifiedLogs/components/LogTimeline.utils.test.ts`. ### Validation - Focused local unit/MSW suite: 260 tests passed across 18 files with `--retry=0 --sequence.shuffle --sequence.seed=5083605`. - Browser QA verified a real five-step request timeline and folding. Nine-step folding and active-log ordering were verified with deterministic fixtures. - All checks triggered on head `6b80811bae` passed. - Master-only typecheck, unit, formatting, and lint workflows do not run against this stack base. Rerun them when the PR is retargeted to `master`. ### Stack Based on the logs table building blocks stack, which merges first: #50953 → #50954 → #50955 → #50957 → #50958 → #52281. Then merge in order: 1. #50835 — grouped log overviews and raw JSON 2. #50840 — request correlation queries 3. #50836 — request timeline UI and folding 4. #50841 — shared Auth user details 5. #50837 — log user correlation and Auth activity --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jordi Enric <jordi.err@gmail.com> |
||
|
|
b5e9388ea7 |
fix(studio): redirect logged-out users from the logs index to sign-in (#52455)
Logged-out visitors who open `/project/<ref>/logs` directly now get sent to sign-in. Before this change they stayed on a loading screen. **Why** Protected project pages get their auth guard from the layout: `AuthLayout`, `LogsLayout`, `ProjectLayoutWithAuth` and so on all wrap `withAuth`. `pages/project/[ref]/logs/index.tsx` is the exception. Depending on the unified logs preview, it renders one of three things: - `null` while the preview flags are still loading, - a plain, unguarded `ProjectLayout` with `UnifiedLogs`, - or a redirect to `/logs/explorer`, which is guarded by `LogsLayout`. The unified logs preview is now on by default on the platform (`isDefaultOptIn: true`), and a fresh browser has no stored opt-out. So a logged-out visitor lands on the unguarded `ProjectLayout` branch. Nothing in that tree runs `withAuth`, so no redirect ever fires and the page waits forever on project data. `/auth/users` doesn't have this problem because `AuthLayout` is wrapped in `withAuth`. **Approach** The page has no guarded layout, so this change wraps the page itself: `export default withAuth(LogPage)`. Several pages already do this (`authorize`, `cli/login`, `claim-project`, ...). A page-level guard is mounted from the first render, so it also covers the `null` phase while the preview flags load, not only the unified logs branch. `withAuth` keeps `getLayout`, and the TanStack route (`routes/project/$ref/logs/index.tsx`) renders the default export, so both runtimes get the guard. The existing redirect logic is reused as is, so `returnTo` is still kept on the redirect to sign-in. Signed-in rendering is the same as before. **Validation** - New `tests/pages/project/[ref]/logs/index.platform.test.tsx` (runs with `IS_PLATFORM=true`): - no session, unified logs on: redirects to `/sign-in?returnTo=/project/default/logs` - no session, preview still loading: redirects to sign-in - signed in: renders the logs view, no redirect - Without the fix, both logged-out cases fail. With the fix, all 3 tests pass. - `eslint` and `prettier --check` pass on the changed files. - Studio `tsc --noEmit` ran out of memory on the sandbox (8 GB) twice, so it is not verified locally. --------- Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com> |
||
|
|
4bc9e65497 |
feat(studio): gate branches pages on the list grant (#52374)
Part 3 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 The branches, merge-requests, and merge pages replace `useAsyncCheckPermissionsV2(BRANCHING_DEVELOPMENT_READ)` with the list grant. They show `NoPermission` when it's denied and `AlertError` when the check fails. The old check was too strict, because the backend accepts development or production read. ## Testing New branches page test. |
||
|
|
91b780c7d7 |
feat(studio): layout-shaped loading state for compute instance detail (#52453)
Replaces the three generic shimmer bars on the Compute instance detail page with a placeholder that follows the loaded layout. **Why** While the instance loads, the page showed three full-width bars with no header, tabs or sections. When the data arrived, the whole page jumped into a different shape. **Approach** A new `ComputeInstanceDetailSkeleton` reuses the same page primitives as the loaded view (`PageBreadcrumbs`, `PageHeader`, `PageNav`, `PageContainer`, `PageSection`) and the existing `ShimmeringLoader`, so widths, padding and breakpoints match the real page: - Breadcrumbs: the static Compute link, with a placeholder for the instance name - Header: a 56px icon placeholder, a title placeholder and three metadata placeholders (state, runtime, version) - Tabs: four placeholders sized like the tab labels - Overview: the static Instances, Container and Resources section headings, the ready-count line, the 2/4-column instance count grid, and the container and resource rows No instance values are shown until the data loads. On a non-overview tab (`?tab=logs`, etc.), the content area falls back to the same `GenericSkeletonLoader` the logs tab already uses. Data fetching, error handling, the "instance does not exist" state and the loaded view are unchanged. **Validation** - New `ComputeInstanceDetail.platform.test.tsx`: holds the instance request open, checks that the placeholder renders (section headings, breadcrumb link, no instance name, no tabs, no row labels), then releases it and checks that the header, tabs, instance counts and container rows render and the placeholder is gone. The existing Compute tests still pass. - `eslint` on the changed files: clean. `pnpm --filter studio lint`: 0 errors. - `pnpm --filter studio typecheck` (`tsc --noEmit`) ran out of memory in the sandbox (exit 137) twice, so it was not run to completion. Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com> |
||
|
|
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. |
||
|
|
6612073428 |
feat(studio): add bounded request correlation queries (#50840)
Add tested query support for correlating logs by request and execution IDs across API Gateway, Auth, Storage, and Edge Functions. Queries are source-scoped, time-bounded, and limited to 200 rows, with at most one additional lookup to follow a newly discovered execution ID. This data-only layer introduces no UI or automatic requests. The Timeline tab consumes its query options in #50836. Overview and request correlation share a cached source-and-attributes lookup, including concurrent requests. Cancelling a timeline preserves any shared overview lookup. The new query is exercised through MSW without mocking React Query hooks. ### How to test This is a data-only PR. From the repository root, run: ```sh pnpm --filter studio exec vitest run components/interfaces/UnifiedLogs/UnifiedLogs.queries.test.ts data/logs/unified-log-request-timeline-query.test.ts ``` The tests exercise source-scoped IDs, SQL escaping, time/row limits, missing IDs, failed requests, the additional execution-ID lookup, attribute-cache reuse in both navigation orders and concurrently, and cancellation through MSW. ### Validation - Synced with master; verified head `a60bcf0565e0e3477779665660e871eec2edd2c8`. - Focused unit/MSW baseline and shuffled seed 5084028: 121 tests across seven files passed with retries disabled. Independent shuffled run, seed 5084029: 117 tests across six files passed. - Correlation, shared lookup/cache, cancellation, and the 400-second function boundary are covered. Behavioral mutation checks detect shared-lookup cancellation and a shortened execution window. - Matching studio-staging preview smoke check passed for existing grouped overview attributes and complete copied Raw JSON metadata. - All four unit-test shards, all four E2E shards, typecheck, formatting, lint ratchet, knip, and Studio Docker build passed on this head. - Independent review found no actionable issues; no unresolved review threads. ### Stack Based on the logs table building blocks stack, which merges first: #50953 → #50954 → #50955 → #50957 → #50958 → #52281. Then merge in order: 1. #50835 — grouped log overviews and raw JSON 2. #50840 — request correlation queries 3. #50836 — request timeline UI and folding 4. #50841 — shared Auth user details 5. #50837 — log user correlation and Auth activity --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jordi Enric <jordi.err@gmail.com> |
||
|
|
e85d1a4271 |
chore: bump vulnerable dependencies (#52446)
## Summary
```text
pnpm-workspace.yaml
├── catalog: @sentry/nextjs ^10.59.0 → ^10.75.2
└── overrides:
├── - @ardatan/relay-compiler>immutable (fixed upstream, override dropped)
├── + @nuxt/devtools>simple-git ^4.0.0
└── + velite>sharp ^0.35.0
apps/docs/package.json simple-git ^3.24.0 → ^4.0.0
pnpm-lock.yaml patched transitive deps + dedupe
```
Lockfile bumps (transitive unless noted):
```diff
- body-parser 1.20.6 / 2.3.0 + 1.20.9 / 2.4.0
- dompurify 3.4.16 + 3.4.17
- fast-uri 3.1.8 + 3.1.9
- hono 4.13.7 + 4.13.14
- markdown-it 14.3.2 + 14.3.3
- qs 6.16.0 + 6.16.1
- serialize-javascript 7.0.5 + 7.1.4
- simple-git 3.36.0 + 4.0.2
- undici 7.30.0 / 8.11.2 + 7.30.1 / 8.12.3
- vite 7.3.5 / 8.2.1 + 7.3.7 / 8.3.5
- zod 4.6.5 + 4.6.7
- immutable 3.8.3 + 5.1.9
```
Deduped: `sharp`, `rolldown`, `vue`, `@typescript-eslint/parser`.
## Evidence
- **Before:** `pnpm audit` on `master`
```text
93 vulnerabilities found
Severity: 12 low | 39 moderate | 38 high | 4 critical
```
**After:** `pnpm audit` on this branch
```text
33 vulnerabilities found
Severity: 5 low | 16 moderate | 12 high
```
The remaining advisories need major bumps or upstream releases and are
out of scope here.
## Merge Danger
**Door:** two-way
Lockfile and version-range changes only; revert the PR to restore the
previous tree.
**Blast Radius:** build-wide
Newer majors and minors (`simple-git` 4, `immutable` 5, `vite`,
`@sentry/nextjs`) could change build or runtime behavior in `docs`,
`www`, and the Nuxt/Vue blocks. CI is the check.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
||
|
|
6a27ccbe09 |
fix(studio): restore RLS permission checks for GitHub/Vercel integrations (#52385)
## Problem Project-scoped admins see "You need additional permissions to view GitHub connections" (and the same for Vercel) since #50966. That PR moved these checks to `ORGANIZATION.CONFIG_READ`/`CONFIG_WRITE`, which the v2 permissions API never grants to project-scoped members. ## Fix The platform endpoints behind these views don't use OpenFGA: - GitHub connections: list/update/delete are RLS-only; create uses `canForProjectRef(READ, 'projects')` - Vercel connections: create uses `canForProjectRef(CREATE, 'integrations.vercel_connections')`; the rest are RLS-only - OAuth apps (installed integrations view): `AuthWithOrganizationSlug(READ, 'oauth_apps')` So this reverts #50966's changes in `GithubSection`, `GitHubIntegrationConnectionForm`, `VercelSection`, `Landing.utils` and `useInstalledIntegrations` back to `useAsyncCheckPermissions` with the original resources, and updates `MarketplaceIntegrationSettingsTab.test.tsx` to mock the v1 permissions endpoint. ## Testing - `MarketplaceIntegrationSettingsTab.test.tsx` and `MarketplaceDetail.test.tsx` pass Fixes FE-4751 |
||
|
|
671594c69c |
feat(studio): group log overviews and standardize raw JSON (#50835)
Logs without a service-specific overview now show common fields and attributes in collapsible groups. Existing service overviews use the same section layout, with the first section open. Configured fields share one renderer across service overviews. Raw JSON uses shared presentation for single-log, multi-log, and downstream Auth views, with copy controls supplied by each view. Attribute lookups are scoped to the selected log's source, ID, and timestamp window and respect metadata visibility. It's based on the #50953 stack; request correlation, timeline UI, and Auth changes are separate layers. Sections use the `CollapsibleDetailSection` that master now shares with the audit log pages, and the new Supavisor overview follows the same layout: no separate time header, first section open. ### How to test 1. With Unified Logs and `otelUnifiedLogs` enabled, open an API Gateway log and a Postgres or Auth log. Check the overview sections, expand/collapse groups, and try copying a field. 2. Open Raw JSON on a log with enough metadata to scroll. Confirm the copy button stays visible and copies the complete JSON. 3. Select multiple logs and confirm their combined JSON still renders correctly. ### Validation - Synced with master; verified head `663ebfd13117ae3c5aa0de52e4488253a317d59f`. - Focused local unit/MSW suite: 246 tests passed across 19 files with retries disabled, both normally and with `--sequence.shuffle --sequence.seed=50835`. Independent focused run: 24 tests passed with seed 5083528. - Browser QA on the matching studio-staging preview passed: API Gateway and Postgres section expansion/collapse, field copying, scrolling and copying complete Raw JSON, and copying multiple selected logs. - All four unit-test shards, all four E2E shards, typecheck, formatting, lint ratchet, and Studio Docker build passed. The Next.js E2E report includes one storage-folder test that passed on retry. - Independent code review found no actionable issues. Working tree clean. ### Stack Based on the logs table building blocks stack, which merges first: #50953 → #50954 → #50955 → #50957 → #50958 → #52281. Then merge in order: 1. #50835 — grouped log overviews and raw JSON 2. #50840 — request correlation queries 3. #50836 — request timeline UI and folding 4. #50841 — shared Auth user details 5. #50837 — log user correlation and Auth activity --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jordi Enric <jordi.err@gmail.com> |
||
|
|
d973267d27 |
feat(studio): paginate platform webhooks deliveries table by cursor (#52314)
## Problem The deliveries table loaded one page from the API and split it into pages of 5 in the browser, so older deliveries could not be reached. Linear: [FE-3750](https://linear.app/supabase/issue/FE-3750/add-pagination-to-platform-webhooks-deliveries-table) ## Solution - **Cursor pagination:** the table requests deliveries 5 at a time (`page[after]`), and Next and Previous load the next or previous page. It asks for 6 and shows 5, so Next is never enabled on an empty page. Previous uses the history of cursors we visited, because the API's `prev` link can skip a row or land on an empty page. - The footer reads "Showing N deliveries" (the API returns no total). The delivery search still filters only the loaded page. - **Loading and errors:** skeleton rows show while a page loads, and a failed load shows an error with a Try again button instead of "No deliveries found", and polling stops until you retry. If a later refresh fails, the loaded rows stay with a notice that they may be out of date, and polling continues. - Retry and Send test event refresh every cached page of the endpoint's deliveries. Switching endpoints starts again on page 1. - Retry from the details sheet now works for a delivery that is not on the current page. - A pending delivery has no result yet, so its row no longer opens the details sheet. Its Retry button is unchanged. - Removed the "Attempt" field from the details sheet. It was the row's position on the page, not an attempt number. A real one needs the API to return it (CTRL-1974). ## Review instructions 1. Enable the Platform Webhooks feature preview, open an endpoint, and send 7 test events (limited to 10 per minute). 2. Page 1 shows 5 deliveries, Previous is disabled and Next is enabled. Next shows the other 2 and disables Next. Previous goes back to the first 5. 3. On an endpoint with exactly 5 deliveries, both buttons are disabled. 4. In DevTools > Network, set throttling to "Slow 4G" and click Next. Skeleton rows show. Then block the `deliveries` request and click Next. "Failed to retrieve deliveries" shows with a Try again button. Wait 10 seconds: no new `deliveries` requests are sent. Unblock the request and click Try again to load the rows. Also block the request while rows are loaded: they stay, and an "Unable to refresh deliveries" notice appears within about 5 seconds and clears once you unblock. 5. Open the details sheet from the bottom row of page 1. In a second tab, send a test event and wait about 5 seconds. Click Retry delivery in the first tab. A toast and a `POST .../retry` request appear, even though the row has moved off page 1. 6. Set the endpoint URL to `https://httpbin.org/delay/10` and send a test event. While the new row shows `pending` (about 10 seconds), clicking it does nothing. Once it shows `success`, it opens the sheet. |
||
|
|
6397239315 |
refactor(studio): replay removed Assistant tool outputs through legacy contracts (#52398)
Stacked on #52396. ## What Self-hosted Studio's Assistant uses four fallback tools (`getSchemaTables`, `getRlsKnowledge`, `getFunctions`, `getEdgeFunctionKnowledge`) that a later PR replaces with contract tools. Saved chats in IndexedDB still hold their outputs, and today those replay to the model unchecked. - New `LegacyToolContract` type: only `name`, `outputSchema`, `toModelOutput`, and `outputOnInvalid`. - New `tools/legacy-tools.ts` with a legacy contract for each fallback tool. Only history replay reads them, through `sanitizeContractPart`; nothing registers them as tools. - Schema tables, RLS policies, and function lists replay at the `schema` opt-in level and above; below it, the model gets a short note instead. The Edge Functions guide has no project data, so it replays at every level. - A saved output that doesn't match its stored shape is replaced with a short "couldn't be read" note. - README documents legacy contracts. ## Behavior changes Self-hosted always runs at the `schema` level, so valid saved outputs replay as before. Malformed saved outputs are now replaced instead of passed through. ## Tests - `legacy-tools.test.ts` covers every stored shape at every opt-in level, plus invalid outputs. - `registry.test.ts` checks legacy names don't overlap live contract names. - A saved self-hosted chat replays through `prepareMessagesForModel` and `convertToModelMessages` without errors. ## 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) |
||
|
|
167c633ed0 |
fix(studio): treat same-origin URLs outside basePath as external in TanStack (#52441)
In the TanStack build, links from the dashboard to other pages on the same origin (e.g. `https://supabase.com/docs/...` from `/dashboard`) were treated as internal routes and got the basepath prepended, landing on `/dashboard/docs/...`. Next only treats an absolute URL as local when it's same-origin **and** under the basePath, so this matches that behavior. **Changed:** - `splitInternalUrl` leaves absolute same-origin URLs outside `NEXT_PUBLIC_BASE_PATH` untouched, so the `next/link` shim renders a plain anchor. Relative paths are always internal, and nothing changes when no basePath is set - The `next/router` shim's `push`/`replace` now do a document navigation for absolute external targets. Previously TanStack resolved an absolute `to` as a relative path segment, so `router.push` to any external URL (cross-origin too) stayed inside the app - `prefetch` skips external targets **Added:** - Unit tests for `splitInternalUrl`, plus shim tests rendering the real Link/router under a `/dashboard` basepath ## To test - Only reproducible where docs and the dashboard share an origin (i.e. prod `supabase.com/dashboard`). On previews, confirm nothing regressed: - New project → pick a paid compute size on a Pro org → submit → in "Confirm compute costs", the "Compute Costs" link opens the compute docs in a new tab - Click a few other docs links (e.g. in project settings) – they open the docs, not a dashboard 404 - Normal in-app navigation (sidebar, table editor links) still navigates client-side without full reloads --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> |
||
|
|
84115482be |
feat(studio): storage lifecycle policies UI (#52318)
## Problem Lifecycle policies can only be set with an abstracted ui that hides the actual underlying policies but the user can still modify the policies via api, which would result in an un-documented drift from the policies set via said abstracted ui. ## Solution Show ui with list of effective policies applied and show if the policies drifted in a way that is incompatible with the abstracted ui in the "Create/Edit bucket modal". <img width="1489" height="800" alt="Screenshot 2026-10-26 at 18 35 39" src="https://github.com/user-attachments/assets/9e64f123-c06e-4cfe-9dba-839fae61c845" /> <img width="1439" height="847" alt="Screenshot 2026-10-26 at 18 35 50" src="https://github.com/user-attachments/assets/a32d3a27-6719-48b3-abd2-fb134158bd96" /> <img width="654" height="316" alt="Screenshot 2026-10-26 at 18 36 38" src="https://github.com/user-attachments/assets/0710c139-9b64-42f7-b410-c1a351b1f616" /> This PR also updates copywriting around the effects procured by the lifecycle policies settings in the bucket settings modal. <img width="704" height="440" alt="Screenshot 2026-10-26 at 18 35 17" src="https://github.com/user-attachments/assets/f4fa03d1-e11b-4d08-b4f5-d94b2d9350a3" /> <img width="351" height="82" alt="Screenshot 2026-10-26 at 18 35 28" src="https://github.com/user-attachments/assets/6ff1e149-92e0-4fd8-bfb5-0177afe207aa" /> ## To review - create a file storage bucket, enable object versioning and set some lifecycle policy values - once created, go to /project/_/storage/files/policies and find the bucket policies or navigate to it from the "Edit bucket settings" via the "View rules" button <img width="1133" height="725" alt="Screenshot 2026-10-27 at 14 50 52" src="https://github.com/user-attachments/assets/ef014f7a-5db6-413a-af53-a5648309b2c3" /> - adding extra policies should result in a "This bucket has a custom lifecycle policy" message in the edit bucket modal <img width="557" height="130" alt="Screenshot 2026-10-27 at 14 52 23" src="https://github.com/user-attachments/assets/cde29748-65d9-45b5-a54b-55737d78d311" /> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> |
||
|
|
d4b9d1240c |
refactor(studio): remove the legacy edge function overview (#52281)
The `edgeFunctionsOverview` flag is fully rolled out, so the edge function Overview page now always renders the new Overview. This removes the legacy Overview and everything only it used. - **Overview page**: renders `EdgeFunctionOverview` directly, like the other function tabs. The flag check and the loader shown while flags load are gone. - **`EdgeFunctionRecentInvocations`** and its utils: only the legacy Overview showed this list. - **`components/ui/Charts/AreaChart`**: the legacy Overview was its last importer. The other `AreaChart` uses are recharts' own. **Self-hosted:** flags never load off-platform, so self-hosted Studio always got the legacy Overview. Its Overview tab is already hidden, and the new Overview sends a direct visit to the Details tab, so nothing reachable from the UI changes. After this ships, the `edgeFunctionsOverview` flag can be deleted in ConfigCat. ### How to test 1. Open an edge function's Overview on platform. It shows the new Overview, with no loader flash while flags load. 2. Self-hosted: open `/project/default/functions/<slug>` directly. It redirects to the Details tab. ### Validation - Studio typecheck, lint, Prettier and knip pass on this layer. Functions and Charts unit tests pass. ### Stack Merge in order: 1. #50953 — reusable logs table building blocks 2. #50954 — function-scoped unified logs queries 3. #50955 — slimmer function detail layout, header on Overview 4. #50957 — Invocations merged into a function-scoped Logs tab 5. #50958 — Overview errors in the shared logs table 6. #52281 — remove the legacy Overview --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jordi Enric <jordi.err@gmail.com> |
||
|
|
3f59d25833 |
feat(studio): serve TanStack client assets from the asset CDN (#52397)
Studio's TanStack build serves every client JS/CSS chunk from Vercel at
`/dashboard/_vercel/immutable/...`, and each of those requests also goes
through the www zone's routing (supabase.com/dashboard is proxied by
www). The Next build served the same files from the R2 asset CDN. This
moves the TanStack build's client assets back to the asset CDN on
production builds, using native Vite / TanStack Start hooks rather than
an `assetPrefix`-style rewrite.
**Added:**
- `apps/studio/asset-cdn.ts`: one gate shared with `next.config.ts`
(production or `FORCE_ASSET_CDN=1`, `FORCE_ASSET_CDN=-1` disables,
staging CDN when `NEXT_PUBLIC_ENVIRONMENT=staging`) plus URL helpers.
Only files under `_vercel/immutable/` are rewritten, and web workers
never are
- `upload-static-assets.sh tanstack`: syncs
`.vercel/output/static/_vercel/immutable` to
`<SITE_NAME>/tanstack/_vercel/immutable` on R2 with `max-age=31536000,
immutable`. Uses `--size-only` (names are content hashes, so only new
files upload) and excludes source maps. Local files are kept
- The upload script now fails with a clear message when the asset CDN is
enabled but `ASSET_CDN_S3_ENDPOINT` or the AWS keys are missing, instead
of the AWS CLI failing on an empty `--endpoint-url`
- Unit tests for the gate and URL helpers
**Changed:**
- `server.ts` uses `createStartHandler({ transformAssets })` so the
shell's scripts, modulepreloads and stylesheets point at the CDN with
`crossorigin="anonymous"` (module scripts need CORS; it also keeps full
error details in Sentry)
- `vite.config.ts` sets `experimental.renderBuiltUrl` (client only) so
URLs inside the bundle follow: the preload helper's dependency map, and
fonts/images referenced from CSS. The CDN base is computed once from the
process env (the same env the upload script sees) and inlined into both
server and client so they can't disagree
- `build:tanstack` runs the upload after `vite build` unless
`SKIP_ASSET_UPLOAD=1`, the same as `build:next`. The Docker image's
TanStack build sets `SKIP_ASSET_UPLOAD=1` (images serve their own
assets, and the pruned context has no upload script)
**Unchanged on purpose:**
- Vite `base` and the router basepath stay `/dashboard`; documents,
`/_serverFn` and `/api` stay on Vercel
- Web workers stay same-origin (`worker-src 'self' blob: data:`, and
workers must be same-origin anyway), so `immutableStaticFiles` stays on
- With the CDN off (previews, self-hosted), the build output is
identical to master apart from release hashes
The CDN folder is shared and content-addressed rather than per-commit,
so unchanged chunks dedupe across deploys and older tabs keep finding
their lazy chunks whichever deployment serves the next document.
**Rollout:** production has `FORCE_ASSET_CDN=-1` for now, so merging
this doesn't change prod. Staging picks it up on merge and gets tested
first.
## To test
### On the preview (tests the upload, not the page)
The staging preview for this branch builds with `FORCE_ASSET_CDN=1`, so
it exercises the real build-and-upload path. **The preview page itself
is expected not to load in a browser:** the asset CDN only allows the
staging and production origins in its CORS rules, so module scripts are
blocked on a `*.vercel.app` URL.
- In the build log, check `Uploading immutable static files to R2...` is
followed by `Upload completed successfully!`
- View the preview's page source: the `<script>`, `modulepreload` and
stylesheet tags point at the staging asset CDN
(`.../<SITE_NAME>/tanstack/_vercel/immutable/...`) with
`crossorigin="anonymous"`
- Open a few of those asset URLs directly in a new tab (a JS chunk, a
CSS file, and a `.woff2` font from the CSS): each returns 200 with the
right content type
- Worker URLs inside the chunks still point at
`/dashboard/_vercel/immutable/.../*.worker-*.js` on the page's own
origin
### After merge, on the full staging environment
- Load the staging dashboard with DevTools open: every script,
modulepreload and stylesheet comes from the staging asset CDN with a
200, and there are no CORS or CSP errors in the console
- Fonts render (Inter, and the code fonts in the SQL editor)
- Sign in and click around: Table Editor, SQL Editor, GraphiQL, Logs.
Lazy routes load, and nothing comes from `/dashboard/_vercel/immutable`
except Monaco's workers
- SQL Editor and GraphiQL: Monaco works (syntax highlighting,
autocomplete), and its workers load same-origin
- Trigger an error and check the Sentry event has a readable stack trace
- After the next staging deploy, check the build log's upload only added
new files
---------
Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
|
||
|
|
51b7cd6a4b |
refactor(studio): declare Assistant tool availability on contracts (#52396)
## What
Assistant tool contracts now declare where they're available, and
`getTools` builds tools from the registry.
- `ToolContract` and `RemoteToolContract` gain `availability: {
environments, requires? }`, both read-only sets. `environments` is
`platform` and/or `self-hosted`; `requires` is any of `explorer`,
`supportMode`, `baseUrl`.
- New `tools/registry.server.ts` maps every contract to its factory in
`TOOL_FACTORIES`; its type makes a missing or mismatched factory a
compile error. `buildLocalTools` builds only the tools available for a
request.
- `getTools` no longer branches per tool module. Local contract tools
take precedence over remote MCP tools with the same name. The
self-hosted fallback tools are unchanged for now.
- Deleted the per-module getters (`studio-tools.ts`, `schema-tools.ts`,
`report-tools.ts`, `notebook-tools.ts`, `incident-tools.ts`,
`support-tools.ts`); their tests now call the factories directly.
## Behavior changes
- Self-hosted no longer offers `deploy_edge_function`. Its server half
calls `/v1/projects/{ref}/functions/deploy`, which self-hosted Studio
doesn't serve.
- Self-hosted no longer offers the support tools (`escalate_to_human`,
`resolve_support_conversation`) in support mode.
- Platform offers `list_databases` without the Explorer flag.
Everything else produces the same tool set as before.
## Tests
- `index.availability.test.ts` asserts the exact tool names for every
combination of environment, Explorer, support mode, and `baseUrl`.
- `registry.test.ts` checks registry invariants: keys match contract
names, every contract has a factory, and a name in both the local and
remote maps has disjoint environments and matching gates.
This is the first step in moving the self-hosted Assistant tools to
contracts.
## 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)
|
||
|
|
7f7ebf527b |
feat(studio): use shared logs table for recent function errors (#50958)
The Overview's "Errors in the last 24h" section now uses the Logs tab's queries (#50954) and the read-only `EmbeddedLogsTable` (#50953) instead of its own SQL and table. It previews the latest five errors since the last deploy, capped at 24h, shows "+N more" when there are more and links to the rest. It's behind the `edgeFunctionsOverview` flag, like the rest of the new Overview. - Rows have no multi-select checkbox. Clicking one opens it in the Logs tab with the same range and error filter, and "View logs" and "+N more" open the filtered list. - With the unified logs preview off, those links open the pre-unified Invocations tab (for invocation rows) or Logs tab (for runtime rows), using those tabs' own `its`/`ite`/`log` params. - "Explain with AI" and "Copy summary" send the previewed errors to the Assistant with the same prompt as selected logs on the Logs page. The prompt also notes how many errors were left out. - One count query, scoped to the function and unfiltered, gives both the error count behind "+N more" and the invocations since the deploy, from its level and log type facets. It replaces the hand-built invocation count SQL, so the section runs two queries instead of three. - The row query fetches only the five errors shown, through a new `pageSize` option on `useUnifiedLogsInfiniteQuery`. - The section uses the edge function preset from #50957, so it runs the Logs tab's scoped queries and shares its saved columns. - The custom error grouping and its SQL are removed. Net, the PR removes about 390 lines. ### How to test 1. With `edgeFunctionsOverview` on, open a function that has recent errors. You should see up to five rows without checkboxes, and "+N more" when there are more. 2. Click a row with the unified logs preview on. It opens the Logs tab with that log selected. Turn the preview off and click an invocation row and a runtime row. They open Invocations and Logs respectively. 3. Use Explain with AI and Copy summary and check the prompt. 4. For a function with no errors since the last deploy, the section shows the invocation count instead. ### Validation - MSW component tests: preview rows and "+N more", no checkboxes, the summary prompt, row links with the preview on and off, and the no-errors state. They also check the row query asks for five rows and that a single unfiltered count runs. `pageSize` and the facet count helper have unit tests. - Studio typecheck, lint ratchet, Prettier and knip pass on this layer. ### Stack Merge in order: 1. #50953 — reusable logs table building blocks 2. #50954 — function-scoped unified logs queries 3. #50955 — slimmer function detail layout, header on Overview 4. #50957 — Invocations merged into a function-scoped Logs tab 5. #50958 — Overview errors in the shared logs table 6. #52281 — remove the legacy Overview --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jordi Enric <jordi.err@gmail.com> |
||
|
|
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`. |
||
|
|
5d52b00f70 |
feat(studio): combine function invocations and logs (#50957)
With the unified logs preview on, an edge function's Logs tab renders the unified logs view scoped to that function (#50954), with its invocations and runtime output in one list. That replaces the separate Invocations and Logs tabs. - `UnifiedLogs` takes a `scope` plus view props: `hasFilterSideBar`, `offeredFilters` and `columnPreferencesKey`. The function Logs tab turns the sidebar off, which also drops the filters-toggle shortcut, and saves its columns and panel layout separately from the Logs page. - `getEdgeFunctionLogsScope` and `EDGE_FUNCTION_LOGS_VIEW` are the edge function preset: the scope's fixed filters, the filters the tab offers and its saved-columns key. It offers date, log type, level and message, so no user filter, since no function row has a user. - The Invocations tab and its shortcut are hidden. Old Invocations links redirect to Logs, converting `its`/`ite`/`log` to `date`/`id`. - `getEdgeFunctionLogsUrl` builds links into the scoped tab with the shared params serializer from #50953, and clicking a bar on the invocations chart uses it. With the preview off, both tabs work as on master. ### How to test 1. Turn on the unified logs preview and open an edge function's Logs tab. You should see only that function's invocations and runtime logs, with the filter bar limited to date, log type, level and message. 2. Filter to Edge Function runtime, then to errors, and check counts and the chart follow. 3. Open an old `/functions/<slug>/invocations?its=…&ite=…&log=…` link. It lands on Logs with the same range and log selected. 4. Click a bar on the Overview invocations chart. The Logs tab opens on that bucket. ### Validation - URL helper, offered filter and preset tests, plus the scoped query tests from #50954. - Studio typecheck, lint ratchet, Prettier and knip pass on this layer. ### Stack Merge in order: 1. #50953 — reusable logs table building blocks 2. #50954 — function-scoped unified logs queries 3. #50955 — slimmer function detail layout, header on Overview 4. #50957 — Invocations merged into a function-scoped Logs tab 5. #50958 — Overview errors in the shared logs table 6. #52281 — remove the legacy Overview --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jordi Enric <jordi.err@gmail.com> |
||
|
|
de32f3130b |
fix(studio): show compute size labels on infrastructure surfaces (#52170)
## Problem
We don't want to mention raw AWS instance type names. Instead only
display the actual instance size name (e.g. "Small", "Medium", ...).
Fixes PROD-673
## Solution
Add a `getComputeSizeLabel` helper (`apps/studio/lib/compute-labels.ts`)
that maps `infra_compute_size` to its display label (`medium` →
"Medium", `2xlarge` → "2XL", …) and returns `undefined` for unknown
values so callers render nothing instead of a raw value.
Studio elements changed:
- Read replica details: "Compute Size" field
(`/project/<project_id>/settings/infrastructure/replica/<replica_id>`)
- Infrastructure diagram: primary and replica node cards
(`generateNodes` now receives the label; replicas always match the
primary's compute size) (`/project/_/settings/infrastructure`)
- Map view: "AWS • {size}" line in the region popup
(`/project/<project_id>`)
- HA pooler node cards (`useHaPoolerCard`)
Also removes the `size` field from the create-replica request (API
ignores it).
Unit tests cover the new helper, including the unknown-value case. The
existing `project_homepage:show_instance_size` feature flag keeps gating
the label as before.
## Review instructions
1. Open a project's Infrastructure settings page
(`/project/_/settings/infrastructure`).
2. Check the diagram node cards and (for projects with replicas) the map
view popup: compute shows as "Small"/"Medium"-style labels matching the
project's compute badge.
3. Open a read replica's details page: the "Compute Size" field shows
the same label.
4. Open the add-replica dialog and submit: the request body contains
only `read_replica_region`.
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
|
||
|
|
c81d8eab49 |
fix(studio): build oauth app grant mocks without iterator helpers (#52379)
`data/oauth-apps/mocks.ts` built a mock list with
`Array(50).keys().map(...)`, which needs `Iterator.prototype.map`
(Safari 18.4+, Chrome 122+, Firefox 131+). The array is built when the
module loads, not only when mocks are enabled, and `AccountLayout`
imports `USE_MOCKS` from this module. On older browsers every
`/account/*` page (plus the org OAuth apps page, `/account/apps` and
`/authorize`) crashes into the global error boundary with
`Array(50).keys().map is not a function`.
**Changed:**
- Build the 50 mock grants with `Array.from({ length: 50 }, …)`. Same
data, works everywhere.
This was the only chained iterator-helper call in `apps/` and
`packages/`.
## To test
- On the preview, open `/dashboard/account/me` in Safari 18.3 or earlier
(or any browser without iterator helpers): the page renders instead of
the error screen
- In a current browser, `/dashboard/account/me` and the org OAuth apps
page still render as before
Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
|
||
|
|
74045a0d61 |
feat(studio): load v2 permissions alongside v1 in ProfileProvider (#52387)
## What `ProfileProvider` now loads `/platform/profile/permissions/v2` alongside the v1 permissions, and includes it in the provider's `isLoading` state. ## Why Many grant-gated queries can't fire until the v2 permissions resolve. Previously the v2 request only started once a consumer (`useAsyncCheckPermissionsV2`, `useGrant`, `ensureGrant`) mounted, adding a serial round-trip in front of those queries. `ProfileProvider` sits near the root in both the Next.js (`pages/_app.tsx`) and TanStack Start (`routes/__root.tsx`) runtimes, so the request now starts in parallel with the profile and v1 permissions fetches on every page load. ## Notes - Consumers of `useProfile().isLoading` now also wait for v2 permissions. - The existing `permissionKeys.list()` invalidation in the profile-create 409 path prefix-matches the v2 key, so v2 is refetched there too. ## Testing - `lib/profile.test.tsx` passes. |
||
|
|
f9e0376951 |
fix(studio): reload once on chunk load failures (#52380)
When a lazy-loaded JS/CSS chunk fails to load (flaky or mobile
networks), users land on the global error screen and stay there until
they refresh by hand. This reloads the page once instead, in both
runtimes.
A reload is the only reliable recovery: WebKit (Safari and every iOS
browser) caches a failed module fetch in the document's module map, so
every later `import()` of that URL fails instantly until the page is
replaced. TanStack's `lazyRouteComponent` already reloads once for route
chunks, but it keys its guard on the error message, and Safari's message
("Importing a module script failed.") is the same for every chunk and
survives reloads, so after the first time in a tab it never reloads
again. Non-route lazy imports (`next/dynamic`, `React.lazy`, Monaco) had
no recovery at all.
**Added:**
- `lib/chunk-load-error.ts`: `isChunkLoadError` (Chrome, Firefox,
WebKit, webpack `ChunkLoadError` and Vite's CSS preload wording) and a
reload guard
- The guard is time-based (`sessionStorage`, 30s window), not
message-based: a second failure within 30s of a reload shows the normal
error screen instead of looping. It's also capped at 3 automatic reloads
per tab, and the guard is read back after writing it. If storage is
unavailable, or silently drops the write, it never reloads
- Unit tests for every message form, the guard window, the per-tab cap,
and broken, missing or write-dropping storage
**Changed:**
- The global error boundary in `pages/_app.tsx` and `routes/__root.tsx`,
plus TanStack's root `errorComponent`, reload once for chunk-load errors
and render nothing while the reload is in flight. Fallbacks only peek at
the guard during render; the reload is claimed after commit
(`useChunkLoadReload`), so a discarded render can't use up the guard
- Chunk-load errors that a reload recovers from are no longer reported
to Sentry. One that recurs within the guard window (the user actually
saw the error screen) is reported, tagged `chunkLoadError: true`
No `vite:preloadError` listener: it also fires for hover/intent route
preloads, so reloading on it would refresh the page under someone who
only hovered a link.
## To test
- On the preview, open DevTools → Network, block one route chunk URL
(e.g. the SQL editor's), then navigate to it: the page reloads once and
recovers (unblock after the reload), with no error screen flash
- Keep the chunk blocked: after the one reload you get the normal error
screen, not a reload loop
- Repeat after 30s+ in the same tab: it reloads again
- Sentry: the recovered reload sends no event; the persistent failure
sends one tagged `chunkLoadError`
- Normal navigation and genuine non-chunk errors behave as before
---------
Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
|
||
|
|
080b888e6b |
feat(studio): slim edge function detail layout and move header to Overview (#50955)
The edge function detail layout is now breadcrumbs plus tabs (`PageNav`), without the page header, so tabs like Logs and Code get the full height below the tabs. The function name, invoke URL and last deploy details move into a header on the Overview tab, which also holds the chart period selector. Both the new and legacy Overview render it, and both now default to a 1 hour period instead of 15 minutes. The Overview sections (invocations, errors, performance and usage) now sit in one default-width `PageContainer` instead of each nesting a full-width one, and the invocations chart moves into a chart card. Invocations has no section heading, since it's the headline metric right below the page header. Both overview versions use the same chart periods. Sparse chart data is filled only between returned API buckets, avoiding synthetic zeros outside the reported range. Chart navigation uses the full rolling period, including a full day for the 1 day option. The selector shows a checkmark for the selected period, and the header announces loaded details. Self-hosted Studio retains a Copy URL action in the detail toolbar because it has no Overview tab. This layer doesn't depend on the logs changes below it. **Heads-up:** the header now only appears on Overview. Code, Details, Invocations and Logs show breadcrumbs and tabs only. This change isn't behind a flag. ### How to test 1. Open an edge function's Overview. The header shows the name, URL (with copy) and last deploy hover card, and the period selector sits in the header with 1 hour selected. 2. Switch through the other tabs. Breadcrumbs and tabs stay sticky, and there's no header. 3. With the `edgeFunctionsOverview` flag off, the legacy Overview renders with the same header. ### Validation - 104 focused tests pass with retries disabled and shuffled order (seed 50968). New tests cover both overview versions, period changes, empty results, header loading and copying, and self-hosted URL copying. Test names describe observable behavior. - 12 targeted regression mutations were detected and restored; the selected-indicator mutation was repeated after the visual alignment fix. - Browser QA on the staging preview for `3d055c0dc4` covers the header and deploy details, copied URL, period changes, all detail tabs, sticky navigation, the legacy overview, and empty results. Temporary local flag overrides were removed. The final test-only commit `5af6a2896b` has identical production code; its matching preview also passed header, URL-copy, period-switching, and Settings smoke checks. - Independent code review and changed-file formatting checks pass. All 40 executed CI checks pass on `5af6a2896b`, including TypeScript/lint, unit tests, Next.js and TanStack E2E tests, and builds. All six review threads are resolved. ### Stack Merge in order: 1. #50953 — reusable logs table building blocks 2. #50954 — function-scoped unified logs queries 3. #50955 — slimmer function detail layout, header on Overview 4. #50957 — Invocations merged into a function-scoped Logs tab 5. #50958 — Overview errors in the shared logs table 6. #52281 — remove the legacy Overview --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jordi Enric <jordi.err@gmail.com> |
||
|
|
5d8499b6f1 |
chore(eslint): allowlist grant and connectionString in query exhaustive-deps (#52334)
## Problem `@tanstack/query/exhaustive-deps` flags every variable used in a `queryFn` that isn't in the `queryKey`. Some variables are intentionally left out because they don't change the returned data, and keeping them out of the key avoids splitting the cache: * **`connectionString`** in queries that run SQL against the user's database. These currently need `eslint-disable` comments or count against the ratchet. * **`grant`**, the FGA grants that Studio data hooks now take (see #52331). Every migrated query would otherwise need a disable comment. The installed plugin (5.91.2) has no way to configure this. ## Solution * Upgrade `@tanstack/eslint-plugin-query` from `^5.0.0` (resolving 5.91.2) to `^5.104.5`. The rule's `allowlist` option arrived in 5.95.0. 5.105.0 is newer than our pnpm minimum release age allows. * Allowlist `grant` and `connectionString` for `exhaustive-deps` in `eslint-config-supabase/next.js`. * Remove the 11 disable comments in Studio that only suppressed `connectionString`. * Six disable comments stay, because they suppress other dependencies: * `ReportBlock.tsx` * `UserJourneys.queries.ts` * `github-config-query.ts` * `bucket-objects-infinite-query.ts` * `table-rows-query.ts` * `useSingleLog.tsx` * Lower Studio's `@tanstack/query/exhaustive-deps` baseline from 87 to 28. The upgraded rule is stricter than 5.91.2: without the allowlist it adds about 18 warnings. With the allowlist, the total drops well below the old baseline, because many existing warnings were unsuppressed `connectionString` omissions. The lockfile changes are the plugin and its `@typescript-eslint` dependencies. The graphiql entries are re-keyed by pnpm's peer resolution; their versions are unchanged. ## Testing * `pnpm --filter studio run lint:ratchet` passes. * ESLint is clean on each file where a disable comment was removed. * Other apps' ratchets only track `shadcn/*` rules, so they're unaffected. |
||
|
|
fdab2cc751 |
feat(studio): interrupt serious account recovery gaps (#51643)
## Problem Users with serious recovery gaps may never visit Account Security, so a manually accessible reminder is easy to miss. ## Solution Show the existing reminder as a full-screen layout takeover after required MFA verification and successful account reads. Keep the original URL, query and fragment intact. The dashboard stays mounted but inert, preserving unsaved work; dismissal reveals it. Wait for existing dialogs to close. Keep rollout gating, eligibility and snooze unchanged. A successfully resolved background check dismisses an untouched takeover; started tasks and completed rows remain until Continue. Both of these recovery flags are enabled via ConfigCat for local and staging: - `enableAccountRecoveryInterstitial`: this work - `enableAuthRecoveryCodes`: the work it depends on We’ll only flip these to `true` for production once all of this is merged and heavily tested. | Interruption Example | | --- | | <img width="654" height="800" alt="16563" src="https://github.com/user-attachments/assets/eec71acf-78ab-473d-a9d3-9c6cdc3aff07" /> | The dashboard remains usable while eligibility loads. An open takeover stays in place through background refreshes. Signing out clears in-memory reminder state so clearing browser snooze permits retesting. ## Review instructions 1. Open [this PR’s staging preview](https://studio-staging-git-dnywh-account-recovery-interstitial-supabase.vercel.app/dashboard/organizations) with a non-SSO test account and complete required MFA verification. Check `enableAccountRecoveryInterstitial` and `enableAuthRecoveryCodes` are both true in the staging dev toolbar. Close the toolbar and other dialogs. 2. **Exhausted codes:** use an account with existing codes and exactly one verified authenticator. Override GET `/factors/recovery-codes` in DevTools Network: retain JSON fields, set `remaining` to `0` and save. Clear `account-recovery-reminder:<userId>` from Local Storage for this preview origin, then reload. Make sure you are **not** on `dashboard/account/security` as that won’t show the interstitial. Confirm the request uses the override and the takeover opens without changing the URL. 3. **Missing codes, separate scenario:** disable overrides and use an MFA test account with no generated codes. Clear snooze and reload. A zero remaining count simulates exhausted codes, not missing codes. A second verified authenticator prevents the exhausted-code trigger, but not the missing-code trigger. 4. Skip, reload and switch projects or organisations. Confirm snooze persists. A different account must have separate reminder state. For warning-to-critical escalation, generate codes on the missing-code account, then override its remaining count to zero and reload without clearing the warning snooze. 5. Disable overrides before live actions. Save codes or add an authenticator, then Continue. Confirm the page and URL remain intact. Tab and Command/Ctrl+K must not reach dashboard controls; nested dialogs must still work. Editor draft and browser-history preservation are also covered by component tests. 6. With snooze cleared, open a project URL containing a query and fragment; opening and dismissing the takeover must leave that full URL unchanged. Check account settings, sign-in, MFA verification and consent/connection flows remain uninterrupted. A healthy account, failed reads or a disabled rollout flag must not trigger a takeover. 7. Throttle the status request: the dashboard stays usable while eligibility loads. If another dialog is already open, the takeover waits until it closes. There is no standalone recovery route or runtime mock parameter. |
||
|
|
e2ec13d9a6 |
feat(studio): snooze recovery reminders per browser (#52124)
## Problem Skipped recovery reminders need a consistent reminder interval for each signed-in person in the browser. ## Solution Snooze missing codes for thirty days and exhausted codes for seven days. Escalation breaks snooze; sign-out preserves it. Completing codes, or adding a backup factor for exhausted codes, resolves the applicable gap. Track task actions, completion and dismissal. ## Review instructions **This PR’s own deploy preview cannot show the takeover.** Review its diff here, but test the assembled stack on [#51643’s staging preview](https://studio-staging-git-dnywh-account-recovery-interstitial-supabase.vercel.app/dashboard/organizations). The controller only mounts in #51643. Before each scenario: use a non-SSO staging test account with MFA verified; check `enableAccountRecoveryInterstitial` and `enableAuthRecoveryCodes` are both true in the staging dev toolbar, then close the toolbar and other dialogs. Clear `account-recovery-reminder:<userId>` from DevTools Application → Local Storage **for that preview origin**, then reload the dashboard. 1. Use an account with existing codes and exactly one verified authenticator. Override GET `/factors/recovery-codes` in DevTools Network: retain JSON fields, set `remaining` to `0`, save and reload. Confirm the overridden request succeeds and the takeover opens. 2. Skip. Confirm the URL stays unchanged and the local-storage record has critical severity with expiry seven days ahead. In a separate scenario, genuinely missing codes should record warning severity with expiry thirty days ahead. 3. Reload, switch projects or organisations, then sign out and back in. The reminder stays hidden. Clear the record and reload to retest. 4. Disable overrides before live actions. Save codes and Continue; the record clears. Adding a second authenticator resolves exhausted codes but must not resolve missing codes. Use separate test accounts for these cases. |
||
|
|
eec2d0f947 |
feat(studio): offer a backup authenticator in the recovery reminder (#52123)
## Problem A recovery reminder should let users save codes and add a backup authenticator independently, with clear loading and completed states. ## Solution Add an optional authenticator task for accounts with one verified factor. Keep completed rows visible, use text shimmers while loading, and dismiss an untouched takeover when a successful refresh confirms the gap is resolved. Continue and Skip dismiss through the same callback used by the layout takeover. | State | Screenshot | | --- | --- | | Loading | <img width="654" height="800" alt="40913" src="https://github.com/user-attachments/assets/d75585f0-5d00-46db-9ec7-1305da0f7464" /> | | Multiple issues | <img width="654" height="800" alt="Supabase" src="https://github.com/user-attachments/assets/8342667c-ecce-4271-a418-41295ebba223" /> | | One issue fixed | <img width="654" height="800" alt="15927" src="https://github.com/user-attachments/assets/693c37fe-e955-4c9d-b866-1c60743a31b8" /> | | Both issues fixed | <img width="654" height="800" alt="59618" src="https://github.com/user-attachments/assets/46140e95-b686-41ab-a5ea-94016f7eda29" /> | ## Review instructions **This PR’s own deploy preview cannot show the takeover.** Review its diff here, but test the assembled stack on [#51643’s staging preview](https://studio-staging-git-dnywh-account-recovery-interstitial-supabase.vercel.app/dashboard/organizations). The controller only mounts in #51643. Before each scenario: use a non-SSO staging test account with MFA verified; check `enableAccountRecoveryInterstitial` and `enableAuthRecoveryCodes` are both true in the staging dev toolbar, then close the toolbar and other dialogs. Clear `account-recovery-reminder:<userId>` from DevTools Application → Local Storage **for that preview origin**, then reload the dashboard. 1. Use a test account with missing codes and exactly one verified authenticator. Cancel Add authenticator, then reopen and enrol a test authenticator. Confirm only that row completes and Skip for now becomes Continue. Generate and acknowledge codes; both completed rows stay visible. These actions change the test account. 2. **Separate exhausted-code scenario:** use an account that still has exactly one verified authenticator. Override GET `/factors/recovery-codes` in DevTools Network: retain JSON fields, set `remaining` to `0`, clear snooze and reload. An account with two verified authenticators will not trigger for exhausted codes. Disable overrides before live actions. 3. For the codes-only layout, use an account with two verified authenticators and genuinely missing codes. Repeat at a narrow viewport. Loading, unavailable and externally resolved states have component-test coverage; healthy or failed reads must not trigger a takeover. |
||
|
|
749386567d |
feat(studio): fix recovery codes inside an interstitial (#52122)
## Problem Users need to fix missing or exhausted recovery codes without leaving the recovery reminder. ## Solution Add a reusable recovery reminder and full-screen modal shell using the existing recovery-code dialogs. Dismissal is a callback. The automatic layout gate in #51643 mounts the UI; there is no standalone preview route. | State | Screenshot | | --- | --- | | Blocked request | <img width="654" height="800" alt="39307" src="https://github.com/user-attachments/assets/2ba80ea7-24ad-4d29-ab50-730890501014" /> | | Recovery codes used up | <img width="654" height="800" alt="Supabase" src="https://github.com/user-attachments/assets/5dd63735-1254-4855-bbd8-04c2e4c699fa" /> | | No recovery codes | <img width="654" height="800" alt="Supabase" src="https://github.com/user-attachments/assets/58ff5b91-7da6-4c39-ad99-cea7cce8cf73" /> | | Recovery codes saved (just completed above _Generate codes_ step) | <img width="654" height="800" alt="63500" src="https://github.com/user-attachments/assets/1fc7ca56-a7cb-4edd-a3cd-4d8cf5c09659" /> | ## Review instructions **This PR’s own deploy preview cannot show the takeover.** Review its diff here, but test the assembled stack on [#51643’s staging preview](https://studio-staging-git-dnywh-account-recovery-interstitial-supabase.vercel.app/dashboard/organizations). The controller only mounts in #51643. Before each scenario: use a non-SSO staging test account with MFA verified; check `enableAccountRecoveryInterstitial` and `enableAuthRecoveryCodes` are both true in the staging dev toolbar, then close the toolbar and other dialogs. Clear `account-recovery-reminder:<userId>` from DevTools Application → Local Storage **for that preview origin**, then reload the dashboard. 1. **Exhausted codes:** use an account with existing codes and exactly one verified authenticator. In DevTools Network, right-click GET `/factors/recovery-codes` → **Override content**. Keep the JSON fields, set `remaining` to `0`, save and reload. Confirm the request shows the overridden response and the takeover opens. 2. **Missing codes, separate scenario:** disable overrides and use an MFA test account with no generated codes. Clear snooze and reload. Setting `remaining` to `0` simulates exhausted codes, not missing codes. 3. Disable overrides before live actions. Cancel regeneration to check existing codes remain intact, then generate or regenerate codes and acknowledge storage. These actions change the test account. Continue or Skip should reveal the unchanged URL and page. |
||
|
|
df8aca1fb2 |
refactor(studio): share recovery setup dialogs (#52121)
## Problem The same recovery setup needs to work from Account Security and the new recovery interstitial without duplicating dialog behaviour. ## Solution Share the generation and regeneration flow, and report completion only after codes are acknowledged or an authenticator is verified. Keep the existing Account Security entry points. This PR provides the dialog foundation; #52122 and #52123 consume its callbacks, and #51643 mounts the takeover. ## Review instructions 1. Open [Account Security](https://studio-staging-git-dnywh-recovery-shared-dialogs-supabase.vercel.app/dashboard/account/security) in staging, or `/account/security` locally, using a disposable test account. 2. Generate recovery codes. Confirm Done stays disabled until the save acknowledgement is checked, then closes the dialog. 3. Regenerate codes. Cancel the confirmation first and confirm nothing changes; repeat and confirm the replacement codes appear. 4. Open Add authenticator and cancel. Then complete enrolment with a test authenticator; confirm it appears only after verification. --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com> |
||
|
|
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. |
||
|
|
092b8ff518 |
fix: repair 404s from legacy dashboard routes, docs links, and the changelog feed (#52292)
Several supabase.com URLs still return a 404 to real browsers every day: an old Database Hooks route, card icons for brands we never shipped an image for, two dashboard links to docs pages that miss the `/guides` prefix, and a few URLs that search engines and feed readers keep requesting. **Changed:** - **Old Database Hooks links land on Webhooks**: #29671 renamed `/project/:ref/database/hooks` without a redirect, so bookmarks and older guides hit a 404. I added a redirect to the Integrations Webhooks page, the same target as the existing `database/webhooks` redirect. - **Card brands without an icon show a generic card**: payment method rows built the image URL straight from the card brand name, so UnionPay and other brands without a PNG rendered a broken image. I added a `CardBrandIcon` in `CreditCard.tsx`, used by both views, that only requests the brand images we ship, labels each with its brand name, and shows a generic card icon for every other brand. - **Branching "Learn more" links open the right docs**: #51393 linked the branching empty state to `/docs/deployment/branching/...` without `/guides`. I fixed both links and added a redirect for the GitHub integration URL, which search engines already indexed (the dashboard one already had a redirect). - **Indexed docs and feed URLs redirect**: I added redirects for `/docs/guides/mcp`, the old hashed architecture diagram path that other sites still embed, and `/changelog/rss.xml`. I also added an RSS `alternate` link to `/changelog` so feed readers find `/changelog-rss.xml` instead of guessing. **Note:** Studio and www changes are independent, so either app can deploy first. ## To test Tested on the PR preview: - [x] Open `/dashboard/project/<ref>/database/hooks`, expect a redirect to `/dashboard/project/<ref>/integrations/webhooks/overview` (`database/hooks-nope` still 404s) - [x] Open org billing with a Visa or Mastercard on file, expect the brand logo as before - [x] With a card whose brand has no image (e.g. UnionPay), expect a generic card icon instead of a broken image in the payment methods list (checked with a mocked UnionPay row: generic icon, no `unionpay.png` request, Visa rows unchanged) - [ ] Same check in the plan change payment method select (not exercised: reaching it starts the plan change flow) - [x] On a project without branching, open Branches and click both "Learn more" buttons, expect the dashboard and GitHub integration branching guides to load - [x] On the www preview, open `/changelog/rss.xml`, `/docs/guides/mcp` and `/docs/deployment/branching/github-integration`, expect 308s to `/changelog-rss.xml`, `/docs/guides/ai-tools/mcp` and `/docs/guides/deployment/branching/github-integration` - [x] View source on `/changelog`, expect a `rel="alternate"` RSS link to `/changelog-rss.xml` ## Linear - fixes GROWTH-1364 |
||
|
|
c127901b64 | test(studio): speed up flaky replication tests (#52326) | ||
|
|
d98c277790 |
feat(studio): rotate Storage URL signing keys FE-4433 (#52165)
## Problem Rotating a project's Storage URL signing key currently needs a support ticket, so customers can't rotate on their own timeline or keep a standby key until their signed URLs have migrated. Linear: [FE-4433](https://linear.app/supabase/issue/FE-4433/allow-users-to-rotate-storage-url-signing-keys-via-ui) ## Solution Adds a URL signing keys page at `/project/{ref}/storage/signing-keys`, linked from the Storage menu. It builds on the design prototype from `feat/storage-rotate-signing-keys` and follows the current JWT Keys page styling. - Active key, standby key, and revoked keys are shown in separate tables, so there is only ever one active key. The UI allows one standby key at a time. - Create a standby key (ES256 by default, HS512 optional), rotate the standby key to active, revoke a standby key, or move a revoked key back to standby. - The key list reports JWK types (`EC`, `oct`), which are mapped to ES256 and HS512 labels. Unrecognized types fall back to the raw value. - Telemetry: `storage_url_signing_key_created` and `storage_url_signing_key_updated` (with a `change` property), fired when the action succeeds. - A "Created at" column is not included yet because the keys endpoint doesn't return it. It will follow in a later PR. <img width="1272" height="846" alt="Screenshot 2026-10-23 at 11 43 45" src="https://github.com/user-attachments/assets/980742ed-6c4e-43d1-b170-847e550fde4c" /> ## Review instructions 1. Open the preview and go to Storage > URL signing keys on a project. 2. Create a standby key, then rotate it to active. The previous active key should move to standby. 3. Revoke the standby key (type its ID to confirm), then move it back to standby from the revoked table. 4. Compare the table styling with Project Settings > JWT Keys. 5. Check that creating a standby key and moving a revoked key to standby are disabled while a standby key exists. ## 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) --------- Co-authored-by: Francesco Sansalvadore <f.sansalvadore@gmail.com> |
||
|
|
c31c7afb1b |
fix(studio): add latest-version hint to Postgres version field (#52143)
## Problem On the General settings page, the Service versions card shows the versions as disabled inputs. When a project is already up to date, nothing explains that Postgres updates would show up in this section, or where to learn more. Resolves FE-4604: https://linear.app/supabase/issue/FE-4604/add-hint-regarding-database-versioning ## Solution Adds a subtle description under the Postgres version field, using the existing `description` prop on `FormItemLayout`: > This project is already on the latest version of Postgres that Supabase supports. Updates will appear here when available. Learn more "Learn more" links to the upgrading guide. It is tertiary information, so it is a field description and not an admonition (changed after design feedback). It only shows when the project is on the latest version, database upgrades are enabled, and the project is not on a K8s cloud provider. The condition is one named boolean, `canShowLatestVersionHint`. Component tests cover the visible case and the hidden cases. ## How to test 1. Run Studio and open a project's General settings page. 2. On a project already on the latest Postgres version, check that the description appears under the Postgres version field, next to the "Latest" badge. 3. Click "Learn more" and check that the upgrading guide opens in a new tab. 4. On a project with an upgrade available, check that only the upgrade alert shows and the description does not. |
||
|
|
90ba1183de | fix(stripe-atlas): change message for simple link (#52323) | ||
|
|
973dfa1b97 |
feat(studio): scope unified logs queries to one edge function (#50954)
Adds an optional `scope` to the unified logs search: fixed filters every query applies on top of the user's, which the user can't remove. Nothing sets a scope in this PR, so the Logs page is unchanged. #50957 uses one to narrow the function Logs tab to one edge function. A scope uses the same columns and operators as the `filter` URL param, so any view can narrow logs to one resource without new query code. Columns the query builder doesn't know match a `log_attributes` key, so one edge function's logs are: ```ts { filters: [ { column: 'log_type', operator: '=', value: 'edge function' }, { column: 'log_type', operator: '=', value: 'edge function runtime' }, { column: 'function_id', operator: '=', value: functionId }, ], } ``` - New `edge function runtime` log type, read from the `function_logs` source. Its level comes from the console level (`error`/`fatal` count as errors, `warn`/`warning` as warnings), and its details stay in metadata. - **Every scan**: the scope's filters apply to rows, counts, the chart and single-facet queries. Facet scans never drop them, unlike the user's own filter on the facet's column. Filters on the same column and operator combine like the URL's (`=` values match any), every group must match, and a scope replaces the default postgres + edge log types. - **Fails closed**: a scope condition that can't be built matches no rows, instead of being dropped like a bad user filter. - **ClickHouse only**: scoped searches always run on ClickHouse, whatever `otelUnifiedLogs` says, including downloads and the log detail panel. The BigQuery queries are unchanged from master and throw on a scope rather than return rows from outside it. - `getLogTypeVisibility` offers only the log types a scope fixes. Otherwise it keeps the new log type out of the filters, since the project-wide Logs page already shows runtime logs inside each invocation's detail panel. - `toQuerySearchParams` and `createUnifiedLogsSearch` attach the scope. - `UnifiedLogs` works out which log types its queries may use once, instead of in each of its queries, filters and facets. ### How to test 1. Open the project Logs page with the unified logs preview on. The log type filter shouldn't offer "Edge Function runtime", and default results should match master. 2. The scoped behavior is easiest to try on #50957. ### Validation - Query builder tests: the scope on every count scan, the chart and facet queries, requests for out-of-scope log types, different operators on one column, the fail-closed case, BigQuery refusing a scope, and unscoped queries staying the same. - Studio typecheck, lint ratchet, Prettier and knip pass on this layer. ### Stack Merge in order: 1. #50953 — reusable logs table building blocks 2. #50954 — function-scoped unified logs queries 3. #50955 — slimmer function detail layout, header on Overview 4. #50957 — Invocations merged into a function-scoped Logs tab 5. #50958 — Overview errors in the shared logs table 6. #52281 — remove the legacy Overview --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jordi Enric <jordi.err@gmail.com> |
||
|
|
3e57a9d5fb |
feat(studio): add FGA grant lint rules and unguarded.migrating ratchet (#52315)
## Problem Resolves FE-4691. Builds on #52238, which added `unguarded.migrating` at every call site that hits an FGA-annotated endpoint. Nothing stops new call sites from adding to that backlog, nothing checks that `unguarded.byDesign` carries a real reason, and type suppressions or the untyped `fetchGet`/`fetchPost` helpers can skip the grant check entirely. ## Solution Adds a local `fga` ESLint plugin (`apps/studio/scripts/eslint-rules/fga.cjs`): - **`fga/no-unguarded-migrating`** (warn, ratcheted): flags each `unguarded.migrating`. Added to `scripts/ratchet-rules.json` with its baseline in `.github/eslint-rule-baselines.json`, so the count can only go down. - **`fga/unguarded-by-design-reason`** (error): `unguarded.byDesign(...)` must take a single non-empty string literal. - **`fga/no-fetch-type-bypass`** (error): - flags `@ts-ignore` / `@ts-expect-error` / `@ts-nocheck` that would suppress a grant error on a `get`/`post`/`put`/`patch`/`del` call from `data/fetchers`: directives targeting the call's first line, an argument's first line, or the `grant` property; - flags imports of the untyped `fetchGet` / `fetchPost`. Directives on `params` lines inside the init (used today to work around spec mismatches) aren't flagged, since they can't hide a missing grant. Existing bypasses are listed in `FETCH_TYPE_BYPASS_EXCEPTIONS` in `eslint.config.cjs`: the 3 `@ts-ignore` fetch calls and the 15 files using `fetchGet`/`fetchPost`. Test files are exempt, since they assert type errors on purpose. ## Testing - RuleTester suite in `scripts/__tests__/fga-eslint-rules.test.ts` - `pnpm --filter studio run lint:ratchet` passes; `eslint --quiet` is clean |
||
|
|
9ddf227359 |
fix(studio): clarify free Micro upgrade messaging on Pro upgrade (#51938)
## What Replaces the "First project included..." admonition in the Pro upgrade dialog with clearer copy that explicitly calls out the free Nano to Micro upgrade, and shows it for any org upgrading from Free to Pro (previously only showed when the org had exactly 1 project). ## Why Users on the Free plan aren't aware that, after upgrading to Pro, their first project's compute is already billed at Micro price and can be switched from Nano to Micro at no extra cost. The old copy didn't make that clear, and was hidden entirely for multi-project orgs. Linear: FE-4667 ## Testing 1. In Studio, go to an organization on the Free plan. 2. Open Billing Settings -> Subscription -> change plan -> select Pro. 3. Confirm the "Micro Compute included for one project" admonition shows, with working links to Infrastructure settings and the compute docs. 4. Repeat with an org that has 2+ projects -> confirm the admonition still shows (previously it was hidden for multi-project orgs). |
||
|
|
8ea3ce7747 |
Fix: stabilize some long flaky units tests (#52297)
## Problem Some of our units fail randomly because they can take a bit more than 5 seconds to complete ## Solution Set their timeout to 10 seconds. |
||
|
|
9391f60ec9 |
test(studio): add shared permissions mocks and testGrant helper (#52312)
## Problem Components and fetchers are moving to endpoint-bound FGA grants, so more tests need to mock `/platform/profile/permissions/v2` and mint grants. Each test file currently defines its own permissions response type and mock, and `testGrant` lives inside `guarded-fetch.test.ts`. Resolves [FE-4692](https://linear.app/supabase/issue/FE-4692/test-infra-global-msw-handler-for-v2-permissions-and-testgrant). ## Solution * `tests/lib/permissions-fixtures.ts`: shared `PermissionsV2Response` type, `ALL_FGA_PERMISSIONS`, `allPermissionsFor(slugs)` (grants everything at the org level), and `NO_PERMISSIONS`. * `tests/lib/msw-permissions.ts`: `mockPermissions(response)` and `mockPermissionsError({ status, message })` on top of `addAPIMock`. * `tests/lib/test-grant.ts`: `testGrant(endpoint, { variant, organizationSlug, projectRef, permissionsProjectRef })` for unit tests of fetchers and query options, moved out of `guarded-fetch.test.ts`. * Existing tests that mocked the v2 endpoint now use the shared helpers. `IndirectTaxDeclarationModal.test.tsx` keeps its own `addAPIMock` because a test asserts the request was served. * Documented in `apps/studio/tests/README.md` and the `studio-mock-api-tests` skill. |
||
|
|
cb4da25dcd |
feat(studio): readable type errors for missing or mismatched grants (#52308)
## What
Grant errors from the guarded fetch wrappers (`get`, `post`, …) are now
short and say what went wrong.
Studio sets `noErrorTruncation: true`, so when a grant was missing, or
the init was passed as a variable with the wrong grant, TypeScript
printed the full structural type of the init (several times over). With
a real request body this ran to roughly 11–12k characters per error.
## How
- `CheckedUrl` checks the grant on the `url` argument. TypeScript
reports the first failing argument, so the error now prints the short
path literal plus a `GrantError<"…">` message:
- `This endpoint requires a grant or 'unguarded'. The grant is missing
or may be undefined.`
- `The grant is for a different endpoint or method.`
- `This endpoint has no FGA annotation. Remove the grant.`
- `GrantProblem` mirrors `GrantOption`, so the `url` check is never
stricter than the existing init check. The init check (`CheckedInit`) is
unchanged and still enforced.
- `Init`'s constraint includes `grant?: unknown`, so an init like `{
grant }` on an endpoint with all-optional options no longer fails the
weak-type check and falls back to the constraint (which hid the real
grant).
- Init optionality is based on `Init` rather than the checked type, so
calling an annotated endpoint with no init reports the grant message
instead of "Expected 2 arguments".
Every case is now under ~430 characters on both TypeScript 6.0.2 and
7.0.2.
## Testing
- Full Studio typecheck passes on TS 7 and TS 6, so every existing
`@ts-expect-error` in `guarded-fetch.test.ts` still fires and accepted
calls still compile.
- `guarded-fetch.test.ts` passes, including the return-type equality
checks against the raw client.
Resolves FE-4722
|
||
|
|
b0b443c4b3 |
fix(studio): don't redirect static assets in maintenance mode (#52307)
With `MAINTENANCE_MODE=true`, the catch-all redirect only exempted `/maintenance` and `/img`. Under a base path on the TanStack build, that also redirected the SPA's own JS/CSS (`/_vercel/immutable`, `/assets`), favicons and fonts, so the maintenance page couldn't load. The Next prod build was unaffected because its assets come from the CDN, but self-hosted Next was redirecting its `public/` files too. **Changed:** - `getMaintenanceRedirects` builds its exclusion from a shared `MAINTENANCE_PASSTHROUGH_SEGMENTS` list: the maintenance page, build output dirs (`_next`, `_vercel`, `assets`) and every top-level `public/` entry - Matches whole path segments, so `/maintenance-foo` or `/images/...` now redirect as expected - `matchRedirect` (the runtime check in `routes/__root.tsx`) uses the same list, so both runtimes stay in sync - `/api` and `/_serverFn` still redirect: maintenance takes the backend offline too, and the maintenance page doesn't need them **Added:** - Tests compiling the rule through Next's path matcher and `@vercel/routing-utils`, with and without `/dashboard` - A guard test that fails if a new top-level `public/` entry isn't added to the list ## To test The `studio-staging` preview for this branch has `MAINTENANCE_MODE=true` and `STUDIO_FRAMEWORK=tanstack` set, so it runs the TanStack build in maintenance mode. - Load any page, e.g. `/dashboard/project/<ref>` or `/dashboard/org`: it should 307 to `/dashboard/maintenance` - The maintenance page should render fully, with the logo, styles and favicon. In the Network tab, everything under `/dashboard/_vercel/immutable/...`, `/dashboard/favicon/...` and `/dashboard/img/...` is a 200 with no redirects - `/dashboard/api/...` requests should still redirect to the maintenance page - Optional: with only `MAINTENANCE_MODE=true` (Next build), pages still redirect and the maintenance page renders Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> |
||
|
|
e6373d2940 |
fix(studio): serve SPA shell for dotted deep links under base path (#52306)
Under a base path, the TanStack Vercel build rewrote any `/dashboard/...` URL ending in `.<ext>` to the root to serve static files. That also caught page deep links whose last segment has a dot, so hard-loading e.g. `/dashboard/project/<ref>/storage/files/buckets/my.bucket` returned a 404 instead of the SPA shell (reproducible on supabase.green today). **Changed:** - `vercel-spa-routes` now limits the prefix rewrite to the actual top-level entries of the static output (`_vercel`, `img`, `favicon`, `fonts`, …), read from Nitro's public dir at build time - Directories only match with a trailing path, so a page sharing a directory's name still gets the shell - Prefixed requests for missing hashed chunks still 404 rather than returning HTML ## To test - On the preview, hard-load a storage bucket URL with a dot in the name (`/dashboard/project/<ref>/storage/files/buckets/my.bucket`) and confirm the page renders - Hard-load a few normal deep links, then check the Network tab: JS/CSS under `/dashboard/_vercel/immutable/...`, favicons and `/dashboard/img/...` all 200 - `curl -I` a made-up `/dashboard/_vercel/immutable/<salt>/nitro/missing.js` and confirm a 404, not HTML --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> |
||
|
|
28e5d2fd64 |
refactor(studio): migrate search_docs remote MCP tool to a contract (#52305)
Migrates `search_docs` to `RemoteToolContract`. Follow-up to #52226. - It is the last remote MCP tool that was still gated by `TOOL_CATEGORY_MAP`. - Opt-in level is unchanged: always available (`minOptInLevel: null`). `needsApproval` is `false`. - Registered in `REMOTE_TOOL_CONTRACTS` and removed from `TOOL_CATEGORY_MAP`. No change to what the model sees. |
||
|
|
0d8b819cbc |
[bot] Decrease ESLint ratchet baselines (#52265)
Automated weekly decrease of ESLint ratchet baselines. Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> |
||
|
|
ac1fa9f1b6 |
fix(studio): add missing grant to entity search query (#52302)
## Problem Typecheck and the `DatabaseEntitySearchCommands.test.tsx` unit tests fail on master. `executeSql` in `entity-search-query.ts` does not pass the now-required `grant`. ## Solution Pass `grant: unguarded.migrating`, matching the other `data/database` queries. |