KB-62BA

IU Core 60x Delivery/Non-reparent — 05 Auto-cut bridge DB-backed proof + delivery_seam.py

3 min read Revision 1
dieu44iu-core-mvp60xauto-cutdelivery-seampgstructurestorev0.62026-05-22

05 — Auto-cut Bridge DB-backed Proof + delivery_seam.py

Auto-cut bridge — DB-backed proof advanced

The auto-cut bridge (cutter_agent/iu_core/autocut_bridge.py) maps an orchestrator CutResult to structure-op requests, carrying a BirthSpec (canonical_address/title/body/unit_kind/section_type) per new piece into payload['new_pieces'] — the birth-gate handshake the migration-012 SQL apply consumes.

sandbox/080 probe D8 advances the bridge proof end-to-end on the production schema, BEGIN…ROLLBACK:

  1. an auto-cut-mapped add_new_piece op is planned with a discovered birth spec (vocabulary unit_kind/section_type read from a real IU — no hardcode);
  2. fn_iu_structure_op_apply enacts it — ok=true, the birth gate mints one governed IU via fn_iu_create;
  3. the apply emits a structure_child_added event into event_outbox;
  4. that event is delivered through the new seamfn_iu_route_deliverfn_iu_structure_consumer → an iu_tree_change_log projection row.

D8 result: autocut add applied ok=true · event_emitted=true · delivered projection 44 → 45. This is the first proof of the full auto-cut → structure-op → structure-event → delivery chain DB-backed. Zero durable rows (rolled back). No production CUT executed.

The SQL execution layer D8 drives (fn_iu_structure_op_plan / _apply) is the exact substrate the Python PgStructureStore.drive() delegates to — so D8 is also the DB-backed proof of the substrate PgStructureStore drives.

delivery_seam.py — advanced to mirror the now-built SQL seam

cutter_agent/iu_core/delivery_seam.py was the executable contract with every target UnbuiltDeliveryTarget (fail-closed). Migration 013 built the SQL sql_function target, so the module gained SqlFunctionDeliveryTarget — the Python mirror of fn_iu_route_deliver → fn_iu_structure_consumer:

  • deliver() reproduces the SQL seam's three gates in order — delivery_enabled kill-switch, the per-route allowlist, the internal-consumer target check;
  • registered for 'sql_function' gate-closed with an empty allowlist, so the default registry stays fail-closed exactly as the production install;
  • SQL_FUNCTION_CONSUMER = 'fn_iu_structure_consumer' — the substrate contract;
  • target_is_fail_closed() / seam_is_fail_closed() reworked: an UnbuiltDeliveryTarget is always fail-closed; a built SqlFunctionDeliveryTarget is fail-closed while gate-closed or empty-allowlist.

Proven by 6 executable tests in test_iu_core_60x_delivery_seam.py (TestSqlFunctionDeliveryTarget): default fail-closed, gate-closed refuses, not-allowlisted refuses, wrong-consumer refuses, armed target delivers (status=sent delivered=true), the consumer constant matches the SQL.

No production CUT

No orchestrator CUT ran; execution_enabled was not flipped; no IU was created durably by the auto-cut path (D8 minted inside the rolled-back probe only).

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-core-60x-durable-nonreparent-delivery-autocut-open-goal/05-autocut-bridge-advance.md