Commit Graph
727 Commits
Author SHA1 Message Date
Drew McLellan 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.
2026-12-03 14:37:55 +00:00
Drew McLellan 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.
2026-12-03 14:18:55 +00:00
Drew McLellan 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.
2026-12-03 14:18:31 +00:00
Drew McLellan 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.
2026-12-03 14:18:02 +00:00
supabase-vercel-tedd[bot] 2922cc2190 feat(studio): track inline cell edits in the Table Editor grid (#54477) 2026-12-03 18:35:00 +08:00
Drew McLellan 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.
2026-12-02 11:47:18 +00:00
anthony lio e7d7345bd6 fix(telemetry): add /new/* to the pages of three account recovery events (#54469)
## Problem

- the account recovery interstitial can open on `/new/<org>` because
`canInterruptRecoveryRoute` allows it
- `@page` of three of its four events lists `/new` but not `/new/*`
- `AccountRecoveryReminderExposedEvent` lists `/new/*`, so the four
events disagree on the pages they fire on

## Solution

- adds `/new/*` to `@page` of `AccountRecoveryActionClickedEvent`,
`AccountRecoveryTaskCompletedEvent` and
`AccountRecoveryReminderClosedEvent`

## Review category (docs PRs only)

- [ ] Critical: needs a review as soon as possible
- [ ] Urgent: the feature ships soon, or it's blocking something else
- [ ] Moderate: good to have soon, not urgent
- [ ] Low: get to it when you can

## Review instructions

1. open `apps/studio/lib/account-recovery/recovery-reminder.ts` and make
sure that `canInterruptRecoveryRoute` allows `/new/<slug>`
2. make sure that the 4 `AccountRecovery*Event` interfaces in
`packages/common/telemetry-constants.ts` list the same pages
3. make sure that the diff changes only JSDoc comments

## 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)
2026-12-02 19:13:50 +08:00
Alaister YoungandAlaister Young 217b9ca3f3 [FE-5024] feat(studio): track Table Editor sidebar and side panels (#53960)
Adds PostHog telemetry events across the Table Editor sidebar, new-tab
page, and column/table/row/cell side panels so we can measure schema
usage, entity-list search/filtering, entity menu actions, and panel
saves without logging schema, table, column, or search names.

**Added:**

- Event definitions in `packages/common/telemetry-constants.ts` (added
to `TelemetryEvent`):
- `table_editor_schema_selector_updated` (`schemaType: 'public' |
'protected' | 'custom'`) when switching schemas in `TableEditorMenu`. It
uses the same `schemaType` property and derivation as the existing
`database_schema_selector_updated` (now shared through
`getDatabaseSchemaType`), so the two selectors can be compared in one
insight
- `table_editor_new_item_clicked` (`itemType: 'schema'` or `itemType:
'table'` with `trigger: 'sidebar' | 'new_tab_card'`) from the sidebar
and `NewTab` card
- `table_editor_table_search_submitted` (debounced 500ms, cancelled on
clear, schema switch via selector or URL/tab change, and unmount)
- `table_editor_entity_filter_updated` (`visibleTypeCount`) on
entity-type checkbox toggle, "Select only", and filter reset
- `table_editor_entity_action_clicked` (`action`, `entityType`) across
dropdown and context menus in `useEntityActionHandlers` (excluding the
`View policies` link, which is covered by pageviews)
- `table_column_created` / `table_column_updated` (`hasForeignKey`,
`isArray`) on column side-panel saves via `SidePanelEditor.utils.tsx`,
with `hasForeignKey` scoped to the saved column and no-op saves skipped
- `table_updated` (`columnCountChanged`) on existing table edits in
`SidePanelEditor.tsx` once table, column, primary key, foreign key,
Realtime, and Data API updates succeed and at least one change was
persisted; no-op saves and saves where any step fails are skipped
- `table_editor_row_updated` (`editMethod: 'side_panel'`) when an
existing row edit from the row side panel is persisted. Saves from the
expanded cell editors and the foreign row selector don't count, and
neither do edits queued with queue operations enabled. The grid ticket
(FE-5023) can add more `editMethod` values when it tracks inline edits
- `table_editor_cell_editor_opened` (`editorType: 'json' | 'text'`) when
expanding JSON or text cell editors from the grid cell editors
(`JsonEditor` / `TextEditor`) or `RowEditor`
- Column, table and row save events are attributed to the project the
save ran against (third `track()` argument), and fire only after the
save succeeds
- Focused MSW-backed tests for non-obvious telemetry edge cases (search
debounce + cancellation on clear and selector/external schema switches,
schema switch single-fire + PII checks, column-scoped FK/array
derivation and no-op gating in `createColumn`/`updateColumn`,
change/error reporting in `updateTable` without double-firing column
events)

## To test

Watch `POST /platform/telemetry/event` in DevTools (and confirm arrival
in staging PostHog):

- Switch schemas (`public` -> `auth` -> custom schema -> `public`):
fires `table_editor_schema_selector_updated` with `schemaType`
`protected` -> `custom` -> `public` and no schema name; re-selecting the
active schema fires nothing
- On the Database > Schemas visualizer, switching schemas still fires
`database_schema_selector_updated` with the same `schemaType` values as
before
- Click **Create a new schema** and **New table** in the sidebar, plus
**Create a table** on `/project/[ref]/editor/new`: fires
`table_editor_new_item_clicked` with the expected `itemType` and
`trigger`
- Type in **Search tables...** and pause >500ms: fires one
`table_editor_table_search_submitted` with no query text; clearing or
switching schemas (via the selector or clicking a tab in another schema)
before 500ms fires nothing
- Toggle entity-type checkboxes, click **Select only**, or reset
filters: fires `table_editor_entity_filter_updated` with the new
`visibleTypeCount`
- Trigger actions from a table/view menu (both ⋮ and right-click): fires
`table_editor_entity_action_clicked` with `action` and `entityType`
(**View policies** does not fire it)
- Create and edit a column via the column panel: fires
`table_column_created` / `table_column_updated` with `hasForeignKey`
(scoped to that column) and `isArray`; clicking **Save** with no changes
fires nothing
- Edit an existing table (with and without adding/removing a column, or
toggling Realtime alone): fires `table_updated` with
`columnCountChanged`, without firing `table_column_*`; clicking **Save**
with no changes fires nothing
- Edit an existing row in the row side panel: fires
`table_editor_row_updated` with `editMethod: 'side_panel'`. Inserting a
new row, saving from an expanded JSON/text cell editor, picking a
foreign row, or saving with queue operations enabled does not fire it
- Edit an existing table so that adding a column (or updating
Realtime/Data API) fails: `table_updated` does not fire
- Expand JSON and text cell editors from both the grid and inside the
row panel: fires `table_editor_cell_editor_opened` with `editorType:
'json' | 'text'`

Notes for review:

- No `data-attr`s were added. Autocapture is off, so each tracked
interaction gets an explicit `track()` call instead.
- `table_editor_cell_editor_opened` counts the expand buttons in both
the grid cell editors and the row side panel fields. It's the same click
on both surfaces.
- `table_editor_row_updated` only has `editMethod: 'side_panel'` for
now. The grid toolbar ticket (FE-5023) can add values when it tracks
inline edits.

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-02 18:54:08 +08:00
supabase-vercel-tedd[bot]andIvan Vasilov 31f68587f6 feat(studio): track remaining usage on project home (#54143)
## Problem

Project home tracked most interactions, but not which credential people
copy from the "Copy" popover, or how often they use the custom report
and notebooks beyond adding blocks. Opening the Connect sheet from the
popover's "Get Connected" button also reported a stale
`connect_sheet_opened` source, because the popover never set one.

## Solution

Project home gets three new events: `home_project_credential_copied`
(with a `credentialType` enum), `home_custom_report_refresh_clicked`,
and `home_notebook_action_clicked` (`action: 'create' | 'analyze'`).
"Get Connected" in the popover now sets a new `home_popover` Connect
sheet source. The compute and GitHub stats now send
`home_activity_stat_clicked` as well, with two new `stat_type` values.
Every event fires from its click handler with a typed `track()` call,
and none sends the copied value or any user-defined name. This follows
the telemetry standards, so no `data-attr` attributes are added.

## How to verify

1. On a project's home page, open the "Copy" popover and copy each item.
Each copy sends one `home_project_credential_copied` event, with
`credentialType` set to `project_url`, `publishable_key`,
`direct_connection_string`, or `cli_setup`. No event contains the copied
value.
2. In the same popover, click "Get Connected". The Connect sheet opens
and sends `connect_sheet_opened` with `source: 'home_popover'`. Opening
it from the header button afterwards still sends `source:
'header_button'`.
3. Click the "Compute size" stat. It sends `home_activity_stat_clicked`
with `stat_type: 'compute'` and no `stat_value`.
4. Click the "GitHub" stat. It sends `home_activity_stat_clicked` with
`stat_type: 'github'`, and `stat_value` is 1 when a repository is
connected and 0 when none is.
5. With the custom report section shown, click "Refresh report". It
sends one `home_custom_report_refresh_clicked` event.
6. With the Notebooks section shown, click "New notebook" (or "Create
your first notebook" when there are none). It sends
`home_notebook_action_clicked` with `action: 'create'`. Click "Analyze"
on a notebook with cells: it sends `action: 'analyze'`.

## Checks

Ran `tsc --noEmit` in `apps/studio` and `packages/common`, `eslint` and
the type-aware `eslint.type-checks.config.cjs` lint on the changed
Studio files, `oxfmt --check` on every changed file, and `vitest run`
for `ProjectConnectionPopover.platform.test.tsx` and
`ActivityStats.test.tsx`.

## Checklist

- [x] I have read the [Contributing
Guidelines](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] I have checked that the change works in the preview deployment

## Feedback for Tedd

To ask Tedd for a change to this PR, reply in Tedd's session on
[FE-5026](https://linear.app/supabase/issue/FE-5026/track-usage-on-project-home-gaps-only).
Tedd doesn't read comments on this PR.

---------

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>
2026-12-01 11:54:29 +01:00
anthony lio 6bd006dc08 feat(docs): layout toggle (#53688)
## Problem

- docs layout v2 (variant `option-1` of the `docs-ia-mvp-v1` flag) is
about to roll out and a reader in the rollout has no way back to the
classic layout

## Solution

- adds a toggle button bottom of the guide right column so user in the
rollout can switch back
- adds a dialog that asks for an optional reason when a reader switches
back to classic, and stores the reason in `feedback_comments` with
`metadata.source = 'docs_layout_switch'` so we relying on existing
- adds the `docs_layout_updated` event and stops new experiment
exposures for readers who picked a layout

| toggle | survey |
| -------|------|
| <img width="654" height="312" alt="image"
src="https://github.com/user-attachments/assets/69bcd4b8-7dd2-4fd3-9045-e3246625ccf9"
/> | <img width="654" height="312" alt="image"
src="https://github.com/user-attachments/assets/4b18eb76-b9f1-4d96-be25-14a960b11475"
/> |

<!--
## Preview links

If relevant, include links to changed pages for easy review access.

Copy the preview base URL from the Vercel bot comment on this PR. Use
the following table as an example template.

| Site | Live | Preview | Search for |
| -------------- |
-------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
| ----------------------------- |
| WWW | [/blog/your-post](https://supabase.com/blog/your-post) |
[/blog/your-post](https://zone-www-dot-com-git-branch-name-supabase.vercel.app/blog/your-post)
| unique phrase from the change |
| Docs |
[/docs/guides/your-page](https://supabase.com/docs/guides/your-page) |
[/docs/guides/your-page](https://docs-git-branch-name-supabase.vercel.app/docs/guides/your-page)
| unique phrase from the change |
| Studio | [/dashboard](https://supabase.com/dashboard) |
[/dashboard](https://studio-git-branch-name-supabase.vercel.app/dashboard)
| unique phrase from the change |
| Design system | [/design-system](https://supabase.com/design-system) |
[/design-system](https://design-system-git-branch-name-supabase.vercel.app/design-system)
| unique phrase from the change |
| UI library | [/library](https://supabase.com/library) |
[/library](https://ui-library-git-branch-name-supabase.vercel.app/library)
| unique phrase from the change |
| Knowledge base |
[/kb/guides/your-page](https://supabase.com/kb/guides/your-page) |
[/kb/guides/your-page](https://kb-git-branch-name-supabase.vercel.app/kb/guides/your-page)
| unique phrase from the change |
-->

<!-- ## Additional context

Optionally add any other context or screenshots.

-->

## Review instructions

1. open
[/docs/guides/database/prisma?docs-ia-mvp-v1=option-1](https://docs-git-antlio-feat-docs-layout-switch-v2-supabase.vercel.app/docs/guides/database/prisma?docs-ia-mvp-v1=option-1)
2. click "Switch to classic layout" in the notice and make sure that a
dialog asks "What made you switch back?"

## 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)
2026-12-01 11:43:40 +02:00
supabase-vercel-tedd[bot]andJoshen Lim bd4912cbdc feat(studio): track SQL editor sidebar, snippet and editor tab usage (#54170)
## Context
Adds seven PostHog events through `useTrack` for the SQL Editor to
better identify usage patterns there, each fired from its click or
submit handler:
- `sql_editor_new_item_clicked` (`itemType`) for the "+" menu.
<img width="229" height="150" alt="image"
src="https://github.com/user-attachments/assets/f6281bdb-d70e-4e7c-adf3-edce0ec2116c"
/>
- `sql_editor_snippet_search_submitted`: once per search session, on the
first keystroke into an empty search box.
<img width="285" height="214" alt="image"
src="https://github.com/user-attachments/assets/4c482385-cab1-49d3-9aaa-e2be1aafb1af"
/>
- `sql_editor_snippet_sort_updated` (`sortBy`) when the sort order
changes.
<img width="226" height="121" alt="image"
src="https://github.com/user-attachments/assets/0e7268ee-bf4a-46d4-ba8d-f07a6e9b0675"
/>
- `sql_editor_snippet_action_clicked` (`action`, `isBulk`) for snippet
and folder context-menu actions.
<img width="254" height="275" alt="image"
src="https://github.com/user-attachments/assets/7338df06-47df-47be-b44d-6fc2dd49c586"
/>
- `sql_editor_snippet_share_submitted` when the share modal is
confirmed.
<img width="531" height="309" alt="image"
src="https://github.com/user-attachments/assets/997e7567-9fdb-400e-af1a-147a5dcbb7a7"
/>
- `sql_editor_snippet_moved` (`snippetCount`, `toNewFolder`) after a
move succeeds.
<img width="539" height="247" alt="image"
src="https://github.com/user-attachments/assets/f0da9544-d29e-402f-a0d3-9b7f5e3fa3c6"
/>
- `editor_tab_closed` (`closeType`, `editor`) in the tab bar that the
SQL, Table and Explorer editors share. It fires when the tabs actually
close, after any unsaved-changes confirmation.
<img width="147" height="64" alt="image"
src="https://github.com/user-attachments/assets/96073c69-acf1-4829-8532-beb283b7f373"
/>

No property carries names, SQL or search text, and every event is sent
with an explicit `track()` call.

## How to verify

On the PR's Studio preview, with analytics consent accepted, watch the
network requests to the telemetry endpoint:

1. In the SQL editor, open the "+" menu and pick a new snippet, a new
folder and (when available) a new logs query. Each one sends
`sql_editor_new_item_clicked` with the matching `itemType`.
2. Type into the snippet search box. One
`sql_editor_snippet_search_submitted` goes out on the first character,
and none on later ones. Clear the box and type again: one more goes out.
3. Change the sort to Alphabetical, then to Created At. Each change
sends `sql_editor_snippet_sort_updated` with `sortBy` `name` or
`inserted_at`. Picking the current sort again sends nothing.
4. Right-click a snippet and pick each action (open in new tab, rename,
move, share, unshare, duplicate, add to or remove from favorites,
export, delete). Each sends `sql_editor_snippet_action_clicked` with
that `action` and `isBulk: false`. Shift-click several snippets and pick
move or delete: `isBulk: true`.
5. Right-click a folder and pick create snippet, rename or delete:
`action` is `folder_create_snippet`, `folder_rename` or `folder_delete`.
6. Confirm the share modal: `sql_editor_snippet_share_submitted` goes
out. Move a snippet into a new folder: after it succeeds,
`sql_editor_snippet_moved` goes out with `snippetCount: 1, toNewFolder:
true`.
7. In the SQL editor and the Table editor tab bars, use Close, Close
Others, Close to the Right and Close All, and the tab's X button. Each
sends `editor_tab_closed` with the matching `closeType` and `editor`. If
you cancel an unsaved-changes prompt, nothing is sent.

---------

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-12-01 13:29:53 +07:00
supabase-vercel-tedd[bot]andIvan Vasilov e3684c034c feat(studio): track usage on Project Settings: General (#54081)
## Problem

Project Settings → General has almost no usage tracking. We can't tell
how often users restart, pause, resume, or transfer projects from here.
We also can't tell how often they copy the project ID or region, use the
custom domain flow, or toggle high compliance mode.

## Solution

Adds six PostHog events to `packages/common/telemetry-constants.ts`:
`project_name_updated`, `project_settings_value_copied`,
`project_lifecycle_action_submitted`, `project_compliance_mode_updated`,
`custom_domain_step_submitted`, and `custom_domain_dns_record_copied`.
Each event fires from the user's submit, confirm, copy, or toggle
handler, never on render. Properties are only enums and booleans. No
project names, domains, DNS record contents, or other typed values are
sent.

`ResumeProjectButton` is shared between settings and the paused-project
home state, so it now takes a required `source` prop. The two call sites
pass `settings_general` and `project_home`. Restart fires from the
confirmation modal, with `restart_project` or `restart_database`
depending on the chosen restart type. `DNSRecord` now types its `type`
prop as `'CNAME' | 'TXT'`, so the copy event sends the record type as an
enum. No `data-attr` attributes are added, because PostHog autocapture
is off and they would not be collected.

## How to verify

1. On Project Settings → General, save a new project name. One
`project_name_updated` event fires.
2. Copy the project ID, then the region. Each copy fires one
`project_settings_value_copied` event, with `field` set to `projectRef`
and then `region`.
3. Open the restart modal, then cancel it. No event fires. Confirm a
restart (project or fast database reboot). One
`project_lifecycle_action_submitted` fires with `action:
restart_project` or `restart_database` and `source: settings_general`.
4. Confirm a pause, a resume, and a transfer. Each fires
`project_lifecycle_action_submitted` with the matching `action`. A
resume from settings sends `source: settings_general`; a resume from the
paused project home page sends `source: project_home`.
5. Toggle high compliance mode. One `project_compliance_mode_updated`
fires, with `isSensitive` set to the new value.
6. In the custom domain flow, Add, Verify, confirm Activate, and confirm
Delete each fire `custom_domain_step_submitted` with `step` set to
`configure`, `verify`, `activate`, and `remove`.
7. In the custom domain verification step, copy a DNS record's name,
then its value. Each copy fires one `custom_domain_dns_record_copied`
event, with `recordType` set to `CNAME` or `TXT` and `field` set to
`name` and then `value`.

## Checks

Ran `tsc --noEmit` in `apps/studio` and `packages/common`. Ran `eslint`
(default config and `eslint.type-checks.config.cjs`) on the changed
Studio files: no errors, only warnings that were already there. Ran
`oxfmt --check` on all changed files. Ran `vitest run` on
`General.test.tsx`, `Project.test.tsx`, `PauseProjectButton.test.tsx`,
and `RestartServerButton.test.tsx`: all pass.

## Checklist

- [x] I have read the [Contributing
Guidelines](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] I have checked that the change works in the preview deployment

## Feedback for Tedd

To ask Tedd for a change to this PR, reply in Tedd's session on
[FE-5029](https://linear.app/supabase/issue/FE-5029/track-usage-on-project-settings-general).
Tedd doesn't read comments on this PR.

---------

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>
2026-11-30 20:38:20 +01:00
Francesco Sansalvadore a098c3be32 chore(studio): improve versioning onboarding comms (#54059)
## Problem

We're going to release versioning in Public Alpha instead of Private, so
we need to be more clear and loud about the new feature being
introduced.

## Solution

This PR makes a few changes mostly around communications and messaging:
- Update `Private Alpha` badges to `Public Alpha`
- Add admonitions in the feature preview modal
- Prompt confirmation before enabling versioning on a bucket
- Dedicated announcement banner in Storage layout
- shown only to users with `storage.capabilities.object_versioning`
enabled
- Popover card when hovering over the Public Alpha badge

See
[update](https://linear.app/supabase/project/storage-object-versioning-and-lifecycle-policies-b5e5809a718e/activity#project-update-e9a50e15)
for more context.

## Review instructions

Functionality changes are minor so mostly check the above mentioned
messaging and ui changes.
2026-11-30 18:18:41 +01:00
Pamela Chia f0a0a4f2fe docs(telemetry): add attempt and render-site rules (#54310)
I reviewed #54081 and found two tracking mistakes that the telemetry
skill had no concrete rule for. I added both rules, and pointed the
header of `telemetry-constants.ts` at the skill.

**Changed:**
- **Attempts named as results**: an event fired in a submit or confirm
handler before the request resolves also counts failed attempts. I added
a rule to name it `submitted`, or to move the call to where the request
has succeeded when a result verb such as `updated` is wanted.
- **Page-named values on shared components**: a value like `source:
'project_home'` is wrong on every other page the component renders on. I
added a rule to find every render site before hardcoding a page name,
and to pass the value as a prop or name it after the component when
there are several.
- **Conflicting verb guidance**: the header of
`packages/common/telemetry-constants.ts` told authors to reuse verbs
already in that file, while the skill names its own list as the
authority. I replaced the header's naming text with a pointer to the
skill.

**Note:** both files are also changed in #54081 (the skill's `data-attr`
paragraph and new events in the constants file), on different lines from
mine.

## Linear
- fixes GROWTH-1596
2026-11-30 23:05:47 +08:00
Pamela Chia 01c6966c9b chore(telemetry): add skill rules and rename three events (#54188)
The telemetry skill had no rules for mistakes I keep flagging in
telemetry PR reviews, two of its sections repeated the rest of the file,
and its approved verb list held verbs that no event uses or that another
verb already covers. I added the rules, collapsed the repetition, cut
four verbs, and renamed the three events whose verb is outside the list.

**Changed:**
- **New tracking rules**: I added rules for dismiss and abandonment
events (a property must be able to differ at the call site), values
captured at submit time, `track()` on conditionally rendered elements,
debounced sends, events sent just before leaving the page, experiment
exposure, and org-level events. I also added a rule for actions that
change nothing: a bulk or menu action that changed nothing sends no
result event, and a count property reports only the items that changed.
The verify step now checks that case too.
- **Shorter skill**: I changed "Review Rules" and "Implementing New
Tracking" to link to the section that states each rule. I removed the
verification checklist because each item duplicated a rule stated above
it.
- **Approved verbs**: I removed `intended` and `converted` (no event
uses them) and `sent` and `moved` (one event each, both covered by
another verb), and defined `created` against `added`. The skill now says
the list is the authority. It used to say the list was derived from
`telemetry-constants.ts`, which still holds older events with other
verbs. I also stated when each verb fires: `clicked` and `submitted` in
the handler, the rest once the result has happened. I updated the verb
list in `.coderabbit.yaml` to match.
- **Event renames**: `www_subprocessor_updates_subscribed` is now
`www_subprocessor_updates_form_completed` (still sent after the
successful response, so it keeps counting completed subscriptions),
`realtime_inspector_broadcast_sent` is now
`realtime_inspector_broadcast_submitted`, and `home_section_rows_moved`
is now `home_section_rows_updated`. Nothing else in this repo references
the old names.

**Note:** after each app deploys, the renamed event is a new series, so
a chart that spans the change needs both names.

## To test

Tested on the PR preview:
- [ ] On www, open `/legal/customer-resources/subprocessor-list`, submit
the updates form with a test email, expect one `telemetry/event` request
whose `action` is `www_subprocessor_updates_form_completed`, and no
event after a failed submit.
- [x] In Studio, open a project's Realtime Inspector, join a channel,
send a broadcast message, expect one `telemetry/event` request whose
`action` is `realtime_inspector_broadcast_submitted`. Observed: one
request with that action and a 201 response, and no event after
canceling the modal.
- [x] In Studio, on the project home page, drag a section to a new
position, expect one `telemetry/event` request whose `action` is
`home_section_rows_updated` with `section_moved`, `old_position` and
`new_position`. Observed: one request per drag, with `section_moved:
"usage"`, `old_position: 1`, `new_position: 2`.

I checked the staging analytics project: both new Studio event names
showed up with matching counts, and neither old name did.

## Linear
- fixes GROWTH-1584
2026-11-27 17:43:25 +08:00
Pamela Chia d336555617 fix(telemetry): redact url params and page titles (#54044)
The frontend apps send the current URL and page title with every
analytics event. The redaction added in #53500 and extended in #53955
only covers the `keywords` and `schema` params, so Table Editor filters,
search text, invite tokens, OAuth codes and the auth redirect hash still
go out in URL properties, and Studio's title carries the table, project
and org names.

**Changed:**
- **Query values are redacted by default**: every `name=value` in a URL
property now goes out as `name=redacted`, unless the name is one that
attribution reads downstream (`utm_*`, the click ids the first-referrer
cookie already collects, `dub_id`, `campaign_id`, `cid`, `promo_code`).
Param names and the `?` stay, so reports that match on a param being
present keep working. Fixed-vocabulary params such as `tab` are not on
the list: nothing reads them today, and several of those names carry
customer data on other pages.
- **A change to a redacted value no longer sends a pageview**: picking a
new filter value on the same page used to send a pageview, which would
now be identical to the previous one. The dedupe check compares the
redacted URL, so it is skipped. This lowers Studio pageview counts: on
current traffic, at most about 9% of dashboard pageviews repeat the
previous path with a query string.
- **Events from both transports are covered, and the hash is dropped**:
`identify` and `group` let the SDK stamp its own `$current_url` with the
hash, and `$set_once` pinned that on the person. `before_send` now
strips it, and the SDK no longer captures hashes itself. Custom events
skip `before_send`, so the same redaction also runs on their `pathname`
field, where www was appending the raw query string. The SDK's copy of a
search-engine referrer's query (`ph_keyword`) is dropped too.
- **Studio sends a route-level title**: `Tables | Database | Supabase`
in place of `users | Tables | Database | <project> | <org> | Supabase`.
The tab title users see is unchanged, and so are titles in the other
apps, which are public content.
- **Dead clicks, heatmaps and web vitals are pinned off**: each one puts
page text or the page URL in a nested payload the redaction does not
walk, and each can be switched on from project settings without a
deploy. All three are off today.

**Note:** One path is only partly covered. Feature-flag requests carry
the first URL and referrer the SDK stored for the browser, and they
never pass through `before_send`. The hash is now gone from them; query
values in that first URL (for example an invite link opened in a fresh
browser) still go out on those requests.

## To test

Signed in on the Studio preview, with analytics consent accepted. Check
events in the staging analytics project, filtered to the preview host.

Tested on the PR preview:
- [x] Open the Table Editor, add a filter with the value
`leaktest@example.com` and a sort, type `leaktest` in the Tables search
and in a logs search, then click through a few pages. Expect no event
containing `leaktest`, and `filter=redacted`, `sort=redacted`,
`search=redacted` and `s=redacted` in `$current_url`. Observed: zero
events from the preview host contained `leaktest`; custom events,
`$pageview`, `$pageleave` and `$set` all carried the `=redacted` forms.
The filter and sort were applied by loading the Table Editor URL with
them, which is how the app restores them
- [x] Same session: expect `page_title` and `title` on every event to
hold only page names (for example `Tables | Database | Supabase`), with
no project, org or table name. Observed: `Table Editor | Supabase`,
`Tables | Database | Supabase`, `Postgres Logs | Logs | Supabase`, `Team
| Supabase` and similar; no event carried the project, org or table
name. `explorer_*` events keep their existing fixed title `Explorer`
- [x] Load
`/dashboard/project/<ref>?token=leaktest1&projectName=leaktest2#access_token=leaktest3`,
then open `/join?token=leaktest4&slug=x`. Expect zero events containing
`leaktest`, including `$set`, `$identify` and `$groupidentify`.
Observed: zero, with `token=redacted&projectName=redacted` and no hash
on any stored URL. `$set` and `$groupidentify` fired and were clean; no
`$identify` fired in this session (the user was already identified), so
that event was not observed
- [x] Load any page with `?utm_source=readable5` appended. Expect
`utm_source=readable5` readable in `$current_url`. Observed on Database
> Tables with `?utm_source=readable5&gclid=readable6&tab=readable7`:
both attribution params readable, `tab=redacted`. The Table Editor route
rewrites its own query string and drops unknown params before any event
fires, so use another page
- [x] Open a table in the Table Editor. Expect the browser tab title to
still lead with the table name and include the project and org names.
Observed: `<table> | Table Editor | <project> | <org> | Supabase`
- [x] On the Table Editor with a filter applied, change the filter value
twice, then add a sort. Expect no new `$pageview` for the two value
changes and one for the added sort (a new param name). Observed, all
through the UI with no reload: adding the filter sent one pageview, the
two value changes sent none, adding the sort sent one, and a sidebar
navigation sent one; the staging analytics project shows the same four
pageviews

## Linear
- fixes GROWTH-1572
2026-11-27 03:41:51 +00:00
Drew McLellan 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.
2026-11-26 16:28:37 +00:00
Drew McLellan 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`
2026-11-26 11:24:05 +00:00
Mert YEREKAPANandPamela Chia cbae30a467 feat(studio): link plan badge to upgrade flow (GROWTH-775) (#47447)
## What

Makes the **Free** plan badge next to the organization name (in the org
dropdown) a clickable entry point into the upgrade funnel.

Resolves [GROWTH-775](https://linear.app/supabase/issue/GROWTH-775).
Feedback verbatim: _"if i hit the 'free' button next to my account name
it should take you to the upgrade to paid account funnel."_

The badge links to
`/org/{slug}/billing?panel=subscriptionPlan&source=org_plan_badge`.
Clicking it fires `upgrade_cta_clicked` with `placement:
'org_plan_badge'`.

## Changes

| File | Change |
|---|---|
| `apps/studio/components/layouts/AppLayout/OrganizationDropdown.tsx` |
Eligibility check and the linked badge. |
| `apps/studio/components/layouts/AppLayout/AppLayoutDropdown.tsx` | New
optional `trailingContent` slot, rendered as a sibling of the nav
`<Link>`. Needed because a clickable badge can't be a `<Link>` nested
inside the org `<Link>` (invalid HTML). Non-breaking — `BranchDropdown`
is unaffected. |
| `packages/common/telemetry-constants.ts` | Adds the `org_plan_badge`
placement to `upgrade_cta_clicked`. |
|
`apps/studio/components/layouts/AppLayout/OrganizationDropdown.test.tsx`
| Free org gets the link; partner-managed, billing-partner, and paid
orgs keep the plain badge. |

## Who sees the link

Orgs on the Free plan, managed by Supabase, with no `billing_partner`.
Everyone else keeps the plain, non-clickable badge. The badge also stays
plain when billing is disabled (`billing:all`) or plan changes are
paused (`disableProjectCreationAndUpdate`), the same two checks
`UpgradePlanButton` applies.

Partner-managed orgs are excluded because they change plans at the
partner (Vercel / AWS Marketplace / Stripe Projects).
`PlanUpdateSidePanel` shows a `PartnerManagedResource` notice and
disables every paid tier for them, so the badge would land them on a
panel with no enabled action. `billing_partner` is checked separately
because `getManagedByFromOrganizationPartner` doesn't map every partner
— `fly` falls through to `supabase`.

Free-plan members without `BILLING_WRITE` still get the link:
`PlanUpdateSidePanel` renders `RequestUpgradeToBillingOwners` per plan
card for them, so the landing is a real next action, not a dead end.

## Testing

`OrganizationDropdown.test.tsx` covers the linked badge for a Free
Supabase-managed org and the plain badge for partner-managed,
billing-partner, and Pro orgs, plus the billing-disabled and
plan-changes-paused cases. Existing partner-icon tests still pass. `tsc
--noEmit` and Prettier are clean for the touched files.

The Studio lint ratchet passes locally.

---------

Co-authored-by: Pamela Chia <pamelachiamayyee@gmail.com>
2026-11-26 09:47:03 +00:00
K-Dog (Kevin) 574cd4ba46 chore: remove old plan change UI (#54105)
Revamped plan change UI is fully rolled out for everyone. Removing the
now obsolete components.
2026-11-26 16:01:29 +08:00
Pamela Chia 71f7780d1e fix(common): clear first-referrer cookie on consent revoke (#54043)
Withdrawing consent expired the analytics and ads cookies but left
`_sb_first_referrer` (referrer, landing URL, UTMs and click ids, 365
days) in the browser. I added it to the list `revokeTrackingConsent`
expires, so it is removed on the host and on `.supabase.com` together
with the others. The cookie is only read after consent, so no
attribution data is lost.

## To test

Previews and staging auto-accept consent, so the withdrawal path only
runs on production after deploy.

- [x] Arrive on supabase.com from an external link and accept cookies.
In the console, `document.cookie.includes('_sb_first_referrer')` returns
`true`. Open Privacy Settings, turn Analytics and Marketing off and
save: after the reload the same expression returns `false`.
- [x] In a fresh private window, arrive from an external link and click
Opt out on the consent toast:
`document.cookie.includes('_sb_first_referrer')` returns `false`.

## Linear
- fixes GROWTH-1574
2026-11-25 22:07:35 +08:00
Alaister YoungandAlaister Young d6e4089b1a feat(common): add FrameworkProvider and remove next imports (#53905)
Introduces a lightweight `FrameworkProvider` React context in
`packages/common` (`Link`, `Image`, `pathname`, `asPath`, `isReady`,
`params`, `push`), wires it up in the consuming apps, and removes the
`next` dependency from `packages/common`.

**Added:**

- `FrameworkProvider`, `useFramework`, `FrameworkLink`, and
`FrameworkImage` in `packages/common/framework.tsx`, with plain HTML
defaults (`DefaultFrameworkLink` / `DefaultFrameworkImage`).
`useFramework().push` always exists and falls back to
`window.location.assign`
- App-level framework providers wiring `next/link`, `next/image`, and
router state in `www` (App + Pages routers), `docs`, `design-system`,
`learn`, and `ui-library`, and native TanStack Router bindings in
`studio` (`StudioFrameworkProvider`)
- `StudioFrameworkProvider` reuses the common defaults (its image only
applies the basePath) and reports `isReady` once the first route load
commits, so the first page view carries the final route after any
redirect
- Unit tests for `StudioFrameworkProvider` (`useParams`,
`FrameworkLink`, `FrameworkImage`, query/hash-only navigation,
`isReady`) and for `PageTelemetry` route-change sends and the
`TelemetryTagManager` consent gate

**Changed:**

- `common/hooks/useParams.ts`: read params from `useFramework()` instead
of `next/compat/router`
- `common/telemetry.tsx`: replace `next/script` in `TelemetryTagManager`
with `useEffect` script injection, and read route state from
`useFramework()` in `PageTelemetry`
- `common/MetaFavicons/app-router.ts`: drop type-only `Metadata` import
from `next`
- Moved `MetaFaviconsPagesRouter` to
`apps/www/components/MetaFaviconsPagesRouter.tsx` (its sole consumer)
- Studio: `toRoutePattern` and `applyBasePath` now live once in
`lib/internal-url.ts`, shared by the provider and the `compat/next`
shims
- `PageTelemetry` throws outside production when no `FrameworkProvider`
is mounted, since it would otherwise send only the landing pageview.
`useFramework()` itself still falls back to the defaults
- `ui-library`: renamed its code-sample framework context to
`FrameworkPreferenceProvider` / `useFrameworkPreference` so
`FrameworkProvider` only means the `common` one

**Removed:**

- `learn`'s unused copy of that context (`useCourse` had no callers)

- `next` from `packages/common/package.json` peerDependencies

App Router adapters set `asPath` to the pathname only, same as the
`usePathname`-based telemetry on master (reading search params at the
root would opt static pages out of static rendering).

## To test

- Run `packages/common` tests and typecheck, and `apps/studio`
`StudioFrameworkProvider` / `route-render` / `telemetry` tests
- Navigate between routes in Studio, Docs, and WWW and confirm page
telemetry fires once per navigation (and does not duplicate on hash-only
changes)
- Load Studio at `/` (which redirects) and confirm the first page event
has the final route
- Verify URL params (`useParams`) continue resolving route and search
params in Studio

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-25 20:13:22 +08:00
supabase-vercel-tedd[bot] e508c3c3f0 feat(studio): track schema visualizer usage (#53955)
## Problem

The schema visualizer (`/project/[ref]/database/schemas`) sends no
telemetry. We can't tell whether people use it to explore a schema or to
export it, which export format they pick, or whether they edit tables
from the graph.

## Solution

Adds PostHog events for the visualizer's main actions: changing the
schema, selecting a Find table result, copying (schema or table as
SQL/Markdown, table or column name), downloading the graph as PNG or
SVG, applying Auto layout, and choosing Edit table or Edit column from a
node menu. Each event fires from the action's handler, so actions
started from a keyboard shortcut count too. Properties are only fixed
enums (`schemaType`, `content`, `format`, `action`); no schema, table,
or column names are sent. Each tracked element also gets a `data-attr`
for autocapture. View in Table Editor and the empty state's New table
link get a `data-attr` only, because the pageview already records them.

It also fixes an empty canvas after switching back to a schema that was
already loaded. The graph stays mounted in that case and fitted the view
only on first load, so the new schema's tables could sit off-screen
until a reload. The view now fits whenever the schema on the canvas
changes. Edits within the same schema still keep the current view.

Studio's database pages keep the selected schema name in the `schema`
URL param, and that name is chosen by the customer. Telemetry now
redacts its value to `redacted` wherever it already redacts `keywords`:
the event and pageview `page_url`, the query string, the referrer,
first-touch data, and the URL properties posthog-js adds. This applies
to every Studio event and pageview, not just this page. Params that only
contain the word, such as `schemas` or `myschema`, are left alone.

## How to verify

On the PR preview, open a project's Database > Schema Visualizer with
PostHog debugging on (or watch the network requests to the telemetry
endpoint), then:

1. Change the schema in the selector: one
`database_schema_selector_updated` event with `schemaType` of `public`,
`protected` (for example `auth`), or `custom`.
2. Open Find table and select a table: one
`database_schema_visualizer_find_table_clicked` event.
3. Click Copy as SQL: one `database_schema_visualizer_copied` with
`content: 'schema_sql'`. Copy as Markdown from the export menu sends
`content: 'schema_markdown'`.
4. Download as PNG and as SVG: one
`database_schema_visualizer_image_download_clicked` each, with `format`
of `png` or `svg`.
5. Open Auto layout and click Apply: one
`database_schema_visualizer_auto_layout_applied`. Cancel sends nothing.
6. From a table node menu, choose Copy name, Copy as SQL, and Copy as
Markdown: `database_schema_visualizer_copied` with `content` of
`table_name`, `table_sql`, and `table_markdown`. Column menu Copy name
sends `column_name`.
7. From a table node menu choose Edit table, and from a column menu
choose Edit column: `database_schema_visualizer_node_menu_clicked` with
`action` of `edit_table` and `edit_column`.
8. No event carries a schema, table, or column name.
9. Switch the schema from public to auth, then back to public, with no
reload: the public tables are shown and fitted on the canvas each time.
Repeat auth → public → auth.
10. Edit a column from the graph and save: the view does not jump.
11. In the telemetry requests from steps 1 to 7 and in the pageview,
`page_url` and `ph.search` show `schema=redacted`, never the schema
name. The page itself still shows and switches the real schema.

## Checks

Ran `pnpm turbo run typecheck --filter='...[origin/master]'`. Every
package passed except studio, which ran out of memory beside a parallel
lint run. `pnpm --filter studio run typecheck` alone then passed, and
passed again after the view fix. `pnpm turbo run lint
--filter='[origin/master]'` ran out of memory twice on studio's
`lint:type-checks` (2 GB default heap). So I ran `eslint` and `eslint
--config eslint.type-checks.config.cjs` on the changed Studio files with
a larger heap: no errors, only pre-existing warnings. `vitest run
components/interfaces/Database/Schemas/Schemas.utils.test.ts` passed.
For the redaction, `vitest run` in `packages/common` (all 310 tests,
including the new `schema` cases) and its `typecheck` passed; `common`
has no lint script. `oxfmt --check` passes on all changed files. Event
names and properties follow the repo's `telemetry-standards` skill.

## Checklist

- [x] I have read the [contributing
guidelines](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [x] The change is scoped to one feature
- [x] Events are defined in `packages/common/telemetry-constants.ts` and
added to the `TelemetryEvent` union

## Feedback for Tedd

To ask Tedd for a change to this PR, reply in Tedd's session on
[FE-5031](https://linear.app/supabase/issue/FE-5031/track-usage-on-the-schema-visualizer).
Tedd doesn't read comments on this PR.

---------

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
2026-11-25 11:35:03 +00:00
K-Dog (Kevin) 653f914ca1 feat: post plan upgrade screen (#54003)
Right now, when customers upgrade from free → paid or even pro → team,
we simply redirect to the org billing page with a quick banner that
vanishes after 3 seconds confirming the plan was changed. it’s quite
unsatisfying and feels like a missed opportunity to display what the
customer now unlocked and next steps. I want to especially highlight
projects that are now upgradeable from nano → micro, but we can later
expand and make the “next steps” smarter and do it context-based.
2026-11-25 11:30:19 +00:00
Alaister YoungandAlaister Young b2cd26e054 chore(ui-patterns): remove trivial and unused next imports (#53903)
Removes unused and straightforward `next` imports in
`packages/ui-patterns` (and a dead `next/navigation` test mock in
`packages/ui`) that do not require a framework adapter.

**Removed:**

- Unused `LW15Banner`, `AnnouncementBanner`, `Announcement`, and
`PromoToast` components and their `package.json` exports
- Unused `HIDE_PROMO_TOAST` local storage key (only `PromoToast` read
it)
- Unused `next/navigation` mock from `packages/ui/vitest.setup.ts`

**Changed:**

- `PrivacySettings`: replace external `next/link` anchors with plain
`<a>` tags
- `Markdown/components` & `SqlToRest`: replace `next/dynamic` with
`React.lazy` + `Suspense` (plus a client-mount guard in `SqlToRest` to
preserve `{ ssr: false }`)
- `McpUrlBuilder` (`McpConfigurationDisplay` & `InstructionBlocks`):
replace `next/image` with plain `<img>` for static bundled
icons/screenshots. Both now share `normalizeAssetUrl` from
`mcpIconAssets.ts`, and the screenshot is lazy-loaded
- `types/assets.d.ts`: type `*.png` / `*.svg` imports as `string | {
src: string }` instead of `import('next/image').StaticImageData` (Vite
returns a string, Next returns an object, and consumers only read `src`)

## To test

- Run `packages/ui-patterns` and `packages/ui` unit tests and typecheck
- Open the MCP connect panel in Studio / Docs and confirm client icons
and setup screenshots render
- Open Privacy Settings modal in WWW / Docs and verify links open
properly
- Check SQL-to-REST translator page in Docs renders client-side

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-25 13:14:44 +08:00
Miranda Limonczenko e44837c256 feat(docs): point every docs page at llms.txt in HTML and markdown (#53965)
Closes DOCS-1756

## Problem

No docs page tells an agent that `llms.txt` exists or that a markdown
version is available. Agents that send `Accept: text/markdown` already
get markdown, but agents that fetch HTML have no signal to try the
markdown path.


## Solution

- **HTML:** add a visually hidden directive as the first child of
`<body>` in the root layout, so it comes before the navigation on every
guide and reference page. It links to
`https://supabase.com/docs/llms.txt` and says guide pages have a
markdown version at the same path with `.md` appended, before any query
string or fragment. It's `sr-only` and `aria-hidden`, and the link has
`tabindex="-1"`.
- **Crawler HTML:** bot requests for SDK reference pages are rewritten
to `/api/crawlers`, which skips the root layout. The same directive goes
before its `<nav>`.
- **Markdown:** add a sentence linking `llms.txt` to the "Note for AI
agents" blockquote in the guides markdown route. The agent feedback page
skips the feedback text to avoid linking to itself, but it keeps the
`llms.txt` line.
- Add `LLMS_TXT_URL` and `LLMS_TXT_DIRECTIVE_HTML` to
`common/markdown-affordance`, and reuse `LLMS_TXT_URL` in `proxy.ts`.

The directive limits the `.md` claim to guides, because reference `.md`
requests 404. It doesn't say `llms.txt` lists every page.

The link targets `/docs/llms.txt`, the docs index that AFDocs scores for
the `/docs` base URL. #53968 makes it a real file. Until that merges,
`/docs/llms.txt` 308-redirects to the site-wide `/llms.txt`, so the link
works in either merge order.

## Manual testing

1. Open a Vercel preview guide page and view source. Confirm the
`llms.txt` directive comes before the navigation markup.
2. Open a reference page and confirm the same.
3. Confirm the directive isn't visible and isn't tabbable.
4. Request a reference section page with a bot user agent, such as `curl
-A Googlebot`, and confirm the directive comes before `<nav>`.
5. Request a guide with `.md` appended and confirm the opening
blockquote links `llms.txt`.
6. Request `/docs/guides/ai-tools/agent-feedback.md` and confirm the
opening blockquote links `llms.txt`.
7. Run AFDocs against the preview and confirm `llms-txt-directive-html`
and `llms-txt-directive-md` pass.
2026-11-24 15:02:23 -08:00
anthony lio c2292c97f2 fix(docs): shared account menu (#53620)
## Problem

- docs menu keeps its own copy of the account items, separate from the
shared top nav menu that #53558 adds for kb
- docs header waits for auth, so a signed-out reader sees "Sign up"
appear after load and the header shifts

## Solution

- moves the docs desktop account menu onto the shared top nav menu, so
docs and kb show the same account items and sign out
- changes the shared menu button to show the avatar of the reader or a
person icon when there is no avatar, so kb gets the avatar too
- changes the docs "Sign up" link and the menu button to read that mark
while auth loads so the header is correct at first paint

<!--
## Preview links

If relevant, include links to changed pages for easy review access.

Copy the preview base URL from the Vercel bot comment on this PR. Use
the following table as an example template.

| Site | Live | Preview | Search for |
| -------------- |
-------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
| ----------------------------- |
| WWW | [/blog/your-post](https://supabase.com/blog/your-post) |
[/blog/your-post](https://zone-www-dot-com-git-branch-name-supabase.vercel.app/blog/your-post)
| unique phrase from the change |
| Docs |
[/docs/guides/your-page](https://supabase.com/docs/guides/your-page) |
[/docs/guides/your-page](https://docs-git-branch-name-supabase.vercel.app/docs/guides/your-page)
| unique phrase from the change |
| Studio | [/dashboard](https://supabase.com/dashboard) |
[/dashboard](https://studio-git-branch-name-supabase.vercel.app/dashboard)
| unique phrase from the change |
| Design system | [/design-system](https://supabase.com/design-system) |
[/design-system](https://design-system-git-branch-name-supabase.vercel.app/design-system)
| unique phrase from the change |
| UI library | [/library](https://supabase.com/library) |
[/library](https://ui-library-git-branch-name-supabase.vercel.app/library)
| unique phrase from the change |
| Knowledge base |
[/kb/guides/your-page](https://supabase.com/kb/guides/your-page) |
[/kb/guides/your-page](https://kb-git-branch-name-supabase.vercel.app/kb/guides/your-page)
| unique phrase from the change |
-->

<!-- ## Additional context

Optionally add any other context or screenshots.

-->

## Review instructions

1. open
[/docs/guides/getting-started](https://docs-git-antlio-fix-docs-shared-account-menu-supabase.vercel.app/docs/guides/getting-started)
with the network set to "Slow 4G" in devtools
2. make sure that "Sign up" shows on the first frame and that the header
does not shift when the page finishes loading
3. make sure that the browser console shows no react error 418
4. open the browser console on the preview, and run this snippet, which
stores a fake dashboard session with no real token:
   ```js
const user = { id: 'test', aud: 'authenticated', email:
'you@example.com', user_metadata: { avatar_url:
'https://github.com/supabase.png' } }
   const key = 'supabase.dashboard.auth.token'
localStorage.setItem(key, JSON.stringify({ access_token: 'a.b.c',
refresh_token: 'r', token_type: 'bearer', expires_in: 3600, expires_at:
Math.floor(Date.now() / 1000) + 3600, user }))
   localStorage.setItem(`${key}-user`, JSON.stringify({ user }))
5. reload the 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)
2026-11-24 16:08:54 +02:00
anthony lio ef8005d863 fix(kb): header sign in state (#53558)
## Problem

- the kb header shows "Sign up" to every reader, also to readers who are
signed in to the dashboard
- kb never reads the dashboard session, so a signed-in reader has no
link to the dashboard and no way to sign out

## Solution

- reads the dashboard session in the kb header with the shared
`AuthProvider` from `common/auth`, the same as docs and www
- changes the header link to "Dashboard" for a signed-in reader, and
keeps "Sign up" for other readers and in the server html, so the header
does not move on load
- adds the email, "Account Preferences", "All Projects" and "Sign out"
to the header menu for a signed-in reader, the same as the docs menu
- changes the mobile menu footer to "Sign in" and "Start your project",
or to "Dashboard" for a signed-in reader, the same as the docs drawer
- adds tests that store a session and check the header and mobile menu
links

| before | after |
| --- | --- |
| <img width="760" height="1000" alt="image"
src="https://github.com/user-attachments/assets/424feb44-4008-4d8e-b994-bd7d5c103bc3"
/> | <img width="760" height="1000" alt="image"
src="https://github.com/user-attachments/assets/54be6c7d-39e1-45ac-9a79-9fc0650d251c"
/> |

<!--
## Preview links

If relevant, include links to changed pages for easy review access.

Copy the preview base URL from the Vercel bot comment on this PR. Use
the following table as an example template.

| Site | Live | Preview | Search for |
| -------------- |
-------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
| ----------------------------- |
| WWW | [/blog/your-post](https://supabase.com/blog/your-post) |
[/blog/your-post](https://zone-www-dot-com-git-branch-name-supabase.vercel.app/blog/your-post)
| unique phrase from the change |
| Docs |
[/docs/guides/your-page](https://supabase.com/docs/guides/your-page) |
[/docs/guides/your-page](https://docs-git-branch-name-supabase.vercel.app/docs/guides/your-page)
| unique phrase from the change |
| Studio | [/dashboard](https://supabase.com/dashboard) |
[/dashboard](https://studio-git-branch-name-supabase.vercel.app/dashboard)
| unique phrase from the change |
| Design system | [/design-system](https://supabase.com/design-system) |
[/design-system](https://design-system-git-branch-name-supabase.vercel.app/design-system)
| unique phrase from the change |
| UI library | [/library](https://supabase.com/library) |
[/library](https://ui-library-git-branch-name-supabase.vercel.app/library)
| unique phrase from the change |
| Knowledge base |
[/kb/guides/your-page](https://supabase.com/kb/guides/your-page) |
[/kb/guides/your-page](https://kb-git-branch-name-supabase.vercel.app/kb/guides/your-page)
| unique phrase from the change |
-->

<!-- ## Additional context

Optionally add any other context or screenshots.

-->

## Review instructions

1. open
[/kb](https://kb-git-antlio-fix-kb-header-sign-in-state-supabase.vercel.app/kb)
at a desktop width, and make sure that the header link shows "Sign up"
2. open the browser console on the preview, and run this snippet, which
stores a fake dashboard session with no real token:
   ```js
const user = { id: 'test', aud: 'authenticated', email:
'you@example.com' }
   const key = 'supabase.dashboard.auth.token'
localStorage.setItem(key, JSON.stringify({ access_token: 'a.b.c',
refresh_token: 'r', token_type: 'bearer', expires_in: 3600, expires_at:
Math.floor(Date.now() / 1000) + 3600, user }))
   localStorage.setItem(`${key}-user`, JSON.stringify({ user }))
3. reload 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)
2026-11-24 16:08:54 +02:00
Pamela Chia d2709729d6 feat(studio): track the plan change flow after the plan CTA click (#53916)
Studio sends no events between the plan CTA click and the backend's
subscription update, so we can't see where people stop in the plan
change flow. The redesigned plan change screen from #53670 is also gated
by a ConfigCat flag, and ConfigCat flag values are not attached to
events, so its rollout can't be compared against the legacy dialog. I
added the missing events and a property for the flag state.

**Changed:**
- **Which screen a user gets**: I added `planUpdateRedesignEnabled` and
`origin` (the `source` query param the panel was opened with) to
`studio_pricing_plan_cta_clicked`.
- **Confirm and completion**: the redesigned screen now sends
`studio_pricing_plan_change_confirm_clicked` on the confirm button and
`studio_pricing_plan_change_completed` once the change succeeds. A
payment confirmation that the API answers with 202 (payment taken, plan
still syncing) counts as completed too.
- **Compute explainer and docs links**: expanding "Billed every hour,
even when idle" sends `studio_pricing_compute_billing_explainer_opened`,
and the compute and project transfer docs links send
`studio_pricing_plan_change_docs_link_clicked`.
- **Stale origin**: closing the pricing panel now removes `source` from
the URL. Before, reopening the panel from the billing page reported the
previous entry point as the origin.

**Note:** the legacy dialog gets no new events, and
`planUpdateRedesignEnabled` should be removed together with it.

## To test
Needs the `billingPlanUpdateRedesign` flag on. Watch the
`telemetry/event` requests in the network tab.

Tested on the PR preview:
- [x] Open `/org/<slug>/billing?panel=subscriptionPlan&source=backups`
on a Free org and click "Upgrade to Pro", expect
`studio_pricing_plan_cta_clicked` with `planUpdateRedesignEnabled: true`
and `origin: "backups"`. Observed, and the redesigned screen opened.
- [x] On the same panel, click the Enterprise card's "Contact us",
expect exactly one `studio_pricing_plan_cta_clicked` with `selectedPlan:
"Enterprise"`, `planUpdateRedesignEnabled: true` and `origin:
"backups"`. Observed, one event.
- [x] Expand "Billed every hour, even when idle", expect one
`studio_pricing_compute_billing_explainer_opened`. Collapse it, expect
no event. Observed, and a second expand sent a second event.
- [x] Click "Learn about compute", expect
`studio_pricing_plan_change_docs_link_clicked` with `docsLink:
"compute"`. Observed, and the "Transfer" link sent `docsLink:
"project_transfer"`.
- [x] Go back and close the pricing panel, expect `source` to be gone
from the URL. Observed: the URL ended at `/billing` with no `panel` or
`source`.
- [x] With the flag overridden off and the page reloaded, click "Upgrade
to Pro", expect `planUpdateRedesignEnabled: false` and the legacy
dialog. Observed.
- [x] Confirm with a declining card, expect
`studio_pricing_plan_change_confirm_clicked` and no
`studio_pricing_plan_change_completed`. Observed: the subscription
update returned 402 and no completion was sent.
- [x] Confirm the upgrade with a test card, expect
`studio_pricing_plan_change_confirm_clicked` then one
`studio_pricing_plan_change_completed` with `currentPlan: "Free"`,
`selectedPlan: "Pro"`, `origin: "backups"` and no project group.
Observed, with `groups` holding only `organization`.
- [x] Upgrade again with a card that requires 3D Secure, expect one
`studio_pricing_plan_change_completed`, sent only after the challenge.
Observed on a Pro to Team change.

I also confirmed ingestion by querying the staging PostHog project: all
five events from this run arrived from the preview host with the
properties above. The run included the CTA click with both `true` and
`false` for `planUpdateRedesignEnabled`, `docsLink` values `compute` and
`project_transfer`, completions for Free to Pro and Pro to Team, and
only an organization group on every event.

## Linear
- fixes GROWTH-1565
2026-11-24 18:40:22 +08:00
Pamela ChiaandJoshen Lim 86ab87efd7 chore(studio): remove the onboarding survey experiment flag (#53918)
The onboarding survey experiment on the new-org form is finished and the
survey version is now the default. I removed the
`onboardingSurveyPlacement` flag from Studio: the form always shows the
survey, and I deleted the old form path.

**Changed:**
- **New-org form**: always renders the name field plus the optional
"Help improve Supabase" survey card. Org type and size are saved through
the survey endpoint only, as they already were for the survey variant.
- **Experiment plumbing removed**: I deleted the flag read, its exposure
event (`onboarding_survey_placement_experiment_exposed`) and the variant
constants, so the form no longer starts on the old layout while flags
load.
- **Tests**: the survey tests keep their assertions with the flag setup
removed. I deleted the test for the old form (org type sent at creation,
no survey) because that behavior no longer exists.

**Note:** I removed the `renderFieldWrapper` option from
`OrganizationDetailsFields`, which only the old form path used. The
cloud marketplace org form still uses the component unchanged.

## To test

Tested on the PR preview:
- [x] Sign in and open `/new`: expect a Name field with no Type field
above the plan picker, and a "Help improve Supabase" card with the org
type, "What are you building?" and "Do you know how to code?" questions.
Observed: Name, Plan, then the card with "Who is this org for?" (default
Personal) and both questions.
- [x] Create a free org with the survey untouched: expect the create
request body to carry no `kind` or `size`, no `onboarding-survey`
request, and the follow-up card on the new org's projects page.
Observed: create body `{"name":"…","tier":"tier_free"}` (201), no survey
request, and the follow-up card with Answer and Skip on the org page.
- [x] Create a free org with type Company, a company size and a "What
are you building?" answer: expect one `POST
/platform/organizations/onboarding-survey` with those answers returning
204, and no follow-up card. Observed: one request with `kind:
"COMPANY"`, `size: "50"`, `building: "b2b_saas"` (204), create body
again without `kind` or `size`, no follow-up card.
- [x] Watch telemetry requests while `/new` loads: expect no
`onboarding_survey_placement_experiment_exposed` event. Observed: none
across both org creations, while `onboarding_survey_dismissed` and
`onboarding_survey_submit_button_clicked` (both `surface: org_form`)
were sent.
- [x] Added: the survey card is in the first render of `/new` and the
Name input keeps focus, with no layout switch after flags load.

## Linear
- fixes GROWTH-1562

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-11-24 18:13:38 +08:00
Pamela Chia 06fc7c4f4e fix(studio): clear telemetry cookies on sign-out (#53915)
Studio's sign-out never called the API to clear the HttpOnly telemetry
cookies (`user_id`, `organization_slug`, `project_ref`). Events sent
from the sign-in page after a sign-out were still recorded under the
user who had just signed out, and the next user on that browser
inherited the previous user's org and project cookies. I call the
existing `resetServerTelemetryCookies` helper (already used when consent
is withdrawn) from `useSignOut`, right after the auth sign-out, and only
when a session existed. A stored session whose refresh fails during
sign-out counts as existing.

**Note:** `withAuth` also calls `useSignOut` when a visitor with no
session opens a protected page. I skip the reset there because the
endpoint also clears the anonymous id and session id cookies, and a
visitor who has not signed in yet needs them until sign-in links them to
the account. When the reset does run, I make sign-out wait for it
(capped at 1 second by the helper) so the sign-in page cannot send an
event with the old cookies first.

## To test

Tested on the PR preview:
- [x] Sign in, open the network tab, then click "Sign out" in the avatar
menu: expect one `POST /platform/telemetry/reset` with a 2xx response.
Observed: one reset request (201), sent right after the auth `logout`
request (204).
- [x] While signed out, open a protected page such as
`/dashboard/organizations`: expect a redirect to sign-in and no `POST
/platform/telemetry/reset`. Observed: redirect to
`/dashboard/sign-in?returnTo=%2Forganizations`, no reset request.

The preview is cross-site to the staging API, so the browser never
stores these `SameSite=Lax` cookies there and the cookie-clearing effect
cannot be observed on it. I'll check that on the staging dashboard after
merge.

## Linear
- fixes GROWTH-1556
2026-11-24 18:12:36 +08:00
Alaister YoungandAlaister Young fcbdda8107 chore: migrate formatter from Prettier to oxfmt (#53835)
Migrate code formatting across the monorepo from Prettier to `oxfmt`
(`0.79.0`, pinned) for much faster formatting checks locally and in CI
while keeping code churn minimal (78 files total, 0.7% of the repo).

Studio's `@ianvs/prettier-plugin-sort-imports` ordering
(`<BUILTIN_MODULES>`, `<THIRD_PARTY_MODULES>`, blank line, then `@/` and
relative imports) is preserved via `oxfmt`'s native `sortImports`
override for `apps/studio/**/*.{js,jsx,ts,tsx}`.

### Performance (before vs after, uncached)

| Benchmark | Prettier (`3.8.x`) | oxfmt (`0.79.0`) | Speedup |
| --- | ---: | ---: | ---: |
| CI formatting step (`blacksmith-4vcpu-ubuntu-2404`, full repo) | `73s`
| **`7s`** | **~10×** |
| Local `apps/studio` JS/TS (`5,157` files) | `17.74s` | **`0.36s`** |
**~49×** |
| Local full monorepo (`11,131` files) | — | **`2.39s`** | — |

**Added:**

- `.oxfmtrc.jsonc` at repo root with Prettier-matching options,
`sortPackageJson: false`, the Studio `sortImports` override, and ignore
patterns migrated from `.prettierignore`
- `oxfmt` (`0.79.0` exact pin) in `pnpm-workspace.yaml` catalog and
workspace `devDependencies` / `dependencies`
- Shared `.agents/scripts/format_and_lint.sh` hook script and
`.agents/hooks.json` (used by both Claude Code and Antigravity)

**Changed:**

- Replaced `test:prettier` with `format:check` and switched `format` in
root `package.json` to `oxfmt`
- Updated `packages/api-types` (`codegen`,
`verify-production-types.mjs`), `apps/design-system` (`build:registry`),
`apps/docs` (`CodeSample.ts`, `generate-sitemap.ts`, `next.config.mjs`,
`spec/Makefile`), `apps/www` (`generate-sitemap.mjs`), and
`packages/build-icons` (`generateIconFiles.mjs`) from Prettier to
`oxfmt`
- Updated `.github/workflows/prettier.yml` (keeping the `format` job ID
intact), `.github/workflows/autofix_linters.yml`,
`.claude/settings.json`, `AGENTS.md`, `CONTRIBUTING.md`, and
`.github/copilot-instructions.md`
- Applied one-time `oxfmt` formatting pass in a separate commit (78
files: 30 `i18n/README.*.md` trailing spaces, 19 Studio files, 17 other
TS/TSX/generated types, 8 MD/MDX, 3 `package.json`, 2 example CSS files)

**Removed:**

- `prettier`, `@ianvs/prettier-plugin-sort-imports`, and
`prettier-plugin-sql-cst` from `devDependencies` (note: `.sql` files
were not part of the CI formatting glob; `eslint-config-prettier` is
kept for ESLint)
- `prettier.config.mjs`, `.prettierignore`, and
`.claude/scripts/format_and_lint.sh`

## To test

- Run `pnpm run format:check` and confirm it passes cleanly across all
matched files
- Run `pnpm --filter api-types test`, `pnpm --filter docs exec vitest
run features/directives/CodeSample.test.ts`, and `pnpm --filter www exec
vitest run generate-sitemap.test.ts`
- Edit an `apps/studio` file with out-of-order imports and run `pnpm run
format` to confirm builtin/third-party vs `@/`/relative grouping matches
prior behavior
- Check that the `Check Code Formatting` CI workflow passes on this PR

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-24 12:51:31 +08:00
kemal.earth 676d216c81 feat(studio): add events for saved views (#53856)
## Problem

Studio tracks PostHog telemetry for most user-facing interactions, but
the saved-views feature added in #53630 (moving saved views from a
toolbar dropdown into the filter sidebar) shipped with no tracking.
There's no way to measure whether people discover the new Views panel,
how often they create/apply/manage views, or how they respond to the
"this view has been modified" prompt.

## Solution

Added six PostHog events covering the saved-views lifecycle, following
the existing `unified_logs_*` naming convention (matching the
pre-existing `unified_logs_row_clicked` event):

- `unified_logs_views_panel_opened` — opening the panel from the sidebar
entry or mobile drawer (`surface` property)
- `unified_logs_view_applied` — applying a preset or saved view
(`viewType`, and `trigger: 'select' | 'reset'` to distinguish a row
click from discarding edits via "Reset")
- `unified_logs_view_created` — creating a view, with `source: 'new' |
'save_as_new' | 'duplicate'` to distinguish entry points
- `unified_logs_view_updated` — renaming (`updateType: 'name'`) or
updating a view's filters from the modified-view popover (`updateType:
'filters'`)
- `unified_logs_view_removed` — deleting a view
- `unified_logs_view_update_prompt_closed` — dismissing the "this view
has been modified" popover without updating/saving/resetting

Key choice: similar actions were consolidated into one event with a
distinguishing property rather than one event per button, per the
telemetry-standards convention (e.g. rename and filter-update both fire
`unified_logs_view_updated` rather than two separate events). The
internal re-apply that happens right after duplicating a view is not
tracked as a separate `view_applied` event, to avoid double-counting
against `view_created`.

Event interfaces were added to `packages/common/telemetry-constants.ts`
and registered in the `TelemetryEvent` union; `track()` calls were wired
into the relevant handlers in `UnifiedLogs.tsx`.

## Review instructions

1. Enable the Unified Logs feature preview and the `logsSavedViews`
flag, then open **Logs**.
2. With PostHog dev tools / network tab open, click the **Saved views**
sidebar entry and confirm `unified_logs_views_panel_opened` fires with
`surface: 'sidebar'`.
3. Save the current filters as a new view and confirm
`unified_logs_view_created` fires with `source: 'new'`.
4. Click another view row to apply it — confirm
`unified_logs_view_applied` fires with `trigger: 'select'`.
5. Change a filter on the active view, then click **Reset** in the
modified-view popover — confirm `unified_logs_view_applied` fires with
`trigger: 'reset'`.
6. Modify filters again and click **Update view** — confirm
`unified_logs_view_updated` fires with `updateType: 'filters'`.
7. Rename a view via the row's ⋮ menu — confirm
`unified_logs_view_updated` fires with `updateType: 'name'`.
8. Duplicate a view — confirm `unified_logs_view_created` fires with
`source: 'duplicate'`.
9. Delete a view — confirm `unified_logs_view_removed` fires.
10. Modify the active view again and dismiss the popover with the X —
confirm `unified_logs_view_update_prompt_closed` fires.
2026-11-23 16:54:03 +00:00
K-Dog (Kevin) 286dc37677 chore: Free Micro Upgrade banner less permanently dismissible (#53838)
We want more customers to upgrade their instances to Micro on paid
plans.

- Only dismiss for 7 days at a time per project
- Render it if available, not only when there's a performance related
reason
2026-11-23 18:09:42 +08:00
Drew McLellan 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)
2026-11-20 13:40:23 +00:00
Sean OliverandDanny White f9fd4a2a9f feat(www,docs,kb): show Do Not Sell or Share footer link to US visitors (#53490)
## Problem

US visitors need a "Do Not Sell or Share My Personal Information" footer
link, and no site reads the visitor's country
([GROWTH-1369](https://linear.app/supabase/issue/GROWTH-1369)).

## Solution

- The www proxy copies the `x-vercel-ip-country` header into a
`_sb_country` cookie, which the footers read client-side. Docs and kb
route through www, so that covers all three.
- US visitors and unknown countries see the opt-out label. Everyone else
keeps "Privacy Settings". Both open the same modal.
- The link sits on each footer's copyright line, and the label stays
hidden until the cookie is read.
- Out of scope: GPC
([GROWTH-1373](https://linear.app/supabase/issue/GROWTH-1373)) and modal
copy ([GROWTH-1370](https://linear.app/supabase/issue/GROWTH-1370)).
- Tests cover US, non-US, unknown countries, and the cookie write.
Screenshots used a hand-set cookie.

**www**

| | Before | US | DE |
|---|---|---|---|
| 375px | <img
src="https://github.com/user-attachments/assets/1bd8bcb8-6692-4fe9-90a0-5343b0364053"
width="200"> | <img
src="https://github.com/user-attachments/assets/0514a0bd-ad1c-4773-b889-de941f5466b5"
width="200"> | <img
src="https://github.com/user-attachments/assets/328ca1b4-9698-492e-8045-a15d884108f2"
width="200"> |
| 1440px | <img
src="https://github.com/user-attachments/assets/3cb3e7d7-62ab-4d34-841c-23d50d7d1cd5"
width="300"> | <img
src="https://github.com/user-attachments/assets/caf75b29-7286-404a-b1ea-7dfa5022912c"
width="300"> | <img
src="https://github.com/user-attachments/assets/2c067209-39cd-4ad8-9987-4f8763d70660"
width="300"> |

**docs**

| | Before | US | DE |
|---|---|---|---|
| 375px | <img
src="https://github.com/user-attachments/assets/37248b4a-436b-4d2d-b2d3-3966117abf9e"
width="200"> | <img
src="https://github.com/user-attachments/assets/0b109a0d-7618-46f8-ade0-8ba17e390b56"
width="200"> | <img
src="https://github.com/user-attachments/assets/0047b2b8-7047-40df-8d9c-09f51e538fa4"
width="200"> |
| 1440px | <img
src="https://github.com/user-attachments/assets/0a7d6a65-e964-43dc-911e-0ea033cb1e91"
width="300"> | <img
src="https://github.com/user-attachments/assets/27922348-661c-4246-b3fc-44ac054bd084"
width="300"> | <img
src="https://github.com/user-attachments/assets/30afb171-1023-43ff-b77e-89f341128377"
width="300"> |

**kb**

| | Before | US | DE |
|---|---|---|---|
| 375px | <img
src="https://github.com/user-attachments/assets/cd4fb8d1-8827-4b1a-8d13-c2a5d4f97378"
width="200"> | <img
src="https://github.com/user-attachments/assets/2706ae24-3df8-4149-9a51-75abb0456734"
width="200"> | <img
src="https://github.com/user-attachments/assets/7afb8731-b487-4e48-ae83-a3a6bde36bee"
width="200"> |
| 1440px | <img
src="https://github.com/user-attachments/assets/3b2bdc17-fee7-4ec0-bd24-d35a0367a6ca"
width="300"> | <img
src="https://github.com/user-attachments/assets/479b03e6-6890-4714-bbbb-ab122f46e786"
width="300"> | <img
src="https://github.com/user-attachments/assets/252f4e0f-5bcc-4b43-aeda-784df9f000ca"
width="300"> |

## Review instructions

1. From a US IP, click the footer link on the www preview. The modal
opens.
2. From a non-US IP, see "Privacy Settings".

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)

---------

Co-authored-by: Danny White <3104761+dnywh@users.noreply.github.com>
2026-11-20 16:44:17 +09:00
Pamela Chia 62d6bf56f8 fix(telemetry): send the live posthog session id on custom events (#53504)
Custom events sent through the telemetry endpoint often carry a session
id the browser's PostHog session has already left: 8.9% of
server-captured events in a recent week had an id more than 24 hours
old, against 0.046% of browser-captured ones. Two things on the client
cause it. The `session_id` in the request body is parsed out of the
PostHog cookie without going through posthog-js, so a custom event never
rotates an expired session. And the `session_id` cookie, which the API
reads for the events it emits itself, was written on each pageview
before posthog-js rotated the session, so the first pageview after an
idle period stored the previous session's id.

**Changed:**
- **Custom events carry the live session id**: I changed
`buildTelemetryEventRequest` to ask posthog-js for the session id the
way a captured event does, so an expired session rotates first. Until
posthog-js has loaded it sends the cookie-parsed id, as before.
- **The `session_id` cookie follows the session**: I moved the write
from the pageview handler to posthog-js's session-change callback, plus
one write when posthog-js loads, so the cookie changes when the session
does.
- **The cookie stays cleared after an opt-out**: when a visitor
withdraws consent, posthog-js resets the session, and the new id would
have been written back over the cleared cookie. I skip the write once
the visitor has opted out, in this tab or another. Unit tests cover this
one: preview builds accept consent by default, so withdrawal can't be
exercised there.
- **Session metrics will step**: custom events now count as session
activity. A long-lived tab that sends events without navigating stays in
one session, so expect fewer, longer sessions from the day this reaches
each app.

**Note:** The API starts reading the body's `session_id` in a companion
change on its side. Either can deploy first: the field is already sent
today and ignored.

## To test

Tested on the PR preview:
- [x] In Studio with the Network tab open, open the user dropdown in the
header. Expect the `telemetry/event` request body's `session_id` to
equal the `session_id` cookie.
- [x] Open the dropdown again right away. Expect the same `session_id`
as in the first request.
- [x] Leave that tab untouched for 35 minutes, then open the user
dropdown again without navigating. Expect a different `session_id` in
the request body than in the first step, and the `session_id` cookie to
equal the new one. Observed after 38 idle minutes.
- [x] Navigate to another Studio page. Expect the `session_id` cookie to
keep the value from the previous step. Observed on an in-app navigation
to the account page.

## Linear
- fixes GROWTH-1509
2026-11-20 16:22:11 +09:00
supabase-vercel-tedd[bot] 7b1def73c8 fix(common): add queryWordCount to the telemetry flag-stamping test fixture (#53619)
## Problem

`SearchQueryProperties` now requires `queryWordCount`, but the fixture
in the `stamps each PostHog flag as $feature/<key>` test in
`packages/common/telemetry-event.test.ts` still used the old shape. `tsc
--noEmit` in `packages/common` fails with TS2322/TS2352 on that test,
which breaks the `common#typecheck` task.

## Solution

Add `queryWordCount: 1` to the fixture so it matches
`SearchQueryProperties` and the other `kb_search_submitted` fixtures in
the same file. This changes only the test, not runtime code.

## How to verify

- `pnpm --filter common run typecheck` passes
- `pnpm --filter common exec vitest run telemetry-event.test.ts` passes
(9 tests)

Also ran `pnpm turbo run typecheck lint --filter='[origin/master]'` and
a Prettier check on the changed file.

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
2026-11-18 14:42:55 +00:00
Pamela Chia 82b88ccb38 fix(telemetry): stop timed posthog-js flag reloads (#53611)
posthog-js reloads its feature flags every 5 minutes on each visible
tab, and again when a hidden tab becomes visible. No app reads flags
from posthog-js: every flag read goes through the flag store the backend
serves, so nothing uses those reloads. I set
`remote_config_refresh_interval_ms: 0` in the shared client, which turns
both off.

**Changed:**
- **Flag reloads**: posthog-js now loads flags on page load, identify
and group changes only. Every app on the shared client gets this
(studio, www, docs, learn, ui-library, kb), each on its own deploy.
- **Open tabs**: a flag change reaches an already open tab on its next
page load. Until now it arrived within 5 minutes. Survey targeting reads
these flags, and posthog-js stamps them as `$feature/<key>` on the
events it captures itself, so both keep the values from the last load.
- **Failed loads**: posthog-js does not retry a failed `/flags` request.
Until now the 5-minute reload re-requested it. Now it is re-requested on
the next page load, identify or group change, and posthog-js keeps the
flag values from the last successful load in the meantime.

**Note:** `getFeatureFlag` and `onFeatureFlags` in `posthog-client.ts`
have no callers. I left them in place.

## To test

Tested on the PR preview:
- [x] Sign in to Studio, filter the network panel to `flags`, and keep
the tab visible for 11 minutes: expect no `/flags` request after the
ones on page load and sign-in, and `/array/<token>/config` still loaded
on page load. Observed: `config.js` and four `/flags` requests on load,
then none in 11 minutes.
- [x] In the same tab, hide the tab and show it again: expect no new
`/flags` request. Observed with a simulated `visibilitychange` (hidden
for 60 seconds, then visible): none.
- [x] Added, control on a Studio preview without this change: expect a
`/flags` request about 5 minutes after load, and another when the tab
becomes visible again. Observed: one at 301 seconds, and one within
milliseconds of the tab becoming visible after 6 minutes hidden.

## Linear
- fixes GROWTH-1398
2026-11-18 23:33:32 +09:00
Drew McLellan 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)
2026-11-18 14:30:07 +00:00
Pamela Chia 27578cdfb5 fix(telemetry): send search query shape instead of raw text (#53500)
Search telemetry sent whatever people typed, and search boxes are a
place where people paste credentials and personal data. I replace the
raw text with a description of it. #53336 added the raw `query` to
`kb_search_submitted`; docs search and the command menu already sent it.

**Changed:**
- **I send a description of the search term**: `kb_search_submitted`,
`docs_search_v2_search_submitted`, `docs_search_v2_result_clicked` and
`command_menu_search_submitted` now send `queryLength` and
`queryWordCount`, measured after trimming and collapsing repeated
whitespace.
- **Text only for keywords**: the term itself (`query`, `value`, and
`search_query` on `command_menu_command_clicked`) is sent only when it
is up to 4 letters-only parts of at most 16 letters each, 40 characters
in total. Keys, tokens, emails, IDs, project refs and connection strings
never match. Over the last 30 days that shape covers about 96% of
command menu searches, 88% of docs searches and 73% of KB searches, so
term-level analysis such as no-result queries keeps most of its data.
- **I removed `keywords` from the auth users search event**:
`auth_users_search_submitted` no longer carries it. Those terms identify
customers' end users, and I confirmed nothing downstream reads them.
- **The `keywords` URL parameter is redacted wherever telemetry copies a
URL**: the Auth users page keeps the search term in its URL, so I
replace the value with `keywords=redacted` in the page URL, query string
and referrer we send, and in the posthog-js `before_send` hook for the
URL properties the SDK fills in on its own (`$session_entry_url`,
`$initial_current_url`, `$referrer`, `$initial_referrer`). The URL in
the browser is unchanged.

**Note:** a letters-only name or passphrase still matches the keyword
shape, and longer questions lose their text. I opened this in place of
#53435, which removed `query` from the KB event only.

## To test

Tested on the PR previews (docs, kb, studio-staging), reading the
request bodies sent to `/platform/telemetry/event`:
- [x] Docs: open search and type `auth`, expect
`docs_search_v2_search_submitted` with `query: "auth"`, `queryLength: 4`
and `queryWordCount: 1`. Observed exactly that, with `hasResults: true`.
- [x] Docs: type `person@example.com`, expect the same event with
`queryLength: 18` and no `query`. Observed, and no telemetry body in
that step contained the address.
- [x] KB: search `how do I reset my database password`, expect
`kb_search_submitted` with `queryLength: 35`, `queryWordCount: 7` and no
`query`. Observed.
- [x] KB: search `storage policies` with two spaces, expect
`kb_search_submitted` with `query: "storage policies"` and `queryLength:
16`. Observed, with `queryWordCount: 2`.
- [x] Studio: open the command menu and type `abcdefghijklmnopqrst`,
expect `command_menu_search_submitted` with no `value`, then type `auth`
and expect `value: "auth"`. Observed both, with `queryLength` 20 and 4.
- [x] Studio: on Auth > Users, search `person@example.com`, expect
`auth_users_search_submitted` with no `keywords`. Observed: `trigger`,
`sort_column`, `sort_order`, `providers` and `filter_column` only.
- [x] Studio: with `?keywords=person%40example.com` in the Auth > Users
URL, reload, then trigger an event on the page, expect `page_url` and
`ph.search` in the request body to carry `keywords=redacted` and the
address bar to keep the real term. Observed on all three events from
that page, and the address bar kept the term.
- [x] Studio: from that URL, do a full page load to another project page
and trigger an event, expect `ph.referrer` to carry `keywords=redacted`
while `document.referrer` keeps the real term. Observed on all three
events from the new page.
- [x] Studio: after that session, query the staging analytics project
for events from the preview host, expect no property value to carry the
address or anything but `keywords=redacted`. Observed: none of the
events in the test window carried the address, and the SDK's own `$set`,
`$pageview` and `$pageleave` events arrived with `keywords=redacted` in
`$current_url`, `$referrer` and `$initial_current_url`. The session
started on a page without the parameter, so `$session_entry_url` was not
exercised here; the unit test on the `before_send` hook covers it.

## Linear
- fixes GROWTH-1501
2026-11-18 23:29:35 +09:00
Pamela Chia 8c2d8d51ac feat(telemetry): stamp PostHog flags on tracked events (#53588)
Events sent through `sendTelemetryEvent` now include the app's loaded
PostHog flags as `$feature/<key>` properties, as `$pageview` already
does. The backend already adds these keys by evaluating flags remotely
for each event. The browser's values now take precedence over that
evaluation, so a follow-up can turn the per-event lookup off without
losing flag properties on events.

**Changed:**
- **Browser flag values on every tracked event**: `FeatureFlagProvider`
passes its PostHog flag map to the event builder each time flags load,
and the builder adds one `$feature/<key>` property per flag. A property
the caller sends under the same key wins.
- **Value source**: `$feature/*` on an event is now the value the app
rendered with. It follows the flag store, so for a moment after sign-in,
sign-out or an org or project switch it holds the previous values until
the refetch lands. The backend-computed `$active_feature_flags` is
unchanged and can differ from it in that window.
- **Logged-out docs, learn and ui-library events**: `$feature/*` now
holds the flag value the page was served. Until now the backend
evaluated it per visitor, so trends on those properties shift on each
app's deploy date.
- **Apps without PostHog flags**: www (`ph: false`) and kb (no provider)
keep an empty map, so their events get no new properties.

**Note:** I set the flags in the provider right before its state update
because an exposure event fired from a child effect, on the render where
its flag first resolves, must already see them. An effect in the
provider would run after that child effect. Events sent before the first
flag load still go out without browser flag values.

## To test

Tested on the PR preview:
- [x] Sign in to Studio and open the new project form. In the network
panel, find the `POST /platform/telemetry/event` request with action
`project_creation_default_privileges_exposed`: expect
`custom_properties` to include `$feature/dataApiRevokeOnCreateDefault`,
equal to `dataApiRevokeOnCreateDefaultEnabled`. Observed: both `false`,
response 201.
- [x] In Studio, after `GET /platform/telemetry/feature-flags` returns,
trigger any tracked event: expect its `custom_properties` to hold one
`$feature/<key>` entry per key in that response, with the same values.
Observed on `command_menu_opened` and the exposure event: every key in
the flags response present with the same value, no extra keys.
- [x] On the docs preview, trigger a tracked event after the flags
request returns: expect `$feature/<key>` entries matching the docs flags
response. Observed on `docs_search_v2_opened`: all keys match the
logged-out flags response.
- [x] On the www preview, trigger a tracked event: expect no
`$feature/*` keys in `custom_properties`. Observed on
`start_project_button_clicked`: `custom_properties` is
`{"buttonLocation":"Header Nav","platform":"www"}`, and www made no
feature-flags request.
## Linear
- fixes GROWTH-1395
2026-11-18 21:57:49 +09:00
Pamela Chia f678d3682f fix(studio): load PostHog flags after MFA verification (#53587)
For a user with MFA enabled, Studio requests PostHog flags once with the
pre-MFA token, the API refuses it, and nothing requests them again after
the challenge is verified. The flags stay missing until the user opens
an organization or project, or reloads, so pages reached straight after
MFA (`/organizations`, `/new`, `/account`) get no flag values.

I made `FeatureFlagProvider` refetch when the auth client reports a
verified MFA challenge. Verification changes none of the existing fetch
inputs (user, organization, project), which is why the refused first
response stuck.

**Note:** The refetch runs on any verified MFA challenge (sign-in,
enrolling a factor, identity re-verification), so users who never verify
a challenge make the same flag requests as before. I did not key it on
the access token, because that would refetch on every token refresh.

## To test

Tested on the PR preview, with a temporary TOTP factor on a staging
account:
- [x] Sign in with an MFA-enabled account, with the network log open,
landing on `/organizations`. Expect a `GET
/platform/telemetry/feature-flags` returning 200 with the account's
flags after `POST /auth/v1/factors/:id/verify`, before opening any
organization or project. Observed: flags 403 before the verify, verify
200, then one flags 200 with no organization or project param.
- [x] Repeat with `returnTo=/new`. Expect the same 200 after the verify
request. Observed: landed on `/new`, same order (403, verify 200, flags
200).
- [x] On the landing page after MFA, open the dev toolbar's Flags tab,
which reads the provider's PostHog flags. Expect the account's flags and
no `message` entry. Observed: the account's flags listed, no `message`
entry, and no flag-lookup console errors.
- [x] Sign in with an account without MFA. Expect no verify request, so
no refetch from this change. Observed: no `factors/:id/verify` request;
every flags request returned 200.
- [x] Enroll a TOTP factor in Account > Security. Expect one flags
request after the enrollment verify (the case the Note describes).
Observed: verify 200, then flags 200.

## Linear
- fixes GROWTH-1507
2026-11-18 16:26:38 +09:00
Sean Oliver b23e9e8d94 fix(consent): clear tracking state and reload when consent is withdrawn (#53294)
## Problem

Opting out from the Privacy Settings modal (www, docs, kb) clears no
cookies, and GTM keeps running. The banner's Opt out misses `_ga_<id>`,
`_dcid`, and PostHog.

## Solution

- `revokeTrackingConsent()` runs from `denyAll`, and from
`updateServices` unless every service is accepted. It clears `_ga`,
`_ga_*`, `_gcl_*`, `FP*`, `_dcid`, `session_id`, `ph_*_posthog`,
PostHog's localStorage, stale consent copies.
- PostHog resets and opts out, with persistence off. The opt-out
survives sign-out. A saved accept opts back in.
- Every opt-out calls `POST /platform/telemetry/reset` (keepalive,
errors ignored) to clear the API's HttpOnly `session_id`,
`anonymous_id`, and `user_id`. Studio's own call is removed.
- To stop GTM, a saved opt-out reloads the page if tracking was on,
waiting at most 1s for the reset.

## Review instructions

1. `cd packages/common && npx vitest run consent-state.test.ts
posthog-client.test.ts`
2. On prod: accept, open Privacy Settings, turn Marketing off, Confirm.
The page reloads with cookies gone and no `collect` request.

Tested: `common` (237 pass), `AnalyticsSettings` tests, CI unit tests
and typecheck. No browser test (previews lack Usercentrics).

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill
2026-11-17 16:38:23 -08:00
Pamela Chia c6a3a23dfb feat(studio): track free project limit blocks on downgrade and transfer (#53460)
Studio blocks a downgrade to the Free Plan and a project transfer when a
member would exceed their free project limit, and neither block is
tracked. This adds one event for each so we can count how often people
hit them. No UI change.

**Changed:**
- **Downgrade blocked**: `studio_billing_downgrade_blocked_modal_opened`
fires when confirming a downgrade opens the "members have exceeded their
free project limits" modal. It sits in `CancellationFlow`, so it covers
both the Cancel subscription button and the plan side panel.
- **Transfer blocked**: `project_transfer_preview_failed` fires when the
transfer preview for the selected target organization comes back with
members over the limit, once per preview. A refetch that returns the
same data does not fire it again.

**Note:** the transfer event fires from an effect on the preview data.
The notice appears when that data arrives, so there is no click handler
to attach it to.

## To test
Needs an organization on a paid plan with a running project, where an
owner or admin already has the maximum number of free projects in other
organizations.

Tested on the PR preview:
- [ ] Go to the org billing page, click "Cancel subscription" and
confirm the downgrade, expect the members-exceed-limit modal and one
telemetry request with action
`studio_billing_downgrade_blocked_modal_opened` carrying `currentPlan`
and `membersExceedingLimitCount`
- [ ] Open the plan side panel, pick the Free Plan and confirm, expect
the same modal and one more
`studio_billing_downgrade_blocked_modal_opened` request
- [ ] In project settings > General, click "Transfer project" and select
a Free Plan target organization, expect the "Project cannot be
transferred" notice listing members and one telemetry request with
action `project_transfer_preview_failed` carrying `sourcePlan`,
`targetPlan` and `membersExceedingLimitCount`
- [ ] Edge case: with the notice showing, switch to another browser tab
and back, expect no additional `project_transfer_preview_failed` request

## Linear
- fixes GROWTH-1510
2026-11-17 16:25:49 +09:00
anthony lio 22ea45a3ba feat: getting started v2 (#52511)
## Problem

* the getting started page is a stack of content listings: an overview,
use cases, framework quickstarts and tutorials
* a new reader must find a path in that list, and the page gives no
commands or agent prompt for their setup

## Solution

* adds a stepper to the getting started page, so a reader gets the steps
and an agent prompt for their setup
* adds the `docs-getting-started-v2` posthog flag, so the stepper and
the current page can run as an a/b test
* adds events for stepper choices, link clicks and prompt copies, so the
test can compare the two pages
* adds a markdown export of the stepper, so the `.md` page lists every
path for agents
* moves the iso shapes from kb into `ui-patterns`, so the docs feature
cards use the same shapes as the kb heroes
* changes the edge functions shape to a flat puzzle piece, because the
old shape had too many parts

<!-- linear:table-colwidths:397,397 -->
<table>
<thead>
<tr>
<th>state</th>
<th>preview</th>
</tr>
</thead>
<tbody>
<tr>
<td>after</td>
<td>


https://github.com/user-attachments/assets/7127d817-4240-4d08-a1c9-6ada1b1b2563

</td>
</tr>
</tbody>
</table>

## Review instructions

1. open
[/docs/guides/getting-started?docs-getting-started-v2=stepper](<https://docs-git-docs-getting-started-explorations-supabase.vercel.app/docs/guides/getting-started?docs-getting-started-v2=stepper>)
and make sure that the stepper shows with agent selected
2. select next.js and the auth card, then make sure that the setup
prompt names next.js and has a step for auth
3. open
[/docs/guides/getting-started?docs-getting-started-v2=stepper&start=cli&fw=nextjs](<https://docs-git-docs-getting-started-explorations-supabase.vercel.app/docs/guides/getting-started?docs-getting-started-v2=stepper&start=cli&fw=nextjs>)
and make sure that connect your app shows the install command and the
quickstart button

## 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>)
2026-11-13 17:46:38 +02:00
Pamela Chia 4998b77ab2 feat(studio): ask whether org creators know how to code (#53317)
I added the "Do you know how to code?" question (Yes / No, optional) to
the onboarding survey on the new organization form and in the follow-up
dialog. The answer is sent as `can_code` in the same survey request as
the other answers. I removed an earlier version of this question before
the survey shipped because the platform didn't store it; the platform
now accepts `can_code`.

**Changed:**
- **New question, always visible**: it shows on both surfaces without
waiting on another answer, so it can be answered on its own. Only the
`org_form` arm of the experiment shows the survey.
- **Follow-up dialog shows every question at once**: "What are you
building?" used to appear only after "Who is this org for?" was
answered. "How many people?" still appears only for the Company org
type.
- **Follow-up card above other banners**: I raised its priority in the
banner stack so it sits in front of the project-page cards for its
five-minute window.
- **Telemetry**: I added a `hasCanCode` boolean to
`onboarding_survey_submit_button_clicked` and
`onboarding_survey_submit_failed`.

**Note:** Merge only after the platform change that accepts `can_code`
is in production: before that, the API drops the key and still returns
204, so answers are lost with no error. The change is live once
`can_code` is listed under `OnboardingSurveyBody` in the production
platform OpenAPI spec. I widened `OnboardingSurveyBody` locally because
`packages/api-types` can only be regenerated once the production spec
has the field.

## To test
Setup: sign in and set the `onboardingSurveyPlacement` flag to
`org_form` with the dev toolbar.

Tested on the PR preview:
- [x] Open `/new`: expect "Do you know how to code?" below "What are you
building?" with Yes then No, before any other question is answered.
Answer both and create the org: expect one `POST
/platform/organizations/onboarding-survey` whose body has `building` and
`can_code`. Observed: both questions on the untouched form, options Yes
then No; one request, 204, body has `"can_code":"yes"`.
- [x] Create an org with only "Do you know how to code?" answered:
expect one request whose body has `can_code` and no `building` key.
Observed: one request, 204, `"can_code":"no"`, no `building` key, and no
follow-up card on the new org's page.
- [x] Create an org with the org type changed to Company, a size picked
and "Do you know how to code?" answered, leaving "What are you
building?" blank: expect one request with `kind`, `size` and `can_code`,
and no follow-up card on the new org's page. Observed: one request, 204,
`"kind":"COMPANY","size":"50","can_code":"yes"`; no follow-up card.
- [x] Create an org with "What are you building?" answered and the new
question left blank: expect the request body to have no `can_code` key,
and the org to be created. Observed: one request, 204, no `can_code`
key.
- [x] Create an org without touching the survey, then open the new org's
page: expect the "Help improve Supabase" card. Click Answer: expect all
three questions in the dialog right away. Answer all three questions and
send: expect one request with `kind`, `building` and `can_code`.
Observed: no survey request at creation; the card shows on the org page;
the dialog opens with all three questions blank; one request, 204, body
has `"can_code":"yes"`.
- [x] Set the flag to `control` and open `/new`: expect no survey
questions. Observed: none of the survey questions render.
- [x] Added check: `onboarding_survey_submit_button_clicked` carries
`hasCanCode`. Observed: `true` when answered on both surfaces, `false`
when left blank.

## Linear
- fixes GROWTH-1487
2026-11-13 23:14:29 +09:00
Sean Oliver 15bee88898 feat(kb): send search query text on kb_search_submitted (#53336)
Adds the trimmed search term as a query property on kb_search_submitted, matching docs search. Goes through the existing consent-gated kb telemetry path. Refs DOCS-1588.
2026-11-12 12:58:25 -08:00
Pamela Chia f2af7ea280 chore(studio): remove the terms of service update notice (#53323)
I removed the "We've updated our Terms of Service" notice from the
dashboard. It was added in #51302 and has been up since early October,
and it had no expiry of its own. I also removed its landing-path helper,
its tests and its dismissal key.

## To test
Tested on the PR preview, in a browser profile that never dismissed the
notice:
- [x] Open an organization's landing page (`/org/<slug>`): expect no
"We've updated our Terms of Service" card in the bottom right. Observed:
no card on the organizations list or on an org's landing page, with the
dismissal key unset on both.

## Linear
- fixes GROWTH-1494
2026-11-12 22:41:33 +09:00
c9291259f5 fix(studio): don't send duplicate pageviews for exact-URL repeats under TanStack (#53291)
Since Studio moved to the TanStack build (rolling release from Oct 27),
it sends a second `$pageview` for the same URL right after the first on
several pages. The router compat shim fires `routeChangeComplete` when
only the hash changes, which Next never did, so `PageTelemetry` records
the page again. On `/sign-in-mfa` this happens when the auth client
strips the token hash after an OAuth return.

**Changed:**
- **One pageview per URL**: `PageTelemetry` remembers the path + query
of the last pageview it sent and skips a route change that lands on the
same one. Identical-URL repeats were about 40% of `/sign-in-mfa`
pageviews and about 12% of all Studio pageviews, up from about 7% before
the rollout.
- **Filter changes still count**: a query-only change
(`?category=security`, `/customers?industry=...`) still sends a
pageview.
- **Referrer on new signups**: the repeat carries the live
`document.referrer` with no first-referrer override, so after an OAuth
return it reported the provider's domain. The github.com share of
`$initial_referring_domain` on signups roughly doubled after the
rollout. `$initial_*` values already written stay as they are.

**Note:** I kept the fix out of the shim. A shim filter on TanStack's
`pathChanged` would also drop query-change pageviews and stop the
command menu closing on same-path query navigations. Identical-URL
repeats that predate the rollout are dropped too (for example www
`/customers`, which calls `router.replace` on mount), so some Studio
page counts will land below their old baseline.

## To test
Tested on the Studio PR preview. Run `window.devToolbar()` in the
console, open the dev toolbar's Events tab, and filter for `$pageview`:
- [x] On any page, run `window.location.hash = 'x'` in the console,
expect no new `$pageview`
- [x] In a project's Logs, tick a Level filter (query change), expect
one `$pageview` per change with the new `?filter=` in its URL
- [x] Click from one project page to another, expect one `$pageview` per
navigation
- [x] Click the sidebar link for the page you are already on, expect no
new `$pageview`
- [x] Sign in through an external provider (tested with SSO), expect
exactly one `$pageview` for `/sign-in-mfa`. The toolbar opens after
login, so I checked this one in the staging event data.

## Linear
- fixes GROWTH-1491

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Pamela Chia <pamelachiamayyee@gmail.com>
2026-11-12 11:46:43 +09:00