mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +00:00
create-pull-request/patch
1530
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5ff6930c2a |
feat(studio): send role passwords as precomputed SCRAM-SHA-256 verifiers (#52544)
## What kind of change does this PR introduce? Feature. ## What is the current behavior? Role passwords are sent as plaintext in the SQL (`create role ... password '...'` and `alter role ... password '...'`), so they can end up in Postgres logs. ## What is the new behavior? ASCII role passwords are hashed in the browser with Web Crypto and sent as a precomputed `SCRAM-SHA-256$...` verifier. Postgres stores a verifier as given, so the plaintext no longer appears in the SQL or the server logs. This applies to every flow that sets a role password, because they all go through the role create and update mutations. Non-ASCII passwords are still sent as plaintext. Postgres normalizes passwords with SASLprep before hashing, and the browser code doesn't apply it, so a verifier built from the raw text could stop the role from logging in. For ASCII, SASLprep changes nothing, so the verifier always matches. The `saslprep` package can't be used here because it reads its table with `fs.readFileSync` at import time. Covering non-ASCII passwords is a follow-up, most likely a server-side API. Studio also falls back to plaintext when `crypto.subtle` isn't available, which browsers only expose in secure contexts. This keeps setting a password working on self-hosted Studio served over plain HTTP. ## Known limitations - The verifier is built with 4096 iterations, the Postgres default. If a project sets `scram_iterations` higher, these roles keep 4096, because Postgres stores a supplied verifier as given. Reading the setting first needs an extra query and a grant for it, so it's left for the follow-up below. - Non-ASCII passwords, and Studio over plain HTTP, still send plaintext. - The follow-up is a server-side path that sets the password without it going through the SQL, which would honor the server's own settings and cover these cases. A verifier isn't secret (it can be attacked offline), but it is a clear improvement over plaintext. ## Testing - Unit tests compare the helper with an independent `node:crypto` implementation, and check that ASCII passwords become verifiers and non-ASCII passwords pass through unchanged. - I also checked against a real Postgres: roles given these verifiers log in with the plaintext password and reject a wrong one. - The `CreateRolePanel` test now expects a verifier and no plaintext in the SQL. Resolves FE-4822. |
||
|
|
4810bbcfdf |
feat(studio): guard branch read, delete, reset, and restore with FGA grants (#52376)
Part 5 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 `useBranchQuery` becomes `branchQueryOptions`. The delete, reset, and restore mutations take grants. `DeleteBranchModal`, `DeleteBranchPanel`, and the relevant `Overview` actions use `useBranchGrant`, which picks production for the default branch and development for preview branches. Reset previously had no check. ## Testing New `DeleteBranchPanel` test. |
||
|
|
be28b2517f |
fix(logs): correlate request and trace IDs DEBUG-260 (#52514)
Correlate related log timelines using request and trace IDs, and improve the Timeline empty state. Fixes DEBUG-260. |
||
|
|
31c9854c2a |
chore: update api types (#52618)
Fixes API-types as per latest develop - pending prod deployment today to clear out the failing action that checks against prod types |
||
|
|
cd0b65c03e | feat(logs): Add Pipelines to unified logs and rename ETL to Pipelines (#52555) | ||
|
|
7867f22522 |
feat(studio): link log users and show Auth activity timelines (#50837)
Add a User tab that resolves the signed-in user from the selected log or a related request step. It shows the shared Auth profile, offers filtering from the User ID row, and explains anonymous, external, or deleted users. When unified logs are enabled, the Auth user's Logs tab shows the user's 10 most recent logs in `EmbeddedLogsTable`, with the Logs page's columns and row styling. A row opens that log on the Logs page, filtered to the user, and View more in Logs opens the rest. Other configurations retain the existing Logs view. Shared user presentation is isolated in #50841; this PR contains the log/Auth integration and resolves missing-user queries to null. The list uses the #50953 helpers instead of its own: `createUnifiedLogsSearch` builds the query search, `buildUnifiedLogsUrl` builds the links (it now takes a `logId` to open a log), and the query asks for only the 10 rows it shows via `pageSize`. At the panel's default width the table is wider than the panel, so Event message needs a horizontal scroll; the empty state renders outside the table so it stays in view. Issue: [DEBUG-222](https://linear.app/supabase/issue/DEBUG-222/build-correlated-log-and-user-connections-in-studio) ### How to test 1. With the Unified Logs preview and `otelUnifiedLogs` enabled, open a signed-in user's log and select User. Check the profile, copy the User ID, and use Add filter to filter logs to that user. 2. Use Open in Authentication, then open the user's Logs tab. Select a row and confirm it opens the matching log; check that View more in Logs preserves the user filter. 3. Open an anonymous request and confirm the explanatory state. For correlated, external, and deleted-user cases, run the fixtures: `pnpm --filter studio exec vitest run components/interfaces/UnifiedLogs/components/LogUser.platform.test.tsx`. 4. In the log's User tab, focus User ID and press Enter, Arrow Down, Enter. Confirm it copies the ID without changing the selected log. Arrow Down should navigate logs again after the menu closes. ### Validation - Latest head: `8e4a9993b0db52ec5e611e55233b5ed77f67e358`, based on `master`, with conflicts resolved and independent review complete. - Local baseline and shuffled verification passed 324 tests across 26 files with retries disabled (shuffle seed `5083710`). An independent affected-suite run passed 29 tests with retries disabled and shuffle seed `5083730`. - Live QA found and reproduced a keyboard collision: field-menu Arrow Down also selected the next log. The shared menu now keeps keyboard events inside the menu. The regression fails when the guard is removed and passes after restoration. - On the verified latest-head preview, keyboard User ID copy, mouse copy, Add filter, Escape, navigation after closing the menu, and adjacent Auth email copying passed. No browser console errors were observed; browser network telemetry was unavailable. - Full signed-in activity, matching log/profile, Authentication navigation, View more filtering, anonymous state and deleted-user handling passed on `311206f9ef`. The subsequent change only affects menu keyboard propagation, which was revalidated on the latest head. - The disposable staging user was deleted and absence verified. Temporary key files were removed and the clipboard cleared. - Current CI: all E2E suites, unit tests, formatting, lint, Docker and deployments passed; typecheck is still running. Local full typecheck exhausted Node's heap, so no local full pass is claimed. ### Stack All prerequisite log-decoupling and request-correlation PRs, including #50841, are merged into `master`. This is the final code PR in the stack. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jordi Enric <jordi.err@gmail.com> |
||
|
|
6aed258d87 | feat(migration): Move pipeline_id to string (#52489) | ||
|
|
c777ca1c74 |
fix(studio): quote pgmq.create_partitioned interval args as text to f… (#52480)
## Problem Creating a **partitioned queue** from the dashboard (Integrations → Queues → Create queue) fails with: ``` Failed to create database queue: function pgmq.create_partitioned(unknown, integer, integer) does not exist ``` The form submits `partitionInterval` / `retentionInterval` as numbers, and `literal()` in pg-format renders numbers unquoted, so the generated SQL passes bare integers while `pgmq.create_partitioned` declares these parameters as `text`. Fixes #52479 ## Solution Convert the intervals with `String()` before passing them to `literal()` so quoted text literals are generated, matching the function signature: ```sql select from pgmq.create_partitioned('my_queue', '10000', '100000'); ``` When both intervals are unset, the arguments are omitted entirely so the function defaults (`'10000'` / `'100000'`) apply instead of explicit `NULL`s. Basic and unlogged queue creation are untouched. ## Review instructions 1. Enable the Queues integration on a project running pgmq whose `create_partitioned` takes text args (e.g. self-hosted / pgmq 1.5.x) 2. Go to Integrations → Queues → Create queue 3. Select "Partitioned queue" (default) and click Create queue 4. Verify the queue appears in the list, and `select * from pgmq.list_queues()` reports `is_partitioned = true` ## 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: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com> Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> |
||
|
|
8bdc2bf0c5 |
feat(studio): refresh webhook deliveries on demand instead of polling (#52444)
## Problem The deliveries table polled the API every 5 seconds, for as long as the page was open. Studio tables are not polled by default, and polling is only needed here because delivery results arrive asynchronously. Stacked on #52314. Linear: [FE-3750](https://linear.app/supabase/issue/FE-3750/add-pagination-to-platform-webhooks-deliveries-table) ## Solution - Deliveries are no longer polled by default. - A **Live** button turns polling on (every 5 seconds), and a **Refresh** button reloads once. - Polling also turns on by itself while a delivery is pending, and after a test event or retry is sent until its delivery appears (30 seconds at most). The action never looks like it did nothing. - Hovering a failed delivery explains that failed deliveries are usually retried automatically. The API returns no retry state yet, so a scheduled retry only shows up once its attempt starts. ## Review instructions 1. Enable the Platform Webhooks feature preview, open an endpoint with deliveries, and filter DevTools > Network by `deliveries`. No request repeats on its own. 2. Click Refresh. One request is sent. 3. Click Live. A request is sent every 5 seconds and the dot pulses. Click Live again and the requests stop. 4. Send a test event. Requests repeat for a few seconds until the new row appears, then stop. 5. Set the endpoint URL to `https://httpbin.org/delay/10` and send a test event. While the new row shows `pending`, requests repeat. Once it shows `success`, they stop. 6. Hover a `failure` badge. The retry tooltip shows. |
||
|
|
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. |
||
|
|
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> |
||
|
|
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. |
||
|
|
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>
|
||
|
|
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. |
||
|
|
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. |
||
|
|
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> |
||
|
|
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 |
||
|
|
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
|
||
|
|
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. |
||
|
|
bc9bee459f |
refactor(studio): extract reusable logs table building blocks (#50953)
Extract shared logs tables and query helpers. Validate query parameters and preserve defaults, keep custom preview footers independent of pagination, and cover preview behavior and omitted log counts. |
||
|
|
254e24b170 |
feat(studio): require grants in fetch wrappers for FGA-annotated endpoints (#52238)
## Problem Resolves FE-4689 and FE-4690. Builds on #52105. Studio's fetch wrappers don't know which FGA permissions an endpoint requires, so a UI guard and the request it protects can drift apart. This makes the `grant` minted by `useGrant`/`getGrant`/`ensureGrant` part of the request itself: calling an annotated endpoint without a matching grant is a compile error. ## Solution ### What changed - **Fetch wrappers** (`data/fetchers.ts`, `data/guarded-fetch.ts`): `get`/`post`/`put`/`patch`/`del` keep their names, so no imports change. - The `grant` option is required for endpoints annotated with `x-fga-permissions`, and forbidden for unannotated ones. - It accepts a `Grant` for that exact endpoint (or one of its variants) or `unguarded`. - The wrapper strips the grant before calling openapi-fetch. - `head`/`trace`/`options` are unchanged. - **Owned params**: refinements can declare query params the wrapper sets from the grant's variant (`ownedQuery`). These params are removed from the init type (`Omit<Query, Owned> & { [K in Owned]?: never }`), so callers can't pass them. Nothing uses this yet: the api-keys `reveal` variant is the first. - **`assertGrant`** runs in development only and throws `GrantAssertionError`. It checks: - the endpoint; - a missing grant; - the variant against `when(init)` predicates; - the path `ref` against the grant's project, also accepting the parent project ref for a grant minted on a branch; - the path `slug` against the grant's organization. - **Escape hatches**: - `unguarded.migrating` for unmigrated call sites. - `unguarded.byDesign('reason')` for calls that intentionally skip the check. - **Grants** now record `permissionsProjectRef`, the ref permissions were evaluated against. It's required once the scope is resolved. - **Readable errors**: a missing or wrong grant reports the caller's own init type plus the expected `grant` type, instead of openapi-fetch's full options type. Under `noErrorTruncation`, the old message was tens of KB per call site. - **`executeSql`** now requires a grant for `POST /platform/pg-meta/{ref}/query`, so every caller counts as unmigrated. - **Codemod**: added `grant: unguarded.migrating` at every existing call site that hits an annotated endpoint, including all `executeSql` callers. No behavior change. A follow-up lint rule ratchets the count down. - **Dependencies**: adds `openapi-typescript-helpers` (the version openapi-fetch already uses) for the helper types. Only openapi-fetch's unexported `InitParam` is copied locally. ### Type-level notes - The grant is checked in the parameter type rather than in `Init`'s constraint. That way `Init` is still inferred from the argument, which keeps both the return type and the error message tied to the caller's code. - The grant is replaced rather than intersected. Intersecting a wrong grant with the expected one can reduce the init type to `never`, which then accepts the call. - `NoInfer<Path>` stops a grant's endpoint from becoming an inference candidate for the path. ## Review instructions ### Tests - `data/guarded-fetch.test.ts`: - Type equality with the raw client: required params and body, template-literal paths, `parseAs`, `signal`/`headers`, optional-init endpoints, and `unguarded`. An openapi-fetch upgrade that breaks the local `InitParam` copy fails typecheck. - Negative type cases: - a missing or `undefined` grant; - a missing init on an annotated endpoint; - a grant for a different path or method; - any grant or `unguarded` on an unannotated endpoint; - a forged grant; - params and body still checked; - an unknown path. - `guardMethod` and `assertGrant` runtime behavior, including branch-parent refs and org slugs. - Variant and owned-param tests are deferred to the api-keys (`reveal`) and pg-meta (`read`/`write`) PRs, since no refinements exist yet. 1. Run `pnpm typecheck` and confirm Studio passes. Then remove a `grant: unguarded.migrating` and check that the error is short and names the expected grant. 2. Run `pnpm test:studio`. 3. Skim the codemod commit: it only adds `grant: unguarded.migrating` and the `unguarded` import. ## Checklist Check all before review: - [ ] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide) |
||
|
|
7d63d764fc |
Joshenlim/fe 4712 cmd k support searching for database tables (#52205)
## Context Looking into some kaizen improvements for Cmd+K, with the overarching idea to make Cmd+K resource-aware so finding and inspecting anything in a project doesn't depend on knowing where it lives in the dashboard. Specifically looking into database entities for now - end state would be that you could search for a table name for example, and Cmd K will pull up everything *related* to that table for you to skim (e.g Policies, Functions, Triggers, etc). Changes in this PR sets the foundation here by starting with just the tables. <img width="500" alt="image" src="https://github.com/user-attachments/assets/65054781-2385-416c-aed9-f142380e4454" /> This might be similar to how we currently support searching for database entities via these "Queries" section, but these only search within the context of the entity category, not across (e.g only tables, only policies) <img width="500" alt="image" src="https://github.com/user-attachments/assets/66ca16c6-9551-4134-b1e1-0b0c4b004085" /> The idea isn't to replace this, but provide another way to find your database entities so that - You can see related entities to what you're searching at a glance - You don't need to go to a 2nd level nav in Cmd K Also fwiw the bulk of the LOC changes in here are mainly tests actually, actual LOC changes are +385, -22 |
||
|
|
9048d86e35 |
Add a custom log detail fetcher + logs overview for supavisor (#52142)
## Context Supavisor logs in the Unified Logs interface didn't have much detail as compared to the old logs UI - was happening as there wasn't any custom log detail fetcher nor logs overview UI defined for Supavisor logs. So this PR adds them both to render a Supavisor log as such: <img width="1919" height="957" alt="Screenshot 2026-10-22 at 17 46 46" src="https://github.com/user-attachments/assets/33077e81-5a20-4c7b-a322-f8aa2faf73d5" /> <img width="1918" height="956" alt="Screenshot 2026-10-22 at 17 46 57" src="https://github.com/user-attachments/assets/00fd7e55-8b57-45dd-b387-e57cd1d30881" /> ## To test Easiest way to test that I can think of is to make some connections with the shared pooler and run some queries Get your connection string from the Connect UI as such: <img width="908" height="520" alt="image" src="https://github.com/user-attachments/assets/977d1d2c-a76e-4adf-b6d3-42f0862f0609" /> And then I did it locally via Claude for the lowest friction: ``` im trying to generate some logs for my project's supavisor this is the connection string <Insert connection string> can you help me make some connections, run some queries or two then exit? ``` |
||
|
|
60b51d74d5 |
Audit existing unit tests + Remove redundant ones (#52215)
## Context
_TLDR: Changes here speeds up unit tests on CI from ~14 minutes to ~3
minutes_ 😂
_TLDR 2: The file changes are solely only test files +
`studio-unit-tests.yml`_
We've currently got a lot of unit tests in the repository which while
great for coverage, hasn't been ideally written. There's a lot of
redundancy + overly specific tests that break easily, and our current
unit test takes about 15 minutes to run in the GHA per PR. Hence am
doing a audit clean up of all existing unit tests in the studio repo.
## Changes involved
- `.test.ts` files now run in `node`, `.test.tsx` in `jsdom`
- jsdom costs about 1s of setup per file. A `.ts` test that needs the
DOM opts in with `// @vitest-environment jsdom` (46 files do).
- Removed redundant and over-specific tests
- Duplicates are merged into `test.each`. Tests that only covered
libraries, existed for coverage, or asserted class names and snapshots
are deleted. 19 files are merged into a sibling or deleted.
- Fixed about 15 tests that couldn't fail
- Examples: unawaited assertions, fixtures equal to the default, and a
`semverGte` test calling `semverLte`.
- Sped up the slowest files
- Real sleeps are replaced with fake timers, `user.type` with paste, and
Radix option queries are scoped to the open listbox. For example,
`RestoringState` went from 18s to 0.3s and
`useTableEditorFiltersSort.navigation` from 20s to 3s.
- These ^ already shave down the unit tests time from 14 mins to 9 mins,
but am also sharding unit tests across 4 jobs to increase speed up
further which then shaves down time to 3 mins now
|
||
|
|
2400e9537a |
Joshenlim/fe 4679 inconsistency with integrations that arent installed create (#52141)
## Context Addresses some issues with the "One click integration" feature preview for the following 3 integrations ### Database Webhooks - The "Create a new hook" CTA can be clicked despite the integration not being installed yet - As such if you were to create a new webhook, you'll run into errors - Am opting to follow the UX in wrappers where the dashboard will install the integration for you if you're trying to create a new webhook while the integration isn't installed yet - So this allows users to go straight to creating webhooks without the additional step of clicking "Install integration" <img width="500" alt="image" src="https://github.com/user-attachments/assets/7fb70937-94c2-4095-9eef-4fb71347d132" /> <img width="500" alt="image" src="https://github.com/user-attachments/assets/7efcee65-34c0-438f-8fb5-3f0d855a0f34" /> ### Cron and Queues - The "Jobs" / "Queues" tab can be opened despite the integration not being installed yet - This results in a number of unnecessary API requests to fetch the data for the corresponding grids, but they'd all error out since the database extension isn't installed - Opting to gate all the network calls via `enabled` if the integration is not installed yet, and also render an empty state instead as such (This aligns with the Stripe Sync Engine) <img width="500" alt="image" src="https://github.com/user-attachments/assets/e8203162-a249-4da0-9ef9-f47df194b20f" /> ## To test - [ ] For database webhooks, verify that you can create a webhook without having to click "Install integration" prior - [ ] For cron and queues, verify that there's no network requests to fetch their data if the integration is not installed yet while you're on the jobs / queues pages --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> |
||
|
|
1bcc472d64 |
feat(studio): add Grant type and useGrant/getGrant/ensureGrant (#52105)
## Problem
Resolves FE-4688.
Core types and minting for endpoint-bound FGA grants. A `Grant<E, V>` is
minted by checking the user's v2 permissions against the generated
`fgaRequirements` map for endpoint `E` (and optional variant `V`).
Nothing consumes grants yet: the fetch wrappers that require them come
in a follow-up PR.
## Solution
### What changed
- **`lib/grants.ts`** (new)
- `Grant<E, V>`: the brand is a function type, so it's invariant in both
the endpoint and the variant. A grant only satisfies its exact endpoint
and variant.
- `GrantResult` is `loading | granted | denied | error`, and `.grant` is
defined only when granted.
- `GrantFor<Method, Path>` resolves to the grant type for an annotated
endpoint, or `never` otherwise.
- Minting functions:
- `getGrant` is pure.
- `useGrant` resolves org and project from the URL unless the scope
overrides them.
- `ensureGrant` is for imperative code and prefetch.
- Self-hosted always mints. A failed permissions request returns
`error`. Grants are never part of query keys.
- **`lib/fga-refinements.ts`** (new): an empty map defining the shape
for named variants. Each entry records the base annotation it was
written against, so typecheck fails if that annotation changes.
- **`permissions-query-v2.ts`**: adds a `permissionsQueryOptionsV2`
factory. `usePermissionsQueryV2` is now a thin wrapper around it, with
the same signature and the same 5-minute `staleTime`.
- **`doPermissionsCheckV2`**:
- Now accepts OR-of-AND requirement groups. Existing single-permission
and flat-list calls behave as before.
- Empty input never grants, including an empty group.
- **`usePermissionScopeV2`**: org/project/branch-parent resolution
extracted from the V2 hook, so `useGrant` and
`useAsyncCheckPermissionsV2` share one implementation.
- **Invalidation**: the role assign, unassign, and update mutations,
`UpdateRolesConfirmationModal`, and project creation now invalidate the
v2 permissions query.
- **knip**: temporary `files` ignore for `lib/grants.ts` until its first
consumer lands.
### Behavior change
`useAsyncCheckPermissionsV2` with an explicit `projectRef` equal to the
URL's project ref now resolves branch projects to their parent before
checking. Previously, any explicit ref skipped that resolution, so users
with project-scoped roles were denied on branch projects. An explicit
ref that differs from the URL ref is still used as-is.
## Review instructions
### Tests
- Unit tests for `doPermissionsCheckV2` with OR-of-AND groups.
- `lib/grants.test.ts`:
- `getGrant`, `useGrant`, and `ensureGrant` across OR-of-AND groups,
branch projects, explicit scope, self-hosted, and loading/denied/error
states.
- Type tests: a grant can't be used for a different endpoint, a plain
object isn't a grant, `GrantFor`, and status narrowing.
The type test that a grant without a variant can't satisfy a variant
parameter moves to the api-keys refinement PR, since no endpoint has
variants yet.
1. Run `pnpm test:studio` and confirm the `doPermissionsCheckV2` and
`lib/grants` tests pass.
2. Run `pnpm typecheck` to confirm the grant type tests hold.
3. Check the branch-project behavior in `useAsyncCheckPermissionsV2`
with an explicit `projectRef` matching the URL's project ref.
## Checklist
Check all before review:
- [ ] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
|
||
|
|
8ba2f0a63b |
feat(studio): clarify memory commitment risk thresholds FE-4467 (#51799)
## Problem The memory commitment chart presents the kernel commit limit as a hard failure threshold, even though committed memory can remain unused. Closes [FE-4467](https://linear.app/supabase/issue/FE-4467/update-memory-commitment-ui-with-risk-zones). ## Fix Show only the highest risk threshold exceeded anywhere in the selected time range: Acknowledgment (yellow), Problematic (orange), or Severe (red). Draw its dashed line and place a matching Warning badge in the card header with keyboard-accessible guidance. Show neither a warning line nor a badge when no threshold is exceeded; equality alone does not trigger a warning. Thresholds remain 50%, 80%, and 90% of estimated physical RAM plus 1 GiB of swap, using each timestamp's capacity. Missing readings stay unavailable. Remove in-chart labels and keep only Committed in the source legend. Keep the vertical range anchored at zero and full estimated capacity, expanding for observed overcommitment. A neutral dashed capacity line follows historical infrastructure changes. Dashed references render above the bars and area fills. The hover tooltip identifies Full commitment capacity at that timestamp and excludes it from Total. The developer toolbar includes a Metrics tab with a Memory commitment selector: Default (real data), Warn, Problematic, and Severe. Simulated states include a capacity change and apply only to the selected project’s memory chart. Overrides are in-memory, leave real query data untouched, and are enabled only in local/staging. Both Studio runtimes register the tab. ## Screenshots ### Capacity changes with connected dashed lines  ### Chart tooltip with full commitment capacity  ### Problematic warning and connected threshold lines  ## How to test 1. Open Observability > Database and inspect Memory commitment in bar and line views. 2. With no threshold exceeded, confirm no warning badge or threshold line appears. 3. In the developer toolbar, open Metrics and select Warn, Problematic, then Severe. Confirm the matching badge and only the highest crossed warning threshold appear. Close the toolbar to inspect the chart; the selected state remains active. 4. Hover or focus Warning to read the matching threshold and guidance. 5. Confirm the neutral capacity line steps down midway through each simulated range. 6. Select Default (real data) to restore live readings. Reloading also clears simulations. Validation: 168 affected tests passed with retries disabled and shuffled runs. Production-guard and incorrect-risk-level mutations failed as expected; tests passed after restoring the implementation. Formatting and code review passed. |
||
|
|
dd09501bac |
Revert "Port private link endpoints from platform to v2" (#52139)
Reverts supabase/supabase#51996 |
||
|
|
1818b713b9 |
Revert "Port POST project transfer from platform to v2" (#52140)
Reverts supabase/supabase#52000 |
||
|
|
d8b4d7bc8f |
Revert "Joshenlim/fe 4676 port log drains api endpoints from platform to v2" (#52137)
Reverts supabase/supabase#51995 |
||
|
|
432869f525 |
Port POST project transfer from platform to v2 (#52000)
## Context Just porting over POST project transfer from platform to v2 The other GET project transfer preview cannot be ported yet as the `v2` endpoint drops the `members_exceeding_free_project_limit` property which the UI depends on ## To test - [ ] Verify that project transfers still work on the preview |
||
|
|
6e2c59d850 |
Port private link endpoints from platform to v2 (#51996)
## Context Just porting over AWS private link API from `platform` to `v2` - verified that private link management still works locally ## To test - [ ] Verify that you can create, read, and delete AWS private links in project settings -> integrations |
||
|
|
fffb1e23ca |
feat: implement profile permissions v2 api (#50966)
## Problem Migrating Studio's permission checks from the old RLS json logic to openfga backed permissions. ### New hooks and helpers - `usePermissionsQueryV2` fetches the new profile openfga permisisons - `useAsyncCheckPermissionsV2` the replacement for the old check hook; takes an FGA permission string (or a list) - `FGA_PERMISSIONS` permission constants derived from `@supabase/shared-types`. At the moment, the hook also accepts plain strings for permissions not yet published in the package - `useAsyncCheckUserContentPermissions` new hook for permission checks on user content (SQL snippets, reports, log snippets). This wraps ``useAsyncCheckPermissionsV2` and adds existing content level rules on top of the fga permission check ### Notes - ~~Need api to support new permissions: project_operations_write, billing_read/write, audit_logs_read~~ [DONE] - ~~Still need to support: organization_config_read/write, auth hooks and users permissions~~ [DONE] --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com> |
||
|
|
3af897e6d6 |
Joshenlim/fe 4676 port log drains api endpoints from platform to v2 (#51995)
## Context Just porting over log drains API from `platform` to `v2` - verified that log drains management still works locally ## To test - [ ] Staging preview: Verify that you can create, read, and delete - there's no way to update log drains atm - [ ] Local / Self-hosted: Verify that you can create, read, and delete |
||
|
|
e42f4ec612 |
chore: remove pgMetaScopedIntrospection feature flag (#52019)
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Cleanup: remove a fully rolled-out Studio feature flag. Resolves CLI-2759. Supersedes #50260 and #47931 (rebuilt on current master). ## What is the new behavior? Scoped introspection is the only path. - Studio: delete `data/scoped-introspection.ts` and `PG_META_SCOPED_INTROSPECTION_FLAG`; stop threading `scoped` through table editor, rows/counts, privileges, enumerated types, table definition, retrieve, prefetcher, `EntityListItem`, `SidePanelEditor`, `EditHookPanel`, `DefaultLayout`. - pg-meta: drop `scoped?: boolean` from public builders and delete the frozen unscoped SQL. `tables.list` keeps its full-catalog `TABLES_SQL` (never flag-gated). ## Test plan - [x] pg-meta + Studio typecheck - [x] pg-meta suite against Docker DB (521/521) - [x] Studio vitest for touched areas - [x] Open Table Editor, row counts, privileges, and enumerated types on a project (dogfooded on the preview deploy) - [ ] After merge, retire `pgMetaScopedIntrospection` in the flag dashboard 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
29878860a9 |
fix(compute): filter logs on the subservice attribute (#50562)
## Problem Compute log rows are filtered on `log_attributes['source']`, the deprecated twin of the top-level `subservice` the log writer now publishes. FUNC-894 deletes the twin from the writer, which would leave the per-instance log tabs and the Unified Logs `compute` type matching nothing — silently, since a missing attribute key returns no rows rather than an error. ## Fix Read the stream from `log_attributes['subservice']` instead. Both keys carry the same value on every row today, so this is a same-behaviour switch that lets the twin be removed. It stays a `log_attributes` lookup rather than a bare `subservice` column: the unified logs mapping does not classify these rows, so `source` is empty on a compute row and every key the backend publishes lands in the attribute map. A bare `subservice` predicate fails the whole query with `Field "subservice" does not exist`. - `COMPUTE_LOG_SUBSERVICES` replaces `WORKER_LOG_SOURCES`; the values keep their pre-rename `worker_*` spelling, which is still what the backend publishes - `STREAM_KEY` in `compute-instance-logs-query.ts` and the Unified Logs condition used by the log-type, status, method, pathname, metadata and level expressions both move to the new key - row fixtures in the three utils test files carry `subservice` instead of `source`, so they match the wire shape that survives FUNC-894 Supersedes #50219, which targets a `subservice` column and a `source = 'worker_logs'` mapping that do not exist yet; that shape becomes the follow-up if the mapping ships. Relates to [FE-4358](https://linear.app/supabase/issue/FE-4358). ## How to test - Open a compute instance's Invocations, Logs, and Activity tabs — each shows only its own stream, and message filtering still narrows within it. - In Unified Logs, include and then exclude the Compute log type; rows, counts, and charts move together, and compute rows keep their metadata while status, method, and pathname stay null. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Compute logs are now identified and filtered using subservice metadata in unified logs and compute instance logs. - Compute log classification and display now handle compute-specific fields and severity consistently. - Guest and ingress compute streams now use subservice metadata for more consistent results across supported log views. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
279434fb70 |
feat(studio): add copied data deletion to Warehouse disable dialog (#51906)
## Problem Disabling Warehouse leaves copied data in storage. Users need an explicit option to remove it without deleting files manually. Closes [PIPE-1128](https://linear.app/supabase/issue/PIPE-1128), using the deletion support from [PIPE-1098](https://linear.app/supabase/issue/PIPE-1098). ## Solution Adds “Also delete copied Warehouse data” to the disable dialog. It stays unchecked by default. Source tables are preserved. | Before | After | | --- | --- | | <img width="826" height="504" alt="CleanShot 2026-10-19 at 16 17 12@2x" src="https://github.com/user-attachments/assets/defc99b9-4ec0-4188-bfa6-53f489ef2be5" /> | <img width="830" height="614" alt="CleanShot 2026-10-19 at 16 36 40@2x" src="https://github.com/user-attachments/assets/80299728-a790-4d80-a2d9-16750977a679" /> | Handles errors differently depending on what it relates to: | General Errors | Data Deletion Only | | --- | --- | | <img width="840" height="864" alt="CleanShot 2026-10-20 at 13 22 05@2x" src="https://github.com/user-attachments/assets/7b2b37c3-ace6-4fe0-a1b7-106a97eaab0a" /> | <img width="854" height="876" alt="CleanShot 2026-10-20 at 13 19 13@2x" src="https://github.com/user-attachments/assets/81459525-bb9f-4d2c-891d-b7f8f646098a" /> | | _Above the fold_ | _Below the fold, within the relevant section_ | ## Review instructions 1. Open **Integrations → Warehouse → Overview** in a project with Warehouse enabled, then click **Disable Warehouse**. 2. Check that **Also delete copied Warehouse data** is unchecked and has a permanent deletion warning. Select it, cancel, and reopen. It should be unchecked again. 3. On a disposable project, confirm with the option unchecked. Copied data should remain. With the option checked, the managed DuckLake catalogue and Storage bucket should be removed. Source tables should remain in both cases. 4. Confirm Studio shows cleanup progress, then returns to setup. Failed requests should keep the dialog open; failed background cleanup should offer **Retry**. |
||
|
|
3e8d7fa795 |
Deprecate formatFilterValue, consistently use formatPatternMatchFilterValue across all table-row-operations (#51918)
## Context Resolves https://github.com/supabase/supabase/issues/51827 Filtering a high-precision numeric column (e.g. `numeric(30,21)`) showed the matching row, but the footer count said 0. We're currently using `formatFilterValue` which coerced numeric filter values with `Number()`, and rounds past ~15 digits so the generated = no longer matched the stored value. This same coercion was used by the count query, export (`getAllTableRowsSql`) and delete-all but the main rows query (`table-row-query`) never coerced, which is why rows and count disagreed. ## Changes involved - Given that `formatFilterValue` was legacy logic, opting to remove the coercion and consistently use `formatPatternMatchFilterValue` instead for all row operations as per what `table-row-query` uses, so filter values reach Postgres as exact string literals. ## To test - Run the following SQL statements to set up the table - `CREATE TABLE public.precise_values (amount numeric(30, 21));` - `INSERT INTO public.precise_values VALUES (0.123456789012345678901);` - In the Table Editor, filter amount = 0.123456789012345678901. The footer should show 1 record and should match what's rendered in the table |
||
|
|
922937f6f7 |
Fix auto limit handling of limit all and limit null (#51917)
## Context Resolves https://github.com/supabase/supabase/issues/51836 Resolves FE-4666 The auto limit logic in the SQL Editor doesn't handle correctly when the query contains a `LIMIT ALL` or `LIMIT NULL` and will append another `LIMIT x` at the end of the query, so this PR fixes that Also added a fix to ensure that auto limit applies for select statements in CTEs ## To test - [ ] Verify that result does not have auto limit applied if running `select 1 limit all` or `select 1 limit null` in SQL Editor - [ ] Verify that there's auto limit for a CTE statement like `WITH numbers AS (SELECT generate_series(1, 2000) AS n) SELECT n FROM numbers;` |
||
|
|
f2876c7787 |
chore(studio): upgrade the TanStack dependency set (#51067)
TanStack Start 1.169 is the stable release. This moves the shared catalog to Start 1.169.2 and Router 1.170.44, the newest matching pair that clears the 72-hour release-age gate, and updates Studio React Query and its devtools to 5.104.3. The ui-library TanStack auth blocks switch to `.validator()` because Start 1.169 removes `.inputValidator()`. **Changed:** - `pnpm-workspace.yaml` – `@tanstack/react-router` `^1.170.44` and `@tanstack/react-start` `^1.169.2`, so Router, Start, router-core, and the Start plugin install as one set - `pnpm-lock.yaml` – react-router 1.170.44, react-start 1.169.2, router-core 1.171.37, router-plugin 1.168.46, start-plugin-core 1.171.53, history 1.162.5, and Studio React Query 5.104.3 - `apps/studio/package.json` – `@tanstack/react-query` and `@tanstack/react-query-devtools` `~5.104.3`, `@tanstack/react-router-devtools` `^1.167.2` - `apps/ui-library/registry/default/blocks/password-based-auth-tanstack/routes/auth/confirm.ts` – `createServerFn` uses `.validator()` - `apps/ui-library/registry/default/blocks/social-auth-tanstack/routes/auth/oauth.ts` – `createServerFn` uses `.validator()` - `apps/ui-library/tests/sign-up-redirect.test.tsx` – the server-function mock follows the `validator` chain - `apps/ui-library/public/r/password-based-auth-tanstack.json` – registry JSON regenerated from the block - `apps/ui-library/public/r/social-auth-tanstack.json` – registry JSON regenerated from the block - `apps/ui-library/content/docs/tanstack/password-based-auth.mdx` – note that the block requires `@tanstack/react-start` 1.168.25 or later, since `.validator()` is missing from earlier Start versions - `apps/ui-library/content/docs/tanstack/social-auth.mdx` – note that the block requires `@tanstack/react-start` 1.168.25 or later, since `.validator()` is missing from earlier Start versions - `apps/studio/server.ts` – correct the header comment: `wrapFetchWithSentry` only adds a span, trace meta tags, and a flush, and request errors are captured by the Sentry middleware in `start.ts` **Removed:** - `minimumReleaseAgeExclude` pins for: - `@tanstack/react-router@1.170.41` - `@tanstack/react-start-client@1.168.39` - `@tanstack/react-start-rsc@0.1.59` - `@tanstack/react-start-server@1.167.46` - `@tanstack/react-start@1.168.60` - `@tanstack/react-store@0.11.2` - `@tanstack/router-core@1.171.34` - `@tanstack/router-generator@1.167.40` - `@tanstack/router-plugin@1.168.42` - `@tanstack/start-client-core@1.170.34` - `@tanstack/start-plugin-core@1.171.49` - `@tanstack/start-server-core@1.169.39` - `@tanstack/start-storage-context@1.167.36` - `@tanstack/store@0.11.2` ## To test - TanStack Studio, open a project home – the shell loads with no router error - TanStack Studio, open a table, switch schema, then Back and Forward – the table id follows history, and Forward returns to the later table - TanStack Studio, run a query in the SQL Editor – results render - TanStack Studio, open Project Settings – the general settings page renders - Next Studio, repeat home, Table Editor, SQL Editor, and Settings – the same pages render - ui-library TanStack password and social auth blocks, follow a sign-up confirm and OAuth confirm link – the server function accepts the search params through `.validator()` and redirects --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> |
||
|
|
cb5b57ce51 |
fix(studio): simplify memory chart defaults DEBUG-241 (#51930)
## Problem The database Memory usage chart includes free memory alongside usage and hides the total RAM limit by default, making usage harder to compare with capacity. ## Fix Remove the Free series and show the total RAM limit by default. Keep the existing limit toggle available. Fixes https://linear.app/supabase/issue/DEBUG-241 ## How to test - Open Observability > Database and inspect Memory usage. Used, Cache + Buffers, and Swap should remain; Free should be absent. - Confirm the total RAM limit is visible initially and can still be hidden and shown with the limit toggle. - Focused chart tests: 65 passed, repeated with shuffled seed 241 and retries disabled. Prettier and whitespace checks passed. - All applicable CI checks passed on |
||
|
|
27e6259a39 |
chore(studio): remove legacy status banner and incidentIoStatusPage flag (#51852)
## Summary The incident.io status page is now the only status banner for everyone, so the legacy status banner path is removed: - Removed the `incidentIoStatusPage` ConfigCat flag. The incident.io path is unconditional. - Deleted the legacy status banner code (`StatusPageBanner` and its utils/visibility hook) and its tests. - Deleted the legacy API endpoints `/api/incident-banner`, `/api/incident-status`, and `/api/status-override` (pages, app, and routes variants), along with their data hooks, query keys, and lib helpers. - Removed `STATUSPAGE_*` env vars from the Turbo config and the `INCIDENT_BANNER_DISMISSED_IDS` local storage key from `packages/common`. - Updated the AI tools and SQL generation endpoint that read the flag. `NEXT_PUBLIC_ONGOING_INCIDENT` / the `ongoingIncident` override is kept. The `incident_status_cache` table and its migration are intentionally untouched. Studio no longer reads it, and dropping it is a separate cleanup. ## Testing - Studio typecheck passes. - Related vitest suites pass (414 tests). |