KB-28A7
IU Core Worker Live — 03 Delivery seam package
3 min read Revision 1
dieu44iu-core-mvpevent-workerdelivery-seamskeletonv0.62026-05-21
IU Core Worker Live — 03 Delivery seam package
What it is
cutter_agent/iu_core/delivery_seam.py — the executable contract / skeleton
for the delivery dispatcher the dry_run=false macro must build. The SQL seam
fn_iu_route_deliver(text,uuid,jsonb) (migration 009) is the seam of record;
in the MVP it RAISES feature_not_supported. This module fixes the dispatcher
shape so the dry_run=false macro has a concrete target to build against.
Surface
DELIVERY_TARGET_KINDS—{sql_function, workflow, vector, report, directus_flow, external_endpoint}, mirrors theiu_outbound_routetarget_kindCHECK (migration 002).DELIVERY_STATUSES—{sent, failed, skipped}.DeliveryRequest—route_code, event_ref, target_kind, target_ref, idempotency_key, safe_payload. Validatestarget_kindand requires anidempotency_key(replay safety).DeliveryOutcome—status, delivered, target_kind, detail. Enforcesdelivered=True ⇒ status='sent'.DeliveryTargetProtocol —deliver(request) -> DeliveryOutcome.UnbuiltDeliveryTarget— the fail-closed default;deliveralways raisesDeliveryNotImplemented(the Python mirror of the SQLRAISE).DELIVERY_TARGET_REGISTRY— every kind →UnbuiltDeliveryTarget.resolve_delivery_target(kind)/dispatch_delivery(request)— the dispatcher; in the MVP always raisesDeliveryNotImplemented.seam_is_fail_closed()— True while every target is unbuilt.
Fail-closed by construction
Pure, DB-free. No concrete DeliveryTarget exists — seam_is_fail_closed()
is True and dispatch_delivery raises for all six kinds. No route, not even a
(CHECK-impossible) dry_run=false one, can deliver downstream.
How the dry_run=false macro uses it
- Decide what "delivery" concretely means for
target_kind='workflow'(a Directus flow, a workflow engine, a notification fan-out). - Implement a
DeliveryTargetfor that kind; replace the registry entry. - Re-author the SQL
fn_iu_route_deliveras the matching dispatcher. - The worker's
deliverbranch then reaches a real target instead of thefeature_not_supportedRAISE.
Tests: TestDeliverySeam (7) — target kinds match SQL, fail-closed, dispatch
raises for every kind, request/outcome validation.