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)

  1. 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.
  2. 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.
  3. Delivery seam — fn_iu_route_deliver unbuilt; dry_run=false blocked. Scoped in doc 06.
  4. Python PgStructureStore — the live StructureStore Protocol impl is still the in-memory seam; the SQL layer is the execution layer of record.

IU_CORE_REMAINING_TREE_BUILD_AND_NONREPARENT_STRUCTURE_OPS

  1. 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.
  2. 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.
  3. Emit the matching events (IU_CHILD_ADDED, IU_SPLIT, IU_MERGED per STRUCTURE_OP_EVENTS) — extend runtime/160 with the new event types.
  4. 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.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-core-structure-event-tree-autocut-worker-scale-open-goal/08-next-macro-package.md