Skip to content

[M0.3] Proto and codegen pipeline - #9

Merged
samuelmbabhazi merged 7 commits into
mainfrom
feat/m0.3-proto-codegen
Nov 3, 2026
Merged

samuelmbabhazi merged 7 commits into
mainfrom
feat/m0.3-proto-codegen

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

Task

[M0.3] Proto and codegen pipeline. Closes #3

What changed

  • buf.yaml (v2, lint STANDARD, breaking FILE) and buf.gen.yaml with pinned remote plugins: protocolbuffers/go v1.36.12, grpc/go v1.5.1, bufbuild/es v2.16.0. Managed mode sets the Go package prefix to github.com/samuelmbabhazi/shipkeep/lib/gen.
  • proto/shipkeep/agent/v1/:
    • gateway.proto: AgentGatewayService (Enroll, RenewCertificate, Connect, ExecStream), the ConnectRequest / ConnectResponse envelopes, ActionRequest with the 23-case action oneof exactly as SPEC Appendix A, ActionUpdate, StateReport, RoutingTable, PeerList, LeaseRenewal, ConfigUpdate, OperationState.
    • actions.proto: every action of SPEC 3.3 with its fields, shared types (ContainerSpec, Mount, Resources, HealthCheckSpec, Route, Upstream, WireGuardPeer, S3Target, RegistryCredentials), the capability allow list as an enum, and typed ActionResults. Secret-bearing fields (SecretEnv.value, git_token, registry password, pre-signed URLs, confirmation tokens, join token) carry debug_redact = true.
    • exec.proto: ExecStream frames (open, stdin, stdout, stderr, resize, close, exit, error).
  • Generated code committed: Go in lib/gen, TypeScript in packages/proto-ts/src/gen. pnpm gen regenerates (clean: true), pnpm proto:lint lints and checks formatting, pnpm proto:breaking compares against main.
  • lib/agentproto: ActionKinds() and ActionKind(req) derived from the descriptor; packages/proto-ts exports ACTION_KINDS and actionKind(). Both have tests asserting the catalogue is exactly the 23 actions of the SPEC, so a contract change cannot slip in unnoticed.
  • buf is provided by the @bufbuild/buf npm package so local and CI versions match; the generated-code job runs pnpm gen, pnpm proto:lint and fails on drift. proto.yml runs buf lint and format on proto changes and the breaking check against main, skipped only while main has no proto files (this PR).
  • Go 1.26 everywhere (go.work, three go.mod, .tool-versions, docs): grpc-go v1.85 requires it.
  • ESLint ignores **/src/gen/** from every project config; lefthook prints only failures and a summary.

Why

The proto is the single source of truth between control plane and agent (ADR 0001, 0002). Every later task in M1 and M2 builds on these messages.

How it was tested

  • buf lint, buf format -d --exit-code: clean.
  • pnpm gen then git status: no drift after regeneration.
  • pnpm nx run-many -t lint typecheck test build: 25 tasks succeeded, including the new proto-ts tests.
  • go test -race ./agent/... ./cli/... ./lib/...: pass, including lib/agentproto.
  • golangci-lint run in each module: 0 issues (generated code excluded).
  • actionlint: clean.

Security considerations

Defines the closed action list (CLAUDE.md, rule 2). No generic exec, shell or file-write action exists. Secret fields are marked debug_redact so protobuf text formatters redact them; the agent still must use Secret wrappers (rule 8) when it handles them in M1. Any later change to ActionRequest requires an ADR or SPEC update and the security-review label.

Checklist

  • Acceptance criteria from docs/PLAN.md are met and the task is ticked
  • Lint, TS tests, Go tests and buf lint pass
  • Tests added (action catalogue in Go and TypeScript)
  • No new shell invocation and no new secret exposure path
  • Audit events: not applicable
  • CLAUDE.md updated (buf usage, Go 1.26)

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow proto / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed⏩ skippedNov 3, 2026, 10:51 AM

@samuelmbabhazi
samuelmbabhazi merged commit 90e982a into main Nov 3, 2026
11 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the feat/m0.3-proto-codegen branch November 3, 2026 10:55
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.

[M0.3] Proto and codegen pipeline

1 participant