Skip to content

Latest commit

 

History

History
65 lines (48 loc) · 2.47 KB

generate.md

File metadata and controls

65 lines (48 loc) · 2.47 KB

API generation

Public builds

Public builds use the vendored protos in proto/v1 and the committed stubs in gen/proto/v1. CI does not need a backend checkout.

make generate

make generate runs buf generate with plugins for protoc-gen-go and protoc-gen-go-grpc only (no gateway / openapiv2).

OpenAPI and the frontend TypeScript client are not used for this Go server.

Maintainer sync

make proto-sync copies protos from a Noderings backend checkout. The default path is ../backend. Pass another checkout with BACKEND_DIR:

make proto-sync BACKEND_DIR=/path/to/backend
make generate

The sync rewrites go_package into this module, drops gameserver, notification, and roadmap, and then reduces what is left to the published surface below. Re-run when a backend RPC used by a tool changes.

Published surface

Only the RPCs listed in scripts/proto-allowlist.txt are vendored. The sync runs three steps after copying the backend protos:

  1. scripts/proto-allowlist.py removes every comment, keeps only the allow-listed RPCs and their services, keeps only the messages and enums those RPCs reach, deletes proto files that end up empty, and drops unused imports. A missing allow-listed RPC fails the sync.
  2. scripts/proto-public-surface.py removes fields this server never sends or returns from what is left: guest and account password fields, cloud-init user_data bodies, payment-method tokens and customer card details, login sessions, kubeconfigs and proxmox_cpu_type. Removed field numbers are reserved.
  3. scripts/proto-leak-check.sh fails if the protos or the generated stubs contain internal hostnames, private IP addresses, email addresses, admin or enforcement endpoints, internal infrastructure names, payment or webhook surface, or any RPC that is not on the allow-list. Run it again after make generate.

To call a new RPC from a tool, add Service.Rpc to scripts/proto-allowlist.txt, then run make proto-sync generate. A message the Go code needs that no allow-listed RPC reaches can be kept with a type MessageName line.

Auth metadata

Outbound gRPC and HTTP-gateway calls attach the process-owned service-account token:

  • authorization: Bearer <service-account-jwt>
  • optional x-organization-id: <uuid>

The HTTP fallback (internal/backend/http.go) is hand-written against proto types and google.api.http paths with protojson. It is not generated from OpenAPI and does not add a second generate step.