Status: experimental productionization baseline
Issue: #677
Related: #580 #597 #598 #607 #609 #572
IDKMesh has several HTTP-facing or browser-facing surfaces in development. They should not each reinvent request correlation, operational probes, response identity, or logging behavior.
This baseline defines dependency-free runtime behavior that can be reused by:
It is deliberately smaller than an application framework.
Every HTTP response produced by an IDKMesh service using this baseline should carry:
X-Request-ID;X-IDKMesh-Service;X-IDKMesh-Service-Version;X-IDKMesh-Read-Only;X-IDKMesh-API-Version when an API version exists.These headers describe the responding service and request. They do not grant identity, authorization, trust, verification, or integration authority.
A caller may send:
X-Request-ID: <opaque-id>
Accepted IDs are bounded to 128 characters and a conservative visible ASCII alphabet. Invalid or oversized values are replaced with a locally generated opaque identifier and are never reflected verbatim.
Request IDs:
Services should separate:
GET /healthz
Answers only whether the process can serve requests.
GET /readyz
Answers whether the service runtime is ready to serve its declared API mode.
A readiness document may include service name, package version, mode, and API version. It must not expose project state, run IDs, WorkUnits, evidence, credentials, prompts, secrets, or user identity.
External dependency health should be added only when the service actually depends on that dependency to satisfy its declared contract.
idkmesh/service_runtime.py provides the reusable limit primitives
(ADR-0022); a service opts in, and the Control Tower is the first
consumer.
RequestLimiter(max_concurrent) is a thread-safe, non-blocking concurrency
cap with a drain switch. admit() returns "admitted", "overloaded" (the
cap is reached) or "draining"; only an admitted caller may release().
begin_drain() makes every later admit() return "draining", and
wait_idle(timeout) waits for in-flight requests and returns False if the
timeout elapses. Saturation is rejected, never queued, because an unbounded
wait queue is an unbounded memory and latency commitment.validate_request_timeout() (0.1-300 s) and
validate_max_concurrent_requests() (1-1024) reject out-of-range or
non-numeric values, including booleans.limits_document() builds the object a service publishes as its limits. It
reports configured limits and the measured stdlib parser bounds (request line
65536 bytes, header line 65536 bytes, 99 header fields) and nothing
aspirational.A consuming service answers an overload or drain with 503, Retry-After
and an error body with retryable: true, exempts liveness, and does no
application work for a rejected request. 429 is not part of the baseline until a per-client identity exists.
RequestLimiter
(max_sse_clients) and does not occupy a slot of the general request cap
(ADR-0023).
Beyond that cap the service answers 503 with Retry-After (retryable:
true); only a GET on the stream path is counted by that limiter, so other
methods are answered 405 however many streams are open; a stream also
carries a heartbeat interval and a maximum lifetime so it cannot hold a thread
indefinitely, and it ends promptly on drain. A service that drains must begin
the drain on both limiters and wait for both.Cancellation is capacity-safe: once a request is admitted, the consumer must
release its limiter slot in a finally path even if the peer disconnects or a
response write fails. Interrupted work is not automatically retried. Long-lived
SSE handlers additionally treat broken-pipe/reset/timeout as stream termination
and release their own stream slot. This runtime rule prevents abandoned clients
from leaking capacity; domain services still own mutation/idempotency semantics.
See Service limits for the Control Tower’s concrete values and the tests that prove them.
Access logging is opt-in through:
IDKMESH_HTTP_ACCESS_LOG=1
Each line is compact JSON containing only bounded operational metadata:
The logging API intentionally does not accept request/response bodies or request headers. This reduces the chance of leaking:
This runtime is not authentication or authorization.
Responsibility remains split:
A service marked X-IDKMesh-Read-Only: true must not silently expose a
write-capable endpoint.
Request correlation and operational metadata belong in headers/logs, not deterministic domain documents.
For the same valid domain input, a deterministic read endpoint should preserve the same response body and content digest even when:
The baseline has no third-party runtime dependency and is suitable for the core
pip install . installation.
It does not require:
Those can be integrated later behind optional deployment profiles without changing the base semantics.
The baseline is ready to reuse when: