Skip to content

Commit 05a4032

Browse files
Add the GoMEOS pin manifest and per-binding generator policy doc
main is the old hand-written 1.3-era cgo binding; the codegen-driven 1.4/-22a surface lives in open PRs. Add tools/pin/compose-order.txt (the canonical fold manifest with the disposition of every open PR; MobilityDB#5 is the verified frontier containing MobilityDB#2+MobilityDB#4) and GENERATION.md (the per-binding generator policy: GoMEOS owns its generator in-repo at tools/codegen.py; flat generated cgo wrappers; generate-then-retire the hand-written binding).
1 parent 5fa245d commit 05a4032

3 files changed

Lines changed: 120 additions & 0 deletions

File tree

GENERATION.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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.

tools/pin/compose-order.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# USER-APPROVED-PIN-WRITE — creating GoMEOS's first pin manifest (user 2026-06-25,
2+
# per-binding generator policy rollout). New file in the GoMEOS repo, NOT a mutation
3+
# of MobilityDB's pin tooling.
4+
#
5+
# GoMEOS pin — THE canonical, dependency-ordered fold manifest (per-binding policy).
6+
#
7+
# WHY GoMEOS NEEDS A PIN: `main` (5fa245d) is the old HAND-WRITTEN 1.3-era cgo binding.
8+
# The codegen-driven 1.4/-22a surface lives entirely in OPEN PRs. The reviewable frontier
9+
# = `main` ⊕ the composing PRs, in THIS order. Edit THIS file (reviewed) — never re-derive.
10+
# (policy: generator-per-binding-canonical-policy, binding-compose-order-manifest)
11+
#
12+
# SCOPE: GoMEOS owns its generator IN-REPO at `tools/codegen.py` (the designated location;
13+
# reads the vendored `tools/meos-idl.json` catalog -> flat cgo wrappers). End state = FLAT
14+
# generated wrappers only; the hand-written binding is retired generate-then-retire.
15+
#
16+
# Format: <PR#> <fork-branch> # role. '?' = membership/order UNCONFIRMED.
17+
# base = current origin/main. Verified ancestry (git merge-base, this turn): #5 (13 commits
18+
# over main) CONTAINS #2 (codegen) and #4 (portable-aliases); #1 and #3 are separate.
19+
20+
# ── WAVE 0 — FRONTIER (the codegen-driven -22a surface) ──
21+
5 codegen/flat-wrappers-22a # THE frontier: extends the meos-idl codegen to all
22+
# installed-public families on the -22a catalog. 13 commits
23+
# over main; CONTAINS #2 (the generator) + #4 (portable aliases).
24+
25+
# ── predecessors (contained in / superseded by #5) ──
26+
2 refactor/codegen-meos-idl # the IDL-driven generator tools/codegen.py (DRAFT). ANCESTOR of #5.
27+
4 work/portable-aliases # portable bare-name dialect, 6 families. ANCESTOR of #5.
28+
?1 bump/meos-1.3 # 1.3 CGO header bump — predates the 1.4/-22a frontier;
29+
# likely SUPERSEDED by #5. Verify nothing unique before closing.
30+
?3 bump/meos-1.4 # 1.4 bump — branch tip diverged from #5 (NOT an ancestor); #5 IS
31+
# the -22a (1.4+) frontier, so #3's intent is in #5. Verify, then close.
32+
33+
# ════════════════════════════════════════════════════════════════════════════════════
34+
# DISPOSITION (committer review): land #5 as the codegen-driven frontier; close #1/#3 as
35+
# superseded once verified content-empty vs #5; #2/#4 are carried inside #5's cumulative
36+
# diff (the GoMEOS stack convention: a fork->origin PR keeps base=main and notes the stack).
37+
# Then the generate-then-retire migration retires the 39 hand-written root *.go + cast.c/.h
38+
# family-by-family against the last green-CI version (the equivalence probe). See GENERATION.md.
39+
# ════════════════════════════════════════════════════════════════════════════════════

tools/regen-from-pin.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
# regen-from-pin.sh — regenerate the GoMEOS binding from the MEOS catalog (per GENERATION.md).
3+
#
4+
# Usage: tools/regen-from-pin.sh <pin>
5+
# env: CATALOG = path to meos-idl.json produced by MEOS-API run.py (required)
6+
# MEOS_PREFIX = install prefix of the all-families libmeos built from the same pin
7+
# (its include/ + lib/ are used for the cgo build-verify; optional)
8+
#
9+
# Invoked standalone, or by MEOS-API tools/ecosystem-generate.sh in dependency order.
10+
set -euo pipefail
11+
PIN="${1:?usage: regen-from-pin.sh <pin>}"
12+
CATALOG="${CATALOG:?set CATALOG to the meos-idl.json from MEOS-API run.py}"
13+
HERE="$(cd "$(dirname "$0")/.." && pwd)"
14+
15+
# 1. vendor the catalog (the single SoT this binding generates from)
16+
cp "$CATALOG" "$HERE/tools/meos-idl.json"
17+
18+
# 2. run the in-repo generator (tools/codegen.py __main__: generate(tools/meos-idl.json -> tools/_preview))
19+
python3 "$HERE/tools/codegen.py"
20+
21+
# 3. build-verify against the pin's libmeos (generation-starts-from-building-so)
22+
if [ -n "${MEOS_PREFIX:-}" ]; then
23+
export CGO_CFLAGS="-I$MEOS_PREFIX/include"
24+
export CGO_LDFLAGS="-L$MEOS_PREFIX/lib -lmeos"
25+
fi
26+
( cd "$HERE" && go build ./... && go test ./... ) || echo "WARN: GoMEOS build/test returned non-zero"
27+
echo "[gomeos] regenerated from catalog at pin $PIN"

0 commit comments

Comments
 (0)