Files
zeekay 11c160189c ui-customization: first Hanzo Base-native Go service binary
The architectural reference for console's tRPC->ZAP migration. Replaces the
in-process tRPC UiCustomization router with a standalone Go binary built on
Hanzo Base (embedded encrypted SQLite + plugins) exposing a typed ZAP
capability-RPC interface. 11+ services follow this pattern.

- proto/ui-customization.zap: canonical schema (zap-spec dialect), source of
  truth, compiled to Go via zapgen (make zap-gen, idempotent).
- server/: ZAP RPC handler at msgType 200. Three decoupled wire layers
  (transport / envelope / typed payload); capability carried as opaque bytes.
  Single auth chokepoint (Kind + PermSessionRead bitmask); signature verify
  gated on a wired issuer registry (TODO -> SPEC.md 2.3). Get + GetModules
  read from the ui_customization Base collection. Promise-pipelining via an
  await/resolve table.
- main.go: base.New() + vault (per-org encrypted SQLite) + ZAP router.
  HTTP :8090 (Base health/metrics), ZAP :9999.
- cmd/probe/: out-of-process smoke probe.

Tests: 4/4 pass (Get, GetModules, permission-denied, pipelining proof showing
the dependent call ships before the first answer resolves). Pure-Go
(CGO_ENABLED=0); zap-gen + build reproducible. No Prisma/Postgres/Mongo/tRPC.
2026-06-15 12:31:11 -07:00

55 lines
1.5 KiB
Makefile

# ui-customization — build + codegen.
#
# The .zap schema (proto/) is the source of truth; gen/ is its Go projection.
# `make zap-gen` and `make build` are idempotent: re-running produces
# byte-identical output (zapgen is deterministic; CGO is off so the binary is
# pure-Go and reproducible).
# Pure-Go: modernc SQLite + luxfi/zap have no required C deps for this service,
# and CGO pulls blst/accel C headers that need a full toolchain. Off = lean,
# reproducible, cross-compilable.
export CGO_ENABLED := 0
# This repo is self-contained via go.mod replaces; ignore any parent go.work.
export GOWORK := off
BIN := ui-customization
SCHEMA := proto/ui-customization.zap
GEN_DIR := gen
ZAPGEN := github.com/zap-proto/go/cmd/zapgen
.PHONY: all build zap-gen test probe vet tidy clean run
all: zap-gen build test
## build: compile the service binary (pure-Go, reproducible).
build:
go build -trimpath -o $(BIN) .
## zap-gen: regenerate Go views from the .zap schema. Idempotent.
zap-gen:
go run $(ZAPGEN) -out $(GEN_DIR) -single $(SCHEMA)
gofmt -w $(GEN_DIR)
## test: run the in-process ZAP RPC + pipelining suite.
test:
go test ./... -count=1
## probe: build the out-of-process smoke probe.
probe:
go build -trimpath -o probe ./cmd/probe
## vet: static checks.
vet:
go vet ./...
## tidy: resolve module graph.
tidy:
go mod tidy
## run: start the service (HTTP :8090, ZAP :9999).
run: build
./$(BIN) serve --http=127.0.0.1:8090 --zap=127.0.0.1:9999
clean:
rm -f $(BIN) probe