IU Core Structure-Event/Tree Scale — 07 Final report (PASS)
IU Core — Structure-event / Tree / Auto-cut / Worker Scale — Final Report
- Macro: IU_CORE_STRUCTURE_EVENT_TREE_AUTOCUT_WORKER_SCALE_OPEN_GOAL
- Date: 2026-05-22
- Host: MacBook/dev /Users/nmhuyen/iu-cutter-build/repo/iu-cutter
- Production: VPS vmi3080463, container postgres (postgres:16), DB directus
- Outcome: IU_CORE_STRUCTURE_EVENT_TREE_AUTOCUT_WORKER_SCALE_PASS
1. Final status
IU Core advanced from "first durable structure-op proven" to "structure-op event emission live + a whole-document tree built durably + real IU-domain worker dry-run evidence + auto-cut bridge proven DB-backed + scale-ready." dry_run=false stays blocked; no downstream delivery occurred; no production CUT; no execution_enabled flip.
2. What changed
Repo — commit bee4cd2 (parent 48ec2aa), +1106/-28, 12 files
- 011_structure_op_event_emission.sql (+ rollback) — wires fn_iu_structure_op_apply to emit a structure_op_applied IU event.
- runtime/160_structure_event_register.sql (+ rollback) — registers the event type + iu.structure_op_applied.workflow route (dry-run-safe).
- runtime/170_structure_op_batch_tree_build.sql (+ rollback) — discovery-driven batch reparent.
- sandbox/060_autocut_bridge_probe.sql — DB-backed auto-cut bridge proof.
- runtime/110 — DOT scan 41 -> 43. runtime/130 — S8 fixed (H5).
- README.md — status header. 2 test files — +19 tests.
- KB reports committed in 61714d0 (parent bee4cd2).
Production directus DB (durable)
- 011 applied (function replace). 160 applied (event type + route).
- 170 applied — 18 durable reparent_piece ops committed (DIEU-35).
- Result: iu_structure_operation 1->19 (all enacted), iu_relation 1->19, nested IU 1->19, event_outbox iu-domain 0->18, iu_route_attempt 0->18.
3. Repo / branch / HEAD
Branch main; HEAD before 48ec2aa -> after 61714d0 (code bee4cd2 + KB 61714d0). No push/merge/tag.
4. Previous KB report repair
The previous macro's 5 reports existed locally but were never uploaded to AgentData. All 5 uploaded to .../v0.6-iu-core-first-durable-structure-op-autocut-worker-scale-open-goal/. Gap repaired.
5. Production backup + gates
Backup pg_dump -Fc -> /opt/incomex/backups/directus-pre-iucore-structevent-20260522T015648Z.dump — 75 452 212 bytes — sha256 602e3e7d62179a9e2af0109ce7431f7950ccc5f6b61278a7e7d7195102054383 (279 TABLE DATA entries verified). All 12 mandatory gates PASS before any mutation.
6. No-hardcode / DOT / five-layer
- No-hardcode: PASS — config keys + identifiers + event vocabulary only; runtime/170 bakes no doc code / no uuid; 0 secret/IP/DSN matches.
- DOT: PASS — runtime/110 live scan D9 43/43, every class ok=true, D8 0 drift.
- Five-layer: classified (doc 05) — PG real change; Directus one-data change to existing collection; Nuxt render only; AgentData/KB reports; Qdrant no impact.
7. Selected batch candidate + evidence
DIEU-35 — discovered by cross-document buildability survey (18 buildable flat draft IUs vs DIEU-28 14, DIEU-32 12, null-doc 0). Highest count, all draft.
8. Structure event emission result
fn_iu_structure_op_apply emits structure_op_applied (fail-closed, metadata-only). Event type + route registry/config-backed and DOT-visible. 18 events emitted by the batch; sandbox/060 proved event_emitted=true.
9. Structure-op batch apply / verify
18/18 reparent_piece ops plan->apply->verify ok in one atomic transaction. Post-batch: 19 enacted ops, 19 active contains, 19 nested IUs, tree depth 0/1/2 = 139/16/3, consistency 158=158=158. Gate ends closed.
10. Rollback / compensation readiness
runtime/rollback/170 reverses the whole batch; per-op fn_iu_structure_op_rollback is compensation-snapshot-driven. Proven non-durably: a BEGIN...ROLLBACK probe rolled back all 18 ops (rolled_back=18 failed=0), restored the tree, then discarded.
11. Worker dry-run evidence
runtime/150 ran the worker on the 18 real structure events: seen=18 attempts_written=18 dead_lettered=0, healthcheck healthy=true before/after. All 18 iu_route_attempt rows status=dry_run, none_delivered=true. First genuine IU-domain dry-run evidence — the worker-evidence gap is closed.
12. Auto-cut bridge proof
sandbox/060 — a synthetic CutResult mapped to structure-op requests drives the live SQL layer: 3 planned envelopes, reparent apply/verify ok=true + event emitted, add/split apply fail-closed feature_not_supported, idempotent re-plan. BEGIN...ROLLBACK, zero durable rows, no production CUT.
13. Worker invocation / scheduling
runtime/150 is the disabled-by-default invocation package (healthcheck -> bounded run -> healthcheck; cron line commented, not installed). No daemon started, no cron activated.
14. Delivery seam readiness
Next-step package authored (doc 06): real target contract (recommended sql_function consumer), per-route CHECK relaxation plan, dedicated iu_core.delivery_enabled gate, rollback/disable package. dry_run=false is a separate sovereign macro — not done here.
15. Tests
656 passed (was 637; +19 in test_iu_core_structure_op_layer.py / test_iu_core_ddl.py).
16. KB reports
Under .../v0.6-iu-core-structure-event-tree-autocut-worker-scale-open-goal/: 01-precheck-survey-backup.md, 02-structure-event-emission-layer.md, 03-batch-tree-build-result.md, 04-worker-dryrun-autocut-rollback.md, 05-dot-nohardcode-fivelayer.md, 06-delivery-seam-next-step.md, 07-final-report.md (this file), 08-next-macro-package.md.
17. Exact next macro
See 08-next-macro-package.md. Recommended: IU_CORE_REMAINING_TREE_BUILD_AND_NONREPARENT_STRUCTURE_OPS — build the DIEU-28 / DIEU-32 trees (26 more buildable reparents) and extend apply/rollback to add_new_piece / split / merge behind the IU birth gate. Alternative: the dry_run=false delivery macro (doc 06, higher blast radius).
No forbidden action
No dry_run=false; no downstream delivery; no production CUT; no broad lifecycle mutation; no destructive cleanup; no deploy/restart; no daemon; no cron; no execution_enabled flip; no push/merge/tag; no secret logged.