feat: contract-driven runtime HTTP server with a pluggable MEOS engine#7
Merged
Conversation
1ea37a8 to
b131b4b
Compare
b131b4b to
c6f0970
Compare
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.
c6f0970 to
fa7b8e6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.How
POST /{function}per stateless-exposable function: validate the JSON body →decodeeach serialized string to an opaque handle →invoke→encodethe result →{"result": …}(204void,400 {"error","code"}on a MEOS/validation error,404unknown). All MEOS work is behind anEngine:CtypesEngine—dlopena builtlibmeos, call by symbol. Every opaque value is an anonymousvoid *; no struct layout is ever needed, because the catalog already reduced every exposable function to scalars + decode/encode of opaque pointers. Selected viaMEOS_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.serveronly — no new dependencies.Validation (and its honest boundary)
mastercatalog and exercised end-to-end over real HTTP sockets.CtypesEnginearg/return ctype mapping and the decode→invoke→encode flow: unit-tested against a fake shared library.libmeos.so— no compiled MEOS exists in this environment (only headers + the catalog). That is the integration step;CtypesEngineis the seam for it, stated plainly indocs/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.pyandtests/test_engine_integration.pyhold the worked examples.