Files
agents/control-plane/pkg/adminwire/list_reasoners_response_zap.go
zeekay ad7c613977 admin: AdminReasoner gRPC/protobuf -> native ZAP transport + wire
The admin control surface was the last gRPC/protobuf in the control plane.
Replace it end to end with the native ZAP stack — no protobuf, no gRPC, no
build-tag dance.

Schema + wire:
- proto/admin/reasoner_admin.zap: the AdminReasoner interface as a .zap schema
  (text fields; param-less listReasoners since ZAP rejects an empty struct).
- pkg/adminwire: zapgen output — zero-copy New<Msg>/Wrap<Msg>, the bytes are
  the message, no marshal step.

Server:
- internal/server/server_admin.go: transport.Serve over the ZAP transport.
  Capability auth carries the API key in each request's Cap field, checked in
  constant time (crypto/subtle) — an upgrade over the deleted gRPC path, which
  compared with ==, a timing oracle.
- H-1 hardening: with no API key configured the surface is unauthenticated, so
  it binds loopback only (adminBindHost) and is unreachable off-box; a keyed
  surface binds all interfaces. Reachability and authentication are decided
  separately, not entangled.
- server.go: the adminTransport/UnimplementedServer gRPC scaffolding drops out
  for a *transport.Server.

Removed:
- google.golang.org/grpc, the direct google.golang.org/protobuf dependency,
  pkg/adminpb (the generated .pb.go + grpc stub), the grpc_auth middleware,
  server_grpc.go / server_zap.go, and the dead `replace operator => ../`.

Tests (all pass): adminwire round-trip over real TCP and Unix sockets with all
seven Reasoner fields intact, unknown-ordinal rejection, the five authorize
cases, and the loopback-bind decision.
2026-06-24 16:14:42 -07:00

49 lines
1.4 KiB
Go

// Code generated by zapgen; DO NOT EDIT.
// source: reasoner_admin.zap
package admin
import (
zap "github.com/zap-proto/go"
)
const (
listReasonersResponseReasonersOff = 0
listReasonersResponseSize = 8
)
// ListReasonersResponse is a zero-copy view into a ZAP-encoded ListReasonersResponse message.
type ListReasonersResponse struct{ o zap.Object }
// WrapListReasonersResponse parses b and returns a typed view. Returns an error if the
// wire-level checks (magic, version, size) fail.
func WrapListReasonersResponse(b []byte) (ListReasonersResponse, error) {
m, err := zap.Parse(b)
if err != nil {
return ListReasonersResponse{}, err
}
return ListReasonersResponse{o: m.Root()}, nil
}
func (t ListReasonersResponse) Reasoners() zap.List {
return t.o.List(listReasonersResponseReasonersOff)
}
// ListReasonersResponseInput collects the field values for NewListReasonersResponse.
type ListReasonersResponseInput struct {
Reasoners [][]byte
}
// NewListReasonersResponse builds a ZAP-encoded ListReasonersResponse message from in and returns the bytes.
func NewListReasonersResponse(in ListReasonersResponseInput) []byte {
b := zap.NewBuilder(256)
ob := b.StartObject(listReasonersResponseSize)
reasonersLB := b.StartList(0)
for _, elem := range in.Reasoners {
reasonersLB.AddObjectBytes(elem)
}
ob.SetList(listReasonersResponseReasonersOff, reasonersLB.FinishOffset(), len(in.Reasoners))
ob.FinishAsRoot()
return b.Finish()
}