Skip to content

platform-lite: real advisor lints + large-backlog get_issues regression eval - #552

Open
francis-codex wants to merge 2 commits into
supabase:mainfrom
francis-codex:feat/platform-lite-advisor-lints-large-backlog
Open

francis-codex wants to merge 2 commits into
supabase:mainfrom
francis-codex:feat/platform-lite-advisor-lints-large-backlog

Conversation

@francis-codex

@francis-codex francis-codex commented Nov 25, 2026 •

Copy link
Copy Markdown

Refs supabase/mcp#546, supabase/mcp#574

platform-lite's security advisor only returned rls_disabled_in_public, and the performance advisor returned an empty list. That meant no eval could exercise get_issues on a project with a real backlog. #574 is about that case: Mockamaster-sized projects with hundreds of findings, where ungrouped advisor output blows past the agent's tool-output limit.

platform-lite

  • Added 10 linter checks from the hosted database linter, with the same names, levels, cache keys and docs URLs.
    • Security: 0007, 0008, 0010, 0011, 0016.
    • Performance: 0001, 0003, 0004, 0006, 0009.
  • The performance route now returns real lints.
  • rls_disabled_in_public remediation is now the docs URL (0013), as in the hosted API. Before, get_issues was surfacing an SQL string as docs_url.
  • test/advisor-lints.test.ts covers each lint with one positive and one negative case.

eval: regression/investigate-database-001-large-advisor-backlog

  • The seed is shaped like the Mockamaster capture in feat(evals): support suite-owned customMetadata in eval frontmatter #546: 547 findings in 11 issues, 8 at warning or worse.
  • The 3 critical issues (RLS disabled, a policy that exists while RLS is off, and a security definer view) all trace to public.payments. The right first fix is enabling RLS on that one table.
  • Checks:
    1. get_issues was called.
    2. The largest get_issues result is ≤100k chars and did not hit the client's token-limit error. When a client spills a large result to a file, the size is read from the spill notice, since the agent can still read the file.
    3. A judge confirms enabling RLS on payments is ranked first, treating the 3 critical issues as one cause, ahead of the volume warnings.

experiment: regression/claude-code-opus-5.5-large-advisor-backlog

Measured on the seed (MCP at a0137116, stdio client):

call chars
get_issues severity=info (default), 11 issues 66,307
get_issues severity=warning, 8 issues 45,384
get_issues severity=critical, 3 issues 2,702
get_advisors type=performance 137,035

The 100k bound is roughly the 25k-token tool output limit common MCP clients enforce. If output regresses to ungrouped, it fails check 2.

Tests: pnpm test in packages/platform-lite passes 110/110, pnpm typecheck is clean, and eval:dry plans the eval on the new experiment.

Live run on the pinned experiment, no local MCP checkout: 3/3 checks in 86s. get_issues returned 64.8KB and the agent put enabling RLS on public.payments first.

@francis-codex
francis-codex requested a review from a team as a code owner November 25, 2026 11:48
@vercel

vercel Bot commented Nov 25, 2026

Copy link
Copy Markdown

@francis-codex is attempting to deploy a commit to the Supabase Team on Vercel.

A member of the Team first needs to authorize it.

…on eval

Adds 10 Supabase database linter checks to platform-lite (security:
policy_exists_rls_disabled, rls_enabled_no_policy, security_definer_view,
function_search_path_mutable, materialized_view_in_api; performance:
unindexed_foreign_keys, auth_rls_initplan, no_primary_key,
multiple_permissive_policies, duplicate_index). The performance advisor
now returns real lints instead of an empty list. rls_disabled_in_public
remediation is now the docs URL, matching the hosted API.

New regression eval investigate-database-001-large-advisor-backlog seeds
a Mockamaster-shaped project: 547 findings in 11 issues, 8 at warning or
worse, and 3 critical issues that all trace to public.payments having RLS
disabled. It checks get_issues was called, its output stayed under 100k
chars without harness truncation, and the agent ranked enabling RLS on
public.payments first.

The experiment pins supabase/mcp at a0137116 (supabase#546 head) so it runs
without a local MCP checkout. Drop the pin once get_issues ships.

Refs supabase/mcp#546, supabase/mcp#574
@francis-codex

Copy link
Copy Markdown
Author

repinned to the #546 merge commit on main (01f8021) now that it's merged. live run against it: 3/3, largest get_issues result 64.8k chars, agent fixed rls on payments first. i'll drop the pin once get_issues is in a published release, and re-measure after the docs_url change lands.

@francis-codex
francis-codex force-pushed the feat/platform-lite-advisor-lints-large-backlog branch from cef8df9 to 0e4e5fd Compare November 25, 2026 16:22
barryroodt pushed a commit to supabase/mcp that referenced this pull request Nov 26, 2026
## What kind of change does this PR introduce?

Bug fix (response size). Follow-up to #546, as @barryroodt asked on #574
([comment](#574 (comment))).
Refs #124.

## What is the current behavior?

Every finding in `get_issues` repeats its issue's `docs_url`. In
splinter, each lint has one fixed remediation link, so these copies add
no data for splinter lints. On a project the size of the Mockamaster
capture in #546 (547 findings in 11 issues), the copies are about 22% of
the default response.

## What is the new behavior?

Findings no longer carry `docs_url`. The issue keeps its `docs_url`, so
every finding still reaches the link through its issue. Nothing else in
the output changes.

| Call | Before | After | Saved (chars / tokens) |
|---|---:|---:|---:|
| default | 62,296 chars, 15,225 tokens | 48,243 chars, 11,614 tokens |
22.6% / 23.7% |
| `severity: warning` | 43,789 chars, 10,533 tokens | 34,836 chars,
8,252 tokens | 20.4% / 21.7% |

I ran the real splinter SQL in PGlite on the supabase/evals#552 seed and
fed the lints to the real `get_issues` on `main`. Splinter also flags 41
unused indexes there, because a fresh database has no index scans. I
left those out to match 547 findings in 11 issues. With them, the
default call goes from 69,279 to 53,346 chars (23.0%). Tokens are OpenAI
`o200k_base`; I did not count Claude tokens. In every call I ran, each
removed link was equal to its issue's link, and the rest of the output
is byte-identical.

There is exactly one way this change can lose data: two findings of the
same lint with different docs links, where the second link is now gone.
I checked splinter at
[`cc529aa9`](https://github.com/supabase/splinter/blob/cc529aa9d3eeffd2e64576c7591e60b22abd205c/splinter.sql):
each of its 31 lints has one constant remediation, so this can't happen
there. I can't see the platform-only and health lints, though: can you
confirm that none of them gives two findings of one lint different
links?

## How to Review

1. **Output contract**
   - `packages/mcp-server-supabase/src/issues.ts`
- `docs_url` leaves the finding schema and the finding object. The
issue-level `docs_url` does not change. `get_issues` uses this schema as
its output schema, so `tools/list` changes too.

2. **Tests**
- `packages/mcp-server-supabase/src/server.debugging.test.ts`: a new
size test calls `get_issues` through the server harness on 547 findings
in 11 issues. The default response must stay under
`LARGE_PROJECT_ISSUES_BUDGET` (48,000 chars).
- `packages/mcp-server-supabase/src/issues.test.ts`: one #546 test gave
two findings of one issue different links. It now checks the issue's
link, and that a finding has no `docs_url`.

**Review questions**

- [ ] Is 48,000 chars a good budget? It is about 10% above today's
43,493 for this fixture, so it catches growth early. It is well under
the 25,000-token limit from #124.
- [ ] If a platform-only or health lint can give different links
(question above), should I keep `docs_url` on a finding only when it
differs from the issue's link?
- [ ] Should this land before the release in #586? Then no published
version has `docs_url` on findings.
- [ ] Do the tests check output, not implementation details?

## Verification

- With `main`'s `issues.ts`, the new size test fails with `expected
56866 to be less than 48000`. On this branch it passes at 43,493.
- `pnpm format:check`, `tsc --noEmit`, and `vitest run --project unit`:
1028/1028 passed.

## Additional context

This changes the `get_issues` output schema: `issues[].affected[]` no
longer has `docs_url`. So it is best merged before that schema goes into
a ChatGPT submission. If #586 merges first, the field is in a published
release. Then I will mark the commit as breaking, as CONTRIBUTING asks
for a contract step.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant