connector!: dialect + auth-mode subcommand tree (Postgres)#15
Conversation
Rearchitects `ana connector create` into a two-level Group tree so new
dialects and auth modes land as file additions rather than growing a
conditional `--type`/`--auth` flag matrix. Postgres (one auth mode today
— password) is migrated as the first dialect; Snowflake/Databricks/etc.
will follow as probes capture their wire shapes.
- newCreateGroup → dialect selector Group ("create" child of connector).
- newPostgresCreateGroup → Postgres dialect Group owning common flags
--name and --ssl via cli.Group.Flags (Phase 2 inheritable flags).
- postgresPasswordCmd → `password` auth-mode leaf. Implements cli.Flagger
so --help renders own + ancestor flags. Reads --name/--ssl through
pointer fields bound in newPostgresCreateGroup's closure.
- resolvePassword stays in create.go; update.go still uses it.
User-visible change: `ana connector create --type postgres --name X ...`
becomes `ana connector create postgres password --name X ...`. Scoped `!`
for the SemVer major bump since this is a breaking flag-shape change.
Docs:
- README: connector-create subcommand shape noted in Getting started.
- README: Windows SmartScreen section rewritten to distinguish signed
release binaries (Azure Trusted Signing via sign-windows job) from
unsigned source builds. Closes #8.
- docs/cli-readiness.md: example command updated to new shape.
Tests: 100% cov on ./internal/connector/. All create cases route through
newCreateGroup so the ancestor-flag plumbing (Postgres Group → leaf) is
exercised the same way real dispatch does.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (6)
💤 Files with no reviewable changes (2)
📝 WalkthroughWalkthroughThe Changes
Sequence DiagramsequenceDiagram
participant Client as CLI Caller
participant CreateGroup as Create Group
participant PostgresGroup as Postgres Group
participant PasswordCmd as Password Command
participant Flags as Flag Parser
participant API as API (Unary)
participant IO as Output Handler
Client->>CreateGroup: Run(args)
CreateGroup->>PostgresGroup: Dispatch "postgres"
PostgresGroup->>PasswordCmd: Dispatch "password"
PasswordCmd->>Flags: Parse args with inherited flags
Flags->>Flags: Register inherited (--name, --ssl)
Flags->>Flags: Register own flags (--host, --port, --user, --database, --password*)
Flags->>Flags: Validate required fields & ranges
PasswordCmd->>PasswordCmd: Resolve password from --password or stdin
PasswordCmd->>API: POST /CreateConnector with postgresSpec
API->>PasswordCmd: Response (connectorId, name, connectorType)
PasswordCmd->>IO: Render connector details to stdout
IO->>Client: Success output
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
ana connector createinto a two-leveldialect auth-modeGroup tree. Postgres migrated as the first dialect; Snowflake/Databricks/etc. will follow as probes land.ana connector create --type postgres --name X …→ana connector create postgres password --name X …. Scoped!for the major bump.Follow-ups
connector update+ auth-swap subtree.Summary by CodeRabbit