mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
bot/decrease-eslint-ratchet-baselines
43
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a91867863b |
feat(studio): send explorer_banner_exposed at most once per week (#54539)
## Problem Part of FE-5266 (remove or sample noisy Studio events). `explorer_banner_exposed` is among the highest-volume Studio events because it fires once per page load. It only needs to work as the denominator for the banner's dismiss and click-through rates. Its owner signed off on capping it at once per user per week. ## Solution - Keep the existing once-per-page-load guard, then check a last-sent timestamp in localStorage (new key `EXPLORER_BANNER_EXPOSED_AT`). The event is sent only if 7 days have passed since the last one, and the timestamp is updated when it is sent. - The check lives in `BannerExplorer.utils.ts` with a unit test, following the existing `BannerFreeMicroUpgrade.utils.ts` pattern. A missing, invalid or future timestamp counts as due, so a clock change can't suppress the event indefinitely. - Update the event's doc comment: it now fires at most once per browser per week. "Per user" is approximated per browser, because the timestamp lives in localStorage. Someone using several browsers, or clearing storage, is counted more than once, and a shared browser counts as one person. If storage is unavailable, behavior falls back to once per page load. This changes what fires, so it is a standalone PR that can be reverted on its own. The dismiss and CTA events are untouched. |
||
|
|
c452528fcd |
chore(common): remove unused catalog events (#54537)
## Problem Part of FE-5266 (remove or sample noisy Studio events). Four events are defined in the telemetry catalog but nothing in the repo fires them: - `rls_generate_policies_clicked`, `rls_generated_policy_removed` and `rls_generated_policies_created`, left over from the generate policies experiment - `reports_database_grafana_banner_clicked` These weren't owned by a specific reviewer. They were announced on FE-5266 with a Friday cutoff for objections, and no one objected. ## Solution Remove the four event types and their `TelemetryEvent` union entries from `telemetry-constants.ts`. There are no call sites, so there is no runtime change. This is a standalone PR so it can be reverted on its own. |
||
|
|
923bbc16fd |
feat(studio): sample perf-relevant routes at a higher Sentry trace rate (#54205)
## Problem Studio traces run at a flat `tracesSampleRate` of 0.02. That's too few samples to trust per-surface perf numbers for the dashboard performance work, and raising the global rate would increase Sentry quota use everywhere. Part of [FE-3828](https://linear.app/supabase/issue/FE-3828/raise-sentry-sample-rate-for-perf-work-stand-up-a-studio-owned-perf). ## Solution Replace the flat rate with a `tracesSampler` (`lib/sentry-traces-sampler.ts`): - Project home, editor, SQL, auth and database routes are sampled at 0.2 (10x). - Everything else stays at 0.02. - Both rates are named constants. - The route pattern matches the TanStack route ID (`/project/$ref/editor`) and the resolved path, with or without the `/dashboard` base path. A pageload's transaction name is the raw path when it is sampled. - A sampling decision made upstream (for example a propagated `sentry-trace` header) is honored on navigations. - **Each pageload starts a new trace.** Studio serves one prerendered `_shell.html` to every visitor, and it carries `sentry-trace` and `baggage` meta tags frozen at build time. The pageload span continues the trace from them, so every full load shared one trace ID and one frozen `sample_rand`. A build whose frozen value was above the route rate could never sample a pageload, whatever the sampler returned. `initSentryTanStackClient` now removes those two tags before `Sentry.init`, so each pageload gets its own trace and is sampled at the route rate. This is temporary while the baseline is collected. To revert, delete `sentry-traces-sampler.ts` and restore `tracesSampleRate: 0.02` in `buildSentryClientOptions`. To only dial the boost down, lower `PERF_ROUTE_TRACES_SAMPLE_RATE`. The steps are also in a comment at the top of the sampler file. The server-side rate is unchanged. Not in this PR: the Sentry Performance view (initial load, per-surface navigation, request timings), which is built in the Sentry UI and tracked on the ticket. ## Review instructions 1. Read `apps/studio/lib/sentry-traces-sampler.ts` and check the route list, rates and pageload handling. 2. Run `pnpm --filter studio exec vitest run lib/sentry-traces-sampler.test.ts lib/sentry-client-options.test.ts sentry.tanstack.test.ts`. 3. On a preview, check in the Sentry transaction envelopes that a navigation to the editor, SQL, auth or database routes records `sample_rate` 0.2, and storage records 0.02. Do a full page load of the project home or table editor and confirm pageload transactions are now recorded for it, with a different trace ID per load. |
||
|
|
6019742b8c |
chore(studio): remove local-only header events (#54535)
## Problem Part of FE-5266 (remove or sample noisy Studio events). `header_local_dropdown_opened` and `header_local_version_popover_opened` only render in local Studio, which never sends telemetry, so they can never fire. Their owner signed off on removing them. ## Solution - Remove the `track()` calls from `LocalDropdown` and `LocalVersionPopover`, along with the `useTrack` imports and the empty `onOpenChange` wrappers they left behind. - Remove the two event types and their `TelemetryEvent` union entries. There is no runtime change. This is a standalone PR so it can be reverted on its own. The catalog deletion sits next to the one in #54533, so whichever merges second may need a trivial rebase. |
||
|
|
663f077b47 |
chore(studio): remove header dropdown opened events (#54533)
## Problem
Part of FE-5266 (remove or sample noisy Studio events). The
`header_{organization,project,branch,user}_dropdown_opened` events are
among the highest-volume events and don't answer a product question: the
next pageview already shows what was selected. Their owner signed off on
removing them.
## Solution
- Remove the `track()` calls from the organization, project, branch and
user dropdowns. Each now passes its state setter straight to
`onOpenChange`.
- Drop the `useTrack` import from `BranchDropdown` and
`ProjectDropdown`, which no longer track anything.
- Remove the four event types and their `TelemetryEvent` union entries.
`header_feedback_dropdown_opened` is kept. `upgrade_cta_clicked` in the
user and organization dropdowns is untouched. This is a standalone PR so
it can be reverted on its own.
|
||
|
|
0bbbdf5c91 |
chore(common): remove unused integration install/uninstall completed events (#54532)
## Problem Part of FE-5266 (remove or sample noisy Studio events). `integration_install_completed` and `integration_uninstall_completed` are defined in the telemetry catalog, but nothing in the repo fires them. Their owner signed off on removing them. ## Solution Remove both event types and their `TelemetryEvent` union entries from `telemetry-constants.ts`. There are no call sites, so there is no runtime change. The related `integration_install_submitted` and failure events are untouched. |
||
|
|
0a3a53298b |
chore(studio): remove home_connect_section_exposed event (#54531)
## Problem Part of FE-5266 (remove or sample noisy Studio events). `home_connect_section_exposed` fires on every project home load and is no longer needed. Its owner signed off on removing it. ## Solution - Remove the exposure effect from `ConnectSection` and the imports it left unused. - Remove the `HomeConnectSectionExposedEvent` type and its `TelemetryEvent` union entry. `home_connect_action_clicked` is untouched. This is a standalone PR so it can be reverted on its own. |
||
|
|
d4ef834d4d |
feat(studio): track usage on the org projects list (FE-5025) (#54417)
## Problem We don't have visibility into how people use the org projects list (`/org/[slug]`) or the organizations list (`/organizations`): whether they search, filter, sort or switch views, and which project card actions they use. Resolves FE-5025. ## Solution Adds four events, defined in `packages/common/telemetry-constants.ts` with org-level groups (no project group): - `org_projects_filter_applied` with `filterType: 'search' | 'status' | 'sort'`. Search sends only the result count, status sends the saved statuses (`active`/`paused`), and sort sends the sort value. - `org_projects_view_mode_updated` with `viewMode`. - `org_project_card_action_clicked` with `action: 'copy_id' | 'settings'` and `viewMode`, from the grid card menu and the table row menu and inline ref button. - `org_list_search_submitted` with `orgCount`. Notes for review: - Every event fires from its handler, not an effect, so restoring filters from local storage doesn't fire anything. - Search events use the same 500ms debounce as the query, skip empty input, and never include the search text. The project search count is read from the list query's cache entry via `fetchInfiniteQuery` on the same key, which reuses the in-flight request. - Status, sort and view events don't fire when the value didn't change. - `HomePageActions` and `ProjectList` also render on the `/project` picker, so `@page` lists both routes. - I didn't add the `data-attr` attributes from the ticket: autocapture is off, so they would send nothing, and the telemetry standards ask for explicit `track()` calls. ## How to test - `pnpm --filter studio exec vitest run components/interfaces/HomePageActions.test.tsx` covers view mode, status filter, search and clearing before the debounce settles. - In the browser network tab on `/org/[slug]`, each action sends one `telemetry/event` request with the properties above. Checking the events in PostHog staging is still to do. |
||
|
|
f8cd1ee63e |
feat(studio): track docs button clicks (#54119)
## Problem We don't track clicks on the shared `DocsButton`, so we can't tell which pages send people to the docs most or where the UI needs more explanation. Closes FE-5020. ## Solution Add a `docs_button_clicked` event, fired once per click from the click handler in the shared `DocsButton`. One call covers every page that renders it. - Properties: optional `topic` (a fixed label passed by the caller, omitted when unset). `pathname` is already attached to every event by `useTrack`. - Groups are `Partial<TelemetryGroups>` because the button renders on project, organization, and account pages. - Click still stops propagation, as before. ## Review instructions 1. Run `pnpm dev:studio` and open a page with a docs button (e.g. a project's Auth or Database page). 2. Click it and check the `docs_button_clicked` event is sent once, with `topic` when the button has one. 3. Run `pnpm --filter studio exec vitest run components/ui/DocsButton.test.tsx`. Still to do after merge: verify the event in PostHog on staging. |
||
|
|
ed1a436a4b |
chore(studio): remove unused data-attr from API keys pages (#54137)
## Summary Follow-up to #54070. Removes the `data-attr` attributes added there, as raised in review: PostHog autocapture is off (`autocapture: false` in `packages/common/posthog-client.ts`), so they send nothing. Copy, reveal, create and remove are all tracked with explicit `track()` calls. Removes `data-attr` from the API key copy and reveal buttons, the delete menu item, both create dialogs, and the initial-setup "Create keys" action. The two docs links and the `DocsButton` `data-attr` prop are removed in #54119 instead, since that PR also edits `DocsButton`. The two PRs touch different files and can merge in either order. No behavior or tracking change. ## Testing - `tsc`, the lint ratchet and the Studio unit tests pass. |
||
|
|
433d95afd0 |
feat(studio): track usage on the API keys pages (#54070)
## Problem Nothing is tracked on the API keys pages (new and legacy), so we can't tell which keys people copy, how often they create or delete keys, or how quickly projects disable legacy keys. Closes FE-5030. ## Solution Adds five events, defined in `packages/common/telemetry-constants.ts` and fired through `useTrack()`: | Event | When | Properties | | --- | --- | --- | | `api_key_copied` | User copies a publishable, secret, or legacy anon/service_role key with its Copy button. Keyboard copies aren't counted. Not fired when blocked by permissions or when the copy fails. | `keyType` | | `api_key_reveal_clicked` | User reveals a secret or legacy service_role key (not on hide) | `keyType` | | `api_key_created` | Key created from the dialog, or by the first-time setup (fires once per key) | `keyType`, `source` | | `api_key_removed` | Key deleted after confirming in the modal | `keyType` | | `legacy_api_keys_updated` | Legacy keys disabled or re-enabled | `enabled` | - Create, delete, and legacy toggle fire in the mutation hook's `onSuccess`, so failed attempts aren't counted and the event still fires if the component unmounts mid-request. They're attributed to the mutation's own project. Copy and reveal fire in the click handler. - Delete is tracked in `SecretAPIKeys` / `PublishableAPIKeys`, where the confirm modal and mutation live, not in the dropdown item. - No key names or values in properties. - `data-attr` added to the copy, reveal, create, delete, and docs controls (static strings; Studio's PostHog autocapture is currently off, so these send nothing today). `DocsButton` gets an optional `data-attr` prop. - `ui-patterns` `Input` gets optional `onReveal` and `onCopied` callbacks. `onCopied` fires only for the Copy button, so legacy and new keys count copies the same way. - The empty-state sample keys are `inert`, so their buttons don't copy or track. - New `getLegacyApiKeyType` helper maps the legacy `anon` / `service_role` tags to the event's `keyType`. Tests cover copy, reveal, the no-event-on-hide and denied-grant cases, the legacy toggle, and the key-type helper. Success paths for the create dialogs and delete aren't covered. ## How to test - [ ] Open `/project/[ref]/settings/api-keys`, copy a publishable and a secret key, reveal a secret key, and check `api_key_copied` and `api_key_reveal_clicked` in PostHog (staging) with the expected `keyType` - [ ] Create and delete a publishable and a secret key and check `api_key_created` / `api_key_removed` - [ ] On the legacy page, copy anon and service_role, reveal service_role, then disable and re-enable the keys and check `legacy_api_keys_updated` |
||
|
|
6a305cd311 |
docs(skills): treat user-defined names as sensitive in telemetry-standards (#53963)
## Problem The `telemetry-standards` skill only says not to track PII. It doesn't cover other identifiers from a user's project, such as schema or table names. Those are customer data and outside our privacy policy, but nothing told contributors or reviewers to avoid them. The skill also pointed at existing `schema_name` and `table_name` properties as conventions to match, which invites copying them. This came up in #53955, where schema names were masked because they weren't needed. ## Solution Updates `.agents/skills/telemetry-standards/SKILL.md`: - New Privacy section requiring that schema, table, column, function, bucket, policy, project and branch names be masked or omitted, along with other user-defined names, SQL and free text, and extra IDs. It notes that `useTrack` already attaches the project ref and org slug. - Recommends counts, enums, booleans or action categories instead of raw names, and typing new properties as string-literal unions rather than plain `string`. - Short masked vs unmasked example. - Reviewers now flag this as a required change (new rule 6), and the verification checklist has matching items. - The Property Standards note now says to match casing only and not copy existing `schema_name` or `table_name` properties. - The event definition template uses a literal union instead of `string`, so it no longer contradicts the rule. ## How to verify Read the diff of `.agents/skills/telemetry-standards/SKILL.md`. Each identifier listed in FE-5207 appears in the Privacy section and in review rule 6. No code changes. Fixes FE-5207 --------- Co-authored-by: Pamela Chia <pamelachiamayyee@gmail.com> |
||
|
|
4fa8afe918 | feat(studio): support grouped OR filters in unified logs (#53943) | ||
|
|
8f73c10ce1 |
feat(studio): sample browser-translation DOM errors in Sentry (#53600)
## Problem Browser translation (e.g. Chrome Translate) and some extensions rewrite DOM text nodes, which makes React throw `insertBefore` / `removeChild` errors. We drop all of these via `ignoreErrors`, so we have no signal on how often they still happen after the dynamic-text ESLint rule (#52949). Linear: [FE-5008](https://linear.app/supabase/issue/FE-5008/sample-sentry-events-for-browser-translation-crashes-instead-of), from the investigation in [FE-5013](https://linear.app/supabase/issue/FE-5013/investigate-how-we-currently-hide-browser-translation-insertremove). ## Solution Stop ignoring these errors in Studio and send a 5% sample, tagged so they are easy to find in Sentry. - Move the insert/remove node messages from `BROWSER_NOISE_IGNORE_ERRORS` into a new `BROWSER_TRANSLATION_DOM_ERRORS` list in `packages/common/sentry.ts`. `docs` and `www` add it to `ignoreErrors`, so their behavior is unchanged. - In Studio's `beforeSend`, tag matching events with `browser_translation`, `page_translated` and `sample_rate`. The existing `shouldDropForSampleRate` applies the rate. - `page_translated` is best effort: it checks for the `translated-ltr` / `translated-rtl` class on `<html>` and Google Translate `<font>` wrappers. Firefox and Edge are less reliable, so `false` is not proof. - `filterSentryEvent` skips its 1% non-crash sampling for tagged events. Without this the rates would multiply and 5% would really be 0.05%. - The generic `parentNode` / `removeChild` null reads stay ignored. They have many unrelated causes, so tagging them as translation would mislead. Not in this PR: - The `text content does not match` and hydration ignores. They are related symptoms and should be a follow-up. - The user-facing fallback in `InsertBeforeRemoveChildErrorHandler`. ## Review instructions 1. Check that `docs` and `www` still ignore the five DOM messages, via `BROWSER_TRANSLATION_DOM_ERRORS` in their `instrumentation-client.ts`. 2. Run `pnpm exec vitest run lib/sentry-client-options.test.ts` from `apps/studio`, and `pnpm exec vitest run sentry.test.ts` from `packages/common`. 3. After merge, filter Sentry for `browser_translation:true` on the production Studio project and compare `page_translated` true against false. ## Before merging Sentry also has server-side inbound filters on the production Studio project. Someone with project access should confirm the `error-message` filter doesn't match these messages. If it does, the sampled events will be dropped on arrival. ## Checklist - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill (not applicable) |
||
|
|
4c4112fa1f |
feat(studio): select a usage project by clicking its name (#53671)
## Problem On the organization usage page, the per-project breakdowns list project names, but there's no way to jump to that project's usage. You have to find it in the project dropdown instead. Resolves FE-5153. ## Solution Project names in the usage breakdowns are now buttons that set the `projectRef` filter and clear `branchRef`, so the page shows that project's usage. The other query params, such as the date range, are left alone. - New `UsageProjectName` component. It renders plain text when that project is already selected, and a button otherwise. It underlines on hover only. - Applied in the metric breakdown tooltip (`BillingMetric`), the compute hover card (`ComputeMetric`) and the database size table (`DatabaseSizeUsage`). - `TotalUsage` passes the selected `projectRef` down to the metric components. - The `projectRef`/`branchRef` nuqs parsers are now shared as `usageFilterParsers` in `Usage.utils.ts`, so `Usage` and `UsageProjectName` use the same definition. Tests cover the click updating the URL (and clearing `branchRef`), the selected project rendering as text, and the `BillingMetric` breakdown in both states. <img width="410" height="296" alt="Screenshot 2026-11-19 at 13 36 17" src="https://github.com/user-attachments/assets/1f032cc3-d0e2-4185-80f7-4ab3303fc6b6" /> ## Review instructions 1. Open an organization's usage page (`/org/<slug>/usage`) for an org with several projects. 2. Hover a metric that has a per-project breakdown, such as Egress, and click a project name. 3. The project dropdown should switch to that project and the usage should update. Any date range you had selected should survive the click. 4. Hover the same metric again. The selected project is now plain text and the others are still clickable. 5. Do the same from the compute hover card and the database size table. ## 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) |
||
|
|
773b4f767c |
fix(common): skip the reduced-motion query when matchMedia is missing (#53613)
## Problem `Marketing site tests / build` fails on PRs that touch www, with `window.matchMedia is not a function` in `lib/sentry-capture.test.tsx`. `packages/common/helpers.ts` calls `window.matchMedia` when it is imported. jsdom does not implement it. #53294 made `common/consent-state` import `posthog-client`, which reaches `helpers.ts` through `telemetry-utils`. The www `sentry-browser` test project runs in jsdom without a `matchMedia` stub, so it now crashes on import. The break went unnoticed on `master` because the www workflow only runs on pull requests, and its path filter listed just two files in `packages/common`. This is the same problem several other places already work around: `consent-state.ts` duplicates `ensurePlatformSuffix` to avoid the import, and the `packages/common` and `kb` tests stub `window.matchMedia` before importing. ## Solution - Guard the call in `helpers.ts` with `typeof window.matchMedia === 'function'`, so `useReducedMotion` returns `false` where the API is missing. Browsers are unaffected. - Add `packages/common/helpers.test.ts`. It imports `helpers` and `consent-state` in jsdom without `matchMedia`, and checks that the query is still read where it exists. Both import tests fail on `master` with this error. - Run the Marketing site tests on changes to `packages/common/**/*.ts*` and its `package.json`, since www imports it widely. This part is independent of the fix and can be split out if you prefer. The `helpers.ts` change is identical to the one in #53589, so the two merge cleanly whichever lands first. This earlier attempt, #53596, was closed. Not changed: the per-test `matchMedia` stubs. They're harmless, and can be removed as a follow-up. ## Review instructions 1. From `packages/common`, run `pnpm exec vitest run helpers.test.ts` and check that all 3 tests pass. 2. Run `git checkout origin/master -- packages/common/helpers.ts` and run it again. Two tests should fail with `window.matchMedia is not a function`. Then run `git checkout HEAD -- packages/common/helpers.ts`. 3. Check that `Marketing site tests / build` passes on this PR and ran because of the `packages/common` path. ## Checklist - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill (not applicable) |
||
|
|
373633361b |
fix(studio): allow collapsed sidebar to scroll vertically without a scrollbar (#53536)
## What kind of change does this PR introduce? Bug fix. ## What is the current behavior? When the sidebar is collapsed to icons, `SidebarContent` sets `overflow-hidden`, which also disables vertical scrolling. On short viewports or at higher zoom levels, the bottom navigation items (including Project Settings) can't be reached. Fixes #53403 ## What is the new behavior? In collapsed mode, `SidebarContent` scrolls vertically, never horizontally, and the scrollbar is hidden (using the existing `no-scrollbar` utility) so it doesn't push the icons around in the narrow rail. The footer with the sidebar control stays pinned. ## Additional context `SidebarContent` is a shared primitive, so other collapsible-to-icon sidebars get the same behavior. Tested manually in the browser. |
||
|
|
9aed3bcb6e |
fix(studio): load more query performance rows when the grid isn't scrollable (#53457)
## Problem On the Query Performance page, more rows only load when the grid fires a scroll event. The first page is 20 rows at 44px each, so on a tall viewport the rows don't overflow the grid. The user can't scroll, and the remaining rows never load. Zooming in works around it. The same dead end happens whenever a client-side filter leaves too few loaded rows to fill the grid. Fixes part of FE-5092. The `calls >= N` filter returning no results is a separate cause and will follow in its own PR. ## Solution `useInfiniteScroll` now takes an optional `containerRef` (the `DataGrid` ref) and `rowCount`. When the ref is passed, the hook also requests the next page whenever the grid's content doesn't overflow its container and there is another page, and it re-checks when the container resizes. Existing callers that don't pass it behave as before. The three `react-data-grid` consumers of the hook share the same dead end, so all three now pass the ref: Query Performance, Cron Jobs and Cron Job runs. For Query Performance, the hook call moved from `WithStatements` into `QueryPerformanceGrid`, which owns the grid ref. ## Review instructions 1. Open Observability → Query Performance on a project with more than 20 statements. 2. Make the browser window tall (or zoom out) so 20 rows don't fill the grid. 3. Confirm more rows load automatically until the grid scrolls, and that scrolling to the bottom still loads further pages. 4. Resize the window taller and confirm more rows load. 5. Repeat on Integrations → Cron (the jobs list and a job's previous runs) if the project has enough jobs or runs to need more than one page. ## Checklist Check all before review: - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide) |
||
|
|
8cda1fc977 |
fix(studio): apply query performance calls and total time filters in SQL (#53459)
## Problem On the Query Performance page, the calls filter only applied to rows already loaded in the grid. The page loads 20 rows at a time, so a filter like `calls >= 200` showed "No queries detected" whenever none of the loaded rows matched, even if matching queries existed further down. The filter bar writes a `callsFilter` URL param, but the page only passed a separate `minCalls` param to the SQL, which nothing set. The total time filter had a related gap: only `>` and `>=` reached the SQL, and the other operators were ignored. Fixes part of FE-5092. The lazy-load fix is in #53457. ## Solution - `generateQueryPerformanceSql` takes `callsFilter` and `totalTimeFilter` and builds the `WHERE` clause for all six comparison operators. The operator comes from a fixed lookup and the value goes through `literal()`. Filters with a non-finite value or an unknown operator are dropped. - The page passes both filters to the query, and the unused `minCalls` param is removed. - The grid no longer filters search, roles or calls in memory, since the SQL already does. - The query search is now a literal, case-insensitive substring match. It was a regex (`~*`), so characters like `[` or `(` produced a SQL error while typing. This matches what the grid's old in-memory search did. Behavior changes to be aware of: - Regex search no longer works. Searching for `a.*b` now looks for that exact text. - Old `?minCalls=` links no longer have any effect. The UI never produced them. ## Review instructions 1. Open Observability → Query Performance on a project with more than 20 statements. 2. Add a Calls filter of `>= 200` (or a value higher than anything in the first 20 rows). Confirm matching queries appear. 3. Try the other operators on Calls and on Total time, including `!=`. 4. Search for `[` and `pg_sleep(` and confirm the grid shows matches (or an empty state) instead of a SQL error. 5. Clear the filters and confirm the full list returns. ## 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) |
||
|
|
f7f27aac78 |
fix(studio): escape json and jsonb values in SQL copy and export (#53372)
## What Fixes invalid or corrupted SQL from "Copy rows as SQL" and "Export table as SQL" for json/jsonb columns (FE-4860, closes #49196). ## Why The SQL formatter built json literals by rewriting `JSON.stringify` output with regexes. That corrupted values containing double quotes or backslashes, and produced invalid SQL for jsonb columns holding plain strings or other non-object values. ## How - `formatTableRowsToSQL` now serializes the parsed value and only escapes single quotes. - Grid rows carry json columns as text (the grid query casts them to `::text`), so a new `parseGridJsonColumns` helper parses untruncated json cells before formatting. It is used by "Copy rows as SQL" and the selected-rows export. Truncated cells are left alone so they are still fetched in full. - The SQL export keeps json columns unstringified (`preserveJsonValues`), so a jsonb string like `"hello"` stays distinguishable from JSON text. CSV and JSON exports are unchanged. No `::text` cast was added to the export query: the API already returns json values parsed. ## Testing - Unit tests for values with `"`, `\`, `'`, plain-string jsonb, arrays, numbers, booleans and null, plus `parseGridJsonColumns`. - Ran the formatter output against a local Postgres: both the parsed (fetch-all) and grid-text (copy / selected rows) shapes loaded and round-tripped identically for jsonb and json columns. The old formatter's output failed with `invalid input syntax for type json` on the same data. - Not exercised end to end in the Studio UI, and the truncated-cell path is covered by unit tests only. ## Not in scope The JSON export still stringifies objects before `JSON.stringify`, so json columns come out as nested strings. That is separate pre-existing behavior. |
||
|
|
ce5c68198c |
fix(studio): sort Postgres versions newest first in the version selector (#53278)
## Problem The internal-only Postgres version selector sorted versions by raw string comparison, so `17.6.1.164` appeared above `17.11.0.002` and the list looked randomly ordered. The sort also ran in place on the array returned by React Query, which can be the cached data. Resolves FE-4603. ## Solution - Add `sortPostgresVersionsNewestFirst` in `ProjectCreation.utils.ts`. It compares version segments numerically, returns a new array, and does not mutate its input. - Use it in `PostgresVersionSelector` in place of `.sort().reverse()`. - OrioleDB versions are not grouped; they are ordered by version number like the rest. - Side effect: the default selection (the first GA version in the list) is now the newest GA version. - Unit tests cover numeric ordering and non-mutation. Before: <img width="447" height="184" alt="Screenshot 2026-11-11 at 16 00 45" src="https://github.com/user-attachments/assets/219f26a1-1475-40ce-a0dc-49480005194f" /> After: <img width="448" height="196" alt="Screenshot 2026-11-11 at 15 58 32" src="https://github.com/user-attachments/assets/24a99b91-22ff-4667-bf96-0046a426d95b" /> |
||
|
|
3aa85cc774 |
feat(studio): show warning and error counts on the edge function status codes chart (#53171)
## Problem On the edge functions report, the Edge Function Status Codes chart shows a single combined count in its header, which is hard to read when responses include errors. The count would be more intuitive if it were broken down by status code. Resolves FE-4025. ## Solution Add **Warnings** (4xx) and **Errors** (5xx) counts to the right of the total in the chart header. This matches the request cards on the project home page, and uses the same warning and error definitions as the Logs Explorer filters. Per-code detail stays in the legend and tooltip. - The counts show the period totals by default and follow the hovered point, like the total does. - Charts opt in through a new optional `getHeaderStats` on `ReportConfig`, passed through `ReportChartV2` and `ComposedChart` to `ChartHeader`. Only the status codes report sets it, so other reports are unchanged. - The counts are summed from the existing pivoted status code series (`getStatusClassCounts`), so the log queries are untouched and both the BigQuery and otel paths work. - The chart's info tooltip now explains what warnings and errors mean. <img width="756" height="305" alt="Image" src="https://github.com/user-attachments/assets/808085f5-abd9-43ec-903b-dfa0d5e4f598" /> ## Review instructions 1. Run Studio and open **Observability → Edge Functions** for a project that has edge function traffic. 2. On the **Edge Function Status Codes** chart, check that **Warnings** and **Errors** appear next to the total, and that they match the 4xx and 5xx rows in the legend. 3. Hover the chart. The total, Warnings and Errors should all follow the hovered point, then return to the period totals when you move away. 4. Check that **Total Edge Function Invocations**, **Execution Time** and **Invocations by Region** show no Warnings or Errors. 5. Try a narrow viewport to check the header doesn't crowd the buttons. Unit tests cover the counting and the header (period totals, hover, and charts without stats): `pnpm exec vitest run components/interfaces/Reports components/ui/Charts`. ## 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) |
||
|
|
2c871b42b7 |
fix(studio): show OAuth app client secret in a blocking modal (#53167)
## Problem After creating a confidential OAuth app or regenerating its client secret, the credentials appeared in a small dismissible banner above the apps table. The secret can't be retrieved again, so a missed banner meant regenerating the secret and breaking existing integrations. ## Change - Replace `NewOAuthAppBanner` with `NewOAuthAppModal`, following the pattern of the S3 access key `CreateCredentialModal`. - The modal shows the client ID and client secret with copy buttons and states the secret won't be shown again. - It can only be closed with Done. Outside clicks, Escape and the close button are blocked. - Public apps (no client secret) and plain edits behave as before: no modal. - Create and both regenerate entry points (row menu and sheet) feed the same modal, so no data-layer changes. Step 1: <img width="420" height="251" alt="Image" src="https://github.com/user-attachments/assets/74430837-90fd-49e9-9441-234abc97588a" /> Step 2: <img width="420" height="375" alt="Image" src="https://github.com/user-attachments/assets/92ab3786-8bd1-46cf-a4b4-b2643f288e65" /> ## Testing - Added `NewOAuthAppModal.test.tsx`: credentials and warning render, no modal for public or missing apps, only Done dismisses. - Manual: Authentication → OAuth Apps → create a confidential app, and regenerate from the row menu and the sheet. Closes #53116 Linear: FE-4976 |
||
|
|
bc9d68a813 |
fix(studio): handle architecture-prefixed Postgres versions in version helpers (#53162)
## Problem `getDatabaseMajorVersion` and `getSemanticVersion` in `apps/studio/lib/helpers.ts` returned `NaN` for Postgres versions with an architecture prefix, e.g. `supabase-postgres-arm64-17.9.0.019` (expected 17 / 1790019). `parseAppVersionKey` already handled `arm64-` and `x86_64-`, but the two helpers did not. Fixes FE-4974 Closes #53109 ## Solution - `formatSemver` now strips any leading architecture token (`^[a-z][a-z0-9_]*-`) rather than a hardcoded list. A version segment always starts with a digit, so this covers `arm`, `arm64`, `x86_64`, `aarch64`, `amd64` and future values. - `APP_VERSION_KEY_RE` in `useSelectedProject.utils.ts` uses the same rule, so the two parsers stay consistent. - Because the rule is generic, strings like `supabase-postgres-custom-123` would otherwise parse as a number. `formatSemver` now rejects anything that doesn't look like `\d+.\d+` after stripping, and both helpers return `0` for it (matching their existing empty-string behavior). Callers only compare the result numerically, so `0` behaves like the previous `NaN`. Tests cover each prefix on both helpers and on `parseAppVersionKey`, a release suffix (`-vault-rc1`), and non-version strings. Not changed: `getSemanticVersion` concatenates segments without padding (`17.10.0.001` becomes 171001, which compares below `17.9.0.019`). That predates this change and its callers pin to a single major line. |
||
|
|
4c68610167 |
feat(studio): copy large values when duplicating a row (#53091)
## What Follow-up to #52952. The grid truncates large columns (over 10 KB) in the database query, so \"Duplicate row\" used to leave those fields blank. It now fetches their full values and fills them into the Insert Row panel. ## Behavior - Truncated columns are fetched by primary key after the panel opens. Each one is disabled with \"Loading full value...\" until it arrives, and Save is disabled until every value has settled. Submitting the form another way (e.g. pressing Enter) is blocked too. - Only the truncated fields are filled in, so anything the user has edited is never overwritten. - If a value can't be copied, the field stays empty with a note saying why: - the value is over 1 MB (it isn't sent, so a single row can't pull an unbounded amount of data into the browser) - the table has no primary key - the fetch failed (also shows a toast) - The fetch honors \"View as role\", like the existing \"Load full\" buttons. ## How - New `useRowLargeValuesQuery` in `data/table-rows/` selects the truncated columns of one row in a single query. Each column is returned as `NULL` when it exceeds `MAX_ROW_LARGE_VALUE_BYTES`. The SQL is built with `ident()`, `literal()` and the Query builder. - A new `useCopiedLargeValues` hook owns the fetch and per-field status, to keep `RowEditor` from growing further. Pure helpers (`getTruncatedFieldNames`, `getPrimaryKeyMatch`, `mergeLargeValues`) are in `RowEditor.utils.ts`. - `InputField` takes an optional `status` and renders the note. ## Also changes `isValueTruncated` now compares byte length instead of character length. The query truncates when a value exceeds the limit in bytes but cuts by characters, so a value of multibyte characters could be truncated and still be shorter than the limit in characters, and wasn't detected. Comparing bytes still never flags a genuine value, because an untruncated value is at most the limit in bytes. Edit row's \"Load full\" buttons benefit from the same fix. ## Notes - A fetched value over 10 KB that genuinely ends in `...` still looks truncated to the existing check, so the form disables that field, as it already does when editing such a row. - A column that changed to `NULL` after the grid loaded also shows the \"too large\" note. ## Testing - Unit tests for the SQL builder (including identifier and literal escaping), the byte-aware detection, and the new helpers. - Component tests for `RowEditor`: the full value is fetched and included in the insert; field and Save are disabled while loading (including form submit); too large, fetch failure, and no primary key leave the field empty with a note; nothing is fetched when no value was truncated. I confirmed the loading test fails when the Save guard is removed. Resolves FE-4927 |
||
|
|
097e7a11ad |
feat(studio): duplicate row and keep values with Create more in Table Editor (#52952)
## What Two additions to the Table Editor's Insert Row flow: - **Duplicate row**: new item in the row context menu. Opens the Insert Row panel as a new record, pre-filled from the selected row. - **Keep values**: a gear button next to \"Create more\" (visible only while \"Create more\" is on) opens a \"Row creation options\" popover with a \"Keep values for the next row\" checkbox. When checked, the form keeps its values after each insert instead of clearing. Off by default, so existing behavior is unchanged. ## How - Both use a shared helper, `generateReusedRowFields`, that clears primary key, identity, function-defaulted (e.g. `gen_random_uuid()`, `nextval(...)`, `now()`, `CURRENT_TIMESTAMP`), and truncated values. Cleared columns fall back to their blank state so the database fills them in. A boolean with a function default is left unset so the database evaluates it. - Duplicate adds a `duplicateFrom` field to the `row` side panel state rather than reusing `row`, so the panel stays in insert mode and can't turn into an update. - The popover lives in a new co-located `RowCreationOptions` component. Its notch is a rotated square drawn inside the popover content, positioned over the trigger by Radix. <img width="165" height="220" alt="Screenshot 2026-11-04 at 15 22 20" src="https://github.com/user-attachments/assets/145e3aeb-9f6f-4826-a789-a0e462d3d1d5" /> <img width="678" height="202" alt="Screenshot 2026-11-05 at 11 41 35" src="https://github.com/user-attachments/assets/07cc5251-e2fc-417c-90bd-6b6268a2c0c7" /> ## Notes - Columns with unique constraints other than the primary key are still copied, so saving a duplicate can fail with the normal error toast. - Large values (over 10 KB) are truncated by the grid query, so duplicate clears them rather than copying a corrupted value. Copying them is tracked in FE-4927. ## Testing - Unit tests for the helper (clearing rules, literal defaults, keyword and boolean function defaults, truncated values). - Component tests for `RowEditor`: duplicate opens in insert mode with the identity key cleared and inserts without it; \"Create more\" clears by default and keeps values via the options popover; the gear only shows while \"Create more\" is on. - Checked manually in the app. Resolves FE-4516 |
||
|
|
706dba62f9 |
fix(studio): attribute storage policies to every bucket they reference (#52692)
## Problem
Studio's storage policy parser (\`extractBucketNameFromDefinition\`)
returned only the first quoted string near \`bucket_id\` and ignored the
operator. As a result:
- Policies covering several buckets (\`bucket_id in ('a', 'b')\`) were
listed and counted under the first bucket only.
- Negated policies (\`bucket_id <> 'a'\`) were attributed to the
excluded bucket.
- \`DeleteBucketModal\` could delete a negated or shared policy that
still protects other buckets.
Fixes FE-3993, supabase/supabase#48164.
Before:
<img width="884" height="444" alt="Screenshot 2026-11-03 at 10 46 08"
src="https://github.com/user-attachments/assets/fc6e4842-b07f-40be-8057-b94f4034e4eb"
/>
After (same data):
<img width="891" height="515" alt="Screenshot 2026-11-03 at 10 46 21"
src="https://github.com/user-attachments/assets/47248b30-a309-4774-8349-05260ad02111"
/>
## Solution
- Replace the parser with \`extractBucketNamesFromDefinition\`, which
returns every bucket referenced via \`=\`, \`= ANY (ARRAY[...])\` and
\`OR\`, and returns none for negated conditions (those fall into
Ungrouped).
- Add \`getPolicyBucketNames\`, which combines \`definition\` and
\`check\`, and use it in the Policies page grouping,
\`useBucketPolicyCount\`, and \`DeleteBucketModal\` so they agree.
- A policy is now listed under each bucket it covers.
- Bucket deletion only removes policies whose sole target is the deleted
bucket. Shared and negated policies are left in place. This is the
conservative choice: an unparsed policy is left behind, never deleted.
- Added unit tests for the parser shapes, negation, \`check\`-only
policies, and grouping.
|
||
|
|
07dbe3ce1d |
fix(studio): use raw object count as storage pagination offset (#52706)
## Problem Studio Storage hides `.emptyFolderPlaceholder` objects after listing a folder, but `fetchMoreFolderContents` calculated the next page offset from the number of visible items. When a page includes the placeholder, the API returns 200 objects but Studio keeps 199, so the next request uses offset 199 instead of 200 and the last file of the previous page appears twice. The duplicates compound with every further page. Fixes FE-4843. Closes #52607. Before: <img width="521" height="458" alt="Screenshot 2026-11-03 at 14 51 09" src="https://github.com/user-attachments/assets/1ed20ded-08c6-4c56-92d7-5c97ef82cd00" /> After: <img width="532" height="460" alt="Screenshot 2026-11-03 at 14 53 58" src="https://github.com/user-attachments/assets/64891f27-7fa0-44cb-8076-39b405df0ee4" /> ## Solution Each storage column now records `hiddenItemsCount`, the number of API objects hidden from the visible list (the placeholder). `fetchMoreFolderContents` offsets the next page by `items.length + hiddenItemsCount`. Because the offset is still derived from `items.length`, local edits to a column (creating a folder, uploads, deletes, renames) keep it in step with the server, as they did before. Added tests to `state/storage-explorer.test.ts`: a folder with a placeholder plus 300 files lists each file exactly once and requests offsets 0 and 200, and a folder without a placeholder still pages at 0, 200, 400. Reverting the offset line makes the placeholder test fail. ## Review instructions 1. In a bucket, create a `docs` folder and, using the Storage API, upload a zero-byte `docs/.emptyFolderPlaceholder` plus files `file-000.txt` through `file-299.txt`. 2. Open `docs` in Studio and sort by Name ascending. 3. Scroll to load further pages and check the list requests in the network tab: offsets should be 0 and 200, and no file should appear twice. 4. Run `pnpm --filter studio exec vitest run state/storage-explorer.test.ts`. ## Checklist - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill (not applicable) |
||
|
|
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. |
||
|
|
1e94d386a4 |
feat(studio): add a reset password action for custom roles (#52506)
## What kind of change does this PR introduce? Feature. ## What is the current behavior? The Dashboard only offers a reset password action for the `postgres` role (Database Settings). To change the password of a custom role, users have to run `alter role ... password` in the SQL editor. ## What is the new behavior? Each role row in Database > Roles has a "Reset password" item in its actions menu. It opens a dialog with a warning that anything using the old password will be disconnected, and the shared password field (generate and copy). The password is required in this dialog. - The item is disabled for system roles, and for roles that can't log in, with a tooltip explaining why. - It uses the existing role update mutation, so no platform endpoint is involved. - `RolePasswordField` gains `isOptional` and `layout` props so the dialog can reuse it. <img width="271" height="174" alt="Screenshot 2026-11-02 at 11 11 33" src="https://github.com/user-attachments/assets/36f05fa0-e95c-440c-b6bb-4fadb466c2f6" /> <img width="543" height="414" alt="Screenshot 2026-11-02 at 11 11 17" src="https://github.com/user-attachments/assets/87ba4f50-1315-4e07-b390-9c5b6beba129" /> ## Testing New `RoleRow` component tests cover the item being available for a custom role that can log in, disabled for system roles and roles that can't log in, the required-password validation, and a successful reset. Resolves FE-4813. |
||
|
|
5bb549efae |
feat(studio): allow setting a password when enabling login on an existing role (#52505)
## What kind of change does this PR introduce? Feature. ## What is the current behavior? Turning on "User can login" for an existing role that couldn't log in gives no way to set a password. Users have to run `alter role ... password` in the SQL editor. ## What is the new behavior? In Database > Roles, turning on "User can login" for a role that couldn't log in now shows the same optional password field as the create panel, including the generate and copy actions. - The field only shows for roles that don't currently have login. Roles that can already log in don't get one. - The password is sent only when login is gained in that save and the field isn't empty. An empty field turns on login without a password, as in create mode. - The password is kept out of the "changed fields" diff, so unrelated edits never send `password ''`. - The password field is extracted from the create panel into a shared `RolePasswordField`, which also owns the "Password generated" announcement state. Follow-up to #52463. Changing the password of a role that can already log in is tracked separately and is the next PR in this stack. <img width="840" height="655" alt="Screenshot 2026-10-29 at 15 47 33" src="https://github.com/user-attachments/assets/8bb52e86-7b1e-4911-b625-2532fb7dfa25" /> ## Testing - New `RoleRow` component tests cover the field's visibility, sending the password, and omitting it when empty or for roles that already have login. - Existing `CreateRolePanel` tests still pass. Part of FE-4763. |
||
|
|
7d6671e6ea |
test(studio): cover generating a role password in the roles E2E test (#52490)
## What kind of change does this PR introduce? Test update. ## What is the current behavior? The Roles CRUD E2E test turns on "User can login" but doesn't touch the password field added in #52463. ## What is the new behavior? After enabling login, the test checks that the Password field appears empty, that "Generate a password" fills it, and that the "Password generated" announcement is present. It then saves the role as before. The roles page is behind the `database:roles` flag, which is on by default, so this runs in the self-hosted E2E jobs. This answers the question on FE-4763 about self-hosted coverage. ## Testing This relies on the self-hosted E2E jobs in CI. Resolves FE-4763 follow-up. |
||
|
|
d5ab791acc |
fix(pg-meta): quote password correctly in role update SQL (#52464)
## Problem `pgMeta.roles.update()` produces invalid SQL whenever a `password` is passed, so every password update fails with a syntax error. The builder wraps the `alter role` in a PL/pgSQL `format()` string and interpolated the already-quoted password into it, so the password's quotes ended the string early. It is latent today because nothing in Studio calls update with a password, but it blocks any future edit or reset-password UI for roles. The not-found branch in `update()` and `remove()` also referenced an undeclared `id`, so a missing role failed with `column "id" does not exist` instead of the intended message. Resolves FE-4766. Found while working on FE-4763. ## Solution - Emit `password %L` in the format string and pass the quoted password as a `format()` argument, the same way `valid until` already works. This also stops `%` in a password being read as a format specifier. - Add a small `getRoleNotFoundSql` helper so `update()` and `remove()` raise `Cannot find role with id N` (or `with name X`) instead of the column error. - Tests: update with a plain password, one with `'` and `"`, and one with `%`; a password combined with `valid until`; and the not-found message for update by id, update by name, and remove. Without the fix the password cases fail with a syntax error and the not-found case fails with the column error. The new tests drop the roles they create, since roles are cluster-wide and dropping the test database doesn't remove them. ## Review instructions 1. Run `pnpm exec vitest run test/roles.test.ts` in `packages/pg-meta` against a throwaway Postgres. 2. Confirm the new tests pass. 3. Revert `src/pg-meta-roles.ts` and confirm the password and not-found tests fail. ## 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) |
||
|
|
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) |
||
|
|
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> |
||
|
|
fdf03de35f |
feat(studio): add multiple network restrictions at once (#52035)
## Problem The Add restriction dialog (database settings > network restrictions) only accepts one address range at a time, so adding several ranges means repeating the dialog and a separate save for each. The `apply` endpoint already accepts the full list, so this is a frontend limitation. Linear: FE-3667 ## Solution The dialog now stages ranges before saving: - The IP address and CIDR block size fields stay as they were. A new "Add to list" button (or Enter) validates the entry, moves it to a "N ranges to add" list, and clears the fields. Each range keeps its own block size. - Each staged range has a remove button. - Duplicates (against existing restrictions and the staged list) now show as inline errors instead of a toast. - Save sends every staged range in a single apply request, appended to the existing restrictions. An entry that was typed but not yet added is included if it's valid. The allow-all and disallow-all case still replaces the existing restriction. - Cancel, Escape, and the backdrop ask for confirmation when there are staged ranges or a typed entry. - `AddRestrictionModal` is now a named export, and the draft reset uses the form's `values` option instead of an effect. I considered `SingleValueFieldArray` and `KeyValueFieldArray`, but each range has two related values and the fields need labels and a narrow size column, so a staged list fit better. Copy changes: the title is now "Add IPv4 restrictions" (or IPv6), the description mentions adding several ranges, the Save label is singular or plural by count, and the success toast is "Restriction added" or "Restrictions added". <img width="556" height="514" alt="Screenshot 2026-10-20 at 16 41 13" src="https://github.com/user-attachments/assets/b7952f9c-0deb-416b-8823-0de9f18a7650" /> <img width="550" height="646" alt="Screenshot 2026-10-21 at 11 32 25" src="https://github.com/user-attachments/assets/3814117b-5447-4a28-b950-b8a96af54a75" /> ## Review instructions 1. Open a project's database settings and go to Network Restrictions, then choose Add restriction for IPv4. 2. Enter an address and a block size, then click "Add to list". The entry moves to the list and the fields clear. 3. Add a second range with a different block size. Try a duplicate or a private address and check the inline errors. 4. Type a third valid address without adding it, then click Save. All three ranges should save in one request. 5. Stage a range and click Cancel. It should ask before discarding. 6. Repeat with IPv6, and with an allow-all or disallow-all restriction in place. Tests: `pnpm exec vitest run components/interfaces/Settings/Database/NetworkRestrictions` from `apps/studio`. |
||
|
|
6957daa3b7 |
feat(studio): add setting to skip the SQL editor unsaved-changes prompt (#52029)
## What Adds an opt-out for the "Unsaved changes" dialog shown when closing SQL editor tabs in manual-save mode. Resolves FE-4170. - New **Confirm on discard** toggle in the SQL editor's More actions menu (both toolbar layouts). - New **Don't ask again** checkbox in the dialog itself. It turns the same setting off when the user confirms the discard. - `DiscardChangesConfirmationDialog` gains a `children` slot. The description now renders as a `div` so block-level children are valid HTML. - `TabCloseConfirmation` gains an optional `optOut`, so any tab type can offer a "don't ask again" checkbox. Only SQL tabs use it. The Explorer tabs are unchanged. - The Intellisense and Confirm on discard items now use `DropdownMenuCheckboxItem`, so both settings announce their checked state to screen readers. The check indicator is still shown on the right via a local class override. <img width="353" height="229" alt="Screenshot 2026-10-20 at 16 10 14" src="https://github.com/user-attachments/assets/c6f67934-51ba-48dd-8aee-f279ae7eb486" /> <img width="432" height="207" alt="Screenshot 2026-10-20 at 16 10 02" src="https://github.com/user-attachments/assets/d064dcb1-1097-4ac3-bbf0-6a47506820c1" /> ## Behavior notes - The setting is stored in `localStorage` (`sql-editor-confirm-unsaved-changes`). It is device-local and global, not per project. It defaults to on. - With the prompt off, closing a tab still **discards** its unsaved edits. It only skips the confirmation. - It only applies in manual-save mode. In auto-save mode there is nothing to discard, so the toggle is hidden. - The browser's native `beforeunload` prompt, shown when closing or reloading the browser tab with unsaved work, is unaffected. Browsers don't allow customizing it. ## Testing - New unit tests for the SQL tab close handler: it confirms by default, skips the dialog when the setting is off, and the opt-out writes the setting. - `lint:ratchet` and `knip` pass. - Manually checked the menu at both widths and the dialog. |
||
|
|
af98094c8c |
feat(studio): show created at column in JWT signing keys table (#51845)
## What kind of change does this PR introduce? Feature ## What is the current behavior? The JWT signing keys table only shows when a key was last rotated. There's no way to see when a key was created, and the key ID can't be copied without selecting it by hand. Resolves FE-3061 <img width="1133" height="193" alt="Screenshot 2026-10-16 at 13 53 43" src="https://github.com/user-attachments/assets/e50e5a59-f0c4-4f8a-aa14-f200e5c469bd" /> ## What is the new behavior? - Adds a **Created at** column (hidden below `xl`) with the same relative label and timestamp tooltip as **Last rotated at**. - Combines the **Status** and **Key ID** columns into a single **Key** column, with the status on top and the key ID beneath in muted monospace. This follows the pattern used in the Access Tokens table. - Makes the key ID copyable: hovering it shows a copy icon and a "Copy key" tooltip, and clicking copies the ID to the clipboard. This follows the project ref copy pattern in the project list. <img width="1151" height="436" alt="Screenshot 2026-10-16 at 15 37 23" src="https://github.com/user-attachments/assets/46c86f85-bff6-4ee6-8d65-0c7a8c23a19e" /> ## Additional context No data or API changes (`created_at` was already returned). |
||
|
|
b859ca0659 |
fix(studio): send exit survey before deleting a project (#51844)
## Problem Deleting a paid project could show a "Failed to submit exit survey" toast with a permissions error. The survey was sent after the delete succeeded. Deleting a project removes its permissions, so the survey endpoint's project-level access check rejected the request with a 403. <img width="510" height="196" alt="Screenshot 2026-10-16 at 15 27 40" src="https://github.com/user-attachments/assets/f01cb89f-597e-492d-bfc4-37f7260c25d3" /> ## Solution - Send the exit survey before the delete, while the project still has its permissions. - Never block the delete on the survey: a failed survey is ignored. - Pass a no-op `onError` so the survey failure toast no longer shows. The old `catch` swallowed the exception but not the hook's default toast. ## Known trade-off If the survey succeeds and the delete then fails, a survey is recorded for a project that still exists. A separate backend change to authorize deletes against the organization would let the survey move back after the delete. ## How to test - Delete a project on a paid plan with a survey reason selected: no error toast, the survey is recorded, and the project is deleted. - `pnpm --filter studio exec vitest run components/interfaces/Settings/General/DeleteProjectPanel/DeleteProjectModal.test.tsx` |
||
|
|
f5288eb1e2 |
feat(studio): remember project home chart interval per project (#51833)
## Problem The time-range dropdown above the request charts on the project home page resets on every visit, so users who prefer a different range have to re-select it each time. Resolves FE-2828. <img width="819" height="353" alt="Screenshot 2026-10-16 at 10 42 05" src="https://github.com/user-attachments/assets/cb8d467b-e709-43b0-9ae4-b02ebccf5faf" /> ## Solution Persist the selection in localStorage, keyed per project (`home-chart-interval-${ref}`), in both usage section variants (`ProjectUsageSection` and `ProjectUsageSectionDeltas`, chosen by the `newHomepageUsageDeltas` flag). - New `resolveChartInterval` helper validates the stored value against the known keys and the plan's log retention, falling back to the plan default for corrupt values or after a plan downgrade. Unit tested. - Removed the `useEffect` in `ProjectUsageSection` that reset the interval on retention change, since it would overwrite the saved value. - Moved `getDaysRequired` into `logs.utils.ts` so the dropdown and the helper share the retention check. Manually verified with the flag on and off: reload keeps the selection, and each project keeps its own. |
||
|
|
b74d799c3d |
fix(studio): sort edge function files by name and select the entrypoint by default (#51796)
## Problem The file list in an Edge Function's code view is shown in the order the Management API returns it (roughly `created_at` order), not sorted by name. Users expect name order, as in VS Code. Resolves FE-2799 ## Solution - `formatFunctionBodyToFiles` now sorts files by their displayed name before assigning ids, using a case-insensitive numeric comparison (`file2` before `file10`). The list is flat, so there is no folder grouping. - Sorting would have changed which file opens first, so the code page now selects the function's entrypoint file by default. `getDefaultSelectedFileId` matches the entrypoint's basename, then falls back to `index.ts`, then to the first file. The entrypoint isn't always `index.ts`: the docs allow any `.ts`, `.js`, `.tsx`, `.jsx` or `.mjs` file. - The shared `FileExplorerAndEditor` and the new-function page are unchanged. The code page passes the selection through the explorer's existing `selectedFileId` / `setSelectedFileId` props. - Files added or renamed in the editor keep their position until the next load. Before: <img width="259" height="370" alt="Screenshot 2026-10-15 at 16 44 50" src="https://github.com/user-attachments/assets/611fe2b9-5676-496a-85a9-e50032708c7a" /> After: <img width="259" height="371" alt="Screenshot 2026-10-15 at 16 35 19" src="https://github.com/user-attachments/assets/7f433661-ef34-4e3f-9143-afc67be1b30a" /> ## Review instructions 1. Open an Edge Function's Code tab for a function with several files, for example `utils.ts`, `index.ts`, `deno.json`. 2. Confirm the files are listed alphabetically and that `index.ts` is selected on load. 3. For a function with a custom entrypoint (for example `main.ts`), confirm that file is selected on load. 4. Run `pnpm test:studio -- components/interfaces/EdgeFunctions`. |
||
|
|
1d9808ab8b |
fix(studio): name the organization in the overdue invoices banner (#51747)
## Problem The "Outstanding invoices in other organization" banner asks users to pay invoices to avoid service disruption, but never says which organization has them. Users with several organizations have to guess where to go. The banner also looked at only the first overdue organization. Its link pointed at that organization's billing page without naming it, and if the lookup failed, it fell back to the current organization's billing page. Linear: FE-4587 ## Solution - `useOrganizationRestrictions` now collects every other organization with overdue invoices from the organizations list. It dedupes them, excludes the current one, and orders them by name, which the list already is. It no longer falls back to the current organization's slug. - The banner names only the first organization, linked to its billing page: "Pay invoices for **Acme** to avoid service disruption". When more organizations are affected it adds a count: "…for **Acme** and 2 others…". Paying the first often clears the rest, and the next one appears once it's resolved. - If no affected organization can be resolved, for example the user lost access, the banner shows "Pay outstanding invoices to avoid service disruption", linking to `/organizations`. - The title is now plural: "Outstanding invoices in other organizations". - The dev toolbar's "overdue invoices from other org" override now injects overdue invoices for every real other organization. It previously used a made-up ID, so the banner could never show a name. I also replaced a nested ternary there, per Studio's style rules. For one org: <img width="1022" height="42" alt="Screenshot 2026-10-14 at 12 01 32" src="https://github.com/user-attachments/assets/8f34c2ff-d47f-45fc-80a4-c7cdc3df558b" /> For multiple orgs: <img width="1057" height="42" alt="Screenshot 2026-10-14 at 13 39 42" src="https://github.com/user-attachments/assets/2100b0b5-65a3-4d7c-8521-48d8e71b62ef" /> Note: Overdue invoice counts are not shown by design, only that one or more overdue invoices exist for an org. ## Review instructions 1. Run Studio in platform mode with at least three organizations, and open a project page. 2. Enable the dev toolbar from the account menu ("Local tools" > "Dev toolbar"). 3. In the Warnings tab when on a Project page, choose "Overdue invoices from other org". 4. Check that the banner names the first other organization alphabetically, shows "and N others" when there's more than one, and that the name links to that organization's billing page. 5. Use "Reset to real data" to clear the override. Tests: `pnpm --filter studio exec vitest run components/interfaces/Organization/restriction.constants.test.tsx hooks/misc/useOrganizationRestrictions.test.tsx` ### Mocking in QA Mock `/platform/stripe/invoices/overdue` for overdue invoice counts in different organizations. Note: The endpoint will not return an org in the result if the overdue invoice count is zero. ## Checklist Check all before review: - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [x] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide) (not applicable) |
||
|
|
e450aa5f85 |
chore(docs): Add Drew McLellan to humans.txt (#51557)
## Problem I've joined Supabase and my name is not yet in the humans.txt file. ## Solution Add my name (Drew McLellan) to the humans.txt file. |