Repository navigation
Conversation
|
/ai-review |
There was a problem hiding this comment.
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.
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.
|
/ai-review |
There was a problem hiding this comment.
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.
…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.
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.
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.
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.
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.
|
/ai-review |
There was a problem hiding this comment.
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 Warehouseaddoverrides 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.
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.
|
/ai-review |
There was a problem hiding this comment.
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 publicwarehouse statushint 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.
…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.
|
/ai-review |
There was a problem hiding this comment.
🤖 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 Warehouseaddoverrides would silently replace upstream paths and schemas after they appear in the deployed specification.
Refuted:packages/api/scripts/download-openapi.ts:145–148throws if the object key already exists, before assignment.packages/api/scripts/download-openapi.unit.test.ts:104covers 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 fitstrusted/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.
…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.
Summary
Adds the first commands generated from the Management API spec, for Warehouse:
supabase warehouse enablestarts replication and can--waitfor setup to finish;supabase warehouse disablestarts cleanup and can--waitfor it to finish;supabase warehouse statusreads the consolidated Warehouse status;supabase warehouse connectionreads the Arrow Flight SQL connection details;supabase warehouse teardowns getreads the current cleanup, and can--waiton it;supabase warehouse tables listlists 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-byand--partition-bytake a JSON value for their rule, and--reset-tablecopies the table again when the layout changes;supabase warehouse inspect query-statsreads Warehouse query statistics over a time range (--since, or--fromand--to), as labelled sample series;supabase warehouse inspect capacityreads Warehouse capacity, admission and activation measurements over a time range, in the same form;supabase warehouse inspect ingestion-statsreads ingestion throughput and WAL lag over a time range, with--attributesto pick measurements and--intervalfor the step;supabase warehouse inspect storage-statsreads maintenance, inline-flush and storage-health measurements over a time range;supabase warehouse replication addadds one eligible table (--schemaand--table) or a schema's currently eligible tables (--schemaalone) to replication;supabase warehouse replication removeremoves one selected table or all selected tables of a schema from replication, keeping the data already in Warehouse;supabase warehouse replication resyncresets and rebuilds one selected table (--schemaand--table). It has no wait, idempotency or revision flags;supabase warehouse replication restartstarts 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:or
SUPABASE_EXPERIMENTAL_WAREHOUSE=1in the shell.The goal is to settle the full pipeline on one real resource before adding more. That pipeline covers:
x-operationandlinks) → generated data;New commands should then need only an
x-operationentry 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-writtenwarehouse enablein #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 endWhy committed data instead of resolving the spec at runtime
api-commands:checkis part ofcheck:all.api-package-sync.ymlregenerates 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(andlinksfor--wait) in the spec, and its operation ID ingeneratedOperations. The spec edit lands upstream, or inpackages/api/scripts/openapi-overrides.jsonuntil it is published.pnpm run generatedownloads the spec, applies the overrides and writes the rest. A new noun is onenounsentry; a noun with its own feature also needs thatexperimental.<feature>key inpackages/config/src/experimental.tsand infeatureSchemas/featureKeysinapps/cli/src/shared/config/experimental-feature.ts, whichApiNoun.featureenforces at type-check time.In the spec:
x-operationon 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-operationis read only on an operation that an allowlisted operation links to (see below).group"warehouse"→supabase warehouse …"warehouse.tables"→supabase warehouse tables …methodlist,getorenable. A read of a singleton facet is named after the facet, such asstatusorconnection, and a report under aninspectgroup is named after the report, such asquery-stats. Every command word is lowercase kebab-case. Names are reviewed in the allowlist PR through thegenerated.mddiff."enable"→supabase warehouse enablepoll--waitand--timeout.The extension is decoded strictly: an unknown key fails generation, and so does a name with only one of
groupandmethod. A name is optional whenpollis 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 thelinksfor--wait, on every Warehouse operation. It also namessetups create, which stays off the allowlist for now.pollfields:status"/data/attributes/status"succeeded["succeeded"]failedoperation_failed(exit 1).["failed"]error"/data/attributes/status_error"inspect"v2-get-warehouse-status"--waitcomes from standard OpenAPIlinks. When a 2xx response has a link to an operation withpoll, the command gets--waitand--timeout. Link parameters map as follows:$response.body#/…takes the value from the first response.$request.path.refreuses the project ref.A response pointer must be required at every level of the response schema, so
--waitalways has something to poll with. A response that still lacks the value fails--waitas an internal error (exit 1) instead of a silent success.An operation either declares
pollor 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
--waitdeclarespolland 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/apiwhile waiting. Itspoll.inspectnames 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
linksof 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,pollor links but not both).Secrets are marked on the field with
writeOnly: true,format: "password"orx-sensitive: true. Those fields are masked in--dry-runoutput whether they come from a flag,--bodyor--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
tablesbecomes--table. Beyond body and query fields:ref, if there is one, becomes a positional argument. An empty value,.or..is a usage error before any request.nullincluded, 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"):In the CLI:
api-command-policy.tsholds:generatedOperations: the operations that generate commands, todayv2-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-replicationandv2-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 isconfirmDescription, which prints the operation's API description before the interactive consent prompt. The replication commands,disableandtables layout updateuse 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 experimentalfeaturethat gates it and the help text of the sub-groups the generator creates (Warehouse describesreplication,inspect,tables,tables.layoutandteardowns). A noun is always a new top-level group: generated commands never join a hand-written one. The group is hidden unless[experimental] <feature> = trueorSUPABASE_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:
x-operationis invalid;poll.inspect;The generator takes everything else from the spec:
required, repeatability and help text;/data/attributes/schema, …);warehouse_setup);@supabase/api/permissions, not generated here).The generator rejects anything the runtime cannot honour, so a bad spec never reaches users. It rejects:
x-scalar-stability: experimental;summary;x-operation;--bodyor--waitor with registered global flags such as--profile, and a name used by more than one of path, query and body;dry_run;refpath parameter or with more than one other path parameter, path parameters that aren't strings, cookie parameters, header parameters other thanAuthorization,Content-TypeandAccept, query parameters that aren't scalars, bodies that aren't a JSON:API envelope, and numeric body fields;pollon a non-GET, or together with a link to a polled operation;What users get
All generated commands follow the same conventions.
Help comes from the spec, including a
PERMISSIONSsection that lists the extra permission--waitneeds. The CLI builds theEXAMPLESentry 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:--dry-runprints 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:Whole bodies are accepted from
--body '<json>',--file body.jsonor--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: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 apointskey 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 printsNo results.jsonwrites one stdout document: the API response exactly as sent (nullfor an empty body), so| jqstays stable.stream-jsonwrites oneresultframe 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, andlogframes in stream-json. A dry run prints the request in the same three forms. The legacy-o/--outputflag 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,
--bodyor--file), so options such asdisable --delete-dataorlayout update --reset-tableshow before you confirm. A command withconfirmDescriptionalso prints its API description first, soreplication addwarns that the pipeline restarts before you answer. Non-interactive runs need--yesorSUPABASE_YES. Read-only commands such asstatusdon't ask.--waitturns 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 endEach read goes through the shared
@supabase/apiclient, 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>afterdisable --wait. When it is a poll-only read, the suggestion names the command of itspoll.inspectoperation, as insupabase warehouse status --remote=<ref>afterenable --wait.supabase warehouse disable --waitpolls the cleanup read the same way. A command prints one result shape with or without--wait:enable --waitanddisable --waitprint the accepted response once the operation succeeds, and the settled state stays onestatusorteardowns getaway.supabase warehouse teardowns get --waitpolls 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.
jsonwrites{"_tag":"Error","error":{"code","message","suggestion"?,"entitlement"?}}to stdout, andstream-jsonwrites anerrorframe.codeis the error's tag (ApiCommandStatusError,ApiCommandUsageError,ApiCommandOperationFailedError,ApiCommandWaitTimeoutError,ApiCommandUnexpectedResponseError,ApiCommandNetworkError, or a shared error such asHostedMutationConsentRequiredError). Failures exit 1, and an interrupt exits 130.A plan-gated 4xx (server body code
entitlement_required) carriesentitlement: {feature, upgrade_url}in place of the permission suggestion. Text prints the upgrade hint, andcli_upgrade_suggestedfires.Suggestions are built where the information is still available:
Run `supabase login`.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
--waitneeds, or the wait's read fails or times out. The message then starts withThe API accepted the request (<summary>), but …. In place of a retry, the suggestion points at the command that shows the current state, such assupabase 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, itsx-operationand its links come from the published spec.openapi-overrides.jsononly fixes eleven Warehouse help texts until the spec is updated: it puts theusqlexample of the connection read in a code span, because the description check rejects its raw<host>placeholder; it says thatreplication resync --schematakes a literal schema name; and it gives the timestamp format of--fromand--toon the fourinspectreports and the default ofinspect ingestion-stats --interval. Each fix is atestandreplacepair, so a reworded upstream text fails the sync instead of being overwritten. The contracts are regenerated.experimental.warehouseto the config schema and to the document-only local paths inpackages/config;apps/cli/schemas/config/v1.jsonis regenerated.supabase#api-commands:generateandapi-commands:check, which is part ofcheck:all. Rootgenerateregenerates@supabase/apiand@supabase/stackfirst, then runssupabase#api-commands:generateandschemas:generatein 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.ymlregenerates command data and the reference together with the spec. oxlint ignoresgenerated.ts.linkedDbResolverRuntimeLayerbecomeslazyManagementApiRuntimeLayer, shared bydb,logs,migration,pulland the generated commands, so the API client is built only when a command needs it.main.tsandroot.tsresolve the enabled noun features throughapi-command-features.ts, and the error-tag snapshot gains the six new error tags.generated.mdlists each command's route, experimental gate, flags and bindings, and its--waitread;api-commands:checkkeeps it in sync. Generated commands get no per-command folder.Not in this PR
setups create, which the spec names. It becomes a command once its operation ID joinsgeneratedOperations.surface.json) and a breaking-change gate built on it. An extraction without a CI-checked consumer was dropped from this PR.experimentalstage.