mcl_core_guard_control (mcl_core v1.0.0)

View Source

The guardian control surface (mcl-om#13): the get_limits / set_limits capabilities every mcl_core service exposes for mcl-sec-guard.

- get_limits is always advertised, auth => open: limits + current-window stats for one procedure, or every declared one. - set_limits is the guardian tier's actuator, advertised only when this app's inbound_guard.guardian config names the realm DID (32 bytes, the realm's Ed25519 key) and the guardian tier name; without it, no gated surface exists on the wire, and the service logs that once. The guardian may tune limits only within the per-key envelope; the envelope itself is deploy config, changed by a human, never over the mesh.

Every APPLIED change is recorded on the guard's audit ring with caller, tier, before and after; an unchanged set is a no-op and gets no audit entry. The handlers are plain functions dispatched through mcl_core_simple_handler, so the pipeline wraps them like any other capability — the guardian pays the default rate budget too.

Summary

Functions

Payload: none, or #{procedure => Proc}. Reply: that procedure's stats, or every declared procedure's.

Payload: #{procedure => Proc, limits => Overrides}. The guardian tier only: within the envelope, never the envelope itself. The platform injects caller for map payloads; it lands in the audit entry.

The control capabilities, prepended to a service's own list. get_limits always; set_limits only when the guardian config exists. A service that declared its own name is refused — these names are mcl_core's, on every node.

Functions

get_limits(Payload)

-spec get_limits(term()) -> {ok, map()} | {error, term()}.

Payload: none, or #{procedure => Proc}. Reply: that procedure's stats, or every declared procedure's.

set_limits(Payload)

-spec set_limits(map()) -> {ok, map()} | {error, term()}.

Payload: #{procedure => Proc, limits => Overrides}. The guardian tier only: within the envelope, never the envelope itself. The platform injects caller for map payloads; it lands in the audit entry.

with_caps(Caps)

The control capabilities, prepended to a service's own list. get_limits always; set_limits only when the guardian config exists. A service that declared its own name is refused — these names are mcl_core's, on every node.