Commit Graph
3 Commits
Author SHA1 Message Date
6738dded80 feat(studio): add Health Advisor page (#49663)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Feature

## Summary

- Add a Health Advisor page at `/project/[ref]/advisors/health`
- Put Health Advisor first in the Advisors left nav (above Security),
platform-only
- Register `V` then `H` and a command-menu entry

Stacked on #49662. Top of the stack.

## To test

1. Open any project in Studio.
2. Click **Advisors** in the main nav (or go to
`/project/<ref>/advisors/security`).
3. In the left nav, confirm the order is **Health Advisor**, then
Security Advisor, then Performance Advisor, then Query Performance.
4. Click **Health Advisor**. You should land on a page titled “Health
Advisor” with Errors / Warnings / Info tabs, same layout as Security
Advisor.
5. If the project is healthy, Errors should say no errors were detected.
If it is not, the failing checks should list here (database down,
connection limit, and so on).
6. Click **Refresh** (or Shift+R) and confirm the list reloads.
7. Click a row and confirm the detail panel opens with a link through to
logs, connections, or infrastructure.
8. While still in Advisors, press **V** then **H**. You should jump back
to Health Advisor.
9. Open the command menu and search **Health Advisor**. Choosing it
should navigate to this page.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Added a Health Advisor page for reviewing project health findings by
severity and category.
- Added Health Advisor navigation in the advisor menu and a keyboard
shortcut (`V`, then `H`) on supported platforms.
- Added refresh, filtering, selection, and lint detail navigation for
health findings.

- **Bug Fixes**
- Added validation for linter severity values, safely handling
unsupported or missing inputs.

- **Documentation**
- Updated migration and shortcut documentation to include the Health
Advisor.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-03 11:42:39 +02:00
Douglas J Hunley eea39cc316 fix(studio): register pitr_archiving_stale in the advisor lintInfoMap (#48044)
## Summary
Studio's Advisor UI reads lint metadata from a fixed `lintInfoMap`, not
from the API response. A lint name missing from that map shows a blank
title, no icon, no filter checkbox, and no remediation link. This PR
adds a `pitr_archiving_stale` entry to `lintInfoMap`, copied from the
existing `pitr_not_enabled` entry, so the new lint renders correctly in
the Advisor UI.

## Dependencies

> [!WARNING]
>
[supabase/platform#35862](https://github.com/supabase/platform/pull/35862)
defines the `pitr_archiving_stale` lint. Until it merges, the API never
sends this lint name, so the Advisor grid and the public
`/v1/projects/{ref}/advisors/security` response never show the new row
-- but the Security Rules page
(`/project/<ref>/advisors/rules/security`) renders one row per
`lintInfoMap` entry regardless of the API, so this PR's new row appears
there immediately, before the backend lint exists. See Details for what
that means in the gap between merges.

---

<details>
<summary>Details</summary>

- A lint name missing from `lintInfoMap` has these effects:
- The grid row shows a blank title and no icon. There is no fallback to
the API's own `title`.
- The row has no filter checkbox. Filter options come from
`lintInfoMap`, not from the API.
- The row has no lint-specific remediation link. The "Learn more" link
falls back to the generic database-linter page.
  - The row does not appear in the Advisor Rules enable/disable list.
- The new `pitr_archiving_stale` entry copies the existing
`pitr_not_enabled` entry's `link`, `docsLink`, and `category`, and uses
a new `title` matching
[supabase/platform#35862](https://github.com/supabase/platform/pull/35862)'s
lint definition verbatim. Its `name` also matches that lint definition
exactly.
- **Known gap, until the backend PR merges:** `AdvisorRules`
(`components/interfaces/Advisors/AdvisorRules.tsx`) filters
`lintInfoMap` by `category` alone, with no dependency on the API
returning the lint -- so this entry makes a "PITR archiving may be
broken" row appear on the Security Rules page for every project right
away, ahead of the backend lint actually existing. From that row, a user
can open `CreateRuleSheet` and submit a disable rule, which `POST`s
`lint_name: 'pitr_archiving_stale'` to the notification-exceptions
endpoint. That name is not yet in the generated
`CreateNotificationExceptionsBody` enum
(`packages/api-types/types/platform.d.ts`), so the request either errors
or stores an exception keyed to a lint name nothing will ever match,
until api-types regenerates after the backend PR ships. This window
closes on its own once
[supabase/platform#35862](https://github.com/supabase/platform/pull/35862)
merges; accepted as a short-lived tradeoff rather than gating this PR on
merge order or adding code to hide the row until then.
- The docs anchor (`#point-in-time-recovery`) explains what PITR and
WAL-G archiving are. It does not explain how to fix a stale or broken
archive. That content does not exist yet in either pull request.
INDATA-1149 tracks this as a follow-up.
- `packages/api-types/types/platform.d.ts` is a generated file. This
repo's own CLAUDE.md says never to hand-edit it. The file does not list
`pitr_archiving_stale` yet, because it regenerates only after the
backend lint ships and `pnpm api:codegen` runs. Until then,
`LintInfo['name']` stays a plain `string`. If someone misspells the new
entry's `name`, the code still compiles and the tests still pass. At
runtime, the icon and docs link fall back silently instead of failing a
build. Once
[supabase/platform#35862](https://github.com/supabase/platform/pull/35862)
merges and api-types regenerates, `LintInfo['name']` must tighten to the
generated `LINT_TYPES` union. This closes the gap for every lint entry,
not only this one.

</details>

---

<details>
<summary>Testing</summary>

- `pnpm --filter=studio test Linter.utils.test.tsx` (17 passed,
including a test that asserts the `pitr_archiving_stale` entry's shape)
- `pnpm typecheck --filter=studio` (clean)
- `pnpm exec eslint` on the touched files (clean; the `pnpm lint
--filter=studio` turbo wrapper itself errors on this machine with an
unrelated JSON-parse failure -- a tool-invocation issue, not a lint
finding)
- `prettier --check` on the touched files
- The `docsLink` assertion
(`toContain('/guides/platform/backups#point-in-time-recovery')`) is
domain-agnostic by construction, so it holds regardless of which
`NEXT_PUBLIC_DOCS_URL` value is set -- no test in this file overrides
that variable, this is a property of the assertion's own shape, not a
scenario the suite exercises

</details>

---

<details>
<summary>Misc</summary>

- Part of INDATA-979
- Changelog:
[supabase/changelog#192](https://github.com/supabase/changelog/pull/192)

</details>
2026-08-31 15:28:37 -04:00
oniani1 a95b6f9013 fix(studio): encode special characters in database advisor lint links (#45385)
The link builders in
`apps/studio/components/interfaces/Linter/Linter.utils.tsx` interpolate
`metadata.schema` and `metadata.name` directly into URL query strings. A
schema or table name with `&`, `=`, `+`, or `#` breaks the destination
filter on the linked page because `URLSearchParams` stops at the bare
`&` and decodes `+` to a space.

The `public_bucket_allows_listing` lint at line 338 already wraps
`bucket_id` in `encodeURIComponent`. The other 15 builders did not. This
wraps each `metadata?.schema` and `metadata?.name` interpolation with
`encodeURIComponent(value ?? '')` to match.

Added `Linter.utils.test.tsx` that constructs links with a schema
`a&b=c` and a name `d e+f` and asserts `URLSearchParams` round-trips
them. The bucket precedent is also covered.

Closes #45384

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved URL encoding for navigation links in the linter interface to
ensure proper handling of special characters in database, schema, and
table names.

* **Tests**
* Added test coverage for URL generation functionality in the linter
utility.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-04 22:02:07 +08:00