Skip to content

Add Connect RPC Go benchmark with architecture agent#4

Merged
viqueen merged 25 commits into
mainfrom
feature/content-api-golang-benchmark
Mar 7, 2026
Merged

Add Connect RPC Go benchmark with architecture agent#4
viqueen merged 25 commits into
mainfrom
feature/content-api-golang-benchmark

Conversation

@viqueen

@viqueen viqueen commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Scaffold a Connect RPC (Go) benchmark implementation for the content-api project with in-memory storage, h2c dual-port serving, and pinned dependency versions
  • Create a reusable Claude agent prompt (.claude/agents/connect-rpc-go.md) that defines a layered architecture (APP/API/DOMAIN/OUTBOX) with sqlc, River queue, goose migrations, zerolog, godotenv config, and buf validate
  • Add agent delegation to the scaffold-implementation command so future scaffolds can leverage architecture-specific agents
  • Upgrade buf config to v2 format

Test plan

  • Run npm run benchmark -- list and confirm content-api/connect-rpc target appears
  • Run npm run benchmark -- build content-api/connect-rpc and confirm Docker build succeeds
  • Run /scaffold-implementation, pick protobuf + connect-rpc + go, and confirm it delegates to the agent prompt
  • Verify generated code follows the layered architecture defined in the agent

🤖 Generated with Claude Code

viqueen and others added 4 commits March 6, 2026 21:49
Implements all ContentService RPCs using connectrpc.com/connect with
in-memory storage, h2c for gRPC compatibility, and a multi-stage
Dockerfile with buf-based proto code generation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Create .claude/agents/connect-rpc-go.md with layered architecture
  guide (APP/API/DOMAIN/OUTBOX) for scaffold-implementation delegation
- Add agent delegation step to scaffold-implementation command
- Upgrade buf.gen.yaml to v2 format with protoc_builtin/remote plugins
- Update Dockerfile to use buf v2 config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 7, 2026 09:25
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Go + Connect RPC benchmark target for the content-api project, plus Claude scaffolding guidance to generate future implementations with an architecture-specific agent and buf v2 generation templates.

Changes:

  • Scaffold projects/content-api/connect-rpc with an in-memory Connect RPC service, Docker build, and compose setup.
  • Register the new benchmark target (content-api/connect-rpc) in benchmark.config.json.
  • Add agent delegation to the scaffold command and introduce a connect-rpc-go architecture agent prompt.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
projects/content-api/connect-rpc/internal/service/content.go In-memory CRUD implementation for the protobuf-defined ContentService.
projects/content-api/connect-rpc/cmd/server/main.go Starts health HTTP server + h2c gRPC/Connect server.
projects/content-api/connect-rpc/docker-compose.yml Defines the benchmark service container and healthcheck.
projects/content-api/connect-rpc/Dockerfile Multi-stage image: buf codegen → build → minimal runtime.
projects/content-api/connect-rpc/buf.gen.yaml Buf v2 generation template for Go + Connect codegen.
projects/content-api/connect-rpc/go.mod New Go module for the benchmark implementation with pinned deps.
projects/content-api/connect-rpc/go.sum Checksums for the Go module dependencies.
benchmark.config.json Registers the new content-api/connect-rpc benchmark target with k6 config.
.claude/commands/scaffold-implementation.md Adds agent delegation to support architecture-specific scaffolds.
.claude/agents/connect-rpc-go.md New agent prompt defining a layered Connect RPC Go architecture.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .claude/agents/connect-rpc-go.md
Comment thread .claude/agents/connect-rpc-go.md Outdated
viqueen and others added 20 commits March 7, 2026 20:45
Cover the full loop: define APIs, scaffold implementations
with Claude Code, run benchmarks, and compare results.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add /define-api Claude Code command for interactive API project creation
- Split proto into _service, _model, _refs files under package-matching paths
- Add buf validate annotations on all request fields
- Use google.protobuf.Timestamp instead of string for timestamps
- Use google.protobuf.FieldMask for partial updates
- Use page_size/page_token cursor pagination instead of limit/offset
- Remove health endpoints from all API specs (implementation convention)
- Unify gRPC and health on single port 8080 across k6 scripts
- Update PROTO_PATH to PROTO_DIR for multi-file proto loading

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Define Content entity with title, body, status, and tags fields.
Proto split into model/refs/service files with buf validate,
field masks, cursor pagination, and google.protobuf.Timestamp.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Scaffold layered architecture: cmd (app wiring), internal/api (Connect handlers),
internal/domain (business logic with sqlc), internal/outbox (River queue events),
and pkg (reusable config, cache, connectapp, connectutil, migrate, outbox).

Includes Dockerfile (multi-stage with buf + sqlc codegen), docker-compose
(postgres, opensearch, dashboards, codegen profile), and benchmark target.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update sqlc override, domain service imports, setup_domains import,
and pinned versions table in the connect-rpc-go architecture agent.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace import paths, sqlc override, and uuid.Parse calls with
uuid.FromString across all domain, API, and wiring layers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Ensures dependencies are resolved from scaffolded imports before
the checklist is considered complete.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Makefile provides codegen (docker-based proto + sqlc generation) and
tidy (codegen + go mod tidy) targets. Agent updated to generate a
Makefile and run make tidy as post-generation step.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- buf.gen.yaml: add managed mode with go_package_prefix to rewrite
  proto imports, disable for protovalidate dep
- mapper.go: use pgtype.Text/Int4 for sqlc nullable params (not pointers)
- interceptors.go: validate.NewInterceptor returns 1 value, not 2
- main.go: remove unused connectapp import
- Agent: document managed mode, pgtype nullable params, unused import
  convention, fix code examples

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Makefile targets: codegen, tidy, vet, build, test, start, stop, clean.
Agent updated with post-generation devloop (vet → build → start → stop)
and common error troubleshooting guide.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix 18 inconsistencies between agent template and implementation:
event struct (ID+Data), List signature (cursor-based), response wrapping,
import paths (<module>/ prefix), error handling (log.Fatal), migrations
embed (separate package), op_get error discrimination, DeleteContent
:execrows, sqlc timestamptz override, event file naming (by concern),
interceptors unused import. Update implementation versions to match agent
pinned versions (Go 1.25.6, buf v1.66.0, sqlc v1.30.0, OpenSearch 3.5.0).
Add platform-backend architecture document for cross-stack reuse.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Relocate from projects/content-api/_architecture/ to _architecture/
(next to platform-backend.png). Rewrite to describe layers generically
by what they expose and consume rather than using Go-specific examples.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Structured review checklist covering: directory structure, layer
dependencies, interface-first pattern, file-per-concern convention,
error handling, transactional outbox, read-through cache, import
correctness, codegen config, proto compliance, server/interceptors,
infrastructure, and migrations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Runs Docker build (codegen + compile + runtime) on pushes and PRs
that touch the implementation or shared protobuf specs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use k6 built-in crypto.randomUUID() instead of importing
randomString from jslib.k6.io.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@viqueen viqueen enabled auto-merge (squash) March 7, 2026 11:59
@viqueen viqueen merged commit f4b8462 into main Mar 7, 2026
2 checks passed
@viqueen viqueen deleted the feature/content-api-golang-benchmark branch March 7, 2026 12:00
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