Skip to content

feat(cli): add warehouse connection - #7674

Merged
jgoux merged 10 commits into
feat/generated-warehouse-commandsfrom
bnjjj/pipe-1449-warehouse-connection
Nov 17, 2026
Merged

jgoux merged 10 commits into
feat/generated-warehouse-commandsfrom
bnjjj/pipe-1449-warehouse-connection

Conversation

@bnjjj

@bnjjj bnjjj commented Nov 17, 2026

Copy link
Copy Markdown

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

Implements PIPE-1449.

Generate `warehouse connection` from `GET /v2/projects/{ref}/warehouse/connection`
to print the Arrow Flight SQL endpoint and source-database login guidance without
fetching credentials. Add `connection` to the generated command vocabulary and
label TLS fields as an acronym.
@bnjjj
bnjjj marked this pull request as ready for review November 17, 2026 16:31
@bnjjj
bnjjj requested review from a team and supabase-oss as code owners November 17, 2026 16:31
@bnjjj
bnjjj requested review from avallete and removed request for a team November 17, 2026 16:31

@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

Verified all three reported findings and merged the duplicate fixture reports into one confirmed minor finding. Also confirmed the documentation omission. No runtime defect was established. The CLI reference procedure and guidance artifacts were absent, so no reference-style assessment was possible.

Findings

Severity Location Category Sources Claim
🟡 MINOR apps/cli/src/commands/api/api-commands.integration.test.ts:385 test-coverage claude+codex Both new connection handler tests use a fixture that omits the required authentication.membership_guidance field, leaving that login guidance unexercised.
⚪ NIT apps/cli/src/commands/api/warehouse/connection/SIDE_EFFECTS.md:58 documentation claude The connection side-effects document omits generic entitlement-denial behavior: a valid 4xx entitlement_required response adds entitlement to the machine-mode stderr document, prints an upgrade hint in terminal text mode, and triggers cli_upgrade_suggested telemetry.

Stats

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


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

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

Comment on lines +385 to +391
method: "database_username_password",
credential_source: "source_project_database",
default_username: "postgres",
password_guidance:
"Use the same password as this role in the source Supabase database. For postgres, use the project's database password.",
required_membership: "supabase_warehouse_reader",
},

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 · test-coverage · source: claude+codex

Both new connection handler tests use a fixture that omits the required authentication.membership_guidance field, leaving that login guidance unexercised.

Evidence: apps/cli/src/commands/api/api-commands.integration.test.ts:375-397 defines the incomplete shared fixture, used at lines 400 and 430. packages/api/src/generated/contracts.ts:14343 declares membership_guidance as Schema.String, and apps/cli/src/commands/api/generated.schemas.ts:288-295 lists it as required.

Suggested fix: Include membership_guidance in the shared fixture and assert that its text appears in the available-connection output. Consider checking the fixture against the generated response type.

Comment on lines +58 to +62
| Code | Condition |
| ---- | ----------------------------------------------------------------------------- |
| `0` | successful read (including not configured, disabled or unavailable Warehouse) |
| `2` | `usage_error`: invalid flags |
| `1` | API error (non-2xx) |

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 · documentation · source: claude

The connection side-effects document omits generic entitlement-denial behavior: a valid 4xx entitlement_required response adds entitlement to the machine-mode stderr document, prints an upgrade hint in terminal text mode, and triggers cli_upgrade_suggested telemetry.

Evidence: apps/cli/src/commands/api/api-command-execute.ts:118-130 attaches entitlement for valid 4xx plan-gate envelopes. shared/cli/standard-errors.ts:258-264 renders the error document or upgrade hint, and telemetry/command-telemetry.ts:584-598 captures cli_upgrade_suggested. The connection document has no corresponding explanation and lists only cli_command_executed at lines 75-82.

Suggested fix: Document the conditional entitlement error output, terminal upgrade hint, and cli_upgrade_suggested event, as warehouse/status/SIDE_EFFECTS.md already does.

Hidden polling reads a generated link may target are now listed in
`pollTargets`, each paired with the read-only generated command a failed
or timed-out wait points users at. The setup read gets its own spec
identity so it no longer shares `warehouse status` with the consolidated
status route, and hidden targets go through the same experimental and
poll-or-links checks as generated operations.
# Conflicts:
#	packages/api/scripts/openapi-overrides.json
@jgoux

jgoux commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

@bnjjj I updated this branch without force-pushing:

  • 4a6eda8 merges the updated feat(cli): expose consolidated Warehouse status #7671 (bea291a; see my comment there for the policy changes). The only conflict was packages/api/scripts/openapi-overrides.json: both branches appended independent ops (your connection path + schema, and the setup-read rename). I kept both, connection ops first. I checked that the generated openapi.json carries both changes: warehouse connection and warehouse status are present, and the setup read is warehouse.setups get. The generated command data is up to date.
  • 54039ba fixes the dry-run row in warehouse/connection/SIDE_EFFECTS.md. --dry-run -o yaml emits YAML because writeDryRun forwards the selected format, so the row now says "the request preview in the selected JSON or YAML presentation", same as status and enable.

Otherwise this PR already fit the base design: generated data, the generic runtime, connection added to the reviewed verb vocabulary, and TLS added to generic formatting. No other changes were needed. Unit, integration and repo-wide checks are green on the merged branch.

Base automatically changed from bnjjj/pipe-1445-warehouse-status to feat/generated-warehouse-commands November 17, 2026 21:21
…s' into bnjjj/pipe-1449-warehouse-connection

# Conflicts:
#	apps/cli/src/commands/api/api-command-policy.ts
#	apps/cli/src/commands/api/api-commands.integration.test.ts
#	packages/api/scripts/openapi-overrides.json
#	packages/api/src/generated/openapi.json
#	packages/api/src/generated/permissions.ts
@jgoux
jgoux merged commit a03779a into feat/generated-warehouse-commands Nov 17, 2026
7 checks passed
@jgoux
jgoux deleted the bnjjj/pipe-1449-warehouse-connection branch November 17, 2026 21:22
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