IU Core Runtime Activation — 07 Structure-ops proof + finding H4
IU Core Runtime Activation E2E — 07 Structure-ops proof + finding H4
All proofs ran inside BEGIN … ROLLBACK — nothing committed. Structure-ops
exercised the iu-core sidecar tables using real information_unit ids only as
read-only FK anchors. Anchors: 4 draft IUs (D38-DIEU28-ROOT/S0/S1/S10)
and 1 enacted IU (ICX-CONST/DIEU-0).
SECTION 4 / 4b — structure-ops lineage — 14/14 PASS
- 4.1
add_new_pieceop envelope +contains(parent→child)edge. - 4.2 duplicate
idempotency_keyrejected (unique_violation) — re-run safe. - 4.3 op lifecycle
draft → planned → enactedaccepted. - 4.4
enactedop with NULLenacted_atrejected. - 4.5 second active
containsparent for one child rejected (one-active-parent partial unique index). - 4.6 self-relation rejected (
no_self_chk). - 4.7
split_large_pieceop + 2split_fromlineage edges. - 4.8
merge_small_piecesop + 2merged_fromlineage edges. - 4.9
deprecate_pieceop +supersedeslineage edge. - 4.10
reparent_pieceop envelope. - 4b.1 compensation: roll the op back, retire its
containsedge (relation_status='retired',valid_to=now()) → a fresh activecontainsfor the same child is then accepted (slot freed). - 4b.2 retired edge retained with
valid_to— no hard delete. - 4b.3
iu_tree_pathdepth-0 root + depth-1 child rows created. - 4b.4 wrong-endpoint path rejected (
endpointsCHECK).
SECTION 5 / 5b — parent-child tree + cycle prevention — 9/9 PASS
A temporary p→c→g chain built over draft IUs (rolled back; gateway marker set
to satisfy fn_iu_gateway_write_guard on information_unit).
- 5.1
fn_iu_tree_assert_acyclic(_,NULL)no-op (reparent-to-root safe). - 5.2 self-parent reparent rejected.
- 5b.0 temp chain built.
- 5b.1/5b.2
v_iu_treedepth = 1 (child), 2 (grandchild) — multi-level recursion. - 5b.3/5b.4
fn_iu_tree_is_descendant(root,grandchild)=true,(grandchild,root)=false. - 5b.5 cyclic reparent (root under grandchild) rejected — descendant detection.
- 5b.6 genuine reparent (grandchild → root) accepted.
Total behaviour + structure-ops proof: 33/33 PASS.
FINDING H4 — iu_structure_operation_enacted_chk defect
SECTION 4 (step 4.11) hit a real DDL defect. The 004 constraint
(operation_status = 'enacted') = (enacted_at IS NOT NULL) makes the
documented enacted → rolled_back transition impossible unless
enacted_at is nulled — destroying the audit record of WHEN the op was
enacted. The Python contract (OPERATION_STATUS_TRANSITIONS) allows
enacted → rolled_back; the SQL CHECK contradicted it.
Fix (committed 5de52d8)
004patched in-place — CHECK is now(enacted_at IS NOT NULL) = (operation_status IN ('enacted','rolled_back')).- New migration
006_structure_op_enacted_chk_fix.sql— idempotentDROP CONSTRAINT IF EXISTS+ADD CONSTRAINTreconcile for databases that applied004before the patch (production directus).+ rollback/006. 006is NOT applied to production this macro — deferred to the next macro. Latent/harmless:iu_structure_operationis empty and the master gate is closed.- Tests
536 → 542(+6, newTestStructureOpEnactedChkFix).