Skip to content

feat(cli): generate warehouse commands from the Management API spec - #7640

Draft
jgoux wants to merge 58 commits into
developfrom
feat/generated-warehouse-commands
Draft

jgoux wants to merge 58 commits into
developfrom
feat/generated-warehouse-commands

Conversation

@jgoux

@jgoux jgoux commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds the first commands generated from the Management API spec, for Warehouse:

  • supabase warehouse enable starts replication and can --wait for setup to finish;
  • supabase warehouse disable starts cleanup and can --wait for it to finish;
  • supabase warehouse status reads the consolidated Warehouse status;
  • supabase warehouse connection reads the Arrow Flight SQL connection details;
  • supabase warehouse teardowns get reads the current cleanup, and can --wait on it;
  • supabase warehouse tables list lists the replicated tables with their replication state and lag;
  • supabase warehouse tables get <table-id> reads one table, including its replication feedback;
  • supabase warehouse tables layout get <table-id> reads a table's saved sorting and partitioning rules beside the layout the DuckLake catalog records;
  • supabase warehouse tables layout update <table-id> changes those rules: --sort-by and --partition-by take a JSON value for their rule, and --reset-table copies the table again when the layout changes;
  • supabase warehouse inspect query-stats reads Warehouse query statistics over a time range (--since, or --from and --to), as labelled sample series;
  • supabase warehouse inspect capacity reads Warehouse capacity, admission and activation measurements over a time range, in the same form;
  • supabase warehouse inspect ingestion-stats reads ingestion throughput and WAL lag over a time range, with --attributes to pick measurements and --interval for the step;
  • supabase warehouse inspect storage-stats reads maintenance, inline-flush and storage-health measurements over a time range;
  • supabase warehouse replication add adds one eligible table (--schema and --table) or a schema's currently eligible tables (--schema alone) to replication;
  • supabase warehouse replication remove removes one selected table or all selected tables of a schema from replication, keeping the data already in Warehouse;
  • supabase warehouse replication resync resets and rebuilds one selected table (--schema and --table). It has no wait, idempotency or revision flags;
  • supabase warehouse replication restart starts a stopped pipeline or restarts a running or failed one, keeping the selected tables and saved layouts.

They are experimental and hidden unless the project opts in, in the same way as compute:

# supabase/config.toml
[experimental]
warehouse = true

or SUPABASE_EXPERIMENTAL_WAREHOUSE=1 in the shell.

The goal is to settle the full pipeline on one real resource before adding more. That pipeline covers:

  • spec (with x-operation and links) → generated data;
  • generic runtime → the CLI's shared output and error contracts.

New commands should then need only an x-operation entry in the spec. The generator and runtime support exactly the shapes Warehouse uses (path and query parameters, JSON:API envelope bodies, JSON responses) and reject anything else at generation time, so a resource that needs a new shape adds it to the runtime explicitly. This is an alternative to the hand-written warehouse enable in #7528.

How it works

The generator writes data, not code. A build-time script turns the OpenAPI spec plus a small CLI policy file into a committed data module and a generated per-command reference. At startup, one generic runtime builds real Effect CLI commands from that data. There is no per-command handler code.

flowchart LR
  subgraph build["Build time: pnpm generate / api-commands:check"]
    spec["packages/api<br/>openapi.json + typed client"]
    policy["api-command-policy.ts<br/>(allowlist, nouns)"]
    gen["scripts/generate-api-commands.ts<br/>derive + lints"]
    data["generated.ts<br/>(command data)"]
    ref["generated.md<br/>(per-command reference)"]
    spec --> gen
    policy --> gen
    gen --> data
    gen --> ref
  end
  subgraph run["Runtime"]
    rt["runtime.ts<br/>withApiCommands()"]
    root["cli/root.ts<br/>mounts each noun whose feature is enabled"]
    exec["request → send → --wait → output"]
    errs["Output service<br/>(result, task, error)"]
    data --> rt --> root
    rt --> exec --> errs
  end
Loading

Why committed data instead of resolving the spec at runtime

Resolve at runtime Generate code per command Generate data + one runtime (this PR)
Reviewable diff when the spec changes no yes, but noisy yes, data only
Spec loaded in the binary whole spec no only the selected operations
Lints fail the build, not the user no yes yes
Behaviour fixes land once yes regenerate every file yes

api-commands:check is part of check:all. api-package-sync.yml regenerates the data and the reference whenever it syncs the spec, so drift turns up as a reviewable diff.

Adding a command

A command is declared in the spec itself. The CLI keeps a small policy file: a temporary allowlist of generated operations, the nouns, and optional per-command presentation choices. It never overrides what the spec says about an operation, and there is no per-command folder.

A command for an existing noun takes two edits: its x-operation (and links for --wait) in the spec, and its operation ID in generatedOperations. The spec edit lands upstream, or in packages/api/scripts/openapi-overrides.json until it is published. pnpm run generate downloads the spec, applies the overrides and writes the rest. A new noun is one nouns entry; a noun with its own feature also needs that experimental.<feature> key in packages/config/src/experimental.ts and in featureSchemas/featureKeys in apps/cli/src/shared/config/experimental-feature.ts, which ApiNoun.feature enforces at type-check time.

In the spec: x-operation on an operation names its command. Only operations on the CLI allowlist generate a command, so the spec can name every operation for other consumers and a name stays inert until its operation is listed. Off the allowlist, x-operation is read only on an operation that an allowlisted operation links to (see below).

Field Meaning Example
group A dot-separated path that starts with a CLI-declared noun. Each segment becomes a command word, and every sub-group needs help text in the CLI's nouns table. A noun is always a new top-level command. "warehouse" → supabase warehouse …
"warehouse.tables" → supabase warehouse tables …
method The last command word. It is usually a verb such as list, get or enable. A read of a singleton facet is named after the facet, such as status or connection, and a report under an inspect group is named after the report, such as query-stats. Every command word is lowercase kebab-case. Names are reviewed in the allowlist PR through the generated.md diff. "enable" → supabase warehouse enable
poll Optional, on a read (GET) only. Says the read reports the state of a long-running operation. The read itself gets --wait and --timeout. See below

The extension is decoded strictly: an unknown key fails generation, and so does a name with only one of group and method. A name is optional when poll is set. It holds only what another consumer of the spec (for example an MCP server generating tools) would also need. CLI-only choices such as flag names stay in the CLI. The published spec carries it, and the links for --wait, on every Warehouse operation. It also names setups create, which stays off the allowlist for now.

poll fields:

Field Meaning Warehouse value
status JSON pointer to the status in the read response. "/data/attributes/status"
succeeded Status values that end the wait successfully (exit 0). ["succeeded"]
failed Status values that end the wait as operation_failed (exit 1). ["failed"]
error Optional. JSON pointer to a failure reason. It supplies the message when the wait ends on a failed status; it doesn't end the wait by itself. "/data/attributes/status_error"
inspect Required on a poll-only read and ignored on a generated one, whose own command is named instead. The operation ID of the read-only command that inspects the same state. "v2-get-warehouse-status"

--wait comes from standard OpenAPI links. When a 2xx response has a link to an operation with poll, the command gets --wait and --timeout. Link parameters map as follows:

  • $response.body#/… takes the value from the first response.
  • $request.path.ref reuses the project ref.
  • Any other expression, an unknown target, or more than one polled link fails generation.

A response pointer must be required at every level of the response schema, so --wait always has something to poll with. A response that still lacks the value fails --wait as an internal error (exit 1) instead of a silent success.

An operation either declares poll or links to a polled operation, never both.

A polled read doesn't have to be a command. A status read that only exists to back --wait declares poll and stays off the allowlist: a poll-only read. It may carry a name for other consumers, but it gets no command: the CLI calls it through @supabase/api while waiting. Its poll.inspect names the operation whose command inspects the same state, and a failed or timed-out wait names that command in its suggestion.

The generator finds a poll-only read through the response links of the allowlisted operations, and ignores one that nothing links to. Nothing in the CLI lists these reads: a new one shows up as a diff in the generated data and reference. Poll-only reads go through the same checks as generated operations (experimental stage, GET, poll or links but not both).

Secrets are marked on the field with writeOnly: true, format: "password" or x-sensitive: true. Those fields are masked in --dry-run output whether they come from a flag, --body or --file. Generation fails when a body field looks like a credential (password, secret, token, key, private) and isn't marked. It also fails for a secret the preview can't mask: one held anywhere inside a nested body field, whose JSON value the preview doesn't mask, and any secret header or query parameter.

Flags follow a convention. A flag is the kebab-case field name. An array field with a plural name gets a singular, repeatable flag, so tables becomes --table. Beyond body and query fields:

  • The path parameter besides ref, if there is one, becomes a positional argument. An empty value, . or .. is a usage error before any request.
  • A nested body field (an object, an array of objects or a union) gets a flag that takes a JSON value for that field, null included, so --sort-by '{"kind":"none"}' needs no JSON:API envelope. The value goes through the same schema validation as the rest of the body, before consent.

The warehouse operations carry (every operation is also "x-scalar-stability": "experimental"):

// POST /v2/projects/{ref}/warehouse/enable → supabase warehouse enable
"x-operation": { "group": "warehouse", "method": "enable" },
"responses": { "202": { "links": { "setup": {
  "operationId": "v2-get-warehouse-setup",
  "parameters": { "ref": "$request.path.ref", "selection_id": "$response.body#/data/attributes/selection_id" }
} } } }

// GET /v2/projects/{ref}/warehouse/setups/current → poll-only read, not on the allowlist
"x-operation": { "group": "warehouse.setups", "method": "get", "poll": {
  "status": "/data/attributes/status", "succeeded": ["succeeded"], "failed": ["failed"],
  "error": "/data/attributes/status_error", "inspect": "v2-get-warehouse-status"
} }

// DELETE /v2/projects/{ref}/warehouse → supabase warehouse disable
"x-operation": { "group": "warehouse", "method": "disable" },
"responses": { "202": { "links": { "teardown": {
  "operationId": "v2-get-warehouse-teardown",
  "parameters": { "ref": "$request.path.ref", "operation_id": "$response.body#/data/id" }
} } } }

// GET /v2/projects/{ref}/warehouse/teardowns/current → supabase warehouse teardowns get
"x-operation": { "group": "warehouse.teardowns", "method": "get", "poll": {
  "status": "/data/attributes/lifecycle_status", "succeeded": ["disabled"], "failed": ["deletion_failed"],
  "error": "/data/attributes/cleanup_error"
} }

// GET /v2/projects/{ref}/warehouse/status → supabase warehouse status
"x-operation": { "group": "warehouse", "method": "status" }

// GET /v2/projects/{ref}/warehouse/connection → supabase warehouse connection
"x-operation": { "group": "warehouse", "method": "connection" }

// GET /v2/projects/{ref}/warehouse/tables → supabase warehouse tables list
"x-operation": { "group": "warehouse.tables", "method": "list" }

// GET /v2/projects/{ref}/warehouse/tables/{table_id} → supabase warehouse tables get <table-id>
"x-operation": { "group": "warehouse.tables", "method": "get" }

// GET /v2/projects/{ref}/warehouse/tables/{table_id}/layout → supabase warehouse tables layout get <table-id>
"x-operation": { "group": "warehouse.tables.layout", "method": "get" }

// PATCH /v2/projects/{ref}/warehouse/tables/{table_id}/layout → supabase warehouse tables layout update <table-id>
"x-operation": { "group": "warehouse.tables.layout", "method": "update" }

// GET /v2/projects/{ref}/warehouse/query-stats → supabase warehouse inspect query-stats
"x-operation": { "group": "warehouse.inspect", "method": "query-stats" }

// GET /v2/projects/{ref}/warehouse/capacity → supabase warehouse inspect capacity
"x-operation": { "group": "warehouse.inspect", "method": "capacity" }

// POST /v2/projects/{ref}/warehouse/replication/add → supabase warehouse replication add
"x-operation": { "group": "warehouse.replication", "method": "add" }

// POST /v2/projects/{ref}/warehouse/replication/remove → supabase warehouse replication remove
"x-operation": { "group": "warehouse.replication", "method": "remove" }

// POST /v2/projects/{ref}/warehouse/replication/resync → supabase warehouse replication resync
"x-operation": { "group": "warehouse.replication", "method": "resync" }

// POST /v2/projects/{ref}/warehouse/replication/restart → supabase warehouse replication restart
"x-operation": { "group": "warehouse.replication", "method": "restart" }

In the CLI: api-command-policy.ts holds:

  • generatedOperations: the operations that generate commands, today v2-get-warehouse-status, v2-get-warehouse-connection, v2-enable-warehouse, v2-disable-warehouse, v2-get-warehouse-teardown, v2-list-warehouse-tables, v2-get-warehouse-table, v2-get-warehouse-table-layout, v2-update-warehouse-table-layout, v2-get-warehouse-query-stats, v2-get-warehouse-capacity, v2-add-warehouse-replication, v2-remove-warehouse-replication, v2-resync-warehouse-replication and v2-restart-warehouse-replication. It is the only thing that turns an operation into a command, so a spec annotation never reaches the CLI on its own.
  • commandPolicies: CLI presentation choices per operation. Today the only one is confirmDescription, which prints the operation's API description before the interactive consent prompt. The replication commands, disable and tables layout update use it, because their descriptions spell out effects such as pipeline restarts, permanent data deletion or a table recopy that the request values alone don't show.
  • nouns: each top-level group, with the experimental feature that gates it and the help text of the sub-groups the generator creates (Warehouse describes replication, inspect, tables, tables.layout and teardowns). A noun is always a new top-level group: generated commands never join a hand-written one. The group is hidden unless [experimental] <feature> = true or SUPABASE_EXPERIMENTAL_<FEATURE>=1. Startup reads only the feature of the noun being run, or every noun feature for root help and completion.

Generation fails for:

  • an allowlisted operation missing from the spec or left without a name;
  • a link to an operation whose x-operation is invalid;
  • a poll-only read without poll.inspect;
  • an inspect operation that isn't generated, changes state, or needs input beyond the project ref.

The generator takes everything else from the spec:

  • summary and description;
  • flags, with their types, required, repeatability and help text;
  • where each flag goes in the request (/data/attributes/schema, …);
  • the JSON:API envelope type (warehouse_setup);
  • FGA permissions (read at runtime from @supabase/api/permissions, not generated here).

The generator rejects anything the runtime cannot honour, so a bad spec never reaches users. It rejects:

  • operations not marked x-scalar-stability: experimental;
  • operations without a summary;
  • unknown keys in x-operation;
  • groups that don't start with a declared noun, sub-groups without help text, and command words that aren't kebab-case;
  • a noun that is already a hand-written command, collisions between generated commands, and a path that is both a command and a group (a name off the allowlist meets these checks once its operation is listed);
  • non-kebab or duplicate flags, flags that collide with runtime flags such as --body or --wait or with registered global flags such as --profile, and a name used by more than one of path, query and body;
  • server-side dry_run;
  • parameter, body or schema shapes the runtime can't bind: parameters declared on the path item instead of the operation (on generated operations and poll-only reads), operations without a ref path parameter or with more than one other path parameter, path parameters that aren't strings, cookie parameters, header parameters other than Authorization, Content-Type and Accept, query parameters that aren't scalars, bodies that aren't a JSON:API envelope, and numeric body fields;
  • secrets the dry-run preview can't mask, as described above;
  • success responses that aren't JSON;
  • poll on a non-GET, or together with a link to a polled operation;
  • unsupported links;
  • waits whose pointers don't resolve in the responses or aren't always present, whose status isn't a string, whose linked values don't have the type of the read parameter they fill, or whose parameters or status values don't match the read operation.

What users get

All generated commands follow the same conventions.

Help comes from the spec, including a PERMISSIONS section that lists the extra permission --wait needs. The CLI builds the EXAMPLES entry from the positional argument and the required flags. A command that takes a body shows --file <path> unless a required flag already sets a body field. Abridged:

$ supabase warehouse enable --help
DESCRIPTION
  …

TARGET
  Remote only. Uses the linked project; pass --remote=<ref|branch> for another.

FLAGS
  --remote[=<ref|branch>]             Target another project: --remote=<ref|branch>. Defaults to the linked project.
  --body string                       Whole request body as JSON; other flags replace fields at their own location.
  --file string                       Read the whole request body from a JSON file, or - for stdin.
  --dry-run                           Print the request that would be sent and send nothing.
  --wait                              Wait until the operation reaches a final status.
  --timeout string                    How long --wait polls, as a duration such as 90s or 10m.
  --warehouse-region string           Optional Warehouse compute region, …
  --destination-project-ref string    Supabase project to use for both the DuckLake PostgreSQL catalog and Supabase Storage. …
  --install-fdw                       Whether to configure and install the Warehouse FDW in the project database. …
  --schema string                     Source PostgreSQL schema. Without tables, selects its currently eligible tables only. Required unless the field is in --body or --file.
  --table string                      Table names in schema. Omit to select the currently eligible tables in that schema.

GLOBAL FLAGS
  …

EXAMPLES
  # Enable Warehouse replication
  supabase warehouse enable --file <path>

PERMISSIONS
  Scoped access token:
    Required:
      project_admin_write
      database_write
    Required with --wait:
      database_read
    May be required:
      projects_read
      …

--dry-run prints the exact request and sends nothing. It needs no consent, and with a literal --remote=<ref> it needs no login either: it builds no API client, sends no Management API request and writes no project cache:

$ supabase warehouse enable --remote=abcdefghijklmnopqrst --schema public --table orders --table customers --dry-run --output-format json
{"method":"POST","path":"/v2/projects/abcdefghijklmnopqrst/warehouse/enable","query":{},"headers":{},
 "body":{"data":{"type":"warehouse_setup","attributes":{"schema":"public","tables":["orders","customers"]}}}}

Whole bodies are accepted from --body '<json>', --file body.json or --file - (stdin). Flags then replace fields at their own location. Top-level keys the operation doesn't declare are rejected, so a body can't redirect the request to another project:

$ supabase warehouse enable --remote=abcdefghijklmnopqrst --yes --body '{"ref":"zyxwvutsrqponmlkjihg","data":{}}'
--body/--file has the field "ref", which the request body does not take.
Top-level fields: data.
# exit 1

Output. The format comes from the global resolver, like every other command: --output-format, else json in agent runs, else text. Text renders the result for people. A JSON:API envelope becomes a heading, then aligned fields, with - for null. A list of resources becomes a table of their scalar fields, and each row's nested fields print in a block below it. Inside a resource, a list of flat objects is a table and any other list of objects prints item by item. A sample series under a points key shows its last 10 samples, in response order, with a notice of how many were left out; every other list prints in full, and JSON output shows everything. An empty list prints No results. json writes one stdout document: the API response exactly as sent (null for an empty body), so | jq stays stable. stream-json writes one result frame with the same data. A success body that isn't valid JSON fails in both: the error takes the place of the result. Progress goes through the output service's tasks: a spinner in text (showing the current status during --wait), stderr lines in json, and log frames in stream-json. A dry run prints the request in the same three forms. The legacy -o/--output flag is a usage error that points to --output-format, since it goes away in V4.

Consent follows ADR 0033. Mutations ask with a default of no, and the question lists the request values (path, query and body fields, from flags, --body or --file), so options such as disable --delete-data or layout update --reset-table show before you confirm. A command with confirmDescription also prints its API description first, so replication add warns that the pipeline restarts before you answer. Non-interactive runs need --yes or SUPABASE_YES. Read-only commands such as status don't ask.

--wait turns the accepted response into a polled status read:

sequenceDiagram
  participant U as supabase warehouse enable --wait
  participant API as Management API
  U->>API: POST /v2/projects/{ref}/warehouse/enable
  API-->>U: 202 {data.attributes.selection_id}
  loop first read immediately, then backoff 1s → 2s → 4s → 8s → 10s cap (Retry-After wins if longer)
    U->>API: GET /v2/projects/{ref}/warehouse/setups/current?selection_id=…
    API-->>U: 200 {status, status_error}
  end
  alt status = succeeded
    U-->>U: print the accepted response, exit 0
  else status = failed
    U-->>U: operation_failed with the status_error message, exit 1
  else read answers non-2xx
    U-->>U: that API error (not_found, conflict, …), exit 1
  else --timeout (default 10m) reached
    U-->>U: wait_timeout, exit 1
  end
Loading

Each read goes through the shared @supabase/api client, which retries a 429 or a 5xx inside the --timeout. A non-2xx that the client returns ends the wait.

Both wait failures include a follow-up command in their suggestion. When the polled read is a command, the suggestion names it with the identity from the accepted response, as in supabase warehouse teardowns get --operation-id <id> --remote=<ref> after disable --wait. When it is a poll-only read, the suggestion names the command of its poll.inspect operation, as in supabase warehouse status --remote=<ref> after enable --wait.

supabase warehouse disable --wait polls the cleanup read the same way. A command prints one result shape with or without --wait: enable --wait and disable --wait print the accepted response once the operation succeeds, and the settled state stays one status or teardowns get away. supabase warehouse teardowns get --wait polls its own route, with its own flags and no change request, and prints the last read, which is its usual shape.

Errors

Generated commands fail through the same path as every other command, so they add no error contract of their own. Text prints the message and its suggestion on stderr. json writes {"_tag":"Error","error":{"code","message","suggestion"?,"entitlement"?}} to stdout, and stream-json writes an error frame. code is the error's tag (ApiCommandStatusError, ApiCommandUsageError, ApiCommandOperationFailedError, ApiCommandWaitTimeoutError, ApiCommandUnexpectedResponseError, ApiCommandNetworkError, or a shared error such as HostedMutationConsentRequiredError). Failures exit 1, and an interrupt exits 130.

$ supabase warehouse disable --remote=abcdefghijklmnopqrst --yes --output-format json
{"_tag":"Error","error":{"code":"ApiCommandStatusError","message":"The selection changed: Re-run enable. (HTTP 409)"}}

A plan-gated 4xx (server body code entitlement_required) carries entitlement: {feature, upgrade_url} in place of the permission suggestion. Text prints the upgrade hint, and cli_upgrade_suggested fires.

Suggestions are built where the information is still available:

  • 401 → Run `supabase login` .
  • 403 → the FGA permissions the operation needs.
  • A hint from the server always takes precedence.
  • An unreachable API or an unreadable response → ApiCommandNetworkError. A read suggests running the command again; a change says the request may have reached the API and to check the current state first.

A change can be accepted and still fail afterwards: its response body can't be read, isn't JSON or lacks what --wait needs, or the wait's read fails or times out. The message then starts with The API accepted the request (<summary>), but …. In place of a retry, the suggestion points at the command that shows the current state, such as supabase warehouse status, when the command has a wait that names one. A 401 or 403 keeps its login or permission suggestion.

Other changes

  • packages/api. Every Warehouse operation, its x-operation and its links come from the published spec. openapi-overrides.json only fixes eleven Warehouse help texts until the spec is updated: it puts the usql example of the connection read in a code span, because the description check rejects its raw <host> placeholder; it says that replication resync --schema takes a literal schema name; and it gives the timestamp format of --from and --to on the four inspect reports and the default of inspect ingestion-stats --interval. Each fix is a test and replace pair, so a reworded upstream text fails the sync instead of being overwritten. The contracts are regenerated.
  • Config. Adds experimental.warehouse to the config schema and to the document-only local paths in packages/config; apps/cli/schemas/config/v1.json is regenerated.
  • Tooling. Adds the Turbo tasks supabase#api-commands:generate and api-commands:check, which is part of check:all. Root generate regenerates @supabase/api and @supabase/stack first, then runs supabase#api-commands:generate and schemas:generate in a second Turbo run, so the command data is derived from the refreshed spec rather than from a cache keyed on the old one. api-package-sync.yml regenerates command data and the reference together with the spec. oxlint ignores generated.ts.
  • CLI runtime. linkedDbResolverRuntimeLayer becomes lazyManagementApiRuntimeLayer, shared by db, logs, migration, pull and the generated commands, so the API client is built only when a command needs it. main.ts and root.ts resolve the enabled noun features through api-command-features.ts, and the error-tag snapshot gains the six new error tags.
  • Docs. The generated generated.md lists each command's route, experimental gate, flags and bindings, and its --wait read; api-commands:check keeps it in sync. Generated commands get no per-command folder.

Not in this PR

  • More generated resources. Warehouse is the pilot.
  • setups create, which the spec names. It becomes a command once its operation ID joins generatedOperations.
  • A machine-readable command surface (surface.json) and a breaking-change gate built on it. An extraction without a CI-checked consumer was dropped from this PR.
  • Generated commands outside the experimental stage.

@jgoux jgoux self-assigned this Nov 16, 2026
@jgoux

jgoux commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

/ai-review

@github-actions github-actions Bot 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.

Superseded by a newer AI review

🤖 AI Review

Verified all 8 Claude and 5 Codex findings against the PR code and trusted conventions, merging two duplicate pairs into 11 confirmed findings. The main issues concern machine-error rendering, error classification, sensitive previews, overlapping result schemas, and generator/runtime mismatches. Generator and sensitive-field gaps are latent for the current warehouse entries. Newline handling, telemetry documentation, and E2E delay are polish concerns. The unlinked-project message still contains the link guidance, correcting an overstatement in Claude's finding.

Findings

Severity Location Category Sources Claim
🟠 MAJOR apps/cli/src/shared/cli/run.ts:861 error-handling codex Standard failures ignore agent-selected machine output. A TTY invocation with --agent=yes can resolve to JSON output but receive a human-text failure instead of the standard error document.
🟡 MINOR apps/cli/src/shared/cli/standard-errors.ts:174 error-handling claude The standard error mapper misclassifies target-resolution failures as internal_error with exit 1 and hint:null. Project-not-linked and invalid-link-state errors bypass the InvalidInput-only usage mapping; wrapped branch network/status errors also bypass the HTTP mappings.
🟡 MINOR apps/cli/src/command-internal/command-surface/command-surface.ts:213 schema-contract codex The result schema's oneOf rejects valid warehouse documents that satisfy both the accepted-response and waited-response schemas.
🟡 MINOR apps/cli/src/commands/api/api-command-request.ts:226 redaction claude+codex For a generated body field marked sensitive, supplying its value solely through --body or --file bypasses dry-run masking.
🟡 MINOR apps/cli/scripts/api-command-derive.ts:458 correctness claude The generator accepts operations without a ref path parameter even though the runtime always supplies ref. A generated operation whose input schema has no ref field then fails strict input decoding.
🟡 MINOR apps/cli/src/commands/api/runtime.ts:245 command-generation claude+codex The generator accepts nested noun paths that the runtime silently omits when constructing command groups.
🟡 MINOR apps/cli/src/commands/api/api-command.errors.ts:40 telemetry claude Operation failures and wait timeouts are classified as invalid user input in telemetry even though they arise after a valid request has been sent.
⚪ NIT apps/cli/scripts/api-command-derive.ts:350 correctness claude Wait-schema lookup rejects +json response media types that the generator otherwise supports as JSON.
⚪ NIT apps/cli/src/commands/api/api-command-execute.ts:155 output claude JSON response passthrough emits no trailing newline when the API body lacks one, leaving terminal output and line-oriented consumers with an unterminated final line.
⚪ NIT apps/cli/src/commands/api/warehouse/enable/SIDE_EFFECTS.md:70 docs claude The telemetry documentation incorrectly says only target and runtime flag names appear in flags. Generated flags, body, and file also appear as redacted entries, and timeout's value is redacted.
⚪ NIT apps/cli/src/commands/api/api-commands.e2e.test.ts:162 test-quality codex The subprocess wait test incurs a real one-second polling delay for a transition already covered by controlled-clock tests.

Stats

Claude findings: 8 · Codex findings: 5 · Confirmed: 11 · Refuted: 0 · Uncertain: 0


Models: claude-opus-5-5 + gpt-6.1-sol · Trigger: manual · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

Comment thread apps/cli/src/shared/cli/run.ts Resolved
Comment thread apps/cli/scripts/api-command-derive.ts Resolved
Comment thread apps/cli/scripts/api-command-derive.ts Resolved
Generated Management API commands now take their names and polling
behaviour from an `x-operation` extension and standard response
`links` in the OpenAPI spec. Secrets are marked on the field, and
flags follow a naming convention. The CLI keeps the noun allowlist,
the verb vocabulary and an override table, which is empty today.
Only operations listed in generatedOperations generate commands. x-operation on
any other operation is ignored until the spec metadata design settles.
- Agent runs on a terminal report failures as the standard JSON document.
- Unlinked-project and branch-resolution failures map to usage, network
  and API error codes instead of internal_error.
- Operation-failed and wait-timeout errors classify as API status.
- --dry-run masks sensitive fields supplied through --body or --file.
- Result schemas combine branches with anyOf.
- Generation rejects nested groups and operations without a ref path
  parameter, and reads +json success schemas for wait pointers.
- SIDE_EFFECTS telemetry wording matches what is recorded.
@jgoux

jgoux commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

/ai-review

@github-actions github-actions Bot 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.

Superseded by a newer AI review

🤖 AI Review

Verified all three findings against the checked-out code and trusted conventions. Both Codex findings are confirmed as minor correctness issues; Claude's missing-newline finding is confirmed as a formatting nit. No findings overlap.

Findings

Severity Location Category Sources Claim
🟡 MINOR apps/cli/src/commands/api/api-command-execute.ts:101 error-handling codex Generated commands discard plan-gate entitlement metadata, losing upgrade guidance, structured entitlement details, and the associated telemetry.
🟡 MINOR apps/cli/scripts/api-command-derive.ts:384 correctness codex Wait validation rejects valid JSON Pointers containing escaped property names.
⚪ NIT apps/cli/src/commands/api/api-command-execute.ts:155 output-consistency claude JSON success responses without a trailing newline leave stdout unterminated, unlike dry-run previews and text or empty responses in JSON mode.

Stats

Claude findings: 1 · Codex findings: 2 · Confirmed: 3 · Refuted: 0 · Uncertain: 0


Models: claude-opus-5-5 + gpt-6.1-sol · Trigger: manual · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

Comment thread apps/cli/scripts/api-command-derive.ts Resolved
…ator

Generated commands gain nested groups, one positional argument, header
flags, action verbs, file-only body fields and reads that poll
themselves, so `warehouse status --wait` waits for a final status.

The generator rejects what the runtime cannot send safely: a secret held
at any depth of a body field without a masked flag, secret header or
query parameters, non-string positionals, nullable wait pointers and
link expressions other than the project ref and response pointers. The
runtime rejects an empty or dot-segment positional before any request.

The command surface moves under `src/cli`, and the shared API command
errors and stage annotation move under `src/command-internal`. The
command policy replaces the override table, and the dry-run preview
lists headers.
…generated commands

Generated commands now parse the Management API entitlement_required body on a
4xx, carry the entitlement in the standard error document, print the upgrade
hint in text mode, and fire cli_upgrade_suggested. The generator decodes ~1 and
~0 in --wait link pointers the same way the runtime does.
bnjjj and others added 2 commits November 17, 2026 15:56
Add generated `warehouse disable` and `warehouse teardowns get` commands
with explicit `--delete-data`, bounded waiting, and the existing
Warehouse feature gate.

Retain data by default, poll the accepted cleanup identity, and include
the last observed lifecycle state in timeout errors. Reuse shared
targeting, consent, output, and error handling.

`warehouse teardowns get` reads current cleanup without an ID. Optional
`--operation-id` pins observation; `warehouse disable --wait` supplies
its ID automatically.

Stacks on #7640. Depends on
supabase/platform#42016.

Implements PIPE-1447. Keeps the local request-preview contract; resolved
impact previews remain follow-up work.
bnjjj and others added 3 commits November 17, 2026 22:21
Generate `warehouse status` from `GET
/v2/projects/{ref}/warehouse/status`, preserving readiness,
capabilities, zero-target enablement and unavailable observations
through the shared runtime.

Preserve `warehouse enable --wait` with selection-bound setup polling.
Discover internal polling targets from response links without exposing a
`warehouse setups get` command; status has no wait flags. Retain
teardown waiting.

Keep text output on terminals, raw JSON when piped or requested, and
YAML through `-o yaml`.

Stacked on #7640 (including merged #7660). Depends on
supabase/platform#42039.

Implements PIPE-1445.

---------

Co-authored-by: Julien Goux <hi@jgoux.dev>
Generate `warehouse connection` from `GET
/v2/projects/{ref}/warehouse/connection`. It prints the Arrow Flight SQL
endpoint, the TLS requirement and source-database login guidance: use a
database role with its existing password (`postgres` uses the project's
database password) and `supabase_warehouse_reader` membership. The
command never fetches or prints a password, and a disabled, unconfigured
or unavailable Warehouse shows no connection string.

Text output on terminals, raw JSON when piped or requested, and YAML
through `-o yaml`, as for the other generated Warehouse commands. Help
includes a usql recipe.

Add `connection` to the generated command vocabulary and render `TLS` as
an acronym in text labels. The contract comes from an OpenAPI override
until it ships in the deployed Management API specification.

Stacked on #7671. Depends on
supabase/platform#42053.

Implements PIPE-1449.

---------

Co-authored-by: Julien Goux <hi@jgoux.dev>
Drive the experimental gate for generated command groups from the policy
nouns instead of a warehouse-specific resolver, and replace the
per-command warehouse SIDE_EFFECTS docs with a shared contract plus a
generated per-command reference kept in sync by the generator check.
jgoux and others added 7 commits November 18, 2026 14:41
A read that a `--wait` polls without being a command now carries
`x-operation: { poll: { ..., inspect } }` with no `group`/`method`.
The generator finds it through the response links of the generated
operations, and `poll.inspect` names the operation whose command the
failure and timeout hint points to.

This replaces the `pollTargets` map in the command policy. The runtime
and the generated command files are unchanged.
The deployed Management API spec now includes the Warehouse disable
route, the teardown read and its response schema, so the overrides that
added them collided and spec regeneration failed. The regenerated
files differ only in ordering.
Only the generated operations list decides whether an operation becomes
a command, and a generated name still goes through every collision
check. A polled read the CLI does not generate may keep its own name
next to poll and inspect, so the spec can name every operation for
other consumers. The setup read's override now names it
warehouse.setups get.
…oined

Generated commands rebuild the group they join, which bypassed the stack
group's own Command.provide. Each stack subcommand now provides the stack
runtime layer itself, so the sealed-group list and its generator check go.
Generate `warehouse tables list` from `GET
/v2/projects/{ref}/warehouse/tables`. It lists the tables selected for
Warehouse replication with their freshness:

- `status`: `syncing`, `live`, `error`, `stopped` or `unknown`;
- the raw replication state;
- when the state was observed;
- `lag_ms`, the flush lag of the replication slot that carries the
table.

Text output shows one row per table. `-o json` and `-o yaml` also
include the full replication feedback. That feedback includes
`flush_lag_bytes`, which reads 0 for a caught-up slot whose lag time
Postgres no longer reports.

Also generate `warehouse tables get <table-id>` from `GET
/v2/projects/{ref}/warehouse/tables/{table_id}`. It reads one of those
tables by the source OID that `warehouse tables list` shows as its ID,
with the same attributes. Its text output also shows the nested
replication feedback, and a table that isn't replicated is an API error.
This is the first generated command with a positional argument on a real
operation, so the generic bindings test now supplies positional path
parameters.

Two generic changes to the text output of generated commands:

- an empty collection prints `No results` instead of `Data  -`;
- a column that holds a nested object in any row is left out of the
table. Before, rows with a nested object printed it as compact JSON
while rows with `null` printed `-`.

The tables contracts, and `flush_lag_bytes` in the status contract, come
from OpenAPI overrides until they ship in the deployed Management API
specification.

Stacked on #7640. Depends on
supabase/platform#42055 and
supabase/platform#42108.

Implements PIPE-1451 and PIPE-1453.

---------

Co-authored-by: Julien Goux <hi@jgoux.dev>
The command surface reads bindings and stage from the generated entry, so the
mounted annotation carries only the operation id and the stage annotation is
gone. Body-bound flags are no longer reported as required on the command line,
and the side-effects doc covers stack-mode project state and the workdir order.
bnjjj and others added 11 commits November 19, 2026 20:26
Adds experimental `warehouse replication add`, `remove` and `resync`
commands on top of #7640.

All three use the generated request/runtime path and preserve the
immediate API response. All support `--dry-run` as a local request
preview, with no server-side dry-run contract. Resync has no
idempotency, revision or wait flags.

The shared generator/runtime gains CLI policy for API impact
descriptions in consent. Local previews use the existing shared
behavior. No hand-written command handlers are added.

Depends on #7640 and the companion Management API endpoints.

---------

Co-authored-by: Julien Goux <hi@jgoux.dev>
…oute help

An ambiguous --remote maps only 401, 403 and token failures to auth
documents; a 404 branch listing stays a usage error. The --wait spinner
status and a non-JSON text-mode success body are escaped for display,
while JSON output keeps the original bytes. Routing args drop a leading
help so `help warehouse` and `help compute` resolve their feature, and
the stack backend reuses that. Help tests assert the cache and poll
permissions outside dry runs.
The noun's gate field is now `experimental`, matching the `experimental.<name>` config key it
reads. Entries no longer copy it; the reference reads the noun and prints how to enable it.
Develop removed every per-command SIDE_EFFECTS.md; the generated per-command
reference and the tests now carry the generated command contract.
…n contract

The description contract test now builds the warehouse command tree, and the
warehouse connection example is wrapped in a code span so `<host>` no longer
parses as HTML.
@jgoux

jgoux commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

/ai-review

@github-actions github-actions Bot 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.

Superseded by a newer AI review

🤖 AI Review

CLI reference prose guidance: snapshot supabase/supabase@6f13230 supplied to reviewers (advisory, not a style pass).

A malformed polling response can leave a warehouse operation waiting until the default ten-minute timeout. The review also confirmed that dry runs can contact the Management API during target resolution, warehouse success output bypasses NDJSON framing, and the generators have several edge cases. The reported silent overwrite of upstream OpenAPI entries is refuted by an explicit collision guard. Both independent reviews and the pinned prose guidance were available. The adjudication was static, with no test execution.

Findings

Severity Location Category Sources Claim
🟠 MAJOR apps/cli/src/commands/api/api-command-execute.ts:229 error-handling codex A malformed successful polling response is treated as an operation still in progress. After the mutation has been accepted, repeated malformed responses can consume the default ten-minute wait and surface a timeout instead of the response error.
🟡 MINOR apps/cli/src/commands/api/api-command-request.ts:254 security codex The generated-command runtime can echo rejected values for fields marked sensitive when it formats request validation failures.
🟡 MINOR apps/cli/src/commands/api/runtime.ts:112 cli-help codex --dry-run promises to “send nothing,” but resolving the target can still send Management API requests.
🟡 MINOR apps/cli/scripts/generate-api-commands.ts:4 code-generation codex The command generator requires its own TypeScript output to load before it can recreate that file or report it missing in check mode.
🟡 MINOR apps/cli/scripts/api-command-derive.ts:449 code-generation codex A valid operation-level override of a path-item query parameter can fail command generation with a duplicate flag.
🟡 MINOR apps/cli/scripts/api-command-derive.ts:207 code-generation codex Reordering properties in one anyOf branch can make the command generator reject an otherwise equivalent request schema.
🟡 MINOR apps/cli/scripts/api-command-derive.ts:1038 code-generation codex The generator can approve a linked wait when a success response lacks the value needed to poll. A mutation can then succeed before the CLI exits with a defect.
🟡 MINOR packages/api/scripts/generate.ts:340 correctness codex Normalizing a nullable oneOf that already has an explicit null branch adds a second null branch. The resulting exclusive union has two matches for null.
🟡 MINOR apps/cli/scripts/api-command-reference.ts:30 documentation codex The generated reference inserts a literal backslash into the copyable Flight SQL connection example.
🟡 MINOR apps/cli/src/commands/api/api-commands.integration.test.ts:2237 test-coverage codex The test named “keeps JSON for success and failure when --output-format text is piped” does not verify that the failure is rendered as JSON.
⚪ NIT apps/cli/src/commands/api/api-command-execute.ts:165 output-consistency claude A warehouse success response can be emitted without a record terminator under --output-format stream-json, which advertises NDJSON.
⚪ NIT apps/cli/src/commands/api/api-commands.e2e.test.ts:200 test-coverage codex Two subprocess tests repeat the same successful enable-and-wait sequence. One invocation can cover piped output selection and assert the linked request paths.
⚪ NIT apps/cli/src/shared/cli/run.ts:48 style codex The patch changes Tty to a value import even though the file only uses it as a type.
⚪ NIT apps/cli/src/commands/api/generated.ts:11 docs-style codex The connection help uses “Login” in prose and omits the Oxford comma in its list of values the API excludes.
⚪ NIT apps/cli/src/commands/api/generated.ts:369 docs-style codex Warehouse help uses “PostgreSQL” in descriptive prose where the snapshot calls for “Postgres.”
⚪ NIT apps/cli/src/commands/api/generated.ts:267 docs-style codex Query-stats help refers to since, from, and to without the -- prefixes readers need to enter those CLI flags.
⚪ NIT apps/cli/src/commands/api/generated.ts:28 docs-style codex The disable help gives the API query field for permanent deletion and introduces “FDW” without expansion.
⚪ NIT apps/cli/src/commands/api/api-command-policy.ts:46 docs-style codex The top-level warehouse description uses “Manage” where it could name the actions the command group supports.
Refuted findings (kept for transparency, not posted as review comments)
  • packages/api/scripts/openapi-overrides.json:157 (code-generation): The temporary Warehouse add overrides will silently replace upstream path items and schemas published under the same keys.
    Refuted: This repository’s override implementation rejects existing object keys and identifies the conflicting pointer. A collision fails regeneration before any replacement occurs.

Stats

Claude findings: 1 · Codex findings: 18 · Confirmed: 18 · Refuted: 1 · Uncertain: 0


Models: claude-opus-5-5 + gpt-6.2-sol · Trigger: manual · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

Comment thread apps/cli/src/commands/api/runtime.ts Resolved
Comment thread apps/cli/scripts/api-command-derive.ts Resolved
Comment thread apps/cli/src/commands/api/generated.ts Resolved
Comment thread apps/cli/src/commands/api/generated.ts Resolved
Comment thread apps/cli/src/commands/api/generated.ts Resolved
Comment thread apps/cli/src/commands/api/generated.ts Resolved
Fail --wait right away when a poll response has no readable status, instead of
polling until the timeout. Drop the reference escaping that broke the copyable
connection example, reword the --dry-run help, revert the unused nullable oneOf
normalization, and tighten the piped-output tests.
@jgoux

jgoux commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

/ai-review

@github-actions github-actions Bot 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.

Superseded by a newer AI review

🤖 AI Review

CLI reference prose guidance: snapshot supabase/supabase@a76a577 supplied to reviewers (advisory, not a style pass).

Static review confirmed 15 of 17 findings. The highest-priority issues are unvalidated API response bytes reaching an interactive terminal and --wait reporting an internal error without a recovery command after a mutation has been accepted. The two refuted findings are covered by UUID validation and the OpenAPI patch loader’s existing-path guard. The supplied prose snapshot supports four advisory help findings. The changed-file list contained no CLI reference overlays, and the supplied next context showed no fundamental conflict. Tests were not run.

Findings

Severity Location Category Sources Claim
🔴 CRITICAL apps/cli/src/commands/api/api-command-execute.ts:166 security codex Selecting JSON or stream-JSON output on a terminal lets a malformed successful API response write server-controlled terminal sequences to stdout.
🟠 MAJOR apps/cli/src/commands/api/api-command-execute.ts:300 error-handling codex An accepted Warehouse mutation can report internal_error with no recovery command under --wait when the API omits the identifier needed to poll.
🟡 MINOR apps/cli/src/commands/api/runtime.ts:227 error-handling claude With a valid request and a resolved project, a Warehouse mutation checks credentials before consent. A noninteractive caller without credentials or --yes receives unauthenticated with exit 1 instead of usage_error with exit 2. An interactive caller without credentials cannot reach the consent prompt.
🟡 MINOR apps/cli/src/shared/cli/standard-errors.ts:269 terminal-output codex An invalid request file can inject control characters into an interactive usage error.
🟡 MINOR apps/cli/scripts/api-command-derive.ts:1064 generator-validation codex The generator accepts a polling status pointer that resolves to a non-string field the runtime can never use as a status.
🟡 MINOR apps/cli/scripts/api-command-derive.ts:449 generator-parameters codex An OpenAPI operation-level parameter override can cause command generation to fail as a duplicate parameter.
🟡 MINOR apps/cli/src/commands/api/api-command-request.ts:253 redaction codex The generic request validator can echo a rejected credential for operations that use the generator’s sensitive-field support.
🟡 MINOR apps/cli/src/commands/api/runtime.ts:273 side-effects codex Rejecting a request or declining Warehouse consent can still trigger a Management API lookup and a local project-cache write.
🟡 MINOR apps/cli/src/commands/api/generated.ts:84 command-help codex The help for three warehouse enable flags describes their behavior using an unexplained targets input.
🟡 MINOR apps/cli/src/commands/api/api-commands.integration.test.ts:2251 test-coverage codex The terminal --output-format stream-json test can pass if CLI startup stops applying the flag to output presentation.
🟡 MINOR apps/cli/src/commands/api/api-commands.e2e.test.ts:175 test-coverage codex The Warehouse subprocess suite repeats successful status and wait behavior already covered at the handler boundary and exceeds the documented one-to-three golden-path guidance.
⚪ NIT apps/cli/src/commands/api/api-command-policy.ts:46 docs-style codex The Warehouse and replication group help uses a vague verb where it could name the available operations.
⚪ NIT apps/cli/src/commands/api/generated.ts:11 docs-style codex The Warehouse connection help uses “Login” in prose and omits Oxford commas.
⚪ NIT apps/cli/src/commands/api/generated.ts:530 docs-style codex Warehouse help uses “PostgreSQL” for prose references to the source database where the terminology guide calls for “Postgres.”
⚪ NIT apps/cli/src/commands/api/runtime.ts:101 docs-style codex The --body help leaves readers to infer which flags override which JSON fields.
Refuted findings (kept for transparency, not posted as review comments)
  • apps/cli/src/commands/api/api-command-execute.ts:274 (output-sanitization): Warehouse polling recovery hints can interpolate an API-returned identifier containing whitespace, shell metacharacters, or control characters.
    Refuted: The teardown hint can include only a validated UUID and project ref. The setup poll uses the public warehouse status hint without forwarding the API-returned selection ID, as shown in apps/cli/src/commands/api/api-command-execute.ts:326–327 and apps/cli/src/commands/api/generated.ts:711–717.
  • packages/api/scripts/openapi-overrides.json:157 (api-sync): The temporary Warehouse path overrides can silently replace upstream contracts when the Management API starts publishing them.
    Refuted: This implementation rejects an existing object member. The guard aborts generation and identifies the path when upstream begins publishing it.

Stats

Claude findings: 2 · Codex findings: 15 · Confirmed: 15 · Refuted: 2 · Uncertain: 0


Models: claude-opus-5-5 + gpt-6.2-sol · Trigger: manual · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

Comment thread apps/cli/src/commands/api/runtime.ts Resolved
Comment thread apps/cli/scripts/api-command-derive.ts Resolved
Comment thread apps/cli/src/commands/api/generated.ts Resolved
Comment thread apps/cli/src/commands/api/generated.ts Resolved
Comment thread apps/cli/src/commands/api/runtime.ts Resolved
jgoux and others added 4 commits November 23, 2026 13:29
…uards

Ask for hosted consent before creating the API client, fall back to the
status hint when the API sends a blank one, reject non-JSON success bodies
in JSON output, name the argument or flag in validation errors, keep --file
in help examples unless a required flag fills the body, and render the -o
rejection as JSON for every -o value.

The generator now rejects envelope data fields other than type and
attributes, and waits whose operation or poll target declares several 2xx
responses.
…ehouse-commands

# Conflicts:
#	packages/api/src/generated/contracts.ts
…ands

Generated commands now resolve the format with the global resolver, fail
through the existing error document and exit codes, emit stream-json result
and log frames, and print the same result with or without --wait. The
bespoke standard-errors envelope is removed.
@jgoux

jgoux commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

/ai-review

@github-actions github-actions Bot 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.

🤖 AI Review

CLI reference prose guidance: snapshot supabase/supabase@9b1af5b supplied to reviewers (advisory, not a style pass).

Both independent reviews were available. The Warehouse restart command makes the hosted-consent snapshot stale, and malformed machine output can tell users to repeat a mutation the API already accepted. The typed Warehouse status client rejects the previous response shape, but current deployment behavior could not be verified. The override loader already rejects collisions with upstream definitions, and the subprocess tests exercise stdout behavior that the handler tests replace with a mock. The CLI prose findings were checked against the pinned guidance. The PR description was unavailable, and the repository test suite was not run.

Findings

Severity Location Category Sources Claim
🟠 MAJOR apps/cli/src/command-internal/hosted-consent/hosted-consent-coverage.unit.test.ts:140 test-regression claude+codex The hosted-consent snapshot will fail because it omits the new warehouse replication restart mutation.
🟠 MAJOR apps/cli/src/commands/api/api-command-execute.ts:169 error-handling codex A malformed 2xx body in machine-output mode tells users to retry an accepted mutation, including a Warehouse table resync that can reset the table again.
🟡 MINOR packages/api/src/generated/contracts.ts:15267 api-compatibility codex The typed Warehouse status method rejects responses that conformed to the previous status schema.
🟡 MINOR apps/cli/src/commands/api/api-command-execute.ts:334 error-handling codex An accepted mutation ends in an internal defect if its response lacks usable polling metadata.
🟡 MINOR apps/cli/scripts/generate-api-commands.ts:4 code-generation codex The API command generator cannot recreate generated.ts when the file is missing or syntactically invalid.
🟡 MINOR apps/cli/src/commands/api/api-command-execute.ts:195 output codex --output-format json can return success while writing invalid UTF-8 to stdout.
🟡 MINOR apps/cli/src/commands/api/api-command-request.ts:246 redaction codex The shared runtime can echo a value marked sensitive when request-schema validation fails.
🟡 MINOR apps/cli/scripts/api-command-derive.ts:1059 code-generation codex API command generation accepts wait links whose source schema cannot satisfy the polling input, and it can accept a non-string status field.
🟡 MINOR apps/cli/scripts/api-command-derive.ts:206 code-generation codex Reordering equivalent JSON Schema properties can make API command generation reject an otherwise supported anyOf envelope.
🟡 MINOR apps/cli/src/commands/api/generated.ts:28 help-text codex Warehouse help uses API field names where users need CLI flag syntax.
⚪ NIT apps/cli/src/commands/api/api-command-execute.ts:303 error-handling claude The shared wait runtime prints follow-up commands with unquoted argument values, so a future polling input containing spaces or shell metacharacters can produce an unsafe or incorrect command to paste.
⚪ NIT apps/cli/src/commands/api/generated.ts:11 docs-style codex Warehouse connection help uses “Login” in prose and places a password instruction in parentheses.
⚪ NIT apps/cli/src/commands/api/generated.ts:108 docs-style codex Warehouse flag and argument help uses “PostgreSQL” in general prose.
⚪ NIT apps/cli/src/commands/api/api-command-policy.ts:71 docs-style codex The Warehouse group descriptions use “Manage” where they could name the available operations.
⚪ NIT apps/cli/src/commands/api/generated.ts:28 docs-style codex The disable and teardown help use unfamiliar abbreviations on first mention.
⚪ NIT apps/cli/src/commands/api/generated.ts:458 docs-style codex The restart and resync help omit serial commas in lists of states or effects.
⚪ NIT apps/cli/src/commands/api/generated.ts:293 docs-style codex The query-stats interval help omits the thousands separator from the point limit.
Refuted findings (kept for transparency, not posted as review comments)
  • packages/api/scripts/openapi-overrides.json:157 (api-sync): The Warehouse add overrides would silently replace upstream paths and schemas after they appear in the deployed specification.
    Refuted: packages/api/scripts/download-openapi.ts:145–148 throws if the object key already exists, before assignment. packages/api/scripts/download-openapi.unit.test.ts:104 covers an existing-key collision. The sync fails visibly if upstream adds either key.
  • apps/cli/src/commands/api/api-commands.e2e.test.ts:263 (test-coverage): The subprocess cases for status output and enable polling duplicate the corresponding handler integration coverage.
    Refuted: The handler and subprocess cases share success outcomes, but they cover different output boundaries. The compiled cases exercise actual feature wiring, raw stdout, and NDJSON serialization. The handler tests observe mock output calls. The targeted subprocess coverage fits trusted/apps/cli/CLAUDE.md:285–291.

Stats

Claude findings: 2 · Codex findings: 18 · Confirmed: 17 · Refuted: 2 · Uncertain: 0


Models: claude-opus-5-5 + gpt-6.2-sol · Trigger: manual · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

Comment thread packages/api/src/generated/contracts.ts Resolved
Comment thread apps/cli/src/commands/api/generated.ts Resolved
Comment thread apps/cli/src/commands/api/generated.ts Resolved
Comment thread apps/cli/src/commands/api/generated.ts Resolved
Comment thread apps/cli/src/commands/api/generated.ts Resolved
bnjjj and others added 5 commits November 25, 2026 13:52
…API spec (#7785)

The deployed Management API spec now publishes the Warehouse operations
that `openapi-overrides.json` still added, so the `add` ops collided and
`download-openapi.ts` failed with `JSON pointer
"/paths/~1v2~1projects~1{ref}~1warehouse~1status" cannot be added.`

## Changes

- Remove the Warehouse override entries now in the deployed spec:
status, connection, tables, table, table layout get and update,
query-stats, capacity, and replication add, remove, resync and restart,
with their schemas.
- Remove the `setups/current` `x-operation` test+replace pair; upstream
already publishes the replaced value.
- Remove `V2WarehouseTableLayoutPartitionBy` and
`V2WarehouseTableLayoutSortBy`; upstream inlines these shapes in
`V2WarehouseTableLayoutUpdateRequest` and nothing else referenced them.
- Add a guarded replace on the `warehouse connection` description:
upstream prints the `usql` example as plain text, so its `<host>`
placeholder fails the command description contract. The replace restores
the inline code span.
- Add guarded replaces where upstream help misleads: the `warehouse
replication resync` `schema` description tells users to omit `table`,
which resync requires; the `warehouse inspect capacity` and
`query-stats` `from`/`to` descriptions omit the seconds and time zone
their pattern requires, so the replacements state the format with an
example.
- Drop `diagnostic.exit_code` from the status integration fixture; the
upstream schema says diagnostics never carry exit codes.
- Regenerate `packages/api/src/generated/*` and the generated CLI
commands.
- Add `warehouse replication restart` to the hosted-consent default
snapshot.

## Upstream changes picked up in `generated.md`

- `warehouse inspect capacity`: the description is one paragraph without
code spans and refers to `since`/`from`/`to` instead of the flag names;
`--from`/`--to` keep the format and example through the guarded replaces
above.
- `warehouse inspect query-stats`: the `--attributes` default lists
measurement names.
- `warehouse replication restart`: adds guidance on restarting a failed
pod and on preserved incomplete setup markers.
- Flag order follows the spec: `since, from, to, attributes, interval`
for both inspect commands, `--interval` choices in ascending order, and
`reset-table, sort-by, partition-by` for `tables layout update`. No
flags are added or removed.

---------

Co-authored-by: Julien Goux <hi@jgoux.dev>
…7802)

Add `warehouse inspect ingestion-stats` for ingestion throughput and WAL
lag, and `warehouse inspect storage-stats` for storage and maintenance
metrics. Both are generated from the `v2-get-warehouse-ingestion-stats`
and `v2-get-warehouse-storage-stats` operations in the deployed
Management API spec. They are read-only and take the same `--since`,
`--from`, `--to`, `--attributes` and `--interval` flags as `warehouse
inspect query-stats` and `capacity`.

## Changes

- Add both operations to the generated-command policy and widen the
`warehouse inspect` group description.
- Add guarded replaces where the upstream help misleads: the `from`/`to`
descriptions omit the seconds and time zone their pattern requires, as
`query-stats` and `capacity` did, and the ingestion `interval`
description mentions latency windows although no ingestion measurement
is a latency.
- Regenerate `packages/api/src/generated/openapi.json` and the generated
CLI commands.

---------

Co-authored-by: Julien Goux <hi@jgoux.dev>
…PI commands

Map transport and body-read failures to ApiCommandNetworkError, and say when
a mutation was already accepted before a later read failed, pointing at the
status command instead of a blind retry. The generator now rejects path-item
parameters and wait links whose types do not match the read operation.
…ailure

An accepted mutation whose response lacks the wait identifier, or whose wait
times out, now fails with a typed error that says the API accepted it and
names the status command. A read whose body cannot be read no longer claims
the API was unreachable. Suggested commands quote their values, the unknown
body field is escaped, group and --body help name what they do, and the
subprocess suite keeps three golden paths.

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

run-preview-packages Publish pkg.pr.new preview CLI packages for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants