|
| 1 | +# GoMEOS generation — the canonical per-binding generator policy |
| 2 | + |
| 3 | +GoMEOS is a **generated** cgo binding. This document is the contract for how it is |
| 4 | +generated, under the ecosystem-wide per-binding generator policy. |
| 5 | + |
| 6 | +## The policy (ecosystem-wide) |
| 7 | + |
| 8 | +Every MobilityDB language binding is a **pure projection of the MEOS-API catalog**, and |
| 9 | +**each binding owns its own generator, in its own repo**, in a canonical layout — not a |
| 10 | +single central generator-repo. The single source of truth is the **catalog** |
| 11 | +(`MEOS-API/output/meos-idl.json`, generated from the MEOS C headers), not a generator |
| 12 | +location. This mirrors how MEOS itself is built: independent, plug-and-play, CMake-gated |
| 13 | +families — a binding is an independent module that owns its generation. |
| 14 | + |
| 15 | +Each binding repo satisfies the same invariants: |
| 16 | + |
| 17 | +1. **In-repo generator**, one clearly-designated location. For GoMEOS that is |
| 18 | + **`tools/codegen.py`** — it reads the vendored catalog and emits cgo wrappers. |
| 19 | +2. **Own pin manifest** `tools/pin/compose-order.txt` — the canonical, dependency-ordered |
| 20 | + fold list of the open PRs that compose this binding's surface onto `main`. |
| 21 | +3. **Vendored catalog**, version-pinned, read-only: `tools/meos-idl.json` (from a |
| 22 | + MobilityDB `ecosystem-pin-*`). |
| 23 | +4. **Thin language projection** — language-neutral decisions (grouping, skip/classify, |
| 24 | + portable names, shape) belong upstream in the catalog, so per-language generators do |
| 25 | + not re-implement and drift. |
| 26 | +5. **Full automation (North Star):** generate-then-retire toward a **zero hand-written** |
| 27 | + surface; anything that seems irreducible is either emitted by the generator or fixed at |
| 28 | + source in MEOS (export the symbol) — never hand-patched in the binding. |
| 29 | + |
| 30 | +## GoMEOS scope: flat generated cgo wrappers |
| 31 | + |
| 32 | +`tools/codegen.py` emits one `meos_<header>.go` per MEOS public header plus a single |
| 33 | +`cgo.go` preamble — self-contained cgo (its own `#cgo` directives and `#include`s), no |
| 34 | +hand-written `cast.h` dependency. The end state is **flat generated wrappers only**; the |
| 35 | +idiomatic OO surface, if any, is also generated (no hand layer). |
| 36 | + |
| 37 | +## Generate-then-retire — the green-CI version is the probe |
| 38 | + |
| 39 | +Removing the hand-written binding happens **little by little, never wipe-first**: |
| 40 | + |
| 41 | +1. align the generator + generate the full surface; `go build ./...` green; |
| 42 | +2. **prove generated ⊇ hand** against the **last green-CI version** (the equivalence |
| 43 | + probe) — `go test` + parity, **family by family**; |
| 44 | +3. retire the hand-written root `*.go` (and `cast.c`/`cast.h`) for that family; |
| 45 | +4. repeat. End state: the hand-written root files are gone; the binding is the generated |
| 46 | + package. The green-CI baseline catches a generated gap before it ships. |
| 47 | + |
| 48 | +## Pinning: this binding's catalog comes from a MobilityDB pin |
| 49 | + |
| 50 | +GoMEOS's vendored `tools/meos-idl.json` is generated from a MobilityDB `ecosystem-pin-*` |
| 51 | +(master ⊕ the MobilityDB compose-order) via the MEOS-API `run.py`. That pin is the |
| 52 | +*catalog/surface* input; GoMEOS's own `tools/pin/compose-order.txt` governs *this repo's* |
| 53 | +PR accumulate. See `tools/pin/compose-order.txt` for the composing set and the disposition |
| 54 | +of every open PR. |
0 commit comments