KB-3B5F

IU Core 480x — 04 Composed-from-scratch, workflow-as-pieces, auto-cut bridge

4 min read Revision 1
dieu44iu-core-mvp480xcomposed-from-scratchworkflow-as-piecesauto-cutv0.62026-05-22

04 — Composed-from-scratch, workflow-as-pieces, auto-cut bridge

Durable composed-FROM-SCRATCH collection — runtime/270 (authored)

runtime/270_composed_from_scratch_collection.sql (+ rollback) is the first durable composed-FROM-SCRATCH collection — it closes 240x open gap #6 (fn_iu_compose minting was BEGIN...ROLLBACK-only). It opens the composer gate for one transaction, calls fn_iu_compose with two new_piece specs so the fn_iu_create birth gate mints 2 governed IUs (never a direct information_unit INSERT), assembles them into one inert draft file collection, validates it, records a collection_rendered checkpoint, and closes the gate again. Bounded durable footprint: +2 information_unit, +1 iu_piece_collection, +2 iu_piece_membership, +N event_outbox (1 collection_created + 2 piece_added_to_collection + 1 collection_rendered once runtime/260 is applied — this is also the durable composer-event emission evidence).

runtime/rollback/270 is fully reversible: it discovers the 2 minted IUs from the memberships, soft-deletes them (deleted_at = now() — never a hard DELETE, the IU substrate's reversible-by-default contract), removes the memberships, and deletes the collection.

Status: authored, not executed — production apply is blocked on the backup gate (doc 01). sandbox/110 E2 proves the from-scratch compose path BEGIN...ROLLBACK on the production schema.

Workflow-as-piece-set — PROVEN

A workflow IS an ordered iu_piece_collection of collection_kind='workflow' where each step is one IU piece (piece_role='step'). sandbox/110 E8 composes a 3-step workflow from scratch and proves: 3 step pieces render in order; piece_order is contiguous 0..2; fn_iu_collection_validate passes. E9 proves workflow validation is fail-closed — a soft-deleted step piece (a missing/broken step) is a validation error. Missing / duplicate / order / cycle are all caught: the iu_piece_membership UNIQUE (collection_id,iu_id) forbids a duplicate step, the UNIQUE (collection_id,piece_order) + contiguity check forbid an order gap, and a piece is an FK to a real IU so a dangling step is impossible.

Auto-cut bridge — production-ready package

autocut_bridge.py gains the production-readiness layer on top of the 240x pure mapper:

  • AutocutComposeApprovalPackage — everything an operator needs to approve the first integrated auto-cut -> composer durable run, and nothing that executes it. executes is always False. It carries: the ComposeRequest, pieces_total / pieces_minted / pieces_referenced, the fail-closed validation_errors, the required_gates (iu_core.composer_enabled, iu_core.routes_master_enabled, and — when the cut mints pieces — the IU birth gate), the expected_events (one collection_created + one piece_added_to_collection per piece), the one_command (dot_iu_create_file_from_pieces -> fn_iu_compose), and the rollback_path.
  • build_autocut_compose_approval_package(...) + the AutocutBridge.approval_package(...) method.

This is the convergence the prompt asks for: a cut's output and a hand-authored composition feed the same fn_iu_compose and emit the same composer event family. The bridge stays pure — no IO, no DB, never executes CUT. No production CUT was run.

composer.py — the event family contract

composer.py gains COMPOSER_EVENT_TYPES (the 8 types, split into COMPOSER_MUTATION_EVENTS x 4 + COMPOSER_CHECKPOINT_EVENTS x 4), COMPOSER_OP_EVENT (which SQL function emits which mutation event), composer_event_route_code(event_type) (-> iu.<type>.workflow), and the dot_iu_checkpoint_collection one-command entry -> fn_iu_collection _checkpoint. Every COMPOSER_COMMANDS value still resolves to a real iu-core DDL function (a test asserts it).

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-core-480x-composer-event-textcode-roundtrip-production-readiness-open-goal/04-composed-from-scratch-workflow-autocut.md