IU Core Controlled Route — 07 Structure tree bootstrap (runtime 050)
IU Core Controlled Route — 07 Structure tree bootstrap
Live tree shape — completely flat
Survey of v_iu_tree (the recursive read-only projection of
information_unit.parent_or_container_ref):
- All 158 IUs are depth-0 roots —
parent_or_container_ref IS NULLfor all 158,0IUs carry a parent pointer. 0soft-deleted IUs,0orphans/unreachable.iu_tree_pathcarried0rows; no triggers on it.
Migration runtime/050 — applied
050_structure_tree_bootstrap.sql —
INSERT INTO iu_tree_path SELECT … FROM v_iu_tree ON CONFLICT (unit_id) DO NOTHING. path_hash = encode(sha256(<path_ids joined by '/'>), 'hex').
Result: 158 iu_tree_path rows inserted, all depth=0,
matches_v_iu_tree=true. Invariants verified post-apply:
array_length(path_ids)=depth+1 ✓, path_ids[1]=root_unit_id ✓,
path_ids[last]=unit_id ✓, path_hash all distinct ✓.
Why this is safe (all 4 macro conditions met)
- Additive / idempotent —
INSERT … ON CONFLICT (unit_id) DO NOTHINGinto a primary-keyed table that was empty; a re-run inserts nothing. - Source of truth = existing production IU state — derived from
v_iu_tree, which readsinformation_unit.parent_or_container_ref. The bootstrap derives, never invents, the tree. - Rollback/cleanup clear —
runtime/rollback/050clearsiu_tree_path(restoring the pre-bootstrap empty state) and REFUSES ifiu_structure_operationholds rows (structure-ops history present).iu_tree_pathis a rebuildable cache ofv_iu_tree. - No lifecycle status changed —
iu_tree_pathis a pure sidecar; no touch toinformation_unit/unit_version.
Lineage (iu_relation) — legitimately empty
iu_relation (typed lineage edges: contains, split_from, merged_from,
supersedes) and iu_structure_operation both remain 0 rows. Lineage edges
are produced by structure operations (add/split/merge/deprecate/reparent);
no such operations have been recorded for the 158 IUs, and the flat tree has
no contains parent→child edges. There is nothing to bootstrap into
iu_relation — it correctly stays empty until structure operations run.