Skip to content

feat: make connect_as required for all service types#356

Merged
rshoemaker merged 1 commit intomainfrom
feat/PLAT-554/connect-as-required
Apr 21, 2026
Merged

feat: make connect_as required for all service types#356
rshoemaker merged 1 commit intomainfrom
feat/PLAT-554/connect-as-required

Conversation

@rshoemaker
Copy link
Copy Markdown
Contributor

Summary

  • Make connect_as a required field on ServiceSpec for all service types
  • Remove g.Default("") workaround and omitempty from the Goa DSL
  • Remove the MCP-only guard on validateConnectAs — validation now runs unconditionally
  • The allow_writes + db_owner cross-validation remains MCP-specific

Context

Now that RAG (#351) and PostgREST (#352) have adopted connect_as, the temporary workarounds to make it optional can be removed.

Test plan

  • All unit tests pass
  • Generated OpenAPI spec shows connect_as in the required array
  • Goa HTTP layer rejects requests missing connect_as on both create-database and update-database
  • E2E tests (all fixtures already have connect_as)

PLAT-554

Remove g.Default("") and omitempty from the connect_as Goa attribute,
add it to g.Required(), and remove the MCP-only guard on
validateConnectAs. All service types (MCP, RAG, PostgREST) now require
connect_as at both the API and validation layers.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

📝 Walkthrough

Walkthrough

The connect_as field in ServiceSpec is now mandatory. The field's default value and JSON omitempty tag were removed, and it was added to the required fields list. Validation for connect_as now applies unconditionally to all service types instead of only specific ones.

Changes

Cohort / File(s) Summary
ServiceSpec connect_as Requirement
api/apiv1/design/database.go, server/internal/api/apiv1/validate.go
Made connect_as field mandatory by removing default value, removing omitempty from JSON tag, adding it to required fields, and applying validation unconditionally across all service types rather than specific service type subsets.

Poem

🐰 A rabbit hops through code so fine,
Where connect_as now must always align!
No more defaults, no omit in sight,
Every service must have it right,
Required for all—the validation's bright! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: making connect_as a required field for all service types.
Description check ✅ Passed The description covers the summary, changes, context, and test plan. One test item is marked incomplete (E2E tests), but it notes all fixtures already include connect_as.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/PLAT-554/connect-as-required

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics -4 complexity · 0 duplication

Metric Results
Complexity -4
Duplication 0

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
api/apiv1/design/database.go (1)

789-1085: Optional: add a connect_as example to at least one CreateDatabaseRequest example.

None of the g.Example(...) payloads on CreateDatabaseRequest (or UpdateDatabaseRequest) include a services block, so the generated OpenAPI docs won't showcase the now-required connect_as field. Consider adding a services example that demonstrates a valid connect_asdatabase_users.username reference so API consumers discover the requirement from the docs.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@api/apiv1/design/database.go` around lines 789 - 1085, The
CreateDatabaseRequest examples (and likewise UpdateDatabaseRequest) omit a
services block demonstrating the required connect_as field, so OpenAPI docs
won't show how connect_as maps to database_users.username; add a services entry
to at least one g.Example in CreateDatabaseRequest that includes a service with
a connect_as value referencing an existing database_users username (e.g.,
"admin" or "storefront") to illustrate the required mapping, and mirror the same
addition in UpdateDatabaseRequest examples so consumers can see a valid
connect_as → database_users.username reference.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@api/apiv1/design/database.go`:
- Around line 789-1085: The CreateDatabaseRequest examples (and likewise
UpdateDatabaseRequest) omit a services block demonstrating the required
connect_as field, so OpenAPI docs won't show how connect_as maps to
database_users.username; add a services entry to at least one g.Example in
CreateDatabaseRequest that includes a service with a connect_as value
referencing an existing database_users username (e.g., "admin" or "storefront")
to illustrate the required mapping, and mirror the same addition in
UpdateDatabaseRequest examples so consumers can see a valid connect_as →
database_users.username reference.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e8b01e9c-b736-4149-9a7a-14eede64c69a

📥 Commits

Reviewing files that changed from the base of the PR and between a7e1e07 and 922aa15.

⛔ Files ignored due to path filters (9)
  • api/apiv1/gen/control_plane/service.go is excluded by !**/gen/**
  • api/apiv1/gen/http/control_plane/client/encode_decode.go is excluded by !**/gen/**
  • api/apiv1/gen/http/control_plane/client/types.go is excluded by !**/gen/**
  • api/apiv1/gen/http/control_plane/server/encode_decode.go is excluded by !**/gen/**
  • api/apiv1/gen/http/control_plane/server/types.go is excluded by !**/gen/**
  • api/apiv1/gen/http/openapi.json is excluded by !**/gen/**
  • api/apiv1/gen/http/openapi.yaml is excluded by !**/gen/**
  • api/apiv1/gen/http/openapi3.json is excluded by !**/gen/**
  • api/apiv1/gen/http/openapi3.yaml is excluded by !**/gen/**
📒 Files selected for processing (2)
  • api/apiv1/design/database.go
  • server/internal/api/apiv1/validate.go

@rshoemaker rshoemaker merged commit 45d1d9a into main Apr 21, 2026
3 checks passed
@jason-lynch jason-lynch deleted the feat/PLAT-554/connect-as-required branch April 27, 2026 18:20
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