Repository navigation
Conversation
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.
…s' into bnjjj/pipe-1455-warehouse-tables-layout-get # Conflicts: # apps/cli/src/cli/command-surface/command-surface.integration.test.ts # apps/cli/src/commands/api/api-command-policy.ts # apps/cli/src/commands/api/api-commands.integration.test.ts # apps/cli/src/commands/api/generated.md # apps/cli/src/commands/api/generated.schemas.ts # apps/cli/src/commands/api/generated.ts # packages/api/scripts/openapi-overrides.json # packages/api/src/generated/contracts.ts # packages/api/src/generated/effect-client.ts # packages/api/src/generated/openapi.json # packages/api/src/generated/permissions.ts
There was a problem hiding this comment.
🤖 AI Review
Confirmed all three findings. The exported OpenAPI document rejects the new Warehouse layout response when sorting is unmanaged, even though the generated Effect contract accepts it. The shared generator also introduces an edge case for unions that already accept null, and the CLI integration test does not cover a missing catalog layout. The CLI reference guidance artifacts were unavailable, so no style pass was performed.
Findings
| Severity | Location | Category | Sources | Claim |
|---|---|---|---|---|
| 🟠 MAJOR | packages/api/scripts/openapi-overrides.json:1698 |
api-contract |
codex | The exported OpenAPI 3.0 document rejects desired.sort_by: null, even though null is a valid response meaning sorting is unmanaged. |
| 🟡 MINOR | packages/api/scripts/generate.ts:337 |
code-generation |
codex | Appending null directly to a oneOf can make the union reject null when exactly one original branch already accepted it. |
| ⚪ NIT | apps/cli/src/commands/api/api-commands.integration.test.ts:506 |
test-coverage |
claude | The new integration test covers only a populated observed object. It does not verify that the CLI still displays the desired rules when the catalog layout is unavailable and observed is null. |
Stats
Claude findings: 1 · Codex findings: 2 · Confirmed: 3 · 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.
| "sort_by": { | ||
| "description": "Configured sort order. none explicitly clears sorting, primary_key sorts by the source primary-key columns in key order, and columns lists them. Null leaves sorting unmanaged.", | ||
| "nullable": true, | ||
| "oneOf": [ |
There was a problem hiding this comment.
🟠 MAJOR · api-contract · source: codex
The exported OpenAPI 3.0 document rejects desired.sort_by: null, even though null is a valid response meaning sorting is unmanaged.
Evidence: The override sets nullable: true next to oneOf without a sibling type. packages/api/src/generated/openapi.json:49509 preserves that shape, and all three branches require objects. The fixture at apps/cli/src/commands/api/api-commands.integration.test.ts:493 sends null.
Suggested fix: Replace the outer nullable flag with an explicit OpenAPI 3.0 null-only branch, such as {"type":"string","nullable":true,"enum":[null]}. Regenerate and validate the fixture against the exported document.
| : Array.isArray(sanitized.oneOf) | ||
| ? "oneOf" | ||
| : undefined; | ||
| if (sanitized.nullable === true && sanitized.type === undefined && union !== undefined) { | ||
| const normalized = { | ||
| ...sanitized, | ||
| anyOf: [...sanitized.anyOf, { type: "null" }], | ||
| [union]: [...(sanitized[union] ?? []), { type: "null" }], |
There was a problem hiding this comment.
🟡 MINOR · code-generation · source: codex
Appending null directly to a oneOf can make the union reject null when exactly one original branch already accepted it.
Evidence: packages/api/scripts/generate.ts:343 appends a null branch without checking the original branches. A oneOf with a nullable string branch and an integer branch goes from one match for null to two. The test at packages/api/scripts/generate.unit.test.ts:278 only covers branches that cannot accept null.
Suggested fix: If the generator must support this shorthand, wrap the intact oneOf and a null branch in an outer anyOf. Add a test that decodes null when one original branch is already nullable.
| it.effect("renders unmanaged desired sorting beside the observed catalog layout", () => { | ||
| const { out, sent, run } = setup(["warehouse", "tables", "layout", "get", "16385"], { | ||
| route: ok(body), | ||
| stdoutIsTty: true, | ||
| }); | ||
| return Effect.gen(function* () { | ||
| yield* run; | ||
| expect(sent).toEqual([{ method: "GET", path: layoutPath, search: "", body: undefined }]); | ||
| expect(out.stdoutText).toMatch(/^Warehouse table layout\n/); | ||
| expect(out.stdoutText).toMatch(/Desired\n\s+Sort by\s+-\n/); | ||
| expect(out.stdoutText).toMatch(/account_id \| \{"kind":"bucket","count":16\}/); | ||
| expect(out.stdoutText).toMatch(/Observation status\s+observed/); | ||
| expect(out.stdoutText).toMatch(/account_id \| bucket\(16\)/); | ||
| expect(out.stdoutText).toMatch(/Observed at\s+2026-11-18T09:30:00\.123456Z/); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
⚪ NIT · test-coverage · source: claude
The new integration test covers only a populated observed object. It does not verify that the CLI still displays the desired rules when the catalog layout is unavailable and observed is null.
Evidence: apps/cli/src/commands/api/api-commands.integration.test.ts:496 sets the status to observed and supplies a populated object. packages/api/src/generated/contracts.ts:15315 allows null, and packages/api/scripts/openapi-overrides.json:1771 documents when it occurs.
Suggested fix: Add a text-mode case with observation_status: "table_missing", observed: null, and desired: { sort_by: { kind: "none" }, partition_by: [] }. Assert that the output still shows the desired rules and renders Observed as -.
Generate
warehouse tables layout get <table-id>fromGET /v2/projects/{ref}/warehouse/tables/{table_id}/layout. It reads one replicated table by the source OID thatwarehouse tables listshows, 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 anobservation_statusofobserved,table_missingorunavailable.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_byis the first nullableoneOfin the specification. The API client generator now addsnullto a nullableoneOfas it already did foranyOf, so the typed client accepts a table with unmanaged sorting. The bindings test's schema fingerprint also reads anullunion 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 https://github.com/supabase/platform/pull/42055 and https://github.com/supabase/platform/pull/42126.
Implements PIPE-1455.