feat: contract-driven runtime HTTP server with a pluggable MEOS engine#7
Open
estebanzimanyi wants to merge 1 commit into
Open
feat: contract-driven runtime HTTP server with a pluggable MEOS engine#7estebanzimanyi wants to merge 1 commit into
estebanzimanyi wants to merge 1 commit into
Conversation
dd98a46 to
1ea37a8
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.
1ea37a8 to
b131b4b
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 buildsrouting, request validation and dispatch from the enriched catalog
(
network/wire) — the same single source the OpenAPI (#5) and MCP (#6)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 aMEOS/validation error,
404unknown). All MEOS work is behind anEngine:CtypesEngine—dlopena builtlibmeos, call by symbol. Everyopaque 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.serveronly — no new dependencies.Validation (and its honest boundary)
validated — built from the live MobilityDB
mastercatalog (1790operations, 0 malformed), exercised end-to-end over real HTTP sockets.
CtypesEnginearg/return ctype mapping and decode→invoke→encode flow:unit-tested against a fake shared library.
libmeos.so— no compiledMEOS exists in this environment (only headers + the catalog). That is the
integration step;
CtypesEngineis the seam for it. Stated plainly indocs/server.md.tests/test_server.py: 17 stdlibunittestcases, all green.Scope / dependency
Logically stacks on the catalog-enrichment work (consumes
network/wire). Delivers a correct-by-construction reference server, not a tunedproduction stack (concurrency/auth/ASGI are intentionally out of scope).
Next units: a built-MEOS integration run, result memory ownership
(
pfree), and an MCP stdio server reusing the same engine.