Skip to content

fix(ci): publish previews from PR head DEBUG-311 - #602

Draft
jordienr wants to merge 1 commit into
mainfrom
jordi/debug-311-preview-head-checkout
Draft

jordienr wants to merge 1 commit into
mainfrom
jordi/debug-311-preview-head-checkout

Conversation

@jordienr

Copy link
Copy Markdown
Member

Problem

Preview packages can be built from GitHub’s synthetic merge commit, which includes main changes absent from the reviewed PR head. Consumers then test a different dependency graph from the source under review.

Fix

Check out the immutable pull request head SHA before building and publishing preview packages. This change is split from MCP #546 so it can be reviewed and reverted independently.

How to test

  • Confirm the workflow checkout uses github.event.pull_request.head.sha and retains complete history.
  • Label a PR publish-preview; verify the published artifact corresponds to the PR head and installs in a downstream consumer.

Validation: primary independently inspected the one-line diff and parsed the workflow. Publication needs the preview-labelled workflow run.

Linked issue: DEBUG-311.

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 45143616437

Coverage remained the same at 98.157%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 6369
Covered Lines: 6274
Line Coverage: 98.51%
Relevant Branches: 1388
Covered Branches: 1340
Branch Coverage: 96.54%
Branches in Coverage %: Yes
Coverage Strength: 296.23 hits per line

💛 - Coveralls

jordienr added a commit that referenced this pull request Nov 25, 2026
## Local HTTP E2E against Mockamaster · 23 Nov 2026

Ran the official server and matching utils preview packages from
`a0137116ef03998cb00dc3ac9b18b698fea5234b` using the built-in loopback
HTTP server, staging Management API, project-scoped read-only mode, and
the debugging feature group. Both scoped clients initialized with
protocol `2026-07-28` and discovered `query_logs`, `get_issues`, and
`get_advisors`.

| Mockamaster-only credential | Project-read control | Actual tool calls
|
| --- | --- | --- |
| Advisors Read | 403 (missing Project Settings Read) | All eight Issues
calls and three legacy Advisors calls succeeded. Security 7 groups,
performance 4, health 0, all three checks complete. With minimum
severity info / warning / critical, counts were 11 / 8 / 0. |
| Project Settings Read only | 200 | All eleven tool calls returned MCP
tool errors. Security and performance reported missing `advisors_read`;
health reported Forbidden. Discovery remained available. |

Actual `tools/call` parameters and decoded response content:

```json
{"name":"get_issues","arguments":{"type":"health"}}
```

- Advisors Read:
`{"issues":[],"checks":[{"type":"health","status":"complete"}]}`
- Project Settings Read only:
`{"error":{"name":"ToolCallerError","message":"Forbidden"}}`

Separate local tests exercised the companion Platform controller at
`ec68d80` with 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:

- [x] Self-hosted compatibility: Issues accepts bare arrays and hosted
envelopes; legacy output stays intact. [Studio
#53837](supabase/supabase#53837) covers the real
adapter and primary independently verified its integration.
- [x] Partial failures: each failed or malformed check becomes
unavailable without losing successful findings. HTTP 401/403 and hosted
protocol authorization errors still propagate; regression cases cover
both APIs and hosted error shapes.
- [x] Bounded evidence: `affected_count` gives the total and `affected`
contains at most 20 findings, ordered by severity and ID. Truncation and
shuffled-input regressions pass.
- [x] Distinct category/default coverage: the default-call fixture
asserts security, performance, and health IDs/categories with an INFO
finding.
- [x] Shared adapter lookup: Issues and Advisors dispatch through the
same table.
- [x] Advisors description: removed the duplicate instruction to run
regularly after DDL.
- [x] Unsupported health selection: excluded from the advertised enum;
`all` still reports health unavailable.
- [x] Global instructions: refer to the project's issues and logs
without naming a possibly disabled tool.
- [x] Preview CI scope: moved the checkout fix to separate [MCP
#602](#602). Generated API types and
the README paragraph have no diff against main.
- [ ] Incomplete-assessment hosted metrics: proposal tracked in
[DEBUG-345](https://linear.app/supabase/issue/DEBUG-345/agree-on-hosted-mcp-metrics-for-incomplete-issue-assessments);
category/status observations or bounded counts exclude
findings/payloads. Requires team agreement; hosted metric semantics are
unchanged.

Companions: [Platform
#41754](supabase/platform#41754), [Studio
#53837](supabase/supabase#53837), [evals
#542](supabase/evals#542), and [docs
#53313](supabase/supabase#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](https://github.com/supabase/evals/actions/runs/45143592652).

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](https://pkg.pr.new/@supabase/mcp-server-supabase@a013711) and
matching utils installed into an isolated npm consumer; it checked
`affected_count: 2` through 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](https://github.com/supabase/mcp/actions/runs/45143506798).

Incomplete-assessment metrics need team agreement and are tracked in
[DEBUG-345](https://linear.app/supabase/issue/DEBUG-345/agree-on-hosted-mcp-metrics-for-incomplete-issue-assessments):
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_issues`** in the debugging tool group, combining security,
performance, and health checks through existing Management API
endpoints.
- **Grouped findings** with affected resources, evidence, remediation
links, and a severity derived from the highest-severity finding in each
group.
- **Minimum-severity filtering** with up to 20 affected findings per
matching group, highest severity first, and `affected_count` for the
full total.
- **Explicit coverage** for each requested check, so unavailable checks
cannot be mistaken for clean results.
- **Compatible migration:** both `get_issues` and `get_advisors` remain
visible in discovery and callable. Advisors keeps its existing
parameters and response contract, with an informational notice about
planned future deprecation.
- **Read-only support:** the tool is available on read-only connections
and carries read-only, non-destructive, and idempotent annotations.

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 })`

| Parameter | Values | Default / requirement | Behavior |
| --- | --- | --- | --- |
| `project_id` | Supabase project reference | Required on an unscoped
connection | Selects the project. On a project-scoped connection it is
injected by the server and omitted from the advertised input schema. |
| `type` | `all`, `security`, `performance`, `health` | Runtime default:
`all` | Selects the requested check categories. `all` requests all
three. Platforms without health support omit `health` from the
advertised enum and report its coverage as unavailable for `all`. |
| `severity` | `info`, `warning`, `critical` | Runtime default: `info` |
Minimum grouped issue severity. `warning` includes warning and critical
groups; `critical` includes only critical groups. Matching groups
include a bounded sample of up to 20 findings and the full
`affected_count`. |

Underlying Advisors levels map as `INFO` → `info`, `WARN` → `warning`,
and `ERROR` → `critical`. Severity filtering does not change check
coverage.

The captured discovery schema advertises `type` and `severity` as
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:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_issues",
    "arguments": {
      "project_id": "erppftcfodkcyoftaqvb",
      "type": "security",
      "severity": "warning"
    }
  }
}
```

Project-scoped connection:

```json
{
  "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 `issues` and `checks`:

| Field | Meaning |
| --- | --- |
| `issues[].id` | Check identifier within the project, not a persistent
incident ID. |
| `title`, `description` | Human-readable check title and explanation. |
| `severity` | Highest affected-resource severity in the group. |
| `category` | `security`, `performance`, or `health`. |
| `source` | `lint`. |
| `docs_url` | Remediation documentation link. |
| `affected_count` | Total findings in the group before truncation. |
| `affected[]` | Up to 20 findings, sorted by severity descending and
ID: `id`, `resource` (`type`, `name`, nullable `schema`), `detail`,
`severity`, and `docs_url`. |
| `checks[]` | Requested category (`type`), `status` (`complete` or
`unavailable`), and optional `reason`. |

An empty `issues` array means no issues matched the filter; inspect
`checks` before concluding the assessment is complete. When a platform
does not implement health checks, `type: "all"` reports health as
unavailable; the advertised enum excludes `health`, 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

- Hosted checks use `advisors_read`; the companion [Platform PR
#41754](supabase/platform#41754) maps
`get_issues` and legacy `get_advisors` to that permission.
- With the debugging feature enabled, the tested project-scoped PR
server advertises `query_logs` and `get_issues`. The legacy tool remains
visible and callable.
- Discovery advertises `get_issues` even for a valid token lacking
Advisors access; invocation is denied. Discovery is not proof of
authorization.
- Published ChatGPT metadata requires a new plugin submission to expose
the new tool. Existing frozen callers remain supported.

## Historical verification

Verified source head: `279778822164f64a48100708712cb4632ade3798`.

| Check | Coverage | Result |
| --- | --- | --- |
| Independent automated tests | 920 unit tests, retries disabled,
shuffled seed 11011; 7 stdio integration tests against a fresh build |
Passed |
| Static checks and build | TypeScript, Biome, build | Passed |
| Regression sensitivity | Deliberately broke grouping, unavailable
coverage, and filter wiring | Tests caught each mutation |
| Live protocol matrix | 10 cases in each of legacy and modern protocol
modes: discovery, compatibility, invalid filters, and CLI parity |
Passed; at capture, default results matched CLI: 11 groups / 547
affected findings |
| Live scoped permissions | Mockamaster-only `advisors_read` token
versus valid `project_admin_read` token without Advisors access |
Allowed token: security 7, performance 4, health 0, all 11; denied
token: all four requests rejected |
| Latest-head CI | check, quality, test, Coveralls, preview publication,
Continuous Releases | Passed; original conditional preview check
skipped, later preview publication succeeded |

[Latest-head test
run](https://github.com/supabase/mcp/actions/runs/42993558361) ·
[Preview
publication](https://github.com/supabase/mcp/actions/runs/43212942312)

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.1` still advertised `get_advisors`, returned
`tool not found` for `get_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.

![MCP health request and response against
Mockamaster](https://github.com/user-attachments/assets/ac688c29-0418-4020-9312-b5c38199426d)

### 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.

![MCP security request and response against
Mockamaster](https://github.com/user-attachments/assets/33d627e5-8165-48c5-a64b-d6e0bc80198e)

## Earlier captured requests, responses, permissions, and discovery

<details>
<summary>Expand historical capture from 2797788 (before Advisors
visibility was restored)</summary>

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`), organization
`jordi-team`; upstream `https://api.supabase.green`. New code ran
through STDIO, source head `2797788`, 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 legacy `get_advisors` correctly
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:

| Credential | Local `get_issues` security / performance / health / all
| Additional observed control |
| --- | --- | --- |
| Existing normal CLI login | 7 / 4 / 0 / 11 grouped issues; requested
checks complete | warning: 8; critical: 0; invalid type/severity
rejected with ZodError; hidden legacy `get_advisors` security call
succeeds with 7 lints |
| Mockamaster-only `advisors_read` | 7 / 4 / 0 / 11 grouped issues;
requested checks complete | Direct GET project: HTTP 403; hosted legacy
health/security calls succeed |
| Mockamaster-only `project_admin_read`, without `advisors_read` | All
four calls return `isError: true`; security/performance/all report
missing `advisors_read`; health reports Forbidden | Direct GET project:
HTTP 200, establishing the token is valid; hosted legacy health/security
calls denied |

Actual discovery request:

```json
{"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_advisors` is absent from new-code
discovery. Selected complete `get_issues` entry from the actual
tools/list response, explicitly an excerpt of that response:

```json
{"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:

```json
{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"get_issues","arguments":{"type":"health"}}}
```

Complete actual response with `advisors_read`:

```json
{"result":{"content":[{"type":"text","text":"{\"issues\":[],\"checks\":[{\"type\":\"health\",\"status\":\"complete\"}]}"}]},"jsonrpc":"2.0","id":5}
```

Complete actual response without `advisors_read`:

```json
{"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 legacy
`query_logs`, `get_advisors` discovery. Complete actual legacy health
request, sent separately with each credential:

```json
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_advisors","arguments":{"type":"health"}}}
```

Complete actual response with `advisors_read` (HTTP 200):

```json
{"result":{"content":[{"type":"text","text":"{\"result\":{\"lints\":[]}}"}]},"jsonrpc":"2.0","id":3}
```

Complete actual response without `advisors_read` (HTTP 200, MCP tool
error):

```json
{"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`, protocol `2025-03-26`. The complete actual `get_issues` health
request and response demonstrate the rollout gap (HTTP 200, MCP tool
error):

```json
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_issues","arguments":{"type":"health"}}}
```
```json
{"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 at
`https://api.supabase.green/platform/mcp-tools-permissions` in both
captures. It contains `"get_advisors":[["advisors_read"]]` (selected
entry, not the complete response) and has no `get_issues` entry. Source
platform draft mapping includes both names under `advisors_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.

</details>

## How to test

1. Build this branch at `a0137116ef03998cb00dc3ac9b18b698fea5234b` and
use a project-scoped, read-only connection with debugging enabled. The
official [preview
package](https://pkg.pr.new/@supabase/mcp-server-supabase@a013711) is
published and passed the seeded local artifact probe; older captures
below use earlier artifacts.
2. Call `tools/list`: expect `get_issues`, with the parameters above;
`get_advisors` should also be present.
3. Call `get_issues` for each type and each minimum severity. Verify
matching groups include no more than 20 affected findings,
`affected_count` gives the full count, and requested coverage is
explicit.
4. Compare an Advisors Read token with a valid token lacking that
permission. Expect successful results versus MCP tool errors,
respectively.
5. Call legacy `get_advisors` directly and verify its existing response
remains supported.
6. Use fixtures for unavailable or unsupported health and mixed-severity
groups; do not infer those cases passed from empty live results.

Persistent issue state, dismissal, history, and banned-IP signals remain
follow-ups.

Linked issue:
[DEBUG-311](https://linear.app/supabase/issue/DEBUG-311/add-mcp-support-for-issues).



## Historical review follow-ups

## Review follow-up (`02d500f`)

`get_issues` now requests unavailable results from the security and
performance adapters as well as health. Legacy `get_advisors` does 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 `85feadd`

Independent 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: true` caused four discovery assertions to fail.

Fresh actual STDIO calls against Mockamaster returned discovery names
`query_logs`, `get_issues`, and `get_advisors`. Both
`get_issues({type:"health"})` and `get_advisors({type:"security"})`
succeeded without tool or protocol errors. Captured 12 November 2026 at
15:50 UTC from source `85feadd2f2e4235d4e41c376a8a08e59a2397771`;
executable SHA256
`bed5ad3e5ecd5e988a5eeae121ac358d5b83bbfd367bb343939310082d33151c`. 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.

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.

2 participants