mirror of
https://github.com/hanzoai/dashboards.git
synced 2026-10-30 20:19:37 +00:00
The rename left the guide still titled CLAUDE.md and without the fold notice README already carries, so an agent reading only this file would build and deploy a repo that ships nothing. CLAUDE.md and AGENTS.md are symlinks to LLM.md, force-added so a clone finds the guide under whichever name its tooling looks for. One file, three names — copies are how the three drift apart.
4.0 KiB
4.0 KiB
LLM.md — contract for AI helpers
Folded into
hanzoai/observability. Do not build or deploy this repo; open PRs against that one. The surface below is served there on msgType 203 with the ordinals preserved at +200, implemented in itsdash_*.gofile set. What follows describes the code in THIS repo, whose wire layout and permission bits are still the live contract.
A Hanzo Base-native Go service in the console tRPC→ZAP migration. It replaces five tRPC routers (dashboards + widgets + tables + view-presets + monitors) with one typed ZAP capability router at msgType 206.
The one rule
The .zap schema is the source of truth. proto/dashboards.zap defines the
data structs; gen/ is its Go projection via make zap-gen. Never hand-edit
gen/. Change the schema, regenerate, then update server/.
Two schema dialects (do not conflate)
proto/dashboards.zapis the zap-spec dialect (package … / Field Type @off) thatgithub.com/zap-proto/go/cmd/zapgencompiles to Go. This is what THIS repo (a Go service) consumes.- The console copies the same file and compiles it with
zapgen --target=tsinto TS View/Builder classes over the@hanzo/zapruntime. ONE schema, two code targets — no capnp on either side. The field set is the shared contract.
Build / test
- Pure-Go always:
CGO_ENABLED=0. CGO pulls blst/accel C deps that need a full toolchain and break reproducibility.makesets this +GOWORK=off. GOWORK=off: this repo is self-contained via go.modreplaces; a parentgo.workmust not capture it.make zap-genandmake buildare idempotent (byte-identical regen, reproducible binary). Keep them so — no timestamps/paths in generated output.make testruns the in-process suite (per-method CRUD + per-category permission gate + pipelining + analytics/queue 501 contracts). Show it passing; don't claim "done" without it.
Architecture invariants (DRY, orthogonal, decomplected)
- Three wire layers, separated: transport (
luxfi/zapNode, msgType 206) / envelope (server/wire.go) / payload (gen/typed views). The capability is carried as OPAQUE bytes through all three — auth is a value, not a place. - One auth chokepoint:
Server.authorize. Kind + the method'sDashPermissionsbit (permissionForinwire.go) always enforced; signature verify gated on a wired issuer registry (TODO). Do not scatter permission checks into the method handlers. Method→permission policy lives in ONE place (permissionFor), read once at dispatch. - One tenant boundary: every data query is scoped to the request
projectId(findScoped/listScoped). A row in another project is NotFound, never read. - One backend: Hanzo Base. No Prisma, Postgres-as-source-of-truth, Mongo,
Redis, tRPC, nginx. The five collections live in Base (encrypted SQLite via the
vault plugin when
--vaultDiris set). - One record→wire mapping:
server/encode.go. Handlers never pluck fields ad hoc. - Pipelining is real:
createWidgetcan targetcreateDashboard's promise; the server's promise table (await/resolve) joins them on the resolved project scope. Genuine in-flight pipelining needs the two calls on SEPARATE connections (the transport is FIFO per connection) — seeClient.PipelineCreateDashboardThenWidgetand the pipelining test.
Not-yet-wired (return 501, never fake)
- Dashboard analytics (chart/scoreHistogram/executeQuery) read ClickHouse
(OLAP), not Base.
server/handleAnalyticsreturns 501 with the shim location (server/analytics.go). - Table batch-action progress reads a BullMQ/Valkey queue, not Base.
server/handleIsBatchActionInProgressreturns 501 with the shim location (server/batchqueue.go).
Do not
- Build Docker images locally (CI does, multi-arch → ghcr.io/hanzoai).
- Push to GitHub from here unless asked.
- Add plugins this one service doesn't need. Lean binary.
- Touch the console — wiring is documented in README, not done here.