Repository navigation
feat(debugging): add project issues DEBUG-311 - #546
Conversation
The shuffled origin/main baseline registers two lazy MCP SDK schemas on the first connection. Initialize that connection before measuring repeated server creation so the zero-growth assertion remains independent of test order.
Coverage Report for CI Build 45143506798Coverage increased (+0.03%) to 98.189%Details
Uncovered Changes
Coverage Regressions1 previously-covered line in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
commit: |
barryroodt
left a comment
There was a problem hiding this comment.
Thanks for this @jordienr!
Please could we look at the following before merging:
- Merge
mainand drop the generated-types commit + the README paragraph. - Fix the four "Must fix" comments. (inline)
- Add an eval for it in supabase/evals. A scenario that passes with
get_issuesfrom your preview build would be great.
The "Smaller" comments (also inline) don't block.
| checks: [ | ||
| { | ||
| type: category, | ||
| status: unavailable.length ? 'unavailable' : 'complete', |
There was a problem hiding this comment.
Smaller: agree with us how an unavailable check shows up in the hosted metrics.
On hosted we count each tool call as ok or as an error. A get_issues call that returns unavailable here still counts as ok, so we can't see how often an assessment comes back incomplete.
I don't have a mechanism to suggest yet, so this is one to work out together in #team-ai.
@jordienr We also made it easier to test MCP source changes against evals in supabase/evals#514 so you can iterate on these without a preview build! |
barryroodt
left a comment
There was a problem hiding this comment.
Looks good, thanks Jordi! My inline comments are non-blocking, so feel free to merge whenever you're ready.
| const response = await adapter(project_id, { | ||
| includeUnavailable: true, | ||
| }); | ||
| return normalizeIssues(response, category); |
There was a problem hiding this comment.
One unexpected lint hides every other finding in its category. I agree with flagging malformed responses. If one lint has a new level, though, the user gets an unavailable check with the raw Zod error. The generated v1 and v2 lint types all fit lintSchema today, so this only comes up when a live payload drifts from the spec (a null in cache_key, or a new level).
I'd use safeParse on each lint so we can return the valid findings. For the check itself, I'd flag how many lints we skipped so a partial result can't read as clean.
| value.code <= -32000) || | ||
| value.code === 'UNAUTHORIZED' || | ||
| value.code === 'FORBIDDEN' || | ||
| (value.cause !== error && |
There was a problem hiding this comment.
Nit: the caller can get a RangeError where it expects an unavailable check. The guard covers an error that points to itself, but two errors that point to each other will overflow the stack. I'd add a small depth cap for that rare case.
…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
The budget comment now says what the size test checks: growth of more than about 10% fails. The supabase#546 test name now says that the docs link is on the issue. The finding no longer has its own remediation link. No assertion or constant changes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
## 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]>
🤖 I have created a release *beep* *boop* --- <details><summary>mcp-utils: 0.11.1</summary> ## [0.11.1](mcp-utils-v0.11.0...mcp-utils-v0.11.1) (2026-11-26) ### Bug Fixes * **mcp-ui:** shared project card for create-project and create-branch ([#578](#578)) ([efe189f](efe189f)) </details> <details><summary>mcp-server-supabase: 0.20.0</summary> ## [0.20.0](mcp-server-supabase-v0.19.0...mcp-server-supabase-v0.20.0) (2026-11-26) ### Features * **debugging:** add project issues DEBUG-311 ([#546](#546)) ([01f8021](01f8021)) * **mcp-server-supabase:** add optional schemas parameter to generate_typescript_types ([#592](#592)) ([7532f53](7532f53)) ### Bug Fixes * **debugging:** link docs once per issue in get_issues ([#610](#610)) ([74801d8](74801d8)) * **mcp-server-supabase:** detect import maps uploaded with a ./ prefix ([#591](#591)) ([6b8f4dc](6b8f4dc)) * **mcp-server-supabase:** keep a declined or cancelled SQL confirmation final ([#581](#581)) ([03afe8e](03afe8e)) * **mcp-server-supabase:** match Studio's notebook row_limit and clarify skip and blank-input messages ([#593](#593)) ([ad07f1b](ad07f1b)) * **mcp-server-supabase:** skip cost confirmation for $0 projects on clients without forms ([#608](#608)) ([50cfc37](50cfc37)) * **mcp-server-supabase:** stop reusing a removed import map on edge function redeploy ([#588](#588)) ([56093a6](56093a6)) * **mcp-ui:** shared project card for create-project and create-branch ([#578](#578)) ([efe189f](efe189f)) * **mcp:** confirm UPDATEs without WHERE that follow a comment and set a dollar-quoted value ([#612](#612)) ([468907a](468907a)) * **mcp:** confirm UPDATEs without WHERE that use inheritance syntax ([#565](#565)) ([687b3ee](687b3ee)) * **mcp:** confirm UPDATEs without WHERE when a column name ends in where ([#557](#557)) ([57fa34b](57fa34b)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
Local HTTP E2E against Mockamaster · 23 Nov 2026
Ran the official server and matching utils preview packages from
a0137116ef03998cb00dc3ac9b18b698fea5234busing the built-in loopback HTTP server, staging Management API, project-scoped read-only mode, and the debugging feature group. Both scoped clients initialized with protocol2026-07-28and discoveredquery_logs,get_issues, andget_advisors.advisors_read; health reported Forbidden. Discovery remained available.Actual
tools/callparameters and decoded response content:{"name":"get_issues","arguments":{"type":"health"}}{"issues":[],"checks":[{"type":"health","status":"complete"}]}{"error":{"name":"ToolCallerError","message":"Forbidden"}}Separate local tests exercised the companion Platform controller at
ec68d80with fixture authentication, permissions and backend data. All eleven assertions passed across modern and legacy HTTP, including both permission metadata entries, missing permission and wrong-project denial. Denied calls made zero backend requests. The live Mockamaster run above used real staging permissions. Shared hosted ingress and its deployed version remain outside this local test. All temporary QA tokens were revoked.Current review follow-up (
a013711)Merged current main. Review checklist:
affected_countgives the total andaffectedcontains at most 20 findings, ordered by severity and ID. Truncation and shuffled-input regressions pass.allstill reports health unavailable.Companions: Platform #41754, Studio #53837, evals #542, and docs #53313. The official eval passed all three checks on this MCP revision, including the model-judged report, tool use and unchanged RLS settings. Eval run.
Validation on this head: full build and typecheck, 971 unit tests, changed-file Biome and diff checks passed. Primary independently passed the affected tests with shuffled order and the actual Studio adapter integration. The seeded platform-lite STDIO probe confirmed two grouped security findings, unavailable health coverage, and legacy discovery. The same probe then passed with the official published MCP preview and matching utils installed into an isolated npm consumer; it checked
affected_count: 2through a real child process and localhost upstream. Latest-head CI passed: test (including packaged consumer), UI tests, type/API checks, quality, Coveralls, and preview publication. The unrelated Proof check was conditionally skipped. Latest test run.Incomplete-assessment metrics need team agreement and are tracked in DEBUG-345: proposed bounded category/status observations or counts, excluding findings and payloads. No hosted metric semantics changed in this PR.
Problem
Studio is moving from Advisors to Issues Inbox. MCP clients need the same Issues interface, including health checks, grouped findings, and severity filtering.
What this adds
get_issuesin the debugging tool group, combining security, performance, and health checks through existing Management API endpoints.affected_countfor the full total.get_issuesandget_advisorsremain visible in discovery and callable. Advisors keeps its existing parameters and response contract, with an informational notice about planned future deprecation.Also fixes a pre-existing order-dependent registry test by initializing SDK schemas before measuring repeated server creation, preserving the zero-growth assertion.
Interface and parameters
get_issues({ project_id, type, severity })project_idtypeall,security,performance,healthallallrequests all three. Platforms without health support omithealthfrom the advertised enum and report its coverage as unavailable forall.severityinfo,warning,criticalinfowarningincludes warning and critical groups;criticalincludes only critical groups. Matching groups include a bounded sample of up to 20 findings and the fullaffected_count.Underlying Advisors levels map as
INFO→info,WARN→warning, andERROR→critical. Severity filtering does not change check coverage.The captured discovery schema advertises
typeandseverityas required and includes their defaults. Runtime calls with these fields omitted apply the defaults. Clients following discovery should send both explicitly.Example requests
Unscoped connection:
{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "get_issues", "arguments": { "project_id": "erppftcfodkcyoftaqvb", "type": "security", "severity": "warning" } } }Project-scoped connection:
{ "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "get_issues", "arguments": { "type": "all", "severity": "info" } } }These examples document the interface; the captured requests and responses below are actual live evidence.
Result fields
The result payload contains
issuesandchecks:issues[].idtitle,descriptionseveritycategorysecurity,performance, orhealth.sourcelint.docs_urlaffected_countaffected[]id,resource(type,name, nullableschema),detail,severity, anddocs_url.checks[]type),status(completeorunavailable), and optionalreason.An empty
issuesarray means no issues matched the filter; inspectchecksbefore concluding the assessment is complete. When a platform does not implement health checks,type: "all"reports health as unavailable; the advertised enum excludeshealth, so an explicit health request is rejected. Individual upstream or malformed-result failures become unavailable coverage with a reason while preserving other categories. Authentication, permission, and protocol errors still fail the call.Permissions and discovery
advisors_read; the companion Platform PR #41754 mapsget_issuesand legacyget_advisorsto that permission.query_logsandget_issues. The legacy tool remains visible and callable.get_issueseven for a valid token lacking Advisors access; invocation is denied. Discovery is not proof of authorization.Historical verification
Verified source head:
279778822164f64a48100708712cb4632ade3798.advisors_readtoken versus validproject_admin_readtoken without Advisors accessLatest-head test run · Preview publication
Mockamaster had no critical, mixed-severity, or unavailable findings during capture; those scenarios are covered by fixtures, not claimed as live coverage. Both temporary scoped QA tokens were revoked after testing and their local credential files deleted. No project schema, data, or settings were changed.
Hosted rollout remains pending: at the 12 November 2026 capture, deployed staging MCP
0.16.1still advertisedget_advisors, returnedtool not foundforget_issues, and omitted it from permission metadata. The successful new-tool checks used this PR's server over STDIO against live Mockamaster APIs. They do not establish that the hosted adapter has been deployed.Historical screenshots
Actual terminal captures from the built PR server against Mockamaster, scoped read-only over STDIO. Credentials are not shown.
Health request and response
Full decoded tool payload: no findings, complete health coverage, successful exit.
Security warning filter
Six warning issues and complete security coverage. For readability, this screenshot projects the response to check ID, title, severity, and affected count; it is not the full raw response.
Earlier captured requests, responses, permissions, and discovery
Expand historical capture from 2797788 (before Advisors visibility was restored)
This earlier capture retains its original requests and responses. Its hidden-Advisors discovery result is superseded by the compatibility verification above. The current bounded evidence and partial-failure contracts supersede the historical payload format below.
Live Mockamaster MCP evidence, 12 Nov 2026
Target: staging Mockamaster (
erppftcfodkcyoftaqvb), organizationjordi-team; upstreamhttps://api.supabase.green. New code ran through STDIO, source head2797788, using--project-ref erppftcfodkcyoftaqvb --read-only --features debugging. Captures: 13:16:14–13:16:28 UTC with normal CLI login, then 13:21:18–13:21:34 UTC with two temporary project-only scoped PATs created through the normal dashboard UI, each with a 24-hour expiry. Tokens and session identifiers are excluded from this report. No project schema/data/settings were changed.The new local MCP passed live scoped permission checks. The deployed hosted MCP still lacks
get_issues; its legacyget_advisorscorrectly enforced the same permission in the control calls. This demonstrates local new-code behavior against live staging upstream APIs, not a completed hosted rollout.Actual result summaries below are projections of complete captured responses:
get_issuessecurity / performance / health / allget_advisorssecurity call succeeds with 7 lintsadvisors_readproject_admin_read, withoutadvisors_readisError: true; security/performance/all report missingadvisors_read; health reports ForbiddenActual discovery request:
{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}Both scoped credentials received the same local
tools/list:query_logs,get_issues. Discovery advertises the tool even when the credential cannot execute it.get_advisorsis absent from new-code discovery. Selected completeget_issuesentry from the actual tools/list response, explicitly an excerpt of that response:{"name":"get_issues","description":"Gets current project issues grouped by check, with security, performance, and health check coverage. Start here when debugging or after DDL changes. IDs identify checks within this project, not persistent incidents. An unavailable check is not a clean assessment. Include docs_url as a clickable remediation link.","annotations":{"title":"Get project issues","readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"type":{"default":"all","type":"string","enum":["all","security","performance","health"]},"severity":{"description":"Minimum severity; filtering retains all findings of a matching issue","default":"info","type":"string","enum":["info","warning","critical"]}},"required":["type","severity"],"additionalProperties":false}}Complete actual local STDIO health request, sent separately with each scoped credential:
{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"get_issues","arguments":{"type":"health"}}}Complete actual response with
advisors_read:{"result":{"content":[{"type":"text","text":"{\"issues\":[],\"checks\":[{\"type\":\"health\",\"status\":\"complete\"}]}"}]},"jsonrpc":"2.0","id":5}Complete actual response without
advisors_read:{"result":{"content":[{"type":"text","text":"{\"error\":{\"name\":\"ToolCallerError\",\"message\":\"Forbidden\"}}"}],"isError":true},"jsonrpc":"2.0","id":5}Hosted control endpoint:
https://mcp.supabase.green/mcp?project_ref=erppftcfodkcyoftaqvb&read_only=true&features=debugging. Both scoped credentials initialized successfully and received legacyquery_logs,get_advisorsdiscovery. Complete actual legacy health request, sent separately with each credential:{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_advisors","arguments":{"type":"health"}}}Complete actual response with
advisors_read(HTTP 200):{"result":{"content":[{"type":"text","text":"{\"result\":{\"lints\":[]}}"}]},"jsonrpc":"2.0","id":3}Complete actual response without
advisors_read(HTTP 200, MCP tool error):{"result":{"content":[{"type":"text","text":"{\"error\":{\"name\":\"ProtocolError\",\"message\":\"MCP error -32600: You do not have permission to perform this action\"}}"}],"isError":true},"jsonrpc":"2.0","id":3}The earlier normal-login hosted initialization identified server version
0.16.1, protocol2025-03-26. The complete actualget_issueshealth request and response demonstrate the rollout gap (HTTP 200, MCP tool error):{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_issues","arguments":{"type":"health"}}}{"result":{"content":[{"type":"text","text":"{\"error\":{\"name\":\"Error\",\"message\":\"tool not found\"}}"}],"isError":true},"jsonrpc":"2.0","id":3}Hosted OAuth protected-resource discovery returned HTTP 200 at
https://mcp.supabase.green/.well-known/oauth-protected-resource/mcp. Deployed permission discovery returned HTTP 200 athttps://api.supabase.green/platform/mcp-tools-permissionsin both captures. It contains"get_advisors":[["advisors_read"]](selected entry, not the complete response) and has noget_issuesentry. Source platform draft mapping includes both names underadvisors_read; deployed metadata does not yet include the new name.Complete newline-framed STDIO requests/responses, full paired exchanges, full HTTP bodies, timestamps, and executable provenance are retained privately. The complete health exchanges above are unprojected captured JSON-RPC bodies; the discovery entry and counts are explicitly labeled excerpts/projections. Executable SHA256:
43c65640d8efe798ce264b9bfbbe2442f14174fa8a4e6408351c792e0310221c. No token values, token hashes, credential file paths, or authentication/session headers appear here.Cleanup: both temporary QA tokens were revoked in the dashboard after the captures. The filtered token list confirmed neither remained; both local credential files were deleted.
How to test
a0137116ef03998cb00dc3ac9b18b698fea5234band use a project-scoped, read-only connection with debugging enabled. The official preview package is published and passed the seeded local artifact probe; older captures below use earlier artifacts.tools/list: expectget_issues, with the parameters above;get_advisorsshould also be present.get_issuesfor each type and each minimum severity. Verify matching groups include no more than 20 affected findings,affected_countgives the full count, and requested coverage is explicit.get_advisorsdirectly and verify its existing response remains supported.Persistent issue state, dismissal, history, and banned-IP signals remain follow-ups.
Linked issue: DEBUG-311.
Historical review follow-ups
Review follow-up (
02d500f)get_issuesnow requests unavailable results from the security and performance adapters as well as health. Legacyget_advisorsdoes not opt in. Platform support is tracked in supabase/platform#41754.Verified: 32 focused tests passed with retries disabled and shuffled order (seed 1113), plus typecheck and formatting. The new regression cases failed before the fix. Latest-head CI is green; an unrelated generated Edge Function response test passed on its one rerun.
Reproducible official preview (
c3b6c54)Preview publication now checks out the exact PR head. Previously it built the merge ref, pulling in upstream dependency changes absent from the reviewed source and breaking the Platform consumer. The corrected official artifact installs under Platform's unchanged supply-chain protections, passes 272 scoped hosted E2E/unit tests twice (independent shuffle seed 1115, retries disabled), and passes actual Mockamaster discovery and calls to both tools. All latest MCP CI checks pass. Platform #41754 used this artifact for local QA only; its committed dependency remains unchanged pending a published release.
Compatibility clarification
Advisors stays visible, discoverable, documented, and usable alongside Issues. Deprecation is planned for a future release; the informational notices do not announce removal or a removal date. Existing contracts and permissions remain supported.
Verified correction at
85feaddIndependent QA passed 68 affected unit tests with retries disabled and shuffle seed 1114. Worker verification passed 87 unit/schema tests, build/typecheck, Biome, and all 7 STDIO integration tests; restoring
hidden: truecaused four discovery assertions to fail.Fresh actual STDIO calls against Mockamaster returned discovery names
query_logs,get_issues, andget_advisors. Bothget_issues({type:"health"})andget_advisors({type:"security"})succeeded without tool or protocol errors. Captured 12 November 2026 at 15:50 UTC from source85feadd2f2e4235d4e41c376a8a08e59a2397771; executable SHA256bed5ad3e5ecd5e988a5eeae121ac358d5b83bbfd367bb343939310082d33151c. No new tokens or project writes.All latest-head CI checks pass, including the test suite and coverage. One unrelated LLM evaluation initially omitted an invocation example; its failed job passed on rerun.