KB-12F0

IU Core 60x Delivery/Non-reparent — 02 First durable non-reparent op (deprecate_piece)

4 min read Revision 1
dieu44iu-core-mvp60xnon-reparentdeprecate-pieceruntime-210v0.62026-05-22

02 — First Durable Non-reparent Structure Operation

Candidate selection — live discovery, never hardcoded

runtime/210_durable_deprecate_piece.sql selects the candidate with a discovery query whose every guard is a WHERE clause and which picks ONE row deterministically (ORDER BY created_at, canonical_address LIMIT 1):

  • lifecycle_status = 'draft' — mutable (trg_iu_enacted_immut freezes an enacted IU; a deprecate_piece must target a draft);
  • deleted_at IS NULL — live;
  • doc_code IS NULL — never encoded into a law document, i.e. not real law content;
  • parent_or_container_ref IS NULL — flat, not nested in any tree;
  • a leaf — no IU is contained by it;
  • in NO iu_relation edge; in NO iu_structure_operation.

The survey found exactly 12 IUs matching the structural predicate — all pilot.* / test/* early-pilot scratch units (design_doc_section, 2026-05-05…05-08). These are genuine deprecate candidates: stale pilot/test scratch that should be marked deprecated, not real content. The discovery selected the oldest:

Field Value
canonical_address pilot.iu0.test-001
id 3ffbbaa5-f22a-4df4-8bc6-c27eab2787fe
unit_kind design_doc_section
created_at 2026-05-05 07:07:26+00
prior lifecycle draft

Durable apply

runtime/210 ran the full plan → apply → verify envelope in one BEGIN…COMMIT; the structure-op gate iu_core.structure_ops_enabled was opened and closed again inside the same transaction (the layer ends inert).

Stage Result
G1 plan op 158a9bcf-fc4b-4919-a979-56ccdb2f127adeprecate_piece, planned
G2 apply ok=true status=enacted prior_lifecycle=draft event_emitted=true
G3 verify ok=true lifecycle_ok=true tree_acyclic=true
G4 post op enacted; pilot.iu0.test-001 lifecycle_status draft → deprecated
G5 event structure_piece_deprecated in event_outbox (stream update, payload_classification=safe_metadata)
G6 gate iu_core.structure_ops_enabled = false (layer inert)

This is the first durable non-reparent structure operation ever enacted on production. The boundary moved from "all six op types implemented + proven in sandbox/070 BEGIN…ROLLBACK" to "one non-reparent op durably enacted".

Durable footprint

iu_structure_operation 45→46 (45 reparent + 1 deprecate), iu_relation unchanged 45 (a deprecate writes no edge), iu_tree_path unchanged 158, event_outbox iu-domain 44→45, one IU draft → deprecated. Bounded to exactly one information_unit row + one op row + one event.

Rollback / compensation — proven

fn_iu_structure_op_rollback non-reparent inverse restores prior_lifecycle from the op's impact_summary ({"3ffbbaa5…":"draft"}). Proven in a BEGIN…ROLLBACK probe against the durable op:

Stage Result
RB_pre pilot.iu0.test-001 = deprecated
RB_call fn_iu_structure_op_rollback(158a9bcf…)ok=true status=rolled_back
RB_post pilot.iu0.test-001 = draft (restored)
RB_verify ok=true lifecycle_ok=true operation_status=rolled_back
txn ROLLBACK — the durable op stays enacted, IU stays deprecated

Reversal command (NOT executed durably): open the gate, call fn_iu_structure_op_rollback('158a9bcf-fc4b-4919-a979-56ccdb2f127a'), close the gate.

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