diff --git a/README.md b/README.md index fca5468..7e28e12 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,32 @@ # mesh-contracts -The mesh's seat contracts (novox/hq ADR 0608 §5, ADR 0613, ADR 0620; design 26 *A seat's definition*): one -language-neutral definition per seat, and the Go and TypeScript types generated from it. +The mesh's seat contracts (novox/hq ADR 0608 §5, ADR 0613, ADR 0620, ADR 0625, ADR 0627; design 26 *A seat's +definition*): one language-neutral definition per seat, the Go and TypeScript code generated from it, and the client +of a seat whose callers share logic over it. This repository holds contracts only and no seat: a seat's holder +implements its contract, and no holder's code lives here. -Every file under `go/` and `ts/` is written by the generators of the Go and the Node build modules, never by hand. -This repository holds contracts only and no seat: a seat's holder implements its contract. +## Where a seat's code goes + +- **The definition**, written by hand: `seats//seat.json`, its fixtures in `seats//fixtures/`, and the + parts several seats include whole in `parts/` (the four registry seats' verbs and events are `parts/registry.json`). + mesh-sdk's `seatdef` is the one reader of the format; the indexer and the generators use it. +- **The seat set**, generated: `go/seats` (module `git.novox.be/novox/mesh-contracts/go`), every seat's name, scope, + verbs and provision at the seat list's grain (ADR 0625 §2). mesh-sdk's `catalogue` is its only importer in mesh-sdk. + A change of it rebuilds every importer of the seat set. +- **A seat defined whole**, generated: `go/seats/`, a Go module of its own importing nothing, + holding the seat's verbs, events and subjects, its message types and a test of its fixtures (ADR 0625 §1). A module + imports only the seats it uses, so a change of one seat rebuilds only its users. The TypeScript side is `ts/src/`. +- **A seat's client**, written by hand: `go/clients/client`, a Go module of its own, only where + two or more callers share logic over the seat (ADR 0625 §4, ADR 0627 §1): operator-channel's (checking an ask, + its digest, a warrant's, and an asking module's keeping of its asks) and the four registry seats' (publishing a file + in parts). A client imports its own seat's contract and mesh-sdk's runtime, never another seat's client, and names + no module's subject or tool. +- **Not here**: the value layouts of seats not yet defined whole (they stay in mesh-sdk until their domain moves, + ADR 0625 §9), and a role only one module could ever play (that module's own tools and events, ADR 0625 §8). + +## How it is checked + +Every file under `go/` and `ts/` outside `go/clients/` is written by the generator (seatgen, the source of the Go and +Node build modules' generate step) and compared on every build: a hand-written file there fails, named (ADR 0625 §5). +`seatgen -check` also runs the client check (each client is for a seat defined whole, a module of its own, importing +only its seat's contract and mesh-sdk) and checks `module.json`'s Go package artifacts against the tree.