Skip to content

feat(cli): add warehouse tables list and get - #7689

Merged
jgoux merged 5 commits into
feat/generated-warehouse-commandsfrom
bnjjj/pipe-1451-warehouse-tables-list
Nov 18, 2026
Merged

jgoux merged 5 commits into
feat/generated-warehouse-commandsfrom
bnjjj/pipe-1451-warehouse-tables-list

Conversation

@bnjjj

@bnjjj bnjjj commented Nov 18, 2026 •

Copy link
Copy Markdown

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 https://github.com/supabase/platform/pull/42055 and https://github.com/supabase/platform/pull/42108.

Implements PIPE-1451 and PIPE-1453.

@bnjjj bnjjj changed the title feat(cli): add warehouse tables list feat(cli): add warehouse tables list and get Nov 18, 2026
Add the generated `warehouse tables list` command for the Management API
tables listing, and the matching `flush_lag_bytes` replication feedback in
the Warehouse status contract. Both contracts come from spec overrides until
the deployed specification includes them.

Render an empty resource collection as `No results` and leave out columns
that hold nested objects in any row, so nullable nested values no longer
print as compact JSON in the table.
Add the generated `warehouse tables get <table-id>` command for reading one
replicated table by its source OID. The contract comes from a spec override
until the deployed specification includes it.

The bindings coverage test now supplies positional path parameters.
@bnjjj
bnjjj force-pushed the bnjjj/pipe-1451-warehouse-tables-list branch from c0cd219 to 03897a9 Compare November 18, 2026 14:16
@jgoux
jgoux marked this pull request as ready for review November 18, 2026 15:45
@jgoux
jgoux requested review from a team and supabase-oss as code owners November 18, 2026 15:45
@jgoux
jgoux requested review from Prashansa-K and removed request for a team November 18, 2026 15:45

@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

Both independent reviews were available. The main issue is that the typed Warehouse status client now rejects otherwise valid responses that omit flush_lag_bytes; the experimental CLI command uses the raw response and is not affected by that decoder change. The shared text renderer also drops entire mixed-type columns, hiding values it previously displayed. The CLI reference procedure and guidance snapshot were absent, so no CLI reference style pass was performed. Read-only contract and formatter checks passed; the targeted Bun tests could not load because Effect dependencies were not installed.

Findings

Severity Location Category Sources Claim
🟠 MAJOR packages/api/scripts/openapi-overrides.json:480 backward-compatibility codex The typed Warehouse status client now rejects otherwise valid responses when a non-null apply_lag or sync_lag object omits flush_lag_bytes.
🟡 MINOR apps/cli/src/commands/api/api-command.format.ts:143 output-regression claude+codex A single object or array cell now hides every value in the same resource-table column, including scalar values in other rows.
🟡 MINOR apps/cli/src/commands/api/SIDE_EFFECTS.md:150 documentation claude The text-output contract describes nested objects as indented blocks but does not say that a resource table omits an entire column if any row contains an object or an array.
🟡 MINOR packages/api/src/generated/contracts.ts:15089 schema-validation codex The new Warehouse table decoders accept observed_at strings that the checked-in OpenAPI patterns reject.
⚪ NIT apps/cli/src/commands/api/api-command-bindings.integration.test.ts:361 test-coverage claude The positional binding test checks agreement between generated fields, but does not independently verify the public argument name table-id.
⚪ NIT apps/cli/src/commands/api/api-command.format.ts:139 code-quality claude The resource-table branch repeats a nonempty-array check after empty arrays have already returned.
⚪ NIT packages/api/scripts/openapi-overrides.json:1340 maintainability codex The Warehouse list and get overrides duplicate the same resource schema, so future changes can make the two contracts drift.
⚪ NIT apps/cli/src/commands/api/api-command-bindings.integration.test.ts:403 test-coverage codex The required-only binding test repeats the same CLI invocation as the all-inputs test for both new Warehouse table commands.

Stats

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


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

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

"required": [
"active",
"feedback_age_ms",
"flush_lag_bytes",

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.

🟠 MAJOR · backward-compatibility · source: codex

The typed Warehouse status client now rejects otherwise valid responses when a non-null apply_lag or sync_lag object omits flush_lag_bytes.

Evidence: packages/api/scripts/openapi-overrides.json:480 and packages/api/scripts/openapi-overrides.json:608 add the field to both required lists. packages/api/src/generated/contracts.ts:14827 and packages/api/src/generated/contracts.ts:14961 use required nullable unions, and packages/api/src/internal/client.ts:699 decodes the response with that schema.

Suggested fix: Make flush_lag_bytes optional and nullable in the existing status response while keeping it required and nullable on the new table endpoints. Add a typed status client test for feedback that omits the field.

rows.some((row) => isScalar(row[column]) && row[column] !== undefined),
const columns = unionKeys(rows).filter(
(column) =>
rows.every((row) => isScalar(row[column])) && rows.some((row) => row[column] !== undefined),

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.

🟡 MINOR · output-regression · source: claude+codex

A single object or array cell now hides every value in the same resource-table column, including scalar values in other rows.

Evidence: apps/cli/src/commands/api/api-command.format.ts:143 requires every cell to be scalar, and apps/cli/src/commands/api/api-command.format.ts:12 classifies arrays as non-scalars. The base filter admitted a column if any row had a defined scalar; apps/cli/src/commands/api/api-command.format.ts:50 then rendered nested cells in that column as compact JSON.

Suggested fix: Scope the replication feedback omission to Warehouse table lists, or keep mixed columns and use placeholders for nested cells. Add a regression test with a scalar and an array in the same column.

| `--dry-run` otherwise | the request preview in the selected JSON or YAML presentation |
| Mode | stdout |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| text presentation | the response as labelled fields and tables, nested objects as indented blocks, `-` for null or empty values; with `--wait` the final read response; an empty response prints `Done.` and an empty collection `No results` |

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.

🟡 MINOR · documentation · source: claude

The text-output contract describes nested objects as indented blocks but does not say that a resource table omits an entire column if any row contains an object or an array.

Evidence: apps/cli/src/commands/api/SIDE_EFFECTS.md:150 does not distinguish single-resource output from collection output. apps/cli/src/commands/api/api-command.format.ts:143 filters collection columns, and apps/cli/src/commands/api/api-commands.integration.test.ts:423 asserts that replication feedback is absent from list text output.

Suggested fix: Distinguish single-resource blocks from collection tables, document the final column omission rule, and point readers to -o json for the full response.

Comment on lines +15089 to +15096
observed_at: Schema.Union([
Schema.String.annotate({
description:
"Time the API retrieved the replication state of the table. It does not indicate when data was last synchronized.",
format: "date-time",
}),
Schema.Null,
]),

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.

🟡 MINOR · schema-validation · source: codex

The new Warehouse table decoders accept observed_at strings that the checked-in OpenAPI patterns reject.

Evidence: packages/api/scripts/openapi-overrides.json:1097 and packages/api/scripts/openapi-overrides.json:1361 specify a UTC timestamp pattern. packages/api/src/generated/contracts.ts:15089 and packages/api/src/generated/contracts.ts:16276 use a string with a date-time annotation or null, without a runtime pattern check.

Suggested fix: Align the new OpenAPI schemas with the intended timestamp tolerance rather than making the typed decoder enforce the UTC-only regex.

location: "path",
name,
source: "argument",
argument: generated.find((entry) => entry.operationId === operationId)?.argument?.name,

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.

⚪ NIT · test-coverage · source: claude

The positional binding test checks agreement between generated fields, but does not independently verify the public argument name table-id.

Evidence: apps/cli/src/commands/api/api-command-bindings.integration.test.ts:361 takes the expected name from the generated argument descriptor. apps/cli/src/commands/api/runtime.ts:345 supplies the generated bindings used as the actual value.

Suggested fix: Assert the public positional name independently, either from the documented CLI naming rule or in a focused command-surface assertion.

if (isResource(data)) {
return [humanize(String(data["type"])), ...blockLines(resourceEntries(data), INDENT)];
}
if (Array.isArray(data) && data.length > 0 && data.every(isResource)) {

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.

⚪ NIT · code-quality · source: claude

The resource-table branch repeats a nonempty-array check after empty arrays have already returned.

Evidence: apps/cli/src/commands/api/api-command.format.ts:135 returns No results for empty arrays before apps/cli/src/commands/api/api-command.format.ts:139 checks data.length > 0.

Suggested fix: Remove the redundant data.length > 0 condition.

},
{
"op": "add",
"path": "/components/schemas/V2WarehouseTableResponse_Output",

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.

⚪ NIT · maintainability · source: codex

The Warehouse list and get overrides duplicate the same resource schema, so future changes can make the two contracts drift.

Evidence: packages/api/scripts/openapi-overrides.json:1075 defines the resource under data.items, and packages/api/scripts/openapi-overrides.json:1340 repeats it under data. A structural comparison confirmed that the two resource definitions are identical.

Suggested fix: Define a shared Warehouse table resource component and reference it from both response envelopes.

const requests = yield* send(row.path, argvOf(required), operation.responseStatus);
const requests = yield* send(
row.path,
[...positionals.map(({ sample }) => sample), ...argvOf(required)],

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.

⚪ NIT · test-coverage · source: codex

The required-only binding test repeats the same CLI invocation as the all-inputs test for both new Warehouse table commands.

Evidence: apps/cli/src/commands/api/generated.ts:236 and apps/cli/src/commands/api/generated.ts:266 declare no operation-specific flags. Both test cases supply the same positional samples at apps/cli/src/commands/api/api-command-bindings.integration.test.ts:384 and apps/cli/src/commands/api/api-command-bindings.integration.test.ts:403.

Suggested fix: Register the required-only case only when the operation has at least one optional input.

@jgoux
jgoux merged commit 9609fa2 into feat/generated-warehouse-commands Nov 18, 2026
@jgoux
jgoux deleted the bnjjj/pipe-1451-warehouse-tables-list branch November 18, 2026 15:55
bnjjj added a commit that referenced this pull request Nov 18, 2026
Generate `warehouse tables layout get <table-id>` from `GET
/v2/projects/{ref}/warehouse/tables/{table_id}/layout`. It reads one
replicated table by the source OID that `warehouse tables list` shows,
and reports two layouts side by side:

- `desired`: the saved sorting and partitioning rules, where null means
unmanaged and `{ "kind": "none" }` or `[]` is an explicit clear;
- `observed`: the sort expressions and partition keys the DuckLake
catalog records, with the time they were read and an
`observation_status` of `observed`, `table_missing` or `unavailable`.

The two can differ until the replicator applies saved rules, and a
catalog layout does not establish that existing files are sorted or
partitioned. Text output shows both as nested tables. A table that isn't
replicated is an API error.

`sort_by` is the first nullable `oneOf` in the specification. The API
client generator now adds `null` to a nullable `oneOf` as it already did
for `anyOf`, so the typed client accepts a table with unmanaged sorting.
The bindings test's schema fingerprint also reads a `null` union branch
as a nullable type.

The layout contract comes from OpenAPI overrides until it ships in the
deployed Management API specification.

Stacked on #7640, after #7689. Depends on
supabase/platform#42055 and
supabase/platform#42126.

Implements PIPE-1455.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants