Module channel_route
Expand description
Real channel delivery for the approval route adapter (EPIC G follow-up).
super::broker::NoopRouteAdapter only logs; this adapter actually delivers an
approval notice to a configured channel (Discord, Slack, …), so a SOP that
parks at a policied gate can reach an approver OUT OF BAND - e.g. a channel-git
trigger starts a triage SOP, the SOP parks for approval, and the request lands in
a Discord ops channel where a maintainer approves it through the normal HTTP/WS/
tool surfaces (which already route back through the broker + chokepoint).
Layering: this lives in zeroclaw-runtime because it needs only
zeroclaw_api::channel::Channel (a runtime dependency already), never the
zeroclaw-channels implementations. The DAEMON builds the concrete channel map
(via zeroclaw_channels::orchestrator::build_channel_map) and injects it here, so
there is no runtime -> channels layering inversion.
Delivery is best-effort and fire-and-forget: ApprovalRouteAdapter::deliver is
a SYNC call made under the engine Mutex (on park, and on the maintenance-tick
escalation path), so it cannot .await. It spawns the async Channel::send onto
a tokio [Handle] captured at construction and returns immediately. A send
failure is logged inside the spawned task; it never blocks or clears the gate -
the gate state is the source of truth, the notice is only a courtesy.
Structs§
- Channel
Route Adapter - A route adapter that delivers approval notices to configured channels.
Enums§
- Approval
Route Issue - A route configuration problem reported at daemon startup before a parked gate would otherwise discover it during delivery.
Functions§
- parse_
approval_ route - Parse a
channel_key:recipientroute into its two non-empty halves. Splits on the FIRST:only, so a recipient that itself contains:(e.g. a Matrix@user:serverid) survives intact on the right. Channel-map keys are dot-separated (discord.ops), never colon-separated, so the first colon is unambiguously the channel/recipient boundary. - unresolvable_
approval_ routes - The configured approval routes (
request_route+escalation_route) whose channel key is NOT amongchannel_keys- the channels the route adapter can actually deliver to (present in its map ANDsupports_outbound_send). A route names an undeliverable channel when it is absent from the map (e.g. an AMQP SOP-dispatch channel that needs runtime SOP handles the adapter lacks) OR present but inbound-only (itssendis a no-op). The daemon logs these at STARTUP so the drift between “configured route” and “deliverable channel” surfaces at boot, not silently on the first parked gate. A route must have non-emptychannel:recipienthalves; malformed values are also surfaced at startup. Returns oneApprovalRouteIssueper invalid route.