Skip to content

feat(cli): add project issues CLI-2888 - #7576

Merged
jordienr merged 21 commits into
developfrom
jordi/cli-2888-cli-issues
Nov 25, 2026
Merged

jordienr merged 21 commits into
developfrom
jordi/cli-2888-cli-issues

Conversation

@jordienr

@jordienr jordienr commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Problem

Studio is moving from Advisors to Issues Inbox, while the CLI still exposes supabase db advisors. CLI users also need remote health checks alongside security and performance findings.

What this adds

  • supabase issues combines security, performance, and remote health checks, grouping affected resources under each issue.
  • Readable terminal output uses the shared CLI table renderer, wraps long titles, and falls back to stacked label/value fields in narrow terminals, matching logs.
  • Machine output stays available through --output-format json and stream-json, including affected resources, evidence, and remediation links. Detected coding agents retain the CLI's JSON default.
  • Filtering and exit control use --type, minimum --severity, and --fail-on. Defaults are all, info, and none respectively.
  • Explicit coverage distinguishes completed checks from unavailable checks. Empty filtered results do not imply unavailable checks passed; unavailable remote checks exit nonzero.
  • Backwards compatibility: db advisors retains its flags, defaults, output, and exit behavior, with an informational notice on stderr about planned future deprecation. Both commands reuse existing Advisors endpoints and check modules.
  • CLI reference docs cover the command, defaults, terminal output, and machine modes.

Local and direct database targets keep SQL checks and report health as unavailable; explicitly requesting local health is rejected. Use --output-format, not the older -o flag. Issue IDs identify project-scoped checks, not persistent incidents; lifecycle actions and banned-IP signals are outside this PR.

Command and flags reference

supabase issues [--remote[=<ref|branch|url>] | --stack <name-or-id>] \
  [--type all|security|performance|health] \
  [--severity info|warning|critical] \
  [--fail-on none|info|warning|critical] \
  [--output-format text|json|stream-json]

Issues flags

These are the check-selection, filtering, and exit-control flags exposed by the new command.

Flag Accepted values Default Behavior
--type <value> all, security, performance, health all Selects which checks run. Hosted health checks cover elevated log error rates for the Data API, Auth, Storage, and Edge Functions.
--severity <value> info, warning, critical info Minimum grouped issue severity to display: info includes everything, warning includes warning and critical issues, and critical includes only critical issues. A group's severity is its highest affected-resource severity; matching groups retain all affected resources and evidence.
--fail-on <value> none, info, warning, critical none Exit with status 1 when a displayed issue meets or exceeds this threshold. none disables failure based on findings; it does not suppress command errors or unavailable remote checks.

Severities map from the underlying Advisors levels: INFO → info, WARN → warning, ERROR → critical. --severity filters the results before --fail-on is evaluated. Neither flag changes which API checks are requested.

Target selection

The command reuses the existing CLI target flags; these are not new global flags.

Form Target and behavior
No target flag Inspect the local database.
--stack <name-or-id> With the experimental stack backend enabled, select a local stack by name, ID, or unique ID prefix. Defaults to SUPABASE_STACK, then the current project stack.
--remote Inspect the linked hosted project.
--remote=<project-ref> Inspect the specified hosted project.
--remote=<branch> Resolve and inspect the specified project branch.
--remote=<postgresql-url> Connect directly to that database for SQL checks. A direct database URL does not enable hosted health checks.

Use = when supplying a remote target, for example --remote=erppftcfodkcyoftaqvb, rather than --remote erppftcfodkcyoftaqvb. Local and direct-URL security/performance checks run in a transaction that is always rolled back. With those targets, --type all reports health as unavailable; explicit --type health fails with guidance to use a hosted project.

The shared, hidden compatibility flags remain accepted but are deprecated for removal in CLI v4: --local (omit the target flag), --linked (use --remote), --project-ref <ref> (use --remote=<ref>), and --db-url <url> (use --remote=<url>).

Shared output and execution flags

These existing global flags apply to issues:

Flag Values / default Behavior
--output-format <value> text, json, stream-json; normally text text prints a table or narrow-terminal stacked fields, followed by coverage. json includes full issues and checks. stream-json emits newline-delimited JSON events, with the structured result in the result event.
--agent <value> auto, yes, no; default auto Controls the CLI's existing agent detection. Detected agents use JSON by default. Use --agent no to exercise normal human defaults; an explicit output format selects the requested format.
--profile <name> Existing CLI profile selection Selects the profile used to connect to the Supabase API.
--workdir <path> Normally searches upward from the current directory Uses the specified directory containing supabase/ exactly, without ancestor search. This determines the local project context and linked project.
--debug Off unless enabled Writes debug logs to stderr.
--help, -h No value Shows command usage, flags, and conditional token permissions.

Other inherited global options remain listed in supabase issues --help; this PR does not change them. Although inherited help lists --output / -o, this command rejects that legacy output flag and directs callers to --output-format.

Exit behavior

Condition Result
Checks complete and no displayed issue reaches --fail-on Exit 0. Findings alone do not fail the default --fail-on none run.
A displayed issue reaches the configured --fail-on threshold Exit 1.
A hosted check is reported unavailable Coverage includes the reason; exit 1, even with --fail-on none.
Local/direct-URL --type all cannot run health Health is marked unavailable; this expected limitation alone does not force exit 1. The findings threshold still applies.
Invalid arguments, unsupported explicit health target, authentication, or execution failure Nonzero exit; not a clean assessment.

For example, --severity critical --fail-on warning fails only if a critical issue is displayed. Warning issues have already been filtered out. An empty result means no issues match the filter, not that every check completed successfully.

Examples

supabase issues
supabase issues --remote --type security --severity warning
supabase issues --remote=erppftcfodkcyoftaqvb --type health --output-format json
supabase issues --remote=erppftcfodkcyoftaqvb --output-format stream-json
supabase issues --remote --severity info --fail-on warning
supabase issues --remote --agent no --output-format text

For scoped access tokens, hosted checks require advisors_read. Project selection may additionally require projects_read; branch resolution may require branching_development_read or branching_production_read. project_admin_read is optional for this command, as reported by --help.

Verification after merging develop

The full E2E matrix ran on afe18cdfa with the compiled macOS CLI. On final head cbfe5be78, Issues registers permissions after all flags so permission discovery includes the stack selector on both backends. The rebuilt binary listed the selector and Advisors Read permission in help and returned six security warnings from Mockamaster. The stack routing regression test failed before the fix and passed afterward.

Target Checks and observed result
Mockamaster on staging All three checks completed and returned 11 grouped issues. Filtering for security warnings returned six groups and exit 1 with --fail-on warning. Filtering for critical issues returned zero and exit 0. Health, JSON, stream JSON, legacy Advisors and terminal layouts at 40, 80 and 120 columns also passed.
Direct PostgreSQL URL Two tables with RLS disabled appeared under one critical issue. The table showed two affected resources. JSON identified both tables, stream JSON emitted the structured result, and --fail-on critical exited 1. Legacy Advisors still returned its original results array.
Named local stack issues --stack cli-2888-qa selected the running native stack. The security result identified the seeded table. The empty database exited 0 with a findings threshold. With the seeded finding it exited 1. Local --type all reported health as unavailable, and explicit local health exited 1.
Automated checks 91 unit and docs tests, 57 Advisors and Issues integration tests, and 26 stack-routing tests passed. After correcting permission registration, 104 permission, docs and Issues tests and 83 integration tests passed. Binary build, type checking and changed-file formatting and lint passed.

GitHub checks for this PR

Follow-up review QA · b0e030d96

Check Observed result
Compiled CLI against PostgreSQL Two outdated extensions (hstore and pg_trgm) had distinct extension identities. A foreign key referencing an auth unique constraint identified its owning table. The terminal counted all three overloaded functions, including two with identical bodies. The upstream mutable-search-path lint omits signatures and can supply the same cache key for identical bodies.
Compiled CLI against a loopback Management API An unknown performance severity marked performance unavailable. Security findings survived, health completed, and text, JSON and stream JSON exited 1. The integration tests also exercise unknown severities in security and health.
Compiled CLI with a loopback telemetry receiver A findings threshold emitted IssuesFailOnError. Incomplete remote coverage emitted IssuesChecksUnavailableError, including when the findings threshold was also met. Each run returned the structured findings and exited 1.
Live Mockamaster on staging 11 grouped issues, all three requested categories complete, and four affected function entries carrying source cache identities.

CLI team review verification · 43942d0e0

  • Reproduced the reported 503 with the previous compiled binary. The updated binary preserves successful findings and ordered coverage, reports the failed category as unavailable and exits 1. Verified through a loopback HTTP API in text, JSON and stream JSON. HTTP 401 and 403 remain fatal authentication or permission errors.
  • Mockamaster returned 11 grouped issues with security, performance and health complete. The security, performance and health requests now run concurrently. The four health checks cover elevated log error rates for Data API, Auth, Storage and Edge Functions.
  • Two foreign keys on one fixture table produced two JSON findings with their original column metadata, remediation text and valid documentation URLs. The terminal table counted one affected resource.
  • Passed 156 focused unit tests and 66 Issues and legacy Advisors integration tests. The integration cases cover each category returning 503, out-of-order responses, and permission failures for every category.

Earlier verification

Check What was verified Result
Live Mockamaster regression 24 cases covering Issues, legacy Advisors, validation, JSON/stream-JSON, severity filtering, and fail-on exits Passed; 16 Issues cases, 4 legacy Advisors cases, and 4 validation/error cases
Human-readable output Actual compiled CLI at 80/120 columns; latest head at 40 columns Tables and stacked fields render correctly; security warnings return 6 grouped issues and complete coverage, exit 0
Latest-head focused tests 14 renderer/logs unit tests and 57 handler integration tests, retries disabled, shuffled seed 1113 Passed
Regression sensitivity Deliberately removed stacked fallback, warning wrapping, and summary wrapping Tests caught each mutation; restored source passed
Static checks and build Types, changed-file lint/formatting, compiled binary Passed
Latest-head CI Code quality, unit/integration suites, CLI and stack E2E, macOS/Windows checks, PR lint, and JS/TS CodeQL Passed on b2c21a6b7

Mockamaster has no critical, mixed-severity, or unavailable checks. Those cases are covered by fixtures, not claimed as live coverage. Conditional/draft CI jobs are skipped; the separate CodeQL comparison is neutral due to the base branch's obsolete Go configuration.

Earlier verification on head 681ec2d
  • 78 handler/integration tests and 41 renderer/logs unit tests passed with retries disabled and shuffled seed 1112; types, changed-file lint/formatting, and binary build passed.
  • Tests caught deliberate mutations to text/machine routing, unavailable coverage, and 120-column width handling. Source was restored and clean tests passed.
  • All 34 full CI jobs passed, alongside PR lint and JS/TS CodeQL: CI run.

How to test

Using a build of this branch and an authenticated project:

supabase issues --remote=<project-ref> --agent no
supabase issues --remote=<project-ref> --agent no --type security --severity warning
supabase issues --remote=<project-ref> --type health --output-format json
supabase issues --remote=<project-ref> --output-format stream-json
supabase issues --remote=<project-ref> --severity warning --fail-on warning
supabase db advisors --remote=<project-ref>

Expect readable tables in a normal terminal and stacked fields at 40 columns. JSON modes retain full findings and coverage. --fail-on warning exits nonzero when matching warning-or-higher findings exist. The legacy command preserves its response and adds its informational future-deprecation notice on stderr. --agent no explicitly selects human defaults when testing from a coding-agent environment.

Screenshots

Actual compiled CLI against Mockamaster. The 80-column screenshot records head 681ec2d; output at 80/120 columns was verified unchanged by the narrow-terminal follow-up.

80-column table

Actual CLI Issues table against Mockamaster at 80 columns

Additional live screenshots: 120-column table, security warnings, and empty health results

Captured from head 681ec2d against Mockamaster in Jordi - Team, using the actual compiled CLI in a read-only localhost browser terminal. Output was not reconstructed or projected through jq, and no project resources changed. PTY width was set after browser initialization; the browser canvas may be wider than the configured PTY.

Default issues, 120 columns

All 11 grouped issues, complete security/performance/health coverage, exit 0.

Actual CLI Issues table against Mockamaster at 120 columns

Security warnings, 80 columns

--type security --severity warning: six warning issues and 11 affected findings, wrapped titles, complete coverage, exit 0.

Actual CLI security warning table against Mockamaster

Empty health results, 120 columns

--type health: no matching issues, complete health coverage, exit 0.

Actual CLI empty health result against Mockamaster

40-column stacked output

Fresh run of b2c21a6b7 against Mockamaster: six security-warning issues, complete security coverage, exit 0. Two screenshots show the beginning and end of the same run. The PTY is 40 columns; shared CLI update notices retain their existing behavior.

40-column CLI command and stacked findings

40-column CLI remaining findings, complete coverage and exit 0

Linked issue: CLI-2888.

@jordienr jordienr added the run-ci Run full develop CI (tests) on drafts and non-develop PRs. label Nov 11, 2026
@jordienr
jordienr marked this pull request as ready for review November 23, 2026 09:35
@jordienr
jordienr requested a review from a team as a code owner November 23, 2026 09:35
@jordienr
jordienr requested a review from Prashansa-K November 23, 2026 09:35
@github-actions

Copy link
Copy Markdown
Contributor

CLI benchmark (Lightweight Commands): no changes found

Commit afe18cd against develop at 1633cc8 · 10 runs each · report only, never blocks merging

Command Workload Before After Change
supabase --version version 158 ms 157 ms no real change
supabase --help help 165 ms 166 ms no real change
supabase init init 181 ms 169 ms no real change (-7%, within normal variation)
supabase migration new bench migration-new 192 ms 204 ms no real change (+6%, within normal variation)
supabase config convert config-convert 242 ms 227 ms no real change (-6%, within normal variation)
supabase config validate config-validate 227 ms 219 ms no real change
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 231 ms 233 ms no real change
supabase projects list projects-list 227 ms 234 ms no real change
supabase functions list --project-ref replayfixtureprojref functions-list 225 ms 229 ms no real change

API calls: unchanged for all 9 commands.

Binary size: 135.5 MB, up 28.0 KB from 135.5 MB.

Details: timing ranges, API calls per command, slowest phases

Timing ranges

Command Workload Before range After range Change Verdict
supabase --version version 153-195 ms 153-200 ms -1 ms (-1%) within noise
supabase --help help 159-173 ms 162-187 ms +1 ms (+1%) within noise
supabase init init 162-204 ms 165-188 ms -12 ms (-7%) within noise
supabase migration new bench migration-new 171-251 ms 174-267 ms +12 ms (+6%) within noise
supabase config convert config-convert 195-268 ms 190-282 ms -15 ms (-6%) within noise
supabase config validate config-validate 203-278 ms 196-283 ms -7 ms (-3%) within noise
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 217-313 ms 210-303 ms +2 ms (+1%) within noise
supabase projects list projects-list 215-276 ms 215-253 ms +7 ms (+3%) within noise
supabase functions list --project-ref replayfixtureprojref functions-list 215-251 ms 213-269 ms +4 ms (+2%) within noise

API calls per command

Command Workload Before After Endpoint changes
supabase --version version 0 0
supabase --help help 0 0
supabase init init 0 0
supabase migration new bench migration-new 0 0
supabase config convert config-convert 0 0
supabase config validate config-validate 0 0
supabase gen types --lang typescript --project-id replayfixtureprojref gen-types 2 2
supabase projects list projects-list 1 1
supabase functions list --project-ref replayfixtureprojref functions-list 2 2

Slowest phases

No command moved beyond noise, so there are no phase deltas.

Workflow run

Comment /bench to run the lightweight benchmark (this comment) again on the latest commit, or /bench full to also run the integration-heavy benchmark, which posts in its own comment.

@jgoux jgoux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new command matches the CLI-2888 contract closely and leaves db advisors unchanged. One blocking issue: a failed remote check aborts the whole run instead of being reported as unavailable alongside the results that did complete, which contradicts the command's documented coverage contract. The rest are minor output, completion and test-placement points.

@jordienr
jordienr enabled auto-merge November 23, 2026 16:13
@jordienr
jordienr requested a review from jgoux November 23, 2026 16:13

@jgoux jgoux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at 80f6a6c26. All points from my previous review are addressed: remote categories now run concurrently and a failing category is reported as unavailable while the others' findings are kept (401/403 stay fatal), health coverage is documented, affected entries carry metadata and real docs URLs, Affected counts distinct resources, completion rejects -o, and the tests are colocated. Three minor follow-ups inline, none blocking.

@jordienr
jordienr added this pull request to the merge queue Nov 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 24, 2026
@jordienr
jordienr added this pull request to the merge queue Nov 25, 2026
Merged via the queue into develop with commit 417095a Nov 25, 2026
122 of 124 checks passed
@jordienr
jordienr deleted the jordi/cli-2888-cli-issues branch November 25, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci Run full develop CI (tests) on drafts and non-develop PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants