IU Core 480x — 02 Composer event wiring (migration 016 + runtime/260)
02 — Composer event wiring (migration 016 + runtime/260)
The 240x composer was a pure substrate — fn_iu_compose / add / remove /
reorder emitted no events, so a composition change was invisible to the
route / delivery / worker layers (240x open gap #1). This macro wires the
composer onto the IU event bus.
Migration 016 — 016_composer_event_wiring.sql (+ rollback)
Additive only (CREATE OR REPLACE, no ALTER, no DROP, no data touched):
fn_iu_emit_collection_event(event_type, collection_id, actor, payload)— the composer counterpart offn_iu_emit_event. Fail-closed: RETURNS NULL unless the master gate (fn_iu_core_routes_enabled) is on AND the event type is registered + active. Writes a metadata-onlyevent_outboxrow withevent_subject_table = 'iu_piece_collection';event_stream/delivery_laneare sourced fromevent_type_registry(never hardcoded).fn_iu_collection_checkpoint(collection_id, event_type, actor, detail)— the gated emitter for the read-side checkpoint events. For acollection_validatedcheckpoint it runs the realfn_iu_collection _validateand folds the verdict into the payload.- The four mutating composer functions (
fn_iu_collection_create/_add_piece/_remove_piece/_reorder_piece) —CREATE OR REPLACEd with the byte-identical migration-015 body PLUS onePERFORM fn_iu_emit_collection_event(...). The migration-011 pattern.fn_iu_composeis unchanged — it emits via its sub-calls. - 2 observability views:
v_iu_composer_event_backlog,v_iu_collection_export_status.
The eight composer event types: collection_created,
piece_added_to_collection, piece_removed_from_collection,
piece_reordered (mutation half, auto-emitted by the 4 functions);
collection_rendered, collection_validated, collection_exported,
collection_import_proposed (checkpoint half, via fn_iu_collection _checkpoint).
Runtime 260 — 260_composer_event_family_register.sql (+ rollback)
Registers the 8 event types (event_stream='update',
delivery_lane='immediate') + 8 outbound routes, every route
enabled=true, dry_run=true. Idempotent. Modelled on runtime/160 + 190.
Emission is double-gated and safe
A composer event reaches the bus only when both composer_enabled=true and
routes_master_enabled=true. The emit is best-effort; the op never fails
because the bus is closed. Every composer route is dry_run=true — external
delivery structurally impossible.
Evidence
sandbox/110 proves emission on the production schema BEGIN…ROLLBACK.
Durable evidence is produced by runtime/270 on apply. No production
mutation occurred this macro.
DOT
Migration 016 + runtime/260 grow the surface 84 → 104 (+2 functions, +2
views, +8 event types, +8 routes). runtime/110 bumped in the same commit.