Skip to content

feat: contract-driven runtime HTTP server with a pluggable MEOS engine#7

Merged
estebanzimanyi merged 1 commit into
masterfrom
feat/runtime-server
Jul 7, 2026
Merged

feat: contract-driven runtime HTTP server with a pluggable MEOS engine#7
estebanzimanyi merged 1 commit into
masterfrom
feat/runtime-server

Conversation

@estebanzimanyi

@estebanzimanyi estebanzimanyi commented May 18, 2026

Copy link
Copy Markdown
Member

What

Adds server/ + serve.py: the projection that executes. It builds routing, request validation and dispatch from the enriched catalog (network / wire) — the same single source the OpenAPI and MCP generators consume; the server is just the consumer that runs the algebra.

python run.py                                 # enriched catalog
python serve.py                               # 127.0.0.1:8080 (StubEngine)
MEOS_LIBRARY_PATH=/path/libmeos.so python serve.py 0.0.0.0 9000

How

POST /{function} per stateless-exposable function: validate the JSON body → decode each serialized string to an opaque handle → invokeencode the result → {"result": …} (204 void, 400 {"error","code"} on a MEOS/validation error, 404 unknown). All MEOS work is behind an Engine:

  • CtypesEnginedlopen a built libmeos, call by symbol. Every opaque value is an anonymous void *; no struct layout is ever needed, because the catalog already reduced every exposable function to scalars + decode/encode of opaque pointers. Selected via MEOS_LIBRARY_PATH.
  • StubEngine — no MEOS build: routing/validation/error-mapping run; calls return deterministic placeholders. Default; makes the server runnable and testable without a compiled MEOS.

Stdlib http.server only — no new dependencies.

Validation (and its honest boundary)

  • Generation / routing / validation / dispatch / error mapping: fully validated — built from the live MobilityDB master catalog and exercised end-to-end over real HTTP sockets.
  • CtypesEngine arg/return ctype mapping and the decode→invoke→encode flow: unit-tested against a fake shared library.
  • Not validated here: linkage against a real libmeos.so — no compiled MEOS exists in this environment (only headers + the catalog). That is the integration step; CtypesEngine is the seam for it, stated plainly in docs/server.md.

The server is a correct-by-construction reference implementation, not a tuned production stack — concurrency, auth, and ASGI are intentionally out of scope. tests/test_server.py and tests/test_engine_integration.py hold the worked examples.

Adds server/ + serve.py: the projection that executes. Routing, request validation and dispatch are built from the enriched catalog (network/wire) — the same single source the OpenAPI/MCP generators consume.

- POST /{function} per stateless-exposable function: validate body,
  decode each serialized string -> opaque handle, invoke, encode the
  result -> {"result": ...} (204 void, 400 {error,code} on failure)
- Engine seam: CtypesEngine (dlopen a built libmeos; opaque values are
  anonymous void*) and StubEngine (runs without a MEOS build)
- CtypesEngine installs a non-fatal MEOS error handler, so a bad request
  becomes a 400 instead of MEOS's default exit() killing the process
- stdlib http.server only; no new dependencies

Validated against the live MobilityDB master catalog (1522 routes, 0
malformed) over real HTTP sockets, and end-to-end against an installed
/usr/local/lib/libmeos.so: POST /temporal_num_instants -> 200
{result:3}, malformed body -> 400 with the real MEOS message, server
survives. Integration test skipped unless MEOS_LIBRARY_PATH is set.
@estebanzimanyi estebanzimanyi merged commit cb58a03 into master Jul 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant