KB-68D6
IU Core Structure-Event/Tree Scale — 08 Next macro package
3 min read Revision 1
dieu44iu-core-mvpstructure-eventnext-macrov0.62026-05-22
08 — Next Macro Package
State at handoff
- Commit bee4cd2 on main (parent 48ec2aa); KB reports 61714d0. 656 tests pass.
- Migrations 001-011 + runtime 010-050/060/090/120/140/160/170 on production.
- 19 nested IUs (DIEU-35 tree fully built); iu_structure_operation 19 enacted; 18 structure_op_applied events; 18 worker dry_run attempts.
- DOT 43/43, no-hardcode clean, five-layer classified.
- dry_run=false blocked; no downstream delivery; structure-op gate closed.
Open gaps (exact)
- Remaining tree breadth — DIEU-28 (14 buildable) and DIEU-32 (12 buildable) are still flat — 26 more reparent_piece ops. The (null)-doc 72 IUs have no encoded hierarchy and 60 are non-draft (trg_iu_enacted_immut would freeze them) — not buildable by reparent.
- Non-reparent structure ops — fn_iu_structure_op_apply / _rollback still RAISE feature_not_supported for add_new_piece / split_large_piece / merge_small_pieces / deprecate_piece / replace_piece. plan accepts all six; sandbox/060 proved the honest boundary.
- Delivery seam — fn_iu_route_deliver unbuilt; dry_run=false blocked. Scoped in doc 06.
- Python PgStructureStore — the live StructureStore Protocol impl is still the in-memory seam; the SQL layer is the execution layer of record.
Recommended next macro
IU_CORE_REMAINING_TREE_BUILD_AND_NONREPARENT_STRUCTURE_OPS
- Run runtime/170 again — it re-discovers the next-best document (DIEU-28, then DIEU-32) and builds their trees; idempotent on DIEU-35. Or a runtime/180 that loops all buildable documents in one bounded batch.
- Extend fn_iu_structure_op_apply / _rollback to add_new_piece (mint via the IU birth gate fn_iu_create), then split / merge. Each needs IU identity creation — design the birth-gate handshake first.
- Emit the matching events (IU_CHILD_ADDED, IU_SPLIT, IU_MERGED per STRUCTURE_OP_EVENTS) — extend runtime/160 with the new event types.
- Refresh runtime/110, five-layer, tests; commit.
Lowest blast radius: do step 1 (tree breadth) first as its own short macro — pure reparent, the proven path; then the non-reparent extension separately.
Alternatives
- dry_run=false delivery macro — build fn_iu_route_deliver + sql_function consumer, relax the route CHECK per-route, add the iu_core.delivery_enabled gate (doc 06). Higher blast radius; sovereign.
- Python PgStructureStore — implement the live StructureStore Protocol over the SQL functions so the orchestrator can drive structure ops in-process.
- Auto-cut production bridge — drive a real orchestrator CutResult through AutocutBridge -> the SQL layer (still gated, no production CUT).
Recommended first: the remaining-tree-build macro — proven path, closes gap #1 at batch scale, no new failure modes.