KB-1880 rev 2

IU Core 500x — 04 First integrated auto-cut to composer + text-as-code

5 min read Revision 2
dieu44iu-core-mvp500xintegrated-autocutcomposertext-as-codesandbox-140v0.62026-05-22

04 — First integrated auto-cut → composer + text-as-code

1. The integrated seam

The 240x macro proved the pure mapper CutResult → ComposeRequest; the 480x macro turned it into build_autocut_compose_approval_package. This macro proves the FIRST integrated flow end-to-end: a synthetic auto-cut output is driven through the composer's fn_iu_compose on the live production schema, the composer event family observing it on the bus — auto-cut output and a hand-authored composition converging into ONE iu_piece_collection model.

No uncontrolled production CUT was executed. The cut is synthetic (a 3-section CutResult built in the proof), and the run is non-durable (BEGIN … ROLLBACK).

2. sandbox/140 — the auto-cut → composer probe

140_autocut_composer_probe.sql — one BEGIN … ROLLBACK, zero durable rows. The pieces payload is the jsonb a 3-section auto-cut produces: three NEW pieces, each minted by fn_iu_compose through the fn_iu_create birth gate (never a direct information_unit INSERT). 6/6 probes pass (SANDBOX_140_VERDICT all_pass=t):

  • A1 fn_iu_compose mints exactly 3 birth-gate IU pieces;
  • A2 the composed collection validates fail-closed (ok=true, piece_count=3);
  • A3 composer events — 1 collection_created + 3 piece_added_to_collection — the delayed-lane no-dedupe proof: all 3 piece_added land, none deduped;
  • A4 every composer event of the collection is on the 'delayed' lane (non-delayed = 0);
  • A5 the route worker dry-runs the new events — seen=5, attempts_written=5, dead_lettered=0, dead_letter_open=0; external delivery structurally impossible;
  • A6 the collection carries a manifest_digest (text-as-code ready).

3. The bridge ↔ probe lock

autocut_bridge.build_autocut_compose_approval_package over a synthetic 3-unit CutResult produces an AutocutComposeApprovalPackage: acceptable=true, executes=false (never runs CUT), pieces_total=3, pieces_minted=3, required_gates includes iu_core.composer_enabled, expected_events = collection_created + 3 × piece_added_to_collection. test_sandbox_140_payload_shape_matches_bridge LOCKS the bridge's compose payload to sandbox/140's inline jsonb — both describe three from-scratch design_doc_section pieces. The Python bridge and the SQL probe are one contract.

4. Idempotency / no-dedupe regression check

The 500x macro found and fixed the composer-event lane defect (the event_outbox partial unique index idx_event_outbox_idempotent … WHERE delivery_lane='immediate' deduped every composer delta sharing the collection id; fixed by registering the family on the 'delayed' lane). sandbox/140 re-verifies the fix holds under the integrated path: A3 shows 3 distinct piece_added rows (not 1), A4 confirms all on 'delayed'. No dedupe regression. Route attempts all dry_run, dead-letter 0.

5. Text-as-code roundtrip + import proposal

Proven in test_iu_core_540x_operator_runtime.py:

  • a CollectionManifest of 2 ordered pieces serialises → parses → roundtrip_collection_manifest returns True (byte-identical);
  • validate_collection_manifest passes clean (contiguous piece_order, unique iu_id, digest matches recomputation);
  • propose_collection_import produces a CollectionImportProposal with acceptable=true and executes=falsenon-destructive. The importer parses → validates → confirms the digest → proposes; it never applies. IMPORT_IS_DESTRUCTIVE stays False.

6. Operator-runtime drive of the read/checkpoint flow

OperatorRuntime.verify runs fn_iu_collection_validate / fn_iu_collection_healthcheck; dot_iu_render_file / dot_iu_validate_collection / dot_iu_checkpoint_collection resolve to the governed render / validate / checkpoint functions — so an operator drives the text-as-code export/validate/checkpoint surface through the same governed runtime, audited in the ledger.

7. What was NOT done — exact deferral

A durable integrated auto-cut → composer run (minting durable IUs from a synthetic or discovered cut, with the composer event family observing it on the bus durably) was deliberately deferred. sandbox/140 proves the flow non-durably; the durable run mints information_unit rows and is the natural first slice of the next macro. No unsafe production state results from the deferral — production stays at iu=160, coll=2.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-core-500x-integrated-autocut-operator-runtime-open-goal/04-integrated-autocut-composer.md